@extends('layouts.admin.main')

@section('content')
    <div class="col-md-12">
        <div class="card">
            <div class="card-header card-header-primary">
                <h4>Configuration Générale</h4>
            </div>
            <div class="card-body mt-5">
                <form action="/admin/config/customisation" method="POST">
                    @csrf
                    <div class="row ml-2">
                        <div class="col-md-6 p-2">
                            <div class="form-group">
                                <label for="exampleInputEmail1">Photo page publique</label>
                                <input type="text" class="form-control" id="escadron_name_full" name="public_index_img_url" aria-describedby="emailHelp" value="{{\App\Config::getData('public_index_img_url')}}">
                                <small id="emailHelp" class="form-text text-muted">URL vers la photo a afficher dans l'en tête de la page publique.</small>
                            </div>
                        </div>
                        <div class="col-md-12 p-2">
                            <button type="submit" class="btn btn-primary">Sauvegarder</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection

@section('breadcrumb')
    <div class="breadcrumbs">
        <div class="col-sm-4">
            <div class="page-header float-left">
                <div class="page-title">
                    <h1>Configuration Générale</h1>
                </div>
            </div>
        </div>
        <div class="col-sm-8">
            <div class="page-header float-right">
                <div class="page-title">
                    <ol class="breadcrumb text-right">
                        <li class="active">Configuration/Générale</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('custom_scripts')
    <script>
        function saveChange(pPerm) {
            (function($) {
                var myswitch = document.getElementById(pPerm);
                $.post('/api/config/general/save?api_token='+api_token, { value: myswitch.checked,perm: pPerm } , function(data) {
                    swal({
                        title: 'Modification enregistré !',
                        type: 'success',
                    }).then((result) => {
                        if (result.value) {
                            location.reload();
                        }
                    })
                });
            })(jQuery);
        }
    </script>
@endsection
