2023-10-24 18:11:28 +02:00
|
|
|
{{#restrict section="config" level="admin" block=true}}{{/restrict}}
|
|
|
|
{{:admin_header title="Configuration" current="module_equipment"}}
|
|
|
|
|
|
|
|
{{* barre de navigation *}}
|
|
|
|
{{:include file="/%s/_nav.html"|args:$module.name current="config"}}
|
|
|
|
|
|
|
|
{{if $_GET.ok}}
|
|
|
|
<p class="block confirm">Configuration enregistrée.</p>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{* Traiter l'envoi du formulaire *}}
|
|
|
|
{{#form on="save"}}
|
|
|
|
|
|
|
|
{{:save key="config"
|
|
|
|
validate_schema="./config.schema.json"
|
2023-11-15 14:49:34 +01:00
|
|
|
inputNature=$_POST.input_fields|array_transpose
|
|
|
|
outputNature=$_POST.output_fields|array_transpose
|
2023-10-24 18:11:28 +02:00
|
|
|
}}
|
|
|
|
{{:redirect to="./config.html?ok=1"}}
|
|
|
|
{{/form}}
|
|
|
|
|
2023-11-15 14:49:34 +01:00
|
|
|
{{* types d'entrées *}}
|
|
|
|
{{:assign var='types_entrees' définitif="définitif" temporaire="temporaire" retour="retour"}}
|
2023-10-24 18:11:28 +02:00
|
|
|
|
2023-11-15 14:49:34 +01:00
|
|
|
{{* entrées par défaut *}}
|
|
|
|
{{:assign var='entrees_defaut.Achat' value='définitif'}}
|
|
|
|
{{:assign var='entrees_defaut.Location' value='temporaire'}}
|
|
|
|
{{:assign var='entrees_defaut.Retour de Location/Prêt' value='retour'}}
|
|
|
|
|
|
|
|
{{* types de sorties *}}
|
|
|
|
{{:assign var='types_sorties' définitif="définitif" temporaire="temporaire" retour="retour"}}
|
|
|
|
|
|
|
|
{{* sorties par défaut *}}
|
|
|
|
{{:assign var='sorties_defaut.Vente' value='définitif'}}
|
|
|
|
{{:assign var='sorties_defaut.Prêt' value='temporaire'}}
|
|
|
|
{{:assign var='sorties_defaut.Retour de Location/Prêt' value='retour'}}
|
2023-10-24 18:11:28 +02:00
|
|
|
|
|
|
|
<form method="post" action="">
|
|
|
|
<fieldset>
|
|
|
|
<legend>Entrées</legend>
|
|
|
|
<table class="list input_fields">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-11-15 14:49:34 +01:00
|
|
|
<th>Nature de l'entrée</th>
|
|
|
|
<th>Type</th>
|
2023-10-24 18:11:28 +02:00
|
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-10-25 12:14:05 +02:00
|
|
|
<tbody id="input_body">
|
2023-10-24 18:11:28 +02:00
|
|
|
{{#foreach from=$module.config.inputNature item="input_field"}}
|
|
|
|
<tr>
|
|
|
|
<td>{{:input type="text" name="input_fields[label][]" default=$input_field.label}}</td>
|
2023-11-15 14:49:34 +01:00
|
|
|
<td>{{:input type="select" name="input_fields[type][]" options=$types_entrees default=$input_field.type required=true default_empty="— Choisir un type —"}}</td>
|
2023-10-24 18:11:28 +02:00
|
|
|
<td class="action">
|
|
|
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{else}}
|
2023-11-15 14:49:34 +01:00
|
|
|
{{#foreach from=$entrees_defaut key="label" item="value"}}
|
2023-10-24 18:11:28 +02:00
|
|
|
<tr>
|
|
|
|
<td>{{:input type="text" name="input_fields[label][]" default=$label}}</td>
|
2023-11-15 14:49:34 +01:00
|
|
|
<td>{{:input type="select" name="input_fields[type][]" options=$types_entrees required=true default=$value default_empty="— Choisir un type —"}}</td>
|
2023-10-24 18:11:28 +02:00
|
|
|
<td class="action">
|
|
|
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/foreach}}
|
|
|
|
{{/foreach}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<p class="actions">
|
|
|
|
{{:button shape="plus"
|
|
|
|
label="Ajouter un champ"
|
2023-10-25 12:14:05 +02:00
|
|
|
onclick="addLine('#input_body')"}}
|
2023-10-24 18:11:28 +02:00
|
|
|
</p>
|
2023-11-15 14:49:34 +01:00
|
|
|
<div class="help">
|
|
|
|
<h3>Signification du type d'entrée</h3>
|
|
|
|
<ul>
|
|
|
|
<li><b>définitif</b> : l'asso devient propriétaire du matériel (ex : achat, don)</li>
|
|
|
|
<li><b>temporaire</b> : l'asso ne devient <strong>pas</strong> propriétaire du matériel (ex : location, emprunt)</li>
|
|
|
|
<li><b>retour</b> : matériel qui revient après une sortie temporaire (ex : retour de location ou de prêt)</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-10-24 18:11:28 +02:00
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
<legend>Sorties</legend>
|
|
|
|
<table class="list output_fields">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-11-15 14:49:34 +01:00
|
|
|
<th>Nature de la sortie</th>
|
|
|
|
<th>Type</th>
|
2023-10-24 18:11:28 +02:00
|
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-10-25 12:14:05 +02:00
|
|
|
<tbody id="output_body">
|
2023-10-24 18:11:28 +02:00
|
|
|
{{#foreach from=$module.config.outputNature item="output_field"}}
|
|
|
|
<tr>
|
2023-10-30 16:43:15 +01:00
|
|
|
<td>{{:input type="text" name="output_fields[label][]" default=$output_field.label}}</td>
|
2023-11-15 14:49:34 +01:00
|
|
|
<td>{{:input type="select" name="output_fields[type][]" options=$types_sorties default=$output_field.type required=true default_empty="— Choisir un type —"}}</td>
|
2023-10-24 18:11:28 +02:00
|
|
|
<td class="action">
|
|
|
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{else}}
|
2023-11-15 14:49:34 +01:00
|
|
|
{{#foreach from=$sorties_defaut key="label" item="value"}}
|
2023-10-24 18:11:28 +02:00
|
|
|
<tr>
|
2023-10-30 16:43:15 +01:00
|
|
|
<td>{{:input type="text" name="output_fields[label][]" default=$label}}</td>
|
2023-11-15 14:49:34 +01:00
|
|
|
<td>{{:input type="select" name="output_fields[type][]" options=$types_sorties required=true default=$value default_empty="— Choisir un type —"}}</td>
|
2023-10-24 18:11:28 +02:00
|
|
|
<td class="action">
|
|
|
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/foreach}}
|
|
|
|
{{/foreach}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<p class="actions">
|
|
|
|
{{:button shape="plus"
|
|
|
|
label="Ajouter un champ"
|
2023-10-25 12:14:05 +02:00
|
|
|
onclick="addLine('#output_body')"}}
|
2023-10-24 18:11:28 +02:00
|
|
|
</p>
|
2023-11-15 14:49:34 +01:00
|
|
|
<div class="help">
|
|
|
|
<h3>Signification du type de sortie</h3>
|
|
|
|
<ul>
|
|
|
|
<li><b>définitif</b> : le matériel n'appartient plus à l'asso (ex : vente, casse, perte, vol, ...)</li>
|
|
|
|
<li><b>temporaire</b> : le matériel sort temporairement de l'asso qui en reste propriétaire (ex : location, prêt)</li>
|
2023-11-18 21:34:10 +01:00
|
|
|
<li><b>retour</b> : le matériel <strong>non propriété de l'asso</strong> est rendu à son propriétaire (ex : retour de location ou d'emprunt)</li>
|
2023-11-15 14:49:34 +01:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-10-24 18:11:28 +02:00
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<p class="submit">
|
2023-10-25 12:14:05 +02:00
|
|
|
{{:button
|
|
|
|
type="submit"
|
|
|
|
name="save"
|
|
|
|
label="Enregistrer"
|
|
|
|
shape="right"
|
|
|
|
class="main"
|
|
|
|
}}
|
2023-10-24 18:11:28 +02:00
|
|
|
</p>
|
|
|
|
</form>
|
|
|
|
|
2023-10-25 12:14:05 +02:00
|
|
|
<script type="text/javascript">
|
|
|
|
// dupliquer la dernière ligne d'une table
|
|
|
|
function addLine(id_body) {
|
|
|
|
var ligne = document.querySelector(id_body).lastElementChild;
|
|
|
|
var nelle = ligne.cloneNode(true);
|
|
|
|
let text = nelle.querySelector('input[type="text"]');
|
|
|
|
text.value = null;
|
2023-11-15 14:49:34 +01:00
|
|
|
let menu = nelle.querySelector('select')
|
|
|
|
if (menu != null) {
|
|
|
|
menu[0].selected = 'selected';
|
2023-10-25 12:14:05 +02:00
|
|
|
}
|
|
|
|
ligne.parentNode.appendChild(nelle);
|
|
|
|
text.focus();
|
|
|
|
}
|
|
|
|
</script>
|
2023-10-24 18:11:28 +02:00
|
|
|
{{:admin_footer}}
|