init
[garradin.git] / templates / admin / compta / operations / modifier.tpl
1 {include file="admin/_head.tpl" title="Modification de l'opération n°`$operation.id`" current="compta/saisie" js=1}
2
3 {if $error}
4 <p class="error">
5 {$error|escape}
6 </p>
7 {/if}
8
9 <form method="post" action="{$self_url|escape}">
10
11 <fieldset>
12 <legend>Informations sur l'opération</legend>
13 <dl>
14 <dt><label for="f_date">Date</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
15 <dd><input type="date" name="date" id="f_date" value="{form_field name=date default=$operation.date|date_fr:'Y-m-d'}" size="10" required="required" /></dd>
16 <dt><label for="f_libelle">Libellé</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
17 <dd><input type="text" name="libelle" id="f_libelle" value="{form_field name=libelle data=$operation}" required="required" /></dd>
18 <dt><label for="f_montant">Montant</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
19 <dd><input type="number" size="5" name="montant" id="f_montant" value="{form_field name=montant data=$operation}" min="0.00" step="0.01" required="required" /> {$config.monnaie|escape}</dd>
20
21 {if is_null($type)}
22 <dt><label for="f_compte_debit">Compte débité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
23 <dd>
24 {select_compte comptes=$comptes name="compte_debit" data=$operation}
25 </dd>
26 <dt><label for="f_compte_credit">Compte crédité</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
27 <dd>
28 {select_compte comptes=$comptes name="compte_credit" data=$operation}
29 </dd>
30 {else}
31 <dt><label for="f_moyen_paiement">Moyen de paiement</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
32 <dd>
33 <select name="moyen_paiement" id="f_moyen_paiement">
34 {foreach from=$moyens_paiement item="moyen"}
35 <option value="{$moyen.code|escape}"{if $moyen.code == $operation.moyen_paiement} selected="selected"{/if}>{$moyen.nom|escape}</option>
36 {/foreach}
37 </select>
38 </dd>
39 <dt class="f_cheque"><label for="f_numero_cheque">Numéro de chèque</label></dt>
40 <dd class="f_cheque"><input type="text" name="numero_cheque" id="f_numero_cheque" value="{form_field name=numero_cheque data=$operation}" /></dd>
41 <dt class="f_banque"><label for="f_banque">Compte bancaire</label></dt>
42 <dd class="f_banque">
43 <select name="banque" id="f_banque">
44 {foreach from=$comptes_bancaires item="compte"}
45 <option value="{$compte.id|escape}"{if ($type == Garradin\Compta_Categories::DEPENSES && $compte.id == $operation.compte_credit) || $compte.id == $operation.compte_debit} selected="selected"{/if}>{$compte.libelle|escape} - {$compte.banque|escape}</option>
46 {/foreach}
47 </select>
48 </dd>
49 {/if}
50
51 <dt><label for="f_numero_piece">Numéro de pièce comptable</label></dt>
52 <dd><input type="text" name="numero_piece" id="f_numero_piece" value="{form_field name=numero_piece data=$operation}" /></dd>
53 <dt><label for="f_remarques">Remarques</label></dt>
54 <dd><textarea name="remarques" id="f_remarques" rows="4" cols="30">{form_field name=remarques data=$operation}</textarea></dd>
55 </dl>
56 </fieldset>
57
58 {if !is_null($type)}
59 <fieldset>
60 <legend>Catégorie</legend>
61 <dl class="catList">
62 {foreach from=$categories item="cat"}
63 <dt>
64 <input type="radio" name="id_categorie" value="{$cat.id|escape}" id="f_cat_{$cat.id|escape}" {form_field name="id_categorie" checked=$cat.id data=$operation} />
65 <label for="f_cat_{$cat.id|escape}">{$cat.intitule|escape}</label>
66 </dt>
67 {if !empty($cat.description)}
68 <dd class="desc">{$cat.description|escape}</dd>
69 {/if}
70 {/foreach}
71 </dl>
72 </fieldset>
73
74 <script type="text/javascript">
75 {literal}
76 (function () {
77
78 window.changeMoyenPaiement = function()
79 {
80 var elm = $('#f_moyen_paiement');
81 toggleElementVisibility('.f_cheque', elm.value == 'CH');
82 toggleElementVisibility('.f_banque', elm.value != 'ES');
83 };
84
85 changeMoyenPaiement();
86
87 $('#f_moyen_paiement').onchange = changeMoyenPaiement;
88 } ());
89 {/literal}
90 </script>
91 {/if}
92
93 <p class="submit">
94 {csrf_field key="compta_modifier_`$operation.id`"}
95 <input type="submit" name="save" value="Enregistrer &rarr;" />
96 </p>
97
98 </form>
99
100 {include file="admin/_foot.tpl"}