From 654fbb128ab331c3272d6e8733dda1b5b71f4253 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 25 Nov 2024 10:05:02 +0700 Subject: update pengajuan tempo --- src/lib/pengajuan-tempo/component/Referensi.jsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/lib/pengajuan-tempo/component/Referensi.jsx') diff --git a/src/lib/pengajuan-tempo/component/Referensi.jsx b/src/lib/pengajuan-tempo/component/Referensi.jsx index 5ec64611..17ac6cb0 100644 --- a/src/lib/pengajuan-tempo/component/Referensi.jsx +++ b/src/lib/pengajuan-tempo/component/Referensi.jsx @@ -79,6 +79,13 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { updateHasSave(false); }; + const handleDeleteSupplier = (index) => { + const updatedData = supplierData.filter((_, i) => i !== index); + setSupplierData(updatedData); + updateFormSupplier(updatedData); // Update store atau state terkait + updateHasSave(false); // Indikasi bahwa data telah berubah + }; + const handleAddNewSupplier = () => { if (Object.values(newSupplier).every((val) => val.trim() !== '')) { setSupplierData((prevData) => { @@ -232,7 +239,7 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { placeholder='Type Durasi Tempo' /> - + { onChange={(e) => onChangeInput(e, index)} placeholder='Type Credit Limit' /> + handleDeleteSupplier(index)} + /> ))} @@ -285,7 +296,7 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { placeholder='Durasi jatuh tempo' /> - + { onChange={handleNewSupplierChange} placeholder='limit kredit' /> + handleDeleteSupplier(index)} + /> -- cgit v1.2.3