<div class="col-md-12">
    <div class="form-group">
        <label for="name">Nom de l'événement</label>
        <input type="text" name="name" id="name" class="form-control" placeholder="" aria-describedby="nameHelp" value="{{$activity->name}}" required>
        <small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'événement</small>
    </div>  
</div>
<div class="col-md-2">
    <div class="form-group">
        <label class="label-control">Date et Heure de début</label>
        <input name="begin" type="text" id="datetimepickerbegin" class="form-control datetimepicker" required/>
    </div> 
</div>
<div class="col-md-2">
    <div class="form-group">
        <label class="label-control">Date et Heure de fin</label>
        <input name="end" type="text" id="datetimepickerend" class="form-control datetimepicker" required/>
    </div> 
</div>
<div class="col-md-5">
    <div class="form-group">
        <label for="name">Lieux</label>
        <input type="text" name="location" id="location" class="form-control" placeholder="" aria-describedby="nameHelp" value="{{$activity->location}}" required>
        <small id="nameHelp" class="text-muted">Veuillez entrer le lieu de l'événement</small>
    </div>  
</div>
<div class="col-md-3 m-auto">
    <div class="form-group">
        <div class="form-check">
            <label class="form-check-label">
                <input class="form-check-input" name="is_mandatory" type="checkbox" value="1" 
                @if ($activity->is_mandatory == 1)
                    checked
                @endif>
                L'événement est obligatoire
                <span class="form-check-sign">
                    <span class="check"></span>
                </span>
            </label>
        </div>
    </div>
</div>
<div class="col-md-12">
    <div class="form-group">
      <label for="desc">Commentaire</label>
        <textarea class="form-control" name="desc" id="desc" rows="6" required>{{$activity->admin_desc}}</textarea>
    </div>
</div>

@if ($activity->id == 1)
<div class="col-md-12">
    <div id="accordion" role="tablist">
        @for ($i = 1; $i <= \App\Config::getData('admin_level_in_schedule_nb'); $i++)
            <div class="card card-collapse">
                <div class="card-header" role="tab" id="heading{{$i}}">
                <h5 class="mb-0">
                    <a data-toggle="collapse" href="#collapse{{$i}}" aria-expanded="true" aria-controls="collapse{{$i}}">
                    Horaire Niveau {{$i}}
                    <i class="material-icons">keyboard_arrow_down</i>
                    </a>
                </h5>
                </div>
            
                <div id="collapse{{$i}}" class="collapse" role="tabpanel" aria-labelledby="heading{{$i}}" data-parent="#accordion">
                    <div class="card-body">
                        
                        @for ($p = 1; $p <= \App\Config::getData('admin_periode_nb'); $p++)
                        <h4 class="mt-3" >Période {{$p}}</h4>
                        <div class="row">
                                <div class="col-sm-6 my-2">
                                    <div class="form-group">
                                        <label for="name">Nom du cours</label>
                                        <input type="text" name="name_n{{$i}}_p{{$p}}" id="name_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required>
                                        <small id="nameHelp" class="text-muted">Veuillez entrer le nom du cours</small>
                                    </div>  
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <div class="form-group">
                                            <label for="name">Instructeur</label>
                                            <input type="text" name="instruc_n{{$i}}_p{{$p}}" id="instruc_n{{$i}}_p{{$p}}" class="form-control basicAutoComplete" aria-describedby="nameHelp" required>
                                            <small id="nameHelp" class="text-muted">Veuillez entrer le nom de l'instructeur</small>
                                        </div> 
                                    </div>  
                                </div>
                                <div class="col-sm-6 my-2">
                                    <div class="form-group">
                                        <label for="name">OCOM</label>
                                        <input type="text" name="ocom_n{{$i}}_p{{$p}}" id="ocom_n{{$i}}_p{{$p}}" class="form-control" aria-describedby="nameHelp" required>
                                        <small id="nameHelp" class="text-muted">Veuillez entrer l'OCOM</small>
                                    </div>  
                                </div>
                                <div class="col-sm-6 my-2">
                                    <div class="form-group">
                                        <label for="name">Lieux</label>
                                        <input type="text" name="loc_n{{$i}}_p{{$p}}" id="loc_n{{$i}}_p{{$p}}" class="form-control" placeholder="" aria-describedby="nameHelp" required>
                                        <small id="nameHelp" class="text-muted">Veuillez entrer le lieux</small>
                                    </div>                                
                                </div>
                                <div class="col-sm-12">
                                    <button type="button"  class="btn btn-primary btn-block" disabled>Réservation de materiel (Disponible une fois l'événement sauvegarder)</button>
                                </div>
                            </div>
                            <hr>
                        @endfor 
                    </div>
                </div>
            </div>
        @endfor
    </div>
</div>
    
@endif

<script>
var begin = "<?php echo $begin_time ?>";
var end = "<?php echo $end_time ?>";
$('#datetimepickerbegin').datetimepicker({
    icons: {
        time: "fa fa-clock-o",
        date: "fa fa-calendar",
        up: "fa fa-chevron-up",
        down: "fa fa-chevron-down",
        previous: 'fa fa-chevron-left',
        next: 'fa fa-chevron-right',
        today: 'fa fa-screenshot',
        clear: 'fa fa-trash',
        close: 'fa fa-remove'
    },
    date: new Date(begin)
});
$('#datetimepickerend').datetimepicker({
    icons: {
        time: "fa fa-clock-o",
        date: "fa fa-calendar",
        up: "fa fa-chevron-up",
        down: "fa fa-chevron-down",
        previous: 'fa fa-chevron-left',
        next: 'fa fa-chevron-right',
        today: 'fa fa-screenshot',
        clear: 'fa fa-trash',
        close: 'fa fa-remove'
    },
    date: new Date(end)
});
$('#desc').trumbowyg({
    lang: 'fr'
});
$( ".basicAutoComplete" ).autocomplete({
  source: '/api/user/list?api_token='+api_token
});
</script>