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':