Projet

Général

Profil

0001-apa-allow-columns-selection-in-apa-droits-table-3629.patch

Thomas Noël, 23 septembre 2019 23:41

Télécharger (4,92 ko)

Voir les différences:

Subject: [PATCH] apa: allow columns selection in apa-droits table (#36297)

To enable this feature, add a "columns" parameter in
JSON_CELL_TYPES['apa-droits'] configuration, like this:

    "apa-droits" : {
       ...
       "form": [
         {
           "varname": "solis",
           "label": "Slug du connecteur Solis",
           "required": false
         },
         {
           "varname": "columns",
           "label": "Colonnes (ex: periode prestation quantite montant participation mode versement destinataire)",
           "required": false
         }
       ],
       ...
 templates/combo/json/apa-droits.html | 52 ++++++++++++++++++----------
 1 file changed, 34 insertions(+), 18 deletions(-)
templates/combo/json/apa-droits.html
80 80
      <table class="pk-data-table pk-table-headers pk-table-zebra">
81 81
        <thead>
82 82
          <tr>
83
            <th>Période</th>
84
            <th>Prestation</th>
85
            <th>Quantité</th>
86
            <th>Montant accordé</th>
87
            <th>Participation du bénéficiaire</th>
88
            <th>Versement</th>
89
            <th>Destinataire du paiement</th>
83
            {% for column in columns|default:"periode prestation quantite montant participation versement destinataire"|split %}
84
              {% if column == "periode" %}<th>Période</th>
85
              {% elif column == "prestation" %}<th>Prestation</th>
86
              {% elif column == "quantite" %}<th>Quantité</th>
87
              {% elif column == "montant" %}<th>Montant accordé</th>
88
              {% elif column == "participation" %}<th>Participation du bénéficiaire</th>
89
              {% elif column == "versement" %}<th>Versement</th>
90
              {% elif column == "mode" %}<th>Mode de règlement</th>
91
              {% elif column == "destinataire" %}<th>Destinataire du paiement</th>
92
              {% endif %}
93
            {% endfor %}
90 94
          </tr>
91 95
        </thead>
92 96
        <tbody>
93 97
          {% for presta in dossier.prestationAccordeeAsg %}
94 98
          <tr>
95
            <td>
96
              {% if presta.periode.dateEffet %}{% if presta.periode.dateFin %}du {%endif %}{{ presta.periode.dateEffet|parse_date|date:"j/n/Y" }}{% endif %}
97
              {% if presta.periode.dateFin %}{% if not presta.periode.dateEffet %}jusqu'{% endif %}au {{ presta.periode.dateFin|parse_date|date:"j/n/Y" }}{% endif %}
98
            </td>
99
            <td nowrap>{{ presta.prestation }}</td>
100
            <td>{{ presta.quantite|default:"non renseigné" }}</td>
101
            <td>{{ presta.montant.accorde|default:"0"|floatformat:2 }} €</td>
102
            <td>{{ presta.montant.participation|default:"0"|floatformat:2 }} €</td>
103
            <td>{{ presta.montant.verse|default:"0"|floatformat:2 }} €</td>
104
            <td>{{ presta.attributaire.identite|default:"non renseigné" }}
105
                {% if presta.attributaire.type %}({{ presta.attributaire.type }}){% endif %}</td>
99
            {% for column in columns|default:"periode prestation quantite montant participation versement destinataire"|split %}
100
              {% if column == "periode" %}
101
                <td>
102
                  {% if presta.periode.dateEffet %}{% if presta.periode.dateFin %}du {%endif %}{{ presta.periode.dateEffet|parse_date|date:"j/n/Y" }}{% endif %}
103
                  {% if presta.periode.dateFin %}{% if not presta.periode.dateEffet %}jusqu'{% endif %}au {{ presta.periode.dateFin|parse_date|date:"j/n/Y" }}{% endif %}
104
                </td>
105
              {% elif column == "prestation" %}
106
                <td nowrap>{{ presta.prestation }}{% if presta.tiers.type %}<br/>({{ presta.tiers.type }}){% endif %}</td>
107
              {% elif column == "quantite" %}
108
                <td>{{ presta.quantite|default:"non renseigné" }}</td>
109
              {% elif column == "montant" %}
110
                <td>{{ presta.montant.accorde|default:"0"|floatformat:2 }} €</td>
111
              {% elif column == "participation" %}
112
                <td>{{ presta.montant.participation|default:"0"|floatformat:2 }} €</td>
113
              {% elif column == "versement" %}
114
                <td>{{ presta.montant.verse|default:"0"|floatformat:2 }} €</td>
115
              {% elif column == "mode" %}
116
                <td>{{ presta.attributaire.tiersComptable.modeReglement|default:"non renseigné" }}</td>
117
              {% elif column == "destinataire" %}
118
                <td>{{ presta.attributaire.identite|default:"non renseigné" }}
119
                    {% if presta.attributaire.type %}({{ presta.attributaire.type }}){% endif %}</td>
120
              {% endif %}
121
            {% endfor %}
106 122
          </tr>
107 123
          {% endfor %}
108 124
        </tbody>
109
-