<commit_before>{% if showDeleteButton %}
    <div class="hidden">
        {{ form(delete_form, {'attr': {'id': 'delete_form', 'class': 'hidden'}}) }}
    </div>
{% endif %}
{{ form_start(form)}}
<div class="table-responsive panel panel-default form-group form-group-sm">

    <div class="container-fluid panel-heading">
        <div class="pull-left "><h4>{{ titre }}</h4></div>
        <div class="btn-group pull-right">
            <a href="{{ path('reservation') }}" class="btn btn-sm btn-primary">Retour</a>
            {% if showDeleteButton %}
                <a onclick="document.getElementById('delete_form').submit();" href='#' class="btn btn-sm btn-warning">Supprimer</a>
            {% endif %}
            <input type="submit" value="Enregistrer"  class="btn btn-sm btn-success"/>

        </div>
    </div>
    <div >
        <input hidden="hidden" value="{{ status }}" id="status" name="status">
        {{ form_errors(form) }}
        {% if editionMode %}
            <table class="record_properties">
                <tbody>
                <tr>
                {{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': form }) }}
                </tr>
                </tbody>
            </table>
        {% else %}
            <table class="record_properties">
                <thead>
                <tr>
                    <th>Matériel</th>
                    <th>Date de début</th>
                    <th>Date de fin</th>
                    <th>Emprunteur</th>
                    <th>Commentaire</th>
                    <th></th>
                </tr>
                </thead>
                <tbody class="reservations" id="reservationList" data-prototype="{% filter escape %}{{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': form.reservations.vars.prototype }) }}{% endfilter %}">
                    {% for item in form.reservations %}
                    <tr>
                    {{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': item }) }}
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endif %}
    </div>
   {% if not editionMode %}
        <div class="container-fluid panel-footer">
            <a href="#" class="add_resa_link btn btn-sm btn-success pull-left">+ Ajouter</a>
        </div>
   {% endif %}
</div>
{{ form_rest(form) }}
{{ form_end(form) }}

<script type="text/javascript">

    var periodArray = [];
    var startDateParams = {
        dateFormat: "dd-mm-yy",
        firstDay: 1,
        minDate: new Date(),
        onSelect: function (dateText, inst) {
            var endId = '#' + inst.id.replace(/startDate/g, 'endDate');
            $(endId).datepicker( "option", "disabled", false );
            $(endId).datepicker(endDateParams);
            $(endId).removeAttr('disabled');
            $(endId).attr('readonly','true');
            // On supprime la date de fin déjà selectionnée
            $.datepicker._clearDate($(endId));
            enableSubmitBtn();
        },
        beforeShowDay: function (date) {
            var endId = '#' + this.id.replace(/startDate/g, 'endDate');
            var rowId = this.id.split('_')[5];
            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            var enable = true;
            var endDateVal=$(endId).value;
            if(endDateVal === undefined) {
                endDateVal=$(endId)[0].value;
            }
            endDateVal=endDateVal.split("-");
            var endDate = new Date(endDateVal[2]+"-"+endDateVal[1]+"-"+endDateVal[0]).getTime();
            {% if not editionMode %}
            if(date >= endDate)// La date de début ne doit pas être supérieur à la date de fin
            {
                return [false];
            }
            {% endif %}
            for (var period in periodArray[rowId]) {
                var d1 = new Date(periodArray[rowId][period][0] * 1000);
                var d2 = new Date(periodArray[rowId][period][1] * 1000);

                if (d1 <= date && date <= d2) // Pas de date de début dans une période réservée
                {
                    enable = false;
                    break;
                }
            }
            return [enable];
        }
    };
    var endDateParams = {
        dateFormat: "dd-mm-yy",
        firstDay: 1,
        minDate: new Date(),
        beforeShowDay: function (date) {
            var enable = true;
            var startId = '#' + this.id.replace(/endDate/g, 'startDate');

            var rowId = this.id.split('_')[5];
            var startDateVal=$(startId).value;
            if(startDateVal === undefined) {
                startDateVal=$(startId)[0].value;
            }
            startDateVal=startDateVal.split("-");
            var startDate = new Date(startDateVal[2]+"-"+startDateVal[1]+"-"+startDateVal[0]).getTime();
            if(date <= startDate)// La date de fin ne doit pas être inférieur à la date de début
            {
                return [false];
            }
            for (var period in periodArray[rowId]) {<commit_msg>Correction date début de reservation a la suite d'une autre -> datepicker création reservation<commit_after>{% if showDeleteButton %}
    <div class="hidden">
        {{ form(delete_form, {'attr': {'id': 'delete_form', 'class': 'hidden'}}) }}
    </div>
{% endif %}
{{ form_start(form)}}
<div class="table-responsive panel panel-default form-group form-group-sm">

    <div class="container-fluid panel-heading">
        <div class="pull-left "><h4>{{ titre }}</h4></div>
        <div class="btn-group pull-right">
            <a href="{{ path('reservation') }}" class="btn btn-sm btn-primary">Retour</a>
            {% if showDeleteButton %}
                <a onclick="document.getElementById('delete_form').submit();" href='#' class="btn btn-sm btn-warning">Supprimer</a>
            {% endif %}
            <input type="submit" value="Enregistrer"  class="btn btn-sm btn-success"/>

        </div>
    </div>
    <div >
        <input hidden="hidden" value="{{ status }}" id="status" name="status">
        {{ form_errors(form) }}
        {% if editionMode %}
            <table class="record_properties">
                <tbody>
                <tr>
                {{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': form }) }}
                </tr>
                </tbody>
            </table>
        {% else %}
            <table class="record_properties">
                <thead>
                <tr>
                    <th>Matériel</th>
                    <th>Date de début</th>
                    <th>Date de fin</th>
                    <th>Emprunteur</th>
                    <th>Commentaire</th>
                    <th></th>
                </tr>
                </thead>
                <tbody class="reservations" id="reservationList" data-prototype="{% filter escape %}{{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': form.reservations.vars.prototype }) }}{% endfilter %}">
                    {% for item in form.reservations %}
                    <tr>
                    {{ include('CEReservationBundle:Reservation:reservationPrototype.html.twig', {'item': item }) }}
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endif %}
    </div>
   {% if not editionMode %}
        <div class="container-fluid panel-footer">
            <a href="#" class="add_resa_link btn btn-sm btn-success pull-left">+ Ajouter</a>
        </div>
   {% endif %}
</div>
{{ form_rest(form) }}
{{ form_end(form) }}

<script type="text/javascript">

    var periodArray = [];
    var startDateParams = {
        dateFormat: "dd-mm-yy",
        firstDay: 1,
        minDate: new Date(),
        onSelect: function (dateText, inst) {
            var endId = '#' + inst.id.replace(/startDate/g, 'endDate');
            $(endId).datepicker( "option", "disabled", false );
            $(endId).datepicker(endDateParams);
            $(endId).removeAttr('disabled');
            $(endId).attr('readonly','true');
            // On supprime la date de fin déjà selectionnée
            $.datepicker._clearDate($(endId));
            enableSubmitBtn();
        },
        beforeShowDay: function (date) {
            var endId = '#' + this.id.replace(/startDate/g, 'endDate');
            var rowId = this.id.split('_')[5];
            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            var enable = true;
            var endDateVal=$(endId).value;
            if(endDateVal === undefined) {
                endDateVal=$(endId)[0].value;
            }
            endDateVal=endDateVal.split("-");
            var endDate = new Date(endDateVal[2]+"-"+endDateVal[1]+"-"+endDateVal[0]).getTime();
            {% if not editionMode %}
            if(date >= endDate)// La date de début ne doit pas être supérieur à la date de fin
            {
                return [false];
            }
            {% endif %}
            for (var period in periodArray[rowId]) {
                var d1 = new Date(periodArray[rowId][period][0] * 1000);
                var d2 = new Date(periodArray[rowId][period][1] * 1000);

                if (d1 <= date && date < d2) // Pas de date de début dans une période réservée
                {
                    enable = false;
                    break;
                }
            }
            return [enable];
        }
    };
    var endDateParams = {
        dateFormat: "dd-mm-yy",
        firstDay: 1,
        minDate: new Date(),
        beforeShowDay: function (date) {
            var enable = true;
            var startId = '#' + this.id.replace(/endDate/g, 'startDate');

            var rowId = this.id.split('_')[5];
            var startDateVal=$(startId).value;
            if(startDateVal === undefined) {
                startDateVal=$(startId)[0].value;
            }
            startDateVal=startDateVal.split("-");
            var startDate = new Date(startDateVal[2]+"-"+startDateVal[1]+"-"+startDateVal[0]).getTime();
            if(date <= startDate)// La date de fin ne doit pas être inférieur à la date de début
            {
                return [false];
            }
            for (var period in periodArray[rowId]) {
{'fraction_non_alphanumeric': 0.15272167724562416, 'fraction_numerical': 0.005385651086747451, 'mean_word_length': 1.7229641267347473, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 112, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3838342', 'n_tokens_mistral': 3049, 'n_tokens_neox': 2880, 'n_words': 632}