fin réorganisation configuration
This commit is contained in:
parent
5c26cf3ad7
commit
64d57b8560
6 changed files with 189 additions and 141 deletions
179
config.html
179
config.html
|
|
@ -9,17 +9,6 @@
|
|||
<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"
|
||||
input_nature=$_POST.input_fields|array_transpose
|
||||
output_nature=$_POST.output_fields|array_transpose
|
||||
}}
|
||||
{{:redirect to="./config.html?ok=1"}}
|
||||
{{/form}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
|
|
@ -28,7 +17,7 @@
|
|||
{{:assign var='input_types.%s'|args:$type value=$type}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* Natures d'entrées qui ne peuvent être supprimées *}}
|
||||
{{* types d'entrées qui ne peuvent être supprimées *}}
|
||||
{{#load type="movement" where="$$.direction='input'" group="$$.input_nature"}}
|
||||
{{:assign var="locked_inputs." value=$input_nature}}
|
||||
{{/load}}
|
||||
|
|
@ -38,127 +27,59 @@
|
|||
{{:assign var='output_types.%s'|args:$type value=$type}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* Natures de sorties qui ne peuvent être supprimées *}}
|
||||
{{* types de sorties qui ne peuvent être supprimées *}}
|
||||
{{#load type="movement" where="$$.direction='output'" group="$$.output_nature"}}
|
||||
{{:assign var="locked_outputs." value=$output_nature}}
|
||||
{{/load}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Entrées</legend>
|
||||
<table class="list input_fields">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nature de l'entrée</th>
|
||||
<th>Type</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="input_body">
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
<tr>
|
||||
<td>{{:input type="text" name="input_fields[label][]" default=$label}}</td>
|
||||
<td>{{:input type="select"
|
||||
name="input_fields[type][]"
|
||||
options=$input_types
|
||||
default=$type
|
||||
required=true
|
||||
default_empty="— Choisir un type —"}}
|
||||
</td>
|
||||
<td class="action">
|
||||
{{:button
|
||||
label="Supprimer" shape="minus"
|
||||
disabled=$locked_inputs|has:$label
|
||||
onclick="this.parentNode.parentNode.remove();"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="actions">
|
||||
{{:button shape="plus" label="Ajouter un champ" onclick="addLine('#input_body')"}}
|
||||
</p>
|
||||
<div class="help block">
|
||||
<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>
|
||||
</fieldset>
|
||||
<h2>Types d'entrées</h2>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Libellé</th>
|
||||
<th>Type</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
<tr>
|
||||
<td>{{$label}}</td>
|
||||
<td>{{$type}}</td>
|
||||
<td class="actions">
|
||||
{{if ! $locked_inputs|has:$label}}
|
||||
{{:linkbutton label="Supprimer" shape="minus" href="config/supprimer_type_mouvement.html?dir=input&mvt=%s"|args:$label target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<fieldset>
|
||||
<legend>Sorties</legend>
|
||||
<table class="list output_fields">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nature de la sortie</th>
|
||||
<th>Type</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="output_body">
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
<tr>
|
||||
<td>{{:input type="text" name="output_fields[label][]" default=$label}}</td>
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="output_fields[type][]"
|
||||
options=$output_types
|
||||
default=$type
|
||||
required=true
|
||||
default_empty="— Choisir un type —"}}
|
||||
</td>
|
||||
<td class="action">
|
||||
{{:button
|
||||
label="Supprimer" shape="minus"
|
||||
disabled=$locked_outputs|has:$label
|
||||
onclick="this.parentNode.parentNode.remove();"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="actions">
|
||||
{{:button shape="plus"
|
||||
label="Ajouter un champ"
|
||||
onclick="addLine('#output_body')"}}
|
||||
</p>
|
||||
<div class="help block">
|
||||
<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>
|
||||
<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>
|
||||
</dl>
|
||||
</div>
|
||||
</fieldset>
|
||||
<h2>Types de sorties</h2>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Libellé</th>
|
||||
<th>Type</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
<tr>
|
||||
<td>{{$label}}</td>
|
||||
<td>{{$type}}</td>
|
||||
<td class="actions">
|
||||
{{if ! $locked_outputs|has:$label}}
|
||||
{{:linkbutton label="Supprimer" shape="minus" href="config/supprimer_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p class="submit">
|
||||
{{:button
|
||||
type="submit"
|
||||
name="save"
|
||||
label="Enregistrer"
|
||||
shape="right"
|
||||
class="main"
|
||||
}}
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<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;
|
||||
let menu = nelle.querySelector('select')
|
||||
if (menu != null) {
|
||||
menu[0].selected = 'selected';
|
||||
}
|
||||
ligne.parentNode.appendChild(nelle);
|
||||
text.focus();
|
||||
}
|
||||
</script>
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue