From cc90aa2457f9b7480c80b1a3bedd428867c6ab6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9?= Date: Mon, 20 Sep 2021 15:12:14 +0200 Subject: [PATCH] checkbox checked if qte > 0 --- app/views/admin/buy_lists/index.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/admin/buy_lists/index.html.haml b/app/views/admin/buy_lists/index.html.haml index 862b4f4..de9fbbb 100644 --- a/app/views/admin/buy_lists/index.html.haml +++ b/app/views/admin/buy_lists/index.html.haml @@ -202,9 +202,10 @@ %td.mask = qte_available %td.mask - =check_box_tag :"p_product_ref_ids[]", plr.p_product_ref.id + - default_qte = [bpa_qte - qte_available, 0].max + =check_box_tag :"p_product_ref_ids[]", plr.p_product_ref.id, (true if default_qte > 0 ) - =number_field_tag "qte[#{plr.p_product_ref.id}]", '', class: "small-input", value: ([bpa_qte - qte_available, 0].max), min: 0 + =number_field_tag "qte[#{plr.p_product_ref.id}]", '', class: "small-input", value: default_qte, min: 0 %td.mask = bpa_qte