<commit_before>{% set _menu_active = 'facture' %}
{% extends 'base.html.twig' %}
{% form_theme form _self %}

{% block _facture_lignes_entry_row %}
    {% set readOnly = (form.vars.data and form.vars.data.origineDocument) %}
    <tr class="dynamic-collection-item">
        <td>
            {{ form_widget(form.libelle) }}
        </td>
        <td >
            {{ form_widget(form.quantite, {'attr': {'readonly': (readOnly) ? "readonly": false }}) }}
        </td>
        <td>
            <div class="input-group">
                {{ form_widget(form.prixUnitaire, {'attr': {'class': 'text-right prix-unitaire form-control'}}) }}
                <div class="input-group-addon">€ HT</div>
            </div>
        </td>
        <td>
            {{ form_widget(form.tauxTaxe, {'value' : (form.tauxTaxe.vars.value) ? form.tauxTaxe.vars.value : 0.2, 'attr': {'class': 'text-right form-control'}}) }}
        </td>
        <td style="width: 0;" class="text-right">
            <button {% if (readOnly) %}disabled="disabled"{% endif %} type="button" tabindex="-1" class="btn btn-default dynamic-collection-remove"><span class="glyphicon glyphicon-remove"></span></button>
        </td>
    </tr>
{% endblock %}

{% block body %}

    <ol class="breadcrumb">
        <li><a href="{{ path('facture') }}">Facture</a></li>
        <li><a href="{{ path('facture_societe',{ 'id' : societe.id }) }}">&nbsp;{{ societe.raisonSociale }}&nbsp;<small>{{societe.adresse.intitule }}</small></a></li>
        <li><a href="">{% if(facture.numeroFacture) %}Modification de la facture n°{{ facture.numeroFacture }}{% else %}Création d'une facture{% endif %}</a></li>
    </ol>

    <div id="formProduitsSuggested" class="form-horizontal" data-produits="{{ produitsSuggestion | json_encode }}">
        {{ form_start(form) }}
        <h3>{% if(facture.numeroFacture) %}
              Modification de {% if (facture.isAvoir) %}l'avoir{% else %}la facture{% endif %} n°{{ facture.numeroFacture }}
            {% else %}
              Création d'une facture
            {% endif %}
        </h3>
        <hr />
        <div class="row">
            <div class="col-xs-5">
                {% if (form.dateFacturation is defined) %}
                <div class="form-group">
                    {{ form_errors(form.dateFacturation) }}
                    {{ form_label(form.dateFacturation, "Date de facturation", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        <div class="input-group">
                            {{ form_widget(form.dateFacturation) }}
                            <div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>
                        </div>
                    </div>
                </div>
                {% endif %}
                {% if (form.dateDevis is defined) %}
                <div class="form-group">
                    {{ form_errors(form.dateDevis) }}
                    {{ form_label(form.dateDevis, "Date du devis", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        <div class="input-group">
                            {{ form_widget(form.dateDevis) }}
                            <div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>
                        </div>
                    </div>
                </div>
                {% endif %}

                <div class="form-group">
                    {{ form_errors(form.frequencePaiement) }}
                    {{ form_label(form.frequencePaiement, "Fréquence de paiement", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        {{ form_widget(form.frequencePaiement) }}
                    </div>
                </div>
                {% if (form.commercial is defined) %}
                <div class="form-group">
                    {{ form_errors(form.commercial) }}
                    {{ form_label(form.commercial, "Commercial", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        {{ form_widget(form.commercial) }}
                    </div>
                </div>
                {% elseif(facture.commercial is defined and not (facture.commercial is null)) %}
                <div class="form-group">
                  <label class="col-xs-5 control-label control-label" for="facture_frequencePaiement">Commercial</label>
                    <div class="col-xs-7">
                      <div class="input-group">
                      {{ facture.commercial.identite }}
                        </div>
                    </div>
                </div>
                {% endif %}
            </div>
            <div class="col-xs-5 col-xs-offset-2">
                <span class="lead">{{ facture.destinataire.nom }}</span><br />
                {{ facture.destinataire.adresseFormatee }}<br />
                {{ facture.destinataire.codePostal }} {{ facture.destinataire.commune }}<br />
            </div>
        </div>
        {% if (form.contrat is defined) %}
        <div class="row">
            <div class="col-xs-12">
              <div class="form-group">
                {{ form_errors(form.contrat) }}
                {{ form_label(form.contrat, "Contrat", {'label_attr': {'class': 'col-xs-2 control-label'}}) }}
                <div class="col-xs-10">
                  {{ form_widget(form.contrat) }}
                </div>
              </div>
            </div>
        </div>
        {% endif %}

        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="col-xs-7">Libellé</th>
                    <th class="col-xs-2">Quantité</th>
                    <th class="col-xs-2">Prix Unitaire</th>
                    <th class="col-xs-1">Taux&nbsp;de&nbsp;TVA</th>
                    <th style="width: 0;"></th>
                </tr>
            </thead>
            <tbody id="facture_lignes_collection" class="dynamic-collection" data-prototype="{{ form_row(form.lignes.vars.prototype)|e('html_attr') }}">
                {{ form_widget(form.lignes, { 'attr': {'class': 'dynamic-collection'} }) }}
            </tbody>
            <tfoot>
                <th colspan="5" class="text-right"><a href="javascript:void(0);" data-collection-target="#facture_lignes_collection"  class="btn btn-primary dynamic-collection-add"><span class="glyphicon glyphicon-plus-sign"></span></a></th>
            </tfoot>
        </table>
        <div class="form-group">
            {{ form_errors(form.description) }}
            {{ form_label(form.description, "Informations complémentaires", {'label_attr': {'class': 'col-xs-2 control-label'}}) }}
            <div class="col-xs-10">
                {{ form_widget(form.description) }}
            </div>
        </div>
        <hr />
        <div class="row form-group">
            <div class="col-xs-4 text-left">
                <a class="btn btn-default" href="{{ path('facture_societe',{ 'id' : societe.id }) }}">Retour</a>
            </div>
            <div class="col-xs-4 text-center">
            	{% if (not facture.numeroFacture and facture.getContrat() and not facture.isAvoir()) %}
            	<a class="btn btn-danger" href="{{ path('facture_suppression',{ 'societe' : societe.id, 'id' : facture.id }) }}" onclick="return confirm('Etes-vous sûr de vouloir supprimer cette facture ?')"><span class="glyphicon glyphicon-remove"></span> Supprimer la facture</a>
            	{% endif %}
                <button type="submit" name="previsualiser" value="previsualiser" class="btn btn-default"><span class="glyphicon glyphicon-file"></span> Prévisualiser la facture</button>
            </div>
            <div class="col-xs-4 text-right">
                <button type="submit" class="btn btn-success">{% if not facture.numeroFacture and facture.getContrat() %}Modifier la facture prévue{% elseif(facture.numeroFacture) %}Modifier la facture{% else %}Générer la facture{% endif %}</button>
            </div>
        </div>
        {{ form_end(form) }}
    </div>
{% endblock %}<commit_msg>controle js du prix unitaire des factures<commit_after>{% set _menu_active = 'facture' %}
{% extends 'base.html.twig' %}
{% form_theme form _self %}

{% block _facture_lignes_entry_row %}
    {% set readOnly = (form.vars.data and form.vars.data.origineDocument) %}
    <tr class="dynamic-collection-item">
        <td>
            {{ form_widget(form.libelle) }}
        </td>
        <td >
            {{ form_widget(form.quantite, {'attr': {'readonly': (readOnly) ? "readonly": false }}) }}
        </td>
        <td>
            <div class="input-group">
                {{ form_widget(form.prixUnitaire, {'attr': {'class': 'text-right prix-unitaire form-control'}}) }}
                <div class="input-group-addon">€ HT</div>
            </div>
        </td>
        <td>
            {{ form_widget(form.tauxTaxe, {'value' : (form.tauxTaxe.vars.value) ? form.tauxTaxe.vars.value : 0.2, 'attr': {'class': 'text-right form-control'}}) }}
        </td>
        <td style="width: 0;" class="text-right">
            <button {% if (readOnly) %}disabled="disabled"{% endif %} type="button" tabindex="-1" class="btn btn-default dynamic-collection-remove"><span class="glyphicon glyphicon-remove"></span></button>
        </td>
    </tr>
{% endblock %}

{% block body %}

    <ol class="breadcrumb">
        <li><a href="{{ path('facture') }}">Facture</a></li>
        <li><a href="{{ path('facture_societe',{ 'id' : societe.id }) }}">&nbsp;{{ societe.raisonSociale }}&nbsp;<small>{{societe.adresse.intitule }}</small></a></li>
        <li><a href="">{% if(facture.numeroFacture) %}Modification de la facture n°{{ facture.numeroFacture }}{% else %}Création d'une facture{% endif %}</a></li>
    </ol>

    <div id="formProduitsSuggested" class="form-horizontal" data-produits="{{ produitsSuggestion | json_encode }}">
        {{ form_start(form) }}
        <h3>{% if(facture.numeroFacture) %}
              Modification de {% if (facture.isAvoir) %}l'avoir{% else %}la facture{% endif %} n°{{ facture.numeroFacture }}
            {% else %}
              Création d'une facture
            {% endif %}
        </h3>
        <hr />
        <div class="row">
            <div class="col-xs-5">
                {% if (form.dateFacturation is defined) %}
                <div class="form-group">
                    {{ form_errors(form.dateFacturation) }}
                    {{ form_label(form.dateFacturation, "Date de facturation", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        <div class="input-group">
                            {{ form_widget(form.dateFacturation) }}
                            <div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>
                        </div>
                    </div>
                </div>
                {% endif %}
                {% if (form.dateDevis is defined) %}
                <div class="form-group">
                    {{ form_errors(form.dateDevis) }}
                    {{ form_label(form.dateDevis, "Date du devis", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        <div class="input-group">
                            {{ form_widget(form.dateDevis) }}
                            <div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>
                        </div>
                    </div>
                </div>
                {% endif %}

                <div class="form-group">
                    {{ form_errors(form.frequencePaiement) }}
                    {{ form_label(form.frequencePaiement, "Fréquence de paiement", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        {{ form_widget(form.frequencePaiement) }}
                    </div>
                </div>
                {% if (form.commercial is defined) %}
                <div class="form-group">
                    {{ form_errors(form.commercial) }}
                    {{ form_label(form.commercial, "Commercial", {'label_attr': {'class': 'col-xs-5 control-label'}}) }}
                    <div class="col-xs-7">
                        {{ form_widget(form.commercial) }}
                    </div>
                </div>
                {% elseif(facture.commercial is defined and not (facture.commercial is null)) %}
                <div class="form-group">
                  <label class="col-xs-5 control-label control-label" for="facture_frequencePaiement">Commercial</label>
                    <div class="col-xs-7">
                      <div class="input-group">
                      {{ facture.commercial.identite }}
                        </div>
                    </div>
                </div>
                {% endif %}
            </div>
            <div class="col-xs-5 col-xs-offset-2">
                <span class="lead">{{ facture.destinataire.nom }}</span><br />
                {{ facture.destinataire.adresseFormatee }}<br />
                {{ facture.destinataire.codePostal }} {{ facture.destinataire.commune }}<br />
            </div>
        </div>
        {% if (form.contrat is defined) %}
        <div class="row">
            <div class="col-xs-12">
              <div class="form-group">
                {{ form_errors(form.contrat) }}
                {{ form_label(form.contrat, "Contrat", {'label_attr': {'class': 'col-xs-2 control-label'}}) }}
                <div class="col-xs-10">
                  {{ form_widget(form.contrat) }}
                </div>
              </div>
            </div>
        </div>
        {% endif %}

        <table class="table table-bordered">
            <thead>
                <tr>
                    <th class="col-xs-7">Libellé</th>
                    <th class="col-xs-2">Quantité</th>
                    <th class="col-xs-2">Prix Unitaire</th>
                    <th class="col-xs-1">Taux&nbsp;de&nbsp;TVA</th>
                    <th style="width: 0;"></th>
                </tr>
            </thead>
            <tbody id="facture_lignes_collection" class="dynamic-collection" data-prototype="{{ form_row(form.lignes.vars.prototype)|e('html_attr') }}">
                {{ form_widget(form.lignes, { 'attr': {'class': 'dynamic-collection'} }) }}
            </tbody>
            <tfoot>
                <th colspan="5" class="text-right"><a href="javascript:void(0);" data-collection-target="#facture_lignes_collection"  class="btn btn-primary dynamic-collection-add"><span class="glyphicon glyphicon-plus-sign"></span></a></th>
            </tfoot>
        </table>
        <div class="form-group">
            {{ form_errors(form.description) }}
            {{ form_label(form.description, "Informations complémentaires", {'label_attr': {'class': 'col-xs-2 control-label'}}) }}
            <div class="col-xs-10">
                {{ form_widget(form.description) }}
            </div>
        </div>
        <hr />
        <div class="row form-group">
            <div class="col-xs-4 text-left">
                <a class="btn btn-default" href="{{ path('facture_societe',{ 'id' : societe.id }) }}">Retour</a>
            </div>
            <div class="col-xs-4 text-center">
            	{% if (not facture.numeroFacture and facture.getContrat() and not facture.isAvoir()) %}
            	<a class="btn btn-danger" href="{{ path('facture_suppression',{ 'societe' : societe.id, 'id' : facture.id }) }}" onclick="return confirm('Etes-vous sûr de vouloir supprimer cette facture ?')"><span class="glyphicon glyphicon-remove"></span> Supprimer la facture</a>
            	{% endif %}
                <button type="submit" name="previsualiser" value="previsualiser" class="btn btn-default"><span class="glyphicon glyphicon-file"></span> Prévisualiser la facture</button>
            </div>
            <div class="col-xs-4 text-right">
                <button type="submit" class="btn btn-success">{% if not facture.numeroFacture and facture.getContrat() %}Modifier la facture prévue{% elseif(facture.numeroFacture) %}Modifier la facture{% else %}Générer la facture{% endif %}</button>
            </div>
        </div>
        {{ form_end(form) }}
    </div>
{% endblock %}
{% block javascripts %}
    <script type="text/javascript">
    $("form").submit(function() {
      var ok = true;
      $("input.prix-unitaire").each(function() {
        if ($(this).val() < 0) {
          ok = false;
        }
      });
      if (!ok) {
        alert("Le Prix Unitaire doit être un nombre positif");
        return false;
      }
    });
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.17145390070921987, 'fraction_numerical': 0.004432624113475178, 'mean_word_length': 1.8093973103104766, 'pattern_counts': {'":': 2, '<': 300, '<?xml version=': 0, '>': 299, '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': '5136240', 'n_tokens_mistral': 5299, 'n_tokens_neox': 4922, 'n_words': 918}