From f2628bb45a14da42d014e42b1521820ffeedfb33 Mon Sep 17 00:00:00 2001 From: N3WT DE COMPET Date: Fri, 7 Feb 2025 17:55:53 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Ajout=20du=20%=20ou=20=E2=82=AC=20en=20m?= =?UTF-8?q?ode=20=C3=A9dition=20de=20r=C3=A9duction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tarification/DiscountsSection.js | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Front-End/src/components/Structure/Tarification/DiscountsSection.js b/Front-End/src/components/Structure/Tarification/DiscountsSection.js index 9d8f04d..177ab05 100644 --- a/Front-End/src/components/Structure/Tarification/DiscountsSection.js +++ b/Front-End/src/components/Structure/Tarification/DiscountsSection.js @@ -86,6 +86,20 @@ const DiscountsSection = ({ discounts, setDiscounts, handleCreate, handleEdit, h }); }; + const handleToggleDiscountTypeEdition = (id) => { + if (editingDiscount) { + setFormData((prevData) => ({ + ...prevData, + discount_type: prevData.discount_type === 0 ? 1 : 0, + })); + } else if (newDiscount) { + setNewDiscount((prevData) => ({ + ...prevData, + discount_type: prevData.discount_type === 0 ? 1 : 0, + })); + } + }; + const handleChange = (e) => { const { name, value } = e.target; if (editingDiscount) { @@ -124,7 +138,19 @@ const DiscountsSection = ({ discounts, setDiscounts, handleCreate, handleEdit, h case 'LIBELLE': return renderInputField('name', currentData.name, handleChange, 'Libellé de la réduction'); case 'REMISE': - return renderInputField('amount', currentData.amount, handleChange,'Montant'); + return ( +
+ {renderInputField('amount', currentData.amount, handleChange,'Montant')} + + +
+ ); case 'DESCRIPTION': return renderInputField('description', currentData.description, handleChange, 'Description'); case 'ACTIONS':