réorganisation (cf remarques Bohwaz)
This commit is contained in:
parent
6006bdd169
commit
0e669a7c21
23 changed files with 279 additions and 236 deletions
|
|
@ -16,10 +16,10 @@
|
|||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$_GET.direction:$key_mvt}}
|
||||
{{/load}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign input_init=$mvt_modif.inputNature}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign input_init=$mvt_modif.input_nature}}
|
||||
{{else}}
|
||||
{{:assign output_init=$mvt_modif.outputNature}}
|
||||
{{:assign output_init=$mvt_modif.output_nature}}
|
||||
{{/if}}
|
||||
{{:assign amount_init=$mvt_modif.amount}}
|
||||
{{:assign date_init=$mvt_modif.date|date_short}}
|
||||
|
|
@ -30,19 +30,19 @@
|
|||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.inputNature key="rang" item="elem"}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.inputNature}}
|
||||
{{#foreach from=$config.input_nature key="rang" item="elem"}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.input_nature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.outputNature key="rang" item="elem"}}
|
||||
{{#foreach from=$config.output_nature key="rang" item="elem"}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.outputNature}}
|
||||
{{if $elem.label == $mvt_modif.output_nature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
|
@ -59,10 +59,10 @@
|
|||
*}}
|
||||
{{#form on="change"}}
|
||||
{{* préparer le mouvement modifié *}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign var="mvt_modif.inputNature" from="types_entrees.%d"|args:$_POST.type_operation}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign var="mvt_modif.input_nature" from="input_types.%d"|args:$_POST.type_operation}}
|
||||
{{else}}
|
||||
{{:assign var="mvt_modif.outputNature" from="types_sorties.%d"|args:$_POST.type_operation}}
|
||||
{{:assign var="mvt_modif.output_nature" from="types_sorties.%d"|args:$_POST.type_operation}}
|
||||
{{/if}}
|
||||
{{:assign var="mvt_modif.amount" value=$_POST.amount}}
|
||||
{{:assign var="mvt_modif.equipment" value=$_POST.equipment}}
|
||||
|
|
@ -78,8 +78,8 @@
|
|||
id, key,
|
||||
json_extract(document, '$.type') as 'type',
|
||||
json_extract(document, '$.direction') as 'direction',
|
||||
json_extract(document, '$.inputNature') as 'inputNature',
|
||||
json_extract(document, '$.outputNature') as 'outputNature',
|
||||
json_extract(document, '$.input_nature') as 'input_nature',
|
||||
json_extract(document, '$.output_nature') as 'output_nature',
|
||||
json_extract(document, '$.amount') as 'amount',
|
||||
json_extract(document, '$.equipment') as 'equipment',
|
||||
json_extract(document, '$.date') as 'date',
|
||||
|
|
@ -130,12 +130,12 @@
|
|||
{{if $erreur}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
« {{$input_init}} de {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$mvt_modif.inputNature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.input_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
{{else}}
|
||||
« {{$output_init}} de {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$mvt_modif.outputNature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.output_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
{{/if}}
|
||||
</p>
|
||||
{{else}}
|
||||
|
|
@ -145,14 +145,14 @@
|
|||
validate_schema="./movement.schema.json"
|
||||
type="movement"
|
||||
direction=$direction
|
||||
inputNature=$mvt_modif.inputNature
|
||||
outputNature=$mvt_modif.outputNature
|
||||
input_nature=$mvt_modif.input_nature
|
||||
output_nature=$mvt_modif.output_nature
|
||||
amount=$mvt_modif.amount|intval
|
||||
equipment=$mvt_modif.equipment
|
||||
date=$mvt_modif.date
|
||||
comment=$mvt_modif.comment
|
||||
}}
|
||||
{{:redirect force="%s?ok=1&msg=Modification enregistrée"|args:$url}}
|
||||
{{:redirect force="%s?ok=1&msg=modification"|args:$url}}
|
||||
{{/if}}
|
||||
|
||||
{{/form}}
|
||||
|
|
@ -173,22 +173,27 @@
|
|||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
<legend>Modifier l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees default=$type_defaut}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types default=$type_defaut}}
|
||||
{{else}}
|
||||
<legend>Modifier la sortie « {{$output_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties default=$type_defaut}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_modif.date}}
|
||||
{{:input type="number" name="amount" label="Quantité" required=true default=$mvt_modif.amount}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$equipments default=$key_eqpmt_init}}
|
||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_modif.comment}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="change" label="Enregistrer" shape="right" class="main"}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue