diff options
Diffstat (limited to 'src/lib/pengajuan-tempo/component/Referensi.jsx')
| -rw-r--r-- | src/lib/pengajuan-tempo/component/Referensi.jsx | 19 |
1 files changed, 17 insertions, 2 deletions
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' /> </td> - <td> + <td className='flex flex-row gap-2'> <input name='creditLimit' type='text' @@ -241,6 +248,10 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { onChange={(e) => onChangeInput(e, index)} placeholder='Type Credit Limit' /> + <Trash2Icon + size={18} + onClick={() => handleDeleteSupplier(index)} + /> </td> </tr> ))} @@ -285,7 +296,7 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { placeholder='Durasi jatuh tempo' /> </td> - <td> + <td className='flex flex-row items-center gap-2 '> <input name='creditLimit' value={formatRupiah(newSupplier.creditLimit)} @@ -294,6 +305,10 @@ const Referensi = ({ chekValid, buttonSubmitClick }) => { onChange={handleNewSupplierChange} placeholder='limit kredit' /> + <Trash2Icon + size={18} + onClick={() => handleDeleteSupplier(index)} + /> </td> </tr> </tbody> |
