config : ajout état définitif d'une sortie
This commit is contained in:
parent
09e42d44ac
commit
08ce30c4cf
43
config.html
43
config.html
@ -15,10 +15,14 @@
|
|||||||
{{:assign var="input_fields." label=$field.label|trim owner=$field.owner|boolval}}
|
{{:assign var="input_fields." label=$field.label|trim owner=$field.owner|boolval}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{#foreach from=$_POST.output_fields|array_transpose item="field"}}
|
||||||
|
{{:assign var="output_fields." label=$field.label|trim final=$field.final|boolval}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{:save key="config"
|
{{:save key="config"
|
||||||
validate_schema="./config.schema.json"
|
validate_schema="./config.schema.json"
|
||||||
inputNature=$input_fields
|
inputNature=$input_fields
|
||||||
outputNature=$_POST.output_fields
|
outputNature=$output_fields
|
||||||
}}
|
}}
|
||||||
{{:redirect to="./config.html?ok=1"}}
|
{{:redirect to="./config.html?ok=1"}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
@ -31,10 +35,10 @@
|
|||||||
{{:assign var='types_entrees.Emprunt' value=0}}
|
{{:assign var='types_entrees.Emprunt' value=0}}
|
||||||
|
|
||||||
{{* types de sorties par défaut *}}
|
{{* types de sorties par défaut *}}
|
||||||
{{:assign var='types_sorties.' value='Vente'}}
|
{{:assign var='types_sorties.Vente' value=1}}
|
||||||
{{:assign var='types_sorties.' value='Don'}}
|
{{:assign var='types_sorties.Don' value=1}}
|
||||||
{{:assign var='types_sorties.' value='Location'}}
|
{{:assign var='types_sorties.Location' value=0}}
|
||||||
{{:assign var='types_sorties.' value='Prêt'}}
|
{{:assign var='types_sorties.Prêt' value=0}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -94,21 +98,36 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type de sortie</th>
|
<th>Type de sortie</th>
|
||||||
|
<th>Définitif ? <br/><span class="help" style="font-weight:normal">Cocher si la sortie est définitive</span></th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="output_body">
|
<tbody id="output_body">
|
||||||
{{#foreach from=$module.config.outputNature item="output_field"}}
|
{{#foreach from=$module.config.outputNature item="output_field"}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{:input type="text" name="output_fields[]" default=$output_field.label}}</td>
|
<td>{{:input type="text" name="output_fields[label][]" default=$output_field.label}}</td>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
{{:input type="hidden" name="output_fields[final][]" value=0}}
|
||||||
|
{{:input type="checkbox" name="output_fields[final][]" value=1 default=$output_field.final}}
|
||||||
|
Définitif ?
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
<td class="action">
|
<td class="action">
|
||||||
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#foreach from=$types_sorties item="value"}}
|
{{#foreach from=$types_sorties key="label" item="value"}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{:input type="text" name="output_fields[]" default=$value}}</td>
|
<td>{{:input type="text" name="output_fields[label][]" default=$label}}</td>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
{{:input type="hidden" name="output_fields[final][]" value=0}}
|
||||||
|
{{:input type="checkbox" name="output_fields[final][]" value=1 default=$value}}
|
||||||
|
Définitif ?
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
<td class="action">
|
<td class="action">
|
||||||
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
{{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
|
||||||
</td>
|
</td>
|
||||||
@ -131,7 +150,7 @@
|
|||||||
label="Enregistrer"
|
label="Enregistrer"
|
||||||
shape="right"
|
shape="right"
|
||||||
class="main"
|
class="main"
|
||||||
onclick="return desactiverCache('#input_body');"
|
onclick="return desactiverCache('#input_body', '#output_body');"
|
||||||
}}
|
}}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
@ -152,8 +171,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Désactiver les champs caché des checkbox cochés
|
// Désactiver les champs caché des checkbox cochés
|
||||||
function desactiverCache(id_body) {
|
function desactiverCache(...id_body) {
|
||||||
for (let ligne of document.querySelector(id_body).children) {
|
for (const id of id_body) {
|
||||||
|
for (let ligne of document.querySelector(id).children) {
|
||||||
let idCase = ligne.querySelector("input[type=checkbox]");
|
let idCase = ligne.querySelector("input[type=checkbox]");
|
||||||
let cache = ligne.querySelector("input[type=hidden]"); // le champ caché
|
let cache = ligne.querySelector("input[type=hidden]"); // le champ caché
|
||||||
if (idCase.checked) {
|
if (idCase.checked) {
|
||||||
@ -161,6 +181,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -19,9 +19,17 @@
|
|||||||
},
|
},
|
||||||
"outputNature": {
|
"outputNature": {
|
||||||
"description": "Nature des sorties",
|
"description": "Nature des sorties",
|
||||||
"type": "array",
|
"type": ["array", "null"],
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"label" : {
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
|
},
|
||||||
|
"final" : {
|
||||||
|
"type" : "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user