Mutualisation onglets prêt et location
This commit is contained in:
parent
974f87e5a4
commit
546a9ea677
10 changed files with 176 additions and 421 deletions
|
|
@ -3,25 +3,66 @@
|
|||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher l'historique des prêts
|
||||
Afficher l'historique des prêts ou locations
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Historique des prêts" custom_css="./style.css" current="module_equipment"}}
|
||||
{{if $_GET.output_type == "loan"}}
|
||||
{{:assign label="prêt"}}
|
||||
{{elseif $_GET.output_type == "rent"}}
|
||||
{{:assign label="location"}}
|
||||
{{else}}
|
||||
{{:error message="Cette page n'existe pas !"}}
|
||||
{{/if}}
|
||||
|
||||
{{:include file="./_nav.html" current="prêts" subcurrent="historique"}}
|
||||
{{:admin_header title="Historique des %ss"|args:$label custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="historique"}}
|
||||
|
||||
{{*
|
||||
vérifier l'existence de la table du module
|
||||
eh oui, il se peut qu'elle ne soit pas encore créée si aucune donnée n'a été ajoutée dedans
|
||||
*}}
|
||||
{{#load limit="1"}}
|
||||
{{:assign table_presente=true}}
|
||||
{{else}}
|
||||
{{:assign table_presente=false}}
|
||||
{{/load}}
|
||||
|
||||
{{if $table_presente}}
|
||||
{{if $_GET.ok}}
|
||||
{{if $_GET.msg == "modification"}}
|
||||
<p class="block confirm">Modification enregistrée</p>
|
||||
{{elseif $_GET.msg == "copie"}}
|
||||
<p class="block confirm">Mouvement copié</p>
|
||||
{{elseif $_GET.msg == "suppression"}}
|
||||
<p class="block confirm">Mouvement supprimé</p>
|
||||
{{/if}}
|
||||
{{elseif $_GET.err}}
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.loan_cat_key}}
|
||||
{{:assign var="selected_category" from="module.config.%s_cat_key"|args:$_GET.output_type}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" loan_cat_key=null}}
|
||||
{{if $_GET.output_type == "loan"}}
|
||||
{{:save key="config" loan_cat_key=null}}
|
||||
{{elseif $_GET.output_type == "rent"}}
|
||||
{{:save key="config" rent_cat_key=null}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:save key="config" loan_cat_key=$selected_category}}
|
||||
{{if $_GET.output_type == "loan"}}
|
||||
{{:save key="config" loan_cat_key=$selected_category}}
|
||||
{{elseif $_GET.output_type == "rent"}}
|
||||
{{:save key="config" rent_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
|
|
@ -34,7 +75,12 @@
|
|||
|
||||
{{* déterminer les types de mouvements *}}
|
||||
{{#foreach from=$config.output_nature key="key"}}
|
||||
{{if $type == 'temporaire' && $fee != 'payant'}}
|
||||
{{if $type != 'temporaire'}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
{{if $_GET.output_type == "loan" && $fee != 'payant'}}
|
||||
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||
{{elseif $_GET.output_type == "rent" && $fee == 'payant'}}
|
||||
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
|
@ -42,13 +88,13 @@
|
|||
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||
|
||||
{{* sélecteur de catégorie *}}
|
||||
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?output_type=%s&cat_key=-1"|args:$_GET.output_type}}
|
||||
{{#load type="category" order="$$.name"}}
|
||||
{{:assign
|
||||
var="cat_options."
|
||||
value=$key
|
||||
label=$name
|
||||
href="?cat_key=%s"|args:$key
|
||||
href="?output_type=%s&cat_key=%s"|args:$_GET.output_type:$key
|
||||
}}
|
||||
{{/load}}
|
||||
|
||||
|
|
@ -62,7 +108,7 @@
|
|||
</fieldset>
|
||||
|
||||
<div class="shortFormLeft">
|
||||
<p class="help">Historique des prêts</p>
|
||||
<p class="help">Historique des {{$label}}s</p>
|
||||
</div>
|
||||
|
||||
{{* lister les mouvements *}}
|
||||
|
|
@ -88,12 +134,9 @@
|
|||
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||
LEFT JOIN users ON users.id = json_extract(mvt.document, '$.user')
|
||||
LEFT JOIN !table AS storage ON storage.key = json_extract(mvt.document, '$.storage')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND
|
||||
!cat_condition
|
||||
WHERE json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND json_extract(mvt.document, '$.operation') IN !op
|
||||
AND !cat_condition
|
||||
),
|
||||
entrees AS
|
||||
(SELECT
|
||||
|
|
@ -123,12 +166,11 @@
|
|||
)
|
||||
SELECT * FROM sorties UNION SELECT * FROM entrees
|
||||
)
|
||||
ORDER BY date
|
||||
ORDER BY date DESC, user
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $out_keys
|
||||
!cat_condition=$cat_condition
|
||||
assign="mvts."
|
||||
}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
{{:assign file_path="%s/%s/"|args:$module.storage_root:$key}}
|
||||
|
|
@ -150,7 +192,7 @@
|
|||
<td>Stockage</td>
|
||||
<td>Documents</td>
|
||||
<td>Écritures</td>
|
||||
<td>Remarques</td>
|
||||
<td>Remarque</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -170,9 +212,14 @@
|
|||
<td class="num">{{if $transactions != null}}{{:icon shape="money"}}{{/if}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
<td class="actions">
|
||||
{{if $_GET.output_type == "loan"}}
|
||||
{{:assign from="lm"}}
|
||||
{{elseif $_GET.output_type == "rent"}}
|
||||
{{:assign from="rm"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Détails"
|
||||
href="movements/movement_details.html?key=%s"|args:$key
|
||||
href="movements/movement_details.html?key=%s&prop=1&from=%s"|args:$key:$from
|
||||
shape="eye"
|
||||
}}
|
||||
</td>
|
||||
|
|
@ -181,5 +228,8 @@
|
|||
<p class="block alert">Aucun mouvement.</p>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun mouvement.</p>
|
||||
{{/if}}
|
||||
{{:admin_footer}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue