summaryrefslogtreecommitdiff
path: root/src/lib/pengajuan-tempo/component/Referensi.jsx
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-25 10:05:02 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-25 10:05:02 +0700
commit654fbb128ab331c3272d6e8733dda1b5b71f4253 (patch)
treea0feff6b3bd5e81c36923674800462652bbbf712 /src/lib/pengajuan-tempo/component/Referensi.jsx
parent35793c84f780e0de60a5e833343949e980d3a63f (diff)
<iman> update pengajuan tempo
Diffstat (limited to 'src/lib/pengajuan-tempo/component/Referensi.jsx')
-rw-r--r--src/lib/pengajuan-tempo/component/Referensi.jsx19
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>