+{if is_null($type)}
+ <script type="text/javascript">
+ {literal}
+ (function () {
+ if (!document.querySelector || !document.querySelectorAll)
+ {
+ return false;
+ }
+ fluxs = document.querySelector('#fluxs');
+ if (fluxs)
+ {
+ var fluxs = fluxs.querySelectorAll('#fluxs > table > tbody > tr');
+ var fluxs_nb = fluxs.length;
+
+ var add = document.createElement('input');
+ add.type = 'button';
+ add.className = 'icn add';
+ add.value = '+';
+ add.title = 'Ajouter un flux';
+ add.onclick = function (e) {
+ var p = this.parentNode.parentNode; // tbody
+ var fluxs = p.querySelectorAll('tr'); // tr
+ var fluxs_nb = fluxs.length;
+
+ // Add new last flux
+ var new_flux = this.parentNode.cloneNode(true); // tr
+ var new_compte = new_flux.querySelector('.compte');
+ new_compte.querySelector('select').id = 'f_compte_'+fluxs_nb;
+ new_compte.querySelector('select').name = 'compte_'+fluxs_nb;
+ p.appendChild(new_flux);
+
+ // Add a montant to old last flux
+ var new_montant = fluxs[0].querySelector('.montant').cloneNode(true);
+ new_montant.querySelector('input').id = 'f_montant_'+(fluxs_nb - 1);
+ new_montant.querySelector('input').name = 'montant_'+(fluxs_nb - 1);
+ new_montant.querySelector('input').value = '0';
+ this.parentNode.appendChild(new_montant);
+ this.parentNode.removeChild(this);
+
+ // Register this callback on new flux
+ var btn = new_flux.querySelector('input.add');
+ btn.onclick = this.onclick;
+ };
+
+ fluxs[fluxs_nb - 1].appendChild(add);
+ }
+ }());
+ {/literal}
+ </script>
+{elseif $type == Garradin\Compta_Categories::DEPENSES || $type == Garradin\Compta_Categories::RECETTES || $type == 'dette'}