init
[garradin.git] / templates / admin / membres / cotisations / index.tpl
1 {include file="admin/_head.tpl" title="Cotisations" current="membres/cotisations" js=1}
2
3 <ul class="actions">
4 <li class="current"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
5 <li><a href="{$admin_url}membres/cotisations/ajout.php">Saisie d'une cotisation</a></li>
6 {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
7 <li><a href="{$admin_url}membres/cotisations/gestion/rappels.php">Gestion des rappels automatiques</a></li>
8 {/if}
9 </ul>
10
11 <table class="list">
12 <thead>
13 <th>Cotisation</th>
14 <td>Période</td>
15 <td>Montant</td>
16 <td>Membres inscrits</td>
17 <td>Membres à jour</td>
18 <td></td>
19 </thead>
20 <tbody>
21 {foreach from=$liste item="co"}
22 <tr>
23 <th><a href="{$admin_url}membres/cotisations/voir.php?id={$co.id|escape}">{$co.intitule|escape}</a></th>
24 <td>
25 {if $co.duree}
26 {$co.duree|escape} jours
27 {elseif $co.debut}
28 du {$co.debut|format_sqlite_date_to_french} au {$co.fin|format_sqlite_date_to_french}
29 {else}
30 ponctuelle
31 {/if}
32 </td>
33 <td class="num">{$co.montant|html_money} {$config.monnaie|escape}</td>
34 <td class="num">{$co.nb_membres|escape}</td>
35 <td class="num">{$co.nb_a_jour|escape}</td>
36 <td class="actions">
37 <a class="icn" href="{$admin_url}membres/cotisations/voir.php?id={$co.id|escape}" title="Liste des membres cotisants">👪</a>
38 {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
39 <a class="icn" href="{$admin_url}membres/cotisations/gestion/modifier.php?id={$co.id|escape}" title="Modifier">✎</a>
40 <a class="icn" href="{$admin_url}membres/cotisations/gestion/supprimer.php?id={$co.id|escape}" title="Supprimer">✘</a>
41 {/if}
42 </td>
43 </tr>
44 {/foreach}
45 </tbody>
46 </table>
47
48 {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
49
50 {if $error}
51 <p class="error">
52 {$error|escape}
53 </p>
54 {else}
55 <p class="help">
56 Idée : les cotisations peuvent également être utilisées pour suivre les activités auxquels
57 sont inscrits les membres de l'association.
58 </p>
59 {/if}
60
61 <form method="post" action="{$self_url|escape}" id="f_add">
62
63 <fieldset>
64 <legend>Ajouter une cotisation</legend>
65 <dl>
66 <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
67 <dd><input type="text" name="intitule" id="f_intitule" value="{form_field name=intitule}" required="required" /></dd>
68 <dt><label for="f_description">Description</label></dt>
69 <dd><textarea name="description" id="f_description" cols="50" rows="3">{form_field name=description}</textarea></dd>
70 <dt><label for="f_montant">Montant minimal</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
71 <dd><input type="number" name="montant" step="0.01" min="0.00" id="f_montant" value="{form_field name=montant default=0.00}" required="required" /></dd>
72
73 <dt><label for="f_periodicite_jours">Période de validité</label></dt>
74 <dd><input type="radio" name="periodicite" id="f_periodicite_ponctuel" value="ponctuel" {form_field checked="ponctuel" name=periodicite default="ponctuel"} /> <label for="f_periodicite_ponctuel">Pas de période (cotisation ponctuelle)</label></dd>
75
76 <dd><input type="radio" name="periodicite" id="f_periodicite_jours" value="jours" {form_field checked="jours" name=periodicite} /> <label for="f_periodicite_jours">En nombre de jours</label>
77 <dl class="periode_jours">
78 <dt><label for="f_duree">Durée de validité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
79 <dd><input type="number" step="1" size="5" min="1" name="duree" id="f_duree" value="{form_field name="duree"}" /></dd>
80 </dl>
81 </dd>
82 <dd><input type="radio" name="periodicite" id="f_periodicite_dates" value="date" {form_field checked="date" name=periodicite} /> <label for="f_periodicite_dates">Période définie</label>
83 <dl class="periode_dates">
84 <dt><label for="f_date_debut">Date de début</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
85 <dd><input type="date" name="debut" value="{form_field name=debut}" id="f_date_debut" /></dd>
86 <dt><label for="f_date_fin">Date de fin</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
87 <dd><input type="date" name="fin" value="{form_field name=fin}" id="f_date_fin" /></dd>
88 </dl>
89 </dd>
90 <dt>
91 <input type="checkbox" name="categorie" id="f_categorie" value="1" {form_field name="categorie" checked=1} /> <label for="f_categorie">Enregistrer les cotisations des membres dans la comptabilité</label>
92 </dt>
93 <dd class="help cat_compta">
94 Si coché, à chaque enregistrement de cotisation d'un membre une opération
95 du montant de la cotisation sera enregistrée dans la comptabilité selon
96 la catégorie choisie.
97 </dd>
98 <dt class="cat_compta"><label for="f_id_categorie_compta">Catégorie comptable</label></dt>
99 <dd class="cat_compta">
100 <select name="id_categorie_compta" id="f_id_categorie_compta">
101 {foreach from=$categories item="cat"}
102 <option value="{$cat.id|escape}" {form_field name="id_categorie_compta" selected=$cat.id}>{$cat.intitule|escape}
103 {if !empty($cat.description)}
104 — <em>{$cat.description|escape}</em>
105 {/if}
106 </option>
107 {/foreach}
108 </select>
109 </dd>
110 </dl>
111 </fieldset>
112
113 <p class="submit">
114 {csrf_field key="new_cotisation"}
115 <input type="submit" name="save" value="Ajouter &rarr;" />
116 </p>
117
118 </form>
119
120 <script type="text/javascript">
121 {literal}
122 (function () {
123 var hide = [];
124
125 if (!$('#f_categorie').checked)
126 hide.push('.cat_compta');
127
128 if (!$('#f_periodicite_jours').checked)
129 hide.push('.periode_jours');
130
131 if (!$('#f_periodicite_dates').checked)
132 hide.push('.periode_dates');
133
134 toggleElementVisibility(hide, false);
135
136 $('#f_categorie').onchange = function() {
137 toggleElementVisibility('.cat_compta', this.checked);
138 return true;
139 };
140
141 function togglePeriode()
142 {
143 toggleElementVisibility(['.periode_jours', '.periode_dates'], false);
144
145 if (this.checked && this.value == 'jours')
146 toggleElementVisibility('.periode_jours', true);
147 else if (this.checked && this.value == 'date')
148 toggleElementVisibility('.periode_dates', true);
149 }
150
151 $('#f_periodicite_ponctuel').onchange = togglePeriode;
152 $('#f_periodicite_dates').onchange = togglePeriode;
153 $('#f_periodicite_jours').onchange = togglePeriode;
154 })();
155 {/literal}
156 </script>
157
158 {/if}
159
160 {include file="admin/_foot.tpl"}