Histo prêts : ajout bouton détails + navigation + mutualisation js

This commit is contained in:
Jean-Christophe Engel 2025-10-29 14:20:58 +01:00
parent 65ee10453c
commit 572dfc172a
8 changed files with 86 additions and 34 deletions

View file

@ -205,7 +205,12 @@
transactions=$transactions
return_date=$return_date|parse_date
}}
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
{{if $_GET.from == "lh"}}
{{:assign from="../loan_history.html"}}
{{else}}
{{:assign from="../equipment_history.html"}}
{{/if}}
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}}
{{/form}}
{{if $mvt_new.direction == "input"}}
@ -292,6 +297,7 @@
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
<div id="div_return_date" style="visibility:{{$visibility}}">
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
</div>
{{/if}}
</dl>
@ -311,7 +317,13 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r
toggleVisibility(idcheck, fields);
}
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
{
setReturnDate(id_date, id_return_date, id_loan_duration);
}
(function () {
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
document.getElementById('f_date').onchange = changeReturnDate;
})();
</script>

View file

@ -21,6 +21,11 @@
{{:include file="../_get_config.html" keep="config"}}
{{#form on="delete"}}
{{if $_GET.from == "lh"}}
{{:assign from="../loan_history.html"}}
{{else}}
{{:assign from="../equipment_history.html"}}
{{/if}}
{{* vérifier s'il est possible de supprimer le mouvement *}}
{{if $mvt_suppr.direction == 'input'}}
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
@ -29,7 +34,7 @@
{{:assign link_key=$key}}
{{/load}}
{{if $link_key != null}}
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
{{/if}}
{{else}}
{{:assign dispo=0}}
@ -62,7 +67,7 @@
{{* problème ? *}}
{{if $dispo < 0 || $nonprop < 0}}
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
{{/if}}
{{/if}}
{{/load}}
@ -83,7 +88,7 @@
{{:assign link_key=$key}}
{{/load}}
{{if $link_key != null}}
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
{{/if}}
{{elseif $type_operation == 'retour'}}
{{#load type="link" where="$$.return = :key" :key=$_GET.key}}
@ -148,7 +153,7 @@
out=$curr_eqpmt.out
notowned=$curr_eqpmt.notowned
}}
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
{{else}}
{{* supprimer le matériel *}}
{{:delete key=$curr_eqpmt.key}}

View file

@ -222,7 +222,12 @@
transactions=$transactions
return_date=$return_date|parse_date
}}
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
{{if $_GET.from == "lh"}}
{{:assign from="../loan_history.html"}}
{{else}}
{{:assign from="../equipment_history.html"}}
{{/if}}
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}}
{{/form}}
{{if $mvt_new.direction == "input"}}
@ -231,8 +236,8 @@
{{:assign mvt_label="sortie"}}
{{/if}}
{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}}
{{:form_errors}}
{{:form_errors}}
{{*
-------------------- Préparer la saisie --------------------
*}}
@ -338,11 +343,9 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r
toggleVisibility(idcheck, fields);
}
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') {
const loan_duration = document.getElementById(id_loan_duration).value;
let nbsec = getDate(id_date) + loan_duration*24*60*60;
const date_retour = new Date(nbsec * 1000);
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
{
setReturnDate(id_date, id_return_date, id_loan_duration);
}
(function () {

View file

@ -42,18 +42,18 @@
<nav class="tabs">
{{:linkbutton
label="Modifier ce mouvement"
href="modify_movement.html?key=%s"|args:$_GET.key
href="modify_movement.html?key=%s&from=%s"|args:$_GET.key:$_GET.from
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer ce mouvement"
href="delete_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
href="delete_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
shape="delete"
target="_dialog"}}
{{if $type_mvt != "retour"}}
{{:linkbutton
label="Dupliquer ce mouvement"
href="copy_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
href="copy_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
shape="plus"
target="_dialog"}}
{{/if}}

View file

@ -230,11 +230,9 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r
toggleVisibility(idcheck, fields);
}
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') {
const loan_duration = document.getElementById(id_loan_duration).value;
let nbsec = getDate(id_date) + loan_duration*24*60*60;
const date_retour = new Date(nbsec * 1000);
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
{
setReturnDate(id_date, id_return_date, id_loan_duration);
}
(function () {