fin réorganisation configuration
This commit is contained in:
parent
5c26cf3ad7
commit
64d57b8560
@ -26,7 +26,6 @@
|
||||
{{#foreach from=$module.config.output_nature item="elem"}}
|
||||
{{:assign var="config.output_nature.%s"|args:$elem.label value=$elem.type}}
|
||||
{{/foreach}}
|
||||
{{* :assign var=config.output_nature value=$module.config.output_nature *}}
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
|
@ -35,7 +35,7 @@
|
||||
{{/if}}
|
||||
<ul class="sub" >
|
||||
<li {{if $subcurrent == 'categories'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Catégories</a></li>
|
||||
<li {{if $subcurrent == 'typesES'}} class="current"{{/if}}><a href="{{$module.url}}config.html">Types ES</a></li>
|
||||
<li {{if $subcurrent == 'typesES'}} class="current"{{/if}}><a href="{{$module.url}}config.html">Types d'entrées/sorties</a></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
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}}
|
||||
|
@ -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>
|
||||
|
67
config/modifier_type_mouvement.html
Normal file
67
config/modifier_type_mouvement.html
Normal 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>
|
61
config/supprimer_type_mouvement.html
Normal file
61
config/supprimer_type_mouvement.html
Normal 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}}
|
Loading…
Reference in New Issue
Block a user