fin réorganisation configuration

This commit is contained in:
Jean-Christophe Engel 2024-11-21 12:26:30 +01:00
parent 5c26cf3ad7
commit 64d57b8560
6 changed files with 189 additions and 141 deletions

View file

@ -50,12 +50,12 @@
{{:assign var="output_natures." from=output_nature}}
{{/if}}
{{:save
key="config"
validate_schema="../config.schema.json"
input_nature=$input_natures
output_nature=$output_natures
}}
{{:save
key="config"
validate_schema="../config.schema.json"
input_nature=$input_natures
output_nature=$output_natures
}}
{{:redirect to="./config.html?ok=1"}}
{{else}}
@ -70,11 +70,11 @@
<form method="post" action="">
<fieldset>
<legend>Types d'entrées</legend>
<legend>Type d'entrée</legend>
<dl>
<td>{{:input
type="text"
label="Nature de l'entrée"
label="Libellé de l'entrée"
name="input_fields[label]"
required=true}}</td>
<td>
@ -108,11 +108,11 @@
<form method="post" action="">
<fieldset>
<legend>Types de sorties</legend>
<legend>Type de sortie</legend>
<dl>
<td>{{:input
type="text"
label="Nature de la sortie"
label="Libellé de la sortie"
name="output_fields[label]"
required=true}}</td>
<td>

View file

@ -0,0 +1,67 @@
{{* -*- brindille -*- *}}
{{*
paramètres :
- dir : input ou output
- mvt : libellé du type de mouvement à modifier
*}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
{{/if}}
{{* lecture config (défaut ou enregistrée) *}}
{{:include file="../_get_config.html" keep="config"}}
{{:debug config.input_nature=$config.input_nature config.input_nature=$config.input_nature}}
{{:debug mvt=$_GET.mvt}}
{{#form on="save"}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{:debug key=$label item=$type}}
{{if $_GET.dir == 'input'
&& $label|trim|tolower == $_GET.mvt|trim|tolower}}
{{:assign var="input_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
{{else}
{{:assign var="input_nature.label" value=$label}}
{{/if}}
{{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}}
{{/foreach}}
{{#foreach from=$config.output_nature key="label" item="type"}}
{{if $_GET.dir == 'output' && $label|trim|tolower == $_GET.mvt|trim|tolower}}
{{:assign var="output_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
{{else}}
{{:assign var="output_nature.label" value=$label}}
{{/if}}
{{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}}
{{/foreach}}
{{:debug input_natures=$input_natures output_natures=$output_natures}}
{{*
{{:save
key="config"
validate_schema="../config.schema.json"
input_nature=$input_natures
output_nature=$output_natures
}}
{{:redirect to="./config.html?ok=1"}}
*}}
{{/form}}
{{:form_errors}}
<form method="post" action="">
<fieldset>
<legend>Modifier le libellé</legend>
<dl>
{{:input type="text" name="name" label="Libellé" default=$_GET.mvt required=true maxlength="100"}}
</dl>
<p class="submit">
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
</p>
</fieldset>
</form>

View file

@ -0,0 +1,61 @@
{{* -*- brindille -*- *}}
{{*
paramètres :
- dir : input ou output
- mvt : libellé du type de mouvement à supprimer
*}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
{{/if}}
{{* lecture config (défaut ou enregistrée) *}}
{{:include file="../_get_config.html" keep="config"}}
{{#form on="delete"}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{if $_GET.dir == 'input' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'output'}}
{{:assign var="input_nature.label" value=$label}}
{{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}}
{{/if}}
{{/foreach}}
{{#foreach from=$config.output_nature key="label" item="type"}}
{{if $_GET.dir == 'output' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'input'}}
{{:assign var="output_nature.label" value=$label}}
{{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}}
{{/if}}
{{/foreach}}
{{:save
key="config"
validate_schema="../config.schema.json"
input_nature=$input_natures
output_nature=$output_natures
}}
{{:redirect to="./config.html?ok=1"}}
{{/form}}
{{if $_GET.dir == 'input'}}
{{:delete_form
legend="Supprimer cette entrée ?"
warning="Supprimer l'entrée « %s » ?"|args:$_GET.mvt
}}
{{else}}
{{:delete_form
legend="Supprimer cette sortie ?"
warning="Supprimer la sortie « %s » ?"|args:$_GET.mvt
}}
{{/if}}
{{:form_errors}}
{{:admin_footer}}