diff --git a/next.config.js b/next.config.js index 409876a..db2124f 100644 --- a/next.config.js +++ b/next.config.js @@ -2,6 +2,9 @@ const nextConfig = { reactStrictMode: true, + images: { + domains: ['loan.witel.ir', /* other domains */], + }, i18n: { defaultLocale: 'fa', locales: ['fa'], diff --git a/src/components/dashboard/refahi/edit-request-loan/forms/EditForm.jsx b/src/components/dashboard/refahi/edit-request-loan/forms/EditForm.jsx index 31cc170..501c47f 100644 --- a/src/components/dashboard/refahi/edit-request-loan/forms/EditForm.jsx +++ b/src/components/dashboard/refahi/edit-request-loan/forms/EditForm.jsx @@ -63,8 +63,9 @@ const EditFormComponent = () => { } setInitialValues(formattedData); setLoadingPage(false) - }).catch(() => { - }) + }) + .catch(() => { + }) }, [provinceList]); // validation and request action of form diff --git a/src/core/components/UploadSystem.jsx b/src/core/components/UploadSystem.jsx index 8c5e058..54dd49d 100644 --- a/src/core/components/UploadSystem.jsx +++ b/src/core/components/UploadSystem.jsx @@ -16,7 +16,6 @@ const UploadSystem = ({ }) => { const t = useTranslations(); const fileInputRef = useRef(null); - const [selectedImage, setSelectedImage] = useState(default_image || "/images/upload-image.svg"); const [fileType, setFileType] = useState(null); const [fileName, setFileName] = useState(""); @@ -39,16 +38,12 @@ const UploadSystem = ({ border: "1px dashed #d32f2f", borderRadius: "5px", padding: "5px", - width: '200px', - height: '200px' } : { cursor: "pointer", objectFit: "contain", border: "1px dashed #e1e1e1", borderRadius: "5px", padding: "5px", - width: '200px', - height: '200px' } const handleClick = () => { @@ -72,13 +67,16 @@ const UploadSystem = ({ > {label} - {selectedImage === "/images/upload-image.svg" ? ( + + + + {selectedImage === "/images/upload-image.svg" || selectedImage === default_image ? ( {imageAlt} @@ -87,8 +85,8 @@ const UploadSystem = ({ src={selectedImage} priority alt={imageAlt} - width={0} - height={0} + width={200} + height={200} onClick={handleClick} style={uploadBoxStyle} /> diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index 0eeedc7..a78ed6c 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -11,6 +11,7 @@ const sidebarMenu = [ icon: , userType: 0, selected: false, + permission_name: "all" }, { key: "sidebar.add-request-loan", @@ -19,6 +20,7 @@ const sidebarMenu = [ icon: , userType: 1, selected: false, + permission_name: "can_request_a_new_loan" }, { key: "sidebar.followUp-loan", @@ -27,6 +29,7 @@ const sidebarMenu = [ icon: , userType: 1, selected: false, + permission_name: "all" }, { key: "sidebar.add-request-loan", @@ -35,6 +38,7 @@ const sidebarMenu = [ icon: , userType: 2, selected: false, + permission_name: "can_request_a_new_loan" }, { key: "sidebar.followUp-loan", @@ -43,6 +47,7 @@ const sidebarMenu = [ icon: , userType: 2, selected: false, + permission_name: "all" }, ], ]; diff --git a/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx b/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx index f417286..6cd6847 100644 --- a/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx +++ b/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx @@ -41,20 +41,29 @@ export default function SidebarList({handleDrawerToggle}) { return ( {itemMenu.map((itemArr, index) => ( - - {itemArr.map((item) => - (item.userType === user.type_id || item.userType === 0) ? ( - - ) : null - )} - - - ))} + + {itemArr.map((item) => { + if ( + (item.userType === user.type_id || item.userType === 0) && + (user[item.permission_name] || item.permission_name === "all") + ) { + return ( + + ); + } else { + return null; + } + })} + + + ) + )} - ); + ) + ; }