diff --git a/src/Components/CustomAlertDialog.jsx b/src/Components/CustomAlertDialog.jsx index 1c1dddb..a54e383 100644 --- a/src/Components/CustomAlertDialog.jsx +++ b/src/Components/CustomAlertDialog.jsx @@ -33,7 +33,7 @@ const CustomAlertDialog = ({ isOpen, onOpen, onClose, alertHandler, isLoading, m onClick={alertHandler} size={"sm"} rounded={'sm'} - colorScheme="green" + colorScheme="forestGreen" ml={3} > Yes diff --git a/src/Components/FormInputMain.jsx b/src/Components/FormInputMain.jsx index 4fab24e..5d54e79 100644 --- a/src/Components/FormInputMain.jsx +++ b/src/Components/FormInputMain.jsx @@ -15,7 +15,8 @@ const FormInputMain = ({ submitTitle, p, w, - btnLoading + btnLoading, + btnhidden, }) => { return ( @@ -25,67 +26,67 @@ const FormInputMain = ({ {/* */} {section} - - {fields.map( - ( - { - label, - name, - id, - arabic, - type, - isRequired, - selectedImageData, - setSelectedImageData, - imageData, - handleImageChange, - removeImage, - placeHolder, - options, - helperText, - multiple, - width, - }, - key - ) => ( - - ) - )} - + + {fields.map( + ( + { + label, + name, + id, + arabic, + type, + isRequired, + selectedImageData, + setSelectedImageData, + imageData, + handleImageChange, + removeImage, + placeHolder, + options, + helperText, + multiple, + width, + }, + key + ) => ( + + ) + )} + {index < Object.entries(groupedFields).length - 1 && } ))} {children} - + {onCancle && ( + {btnhidden ? ( + "" + ) : ( + + )} diff --git a/src/Constants/Constants.js b/src/Constants/Constants.js index 16ac5bf..931a3a2 100644 --- a/src/Constants/Constants.js +++ b/src/Constants/Constants.js @@ -1,4 +1,12 @@ export const getFileNameFromPath = (filePath) => { - const parts = filePath.split('/'); - return parts[parts.length - 1]; - }; \ No newline at end of file + const parts = filePath.split("/"); + return parts[parts.length - 1]; +}; + +export function debounce(func, delay) { + let debounceTimer; + return function (...args) { + clearTimeout(debounceTimer); + debounceTimer = setTimeout(() => func.apply(this, args), delay); + }; +} diff --git a/src/Pages/IO_Management/KeyMeritsAdd.jsx b/src/Pages/IO_Management/KeyMeritsAdd.jsx index 32d0460..3e22b91 100644 --- a/src/Pages/IO_Management/KeyMeritsAdd.jsx +++ b/src/Pages/IO_Management/KeyMeritsAdd.jsx @@ -102,7 +102,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id }) => { @@ -180,7 +180,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id }) => { - + + + - + - + + + - + - - - ), - })) + + + + + ), + })); - console.log(extractedArray); + // ==================== [Delete Function] ======================= - const handleDelete = () => { - const IOtype = investmentType.filter( - (investmentType) => investmentType.id !== actionId - ); - - setTimeout(() => { - setInvestmentType(IOtype); - setDeleteAlert(false); - setIsLoading(false); - }, 100); + const handleDelete = async () => { + console.log(actionId); setIsLoading(true); + try { + const response = await deleteInvestmentType(actionId); + console.log(response); + setIsLoading(false); + setDeleteAlert(false); + } catch (error) {} }; return ( @@ -245,6 +210,9 @@ const InvestmentType = () => { pt={4} spacing="24px" > + + {/* ======================= [Search Input] ======================== */} + { /> + + {/* ==================== [Pagination] ===================== */} + + {/* ===================== [Add Button] ===================== */} +