init
[garradin.git] / templates / admin / membres / cotisations / gestion / modifier.tpl
1 {include file="admin/_head.tpl" title="Modifier une cotisation" 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 {if $error}
12 <p class="error">
13 {$error|escape}
14 </p>
15 {/if}
16
17 <form method="post" action="{$self_url|escape}">
18
19 <fieldset>
20 <legend>Modifier une cotisation</legend>
21 <dl>
22 <dt><label for="f_intitule">Intitulé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
23 <dd><input type="text" name="intitule" id="f_intitule" value="{form_field name=intitule data=$cotisation}" required="required" /></dd>
24 <dt><label for="f_description">Description</label></dt>
25 <dd><textarea name="description" id="f_description" cols="50" rows="3">{form_field name=description data=$cotisation}</textarea></dd>
26 <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
27 <dd><input type="number" name="montant" step="0.01" min="0.00" id="f_montant" value="{form_field default=20 name=montant default=0.00 data=$cotisation}" required="required" /></dd>
28
29 <dt><label for="f_periodicite_jours">Période de validité</label></dt>
30 <dd><input type="radio" name="periodicite" id="f_periodicite_ponctuel" value="ponctuel" {form_field checked="ponctuel" name=periodicite default="ponctuel" data=$cotisation} /> <label for="f_periodicite_ponctuel">Pas de période (activité ou cotisation ponctuelle)</label></dd>
31
32 <dd><input type="radio" name="periodicite" id="f_periodicite_jours" value="jours" {form_field checked="jours" name=periodicite data=$cotisation} /> <label for="f_periodicite_jours">En nombre de jours</label>
33 <dl class="periode_jours">
34 <dt><label for="f_duree">Durée de validité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
35 <dd><input type="number" step="1" size="5" min="1" name="duree" id="f_duree" value="{form_field name="duree" data=$cotisation}" /></dd>
36 </dl>
37 </dd>
38 <dd><input type="radio" name="periodicite" id="f_periodicite_dates" value="date" {form_field checked="date" name=periodicite data=$cotisation} /> <label for="f_periodicite_dates">Période définie</label>
39 <dl class="periode_dates">
40 <dt><label for="f_date_debut">Date de début</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
41 <dd><input type="date" name="debut" value="{form_field name=debut data=$cotisation}" id="f_date_debut" /></dd>
42 <dt><label for="f_date_fin">Date de fin</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
43 <dd><input type="date" name="fin" value="{form_field name=fin data=$cotisation}" id="f_date_fin" /></dd>
44 </dl>
45 </dd>
46 <dt>
47 <input type="checkbox" name="categorie" id="f_categorie" value="1" {form_field name="categorie" checked=1 data=$cotisation} /> <label for="f_categorie">Enregistrer les cotisations des membres dans la comptabilité</label>
48 </dt>
49 <dd class="help cat_compta">
50 Si coché, à chaque enregistrement de cotisation d'un membre une opération
51 du montant de la cotisation sera enregistrée dans la comptabilité selon
52 la catégorie choisie.
53 </dd>
54 <dt class="cat_compta"><label for="f_id_categorie_compta">Catégorie comptable</label></dt>
55 <dd class="cat_compta">
56 <select name="id_categorie_compta" id="f_id_categorie_compta">
57 {foreach from=$categories item="cat"}
58 <option value="{$cat.id|escape}" {form_field name="id_categorie_compta" selected=$cat.id data=$cotisation}>{$cat.intitule|escape}
59 {if !empty($cat.description)}
60 — <em>{$cat.description|escape}</em>
61 {/if}
62 </option>
63 {/foreach}
64 </select>
65 </dd>
66 </dl>
67 </fieldset>
68
69 <p class="submit">
70 {csrf_field key="edit_co_`$cotisation.id`"}
71 <input type="submit" name="save" value="Ajouter &rarr;" />
72 </p>
73
74 </form>
75
76 <script type="text/javascript">
77 {literal}
78 (function () {
79 var hide = [];
80
81 if (!$('#f_categorie').checked)
82 hide.push('.cat_compta');
83
84 if (!$('#f_periodicite_jours').checked)
85 hide.push('.periode_jours');
86
87 if (!$('#f_periodicite_dates').checked)
88 hide.push('.periode_dates');
89
90 toggleElementVisibility(hide, false);
91
92 $('#f_categorie').onchange = function() {
93 toggleElementVisibility('.cat_compta', this.checked);
94 return true;
95 };
96
97 function togglePeriode()
98 {
99 toggleElementVisibility(['.periode_jours', '.periode_dates'], false);
100
101 if (this.checked && this.value == 'jours')
102 toggleElementVisibility('.periode_jours', true);
103 else if (this.checked && this.value == 'date')
104 toggleElementVisibility('.periode_dates', true);
105 }
106
107 $('#f_periodicite_ponctuel').onchange = togglePeriode;
108 $('#f_periodicite_dates').onchange = togglePeriode;
109 $('#f_periodicite_jours').onchange = togglePeriode;
110 })();
111 {/literal}
112 </script>
113
114 {include file="admin/_foot.tpl"}