From 850b2e6998b3a620cf8142282ec9c00e38b97153 Mon Sep 17 00:00:00 2001 From: PramodMahajan14 Date: Sat, 29 Mar 2025 14:36:57 +0530 Subject: [PATCH] update enviroment variable --- src/components/Employee/ManageEmployee.jsx | 5 ++++- src/components/Employee/ManageRole.jsx | 8 ++------ src/components/master/CreateRole.jsx | 6 ++++-- src/components/master/EditRole.jsx | 6 ++++-- src/pages/master/MasterTable.jsx | 24 +++++++++++++++++----- vite.config.ts | 2 +- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/components/Employee/ManageEmployee.jsx b/src/components/Employee/ManageEmployee.jsx index 9d74463c..ddec36f1 100644 --- a/src/components/Employee/ManageEmployee.jsx +++ b/src/components/Employee/ManageEmployee.jsx @@ -23,7 +23,8 @@ const ManageEmployee = () => { error, loading: empLoading, } = useEmployeeProfile(employeeId); - dispatch(changeMaster("Job Role")); + dispatch( changeMaster( "Job Role" ) ); + const [disabledEmail,setDisabledEmail] = useState(false) const { data: job_role, loading } = useMaster(); const [isloading, setLoading] = useState(false); const navigation = useNavigate(); @@ -219,6 +220,7 @@ const ManageEmployee = () => { } : {} // Empty object resets the form ); + // if(currentEmployee && currentEmployee.email) setDisabledEmail(true) }, [currentEmployee, reset]); console.log(currentEmployee); @@ -312,6 +314,7 @@ const ManageEmployee = () => { placeholder="Email" aria-label="" aria-describedby="Email" + disabled={!!currentEmployee?.email} /> {errors.Email && (
{
-
+
{(loading || roleLoading) &&

Loading...

} {data && data.map((item) => ( @@ -155,11 +155,7 @@ const ManageRole = ({employeeId,onClosed}) => { Cancel
- - - - - +
diff --git a/src/components/master/CreateRole.jsx b/src/components/master/CreateRole.jsx index 71b7b730..c9e4f8b6 100644 --- a/src/components/master/CreateRole.jsx +++ b/src/components/master/CreateRole.jsx @@ -66,8 +66,10 @@ const onSubmit = (values) => { cacheData("Role", updatedData); showToast("Role Added successfully.", "success"); onClose() - }).catch((err)=>{ - showToast(err.message, "error"); + } ).catch( ( err ) => + { + + showToast(err?.response?.data?.message, "error"); setIsLoading(false) }) diff --git a/src/components/master/EditRole.jsx b/src/components/master/EditRole.jsx index f8903490..6750082b 100644 --- a/src/components/master/EditRole.jsx +++ b/src/components/master/EditRole.jsx @@ -110,10 +110,12 @@ const EditMaster=({master,onClose})=> { cacheData("Role", updatedData); } - showToast("Role Update successfully.", "success"); + showToast( "Role Update successfully.", "success" ); + setIsLoading(false) onClose() }).catch((Err)=>{ - showToast(Err.message, "error"); + showToast( Err.message, "error" ); + setIsLoading(false) }) }; diff --git a/src/pages/master/MasterTable.jsx b/src/pages/master/MasterTable.jsx index 5e730534..6d01935d 100644 --- a/src/pages/master/MasterTable.jsx +++ b/src/pages/master/MasterTable.jsx @@ -57,12 +57,26 @@ const MasterTable = ( {data, columns, loading, handleModalData} ) => currentItems.map((item, index) => ( - {updatedColumns.map((col) => ( + {updatedColumns.map( ( col ) => ( - {item[col.key] !== undefined && item[col.key] !== null - ? item[col.key] - : " --- "} - + {col.key === "description" ? ( + item[col.key] !== undefined && item[col.key] !== null ? ( + item[col.key].length > 80 ? ( + <> + {item[col.key].slice(0, 80)}... + + ) : ( + item[col.key] + ) + ) : ( + " --- " + ) + ) : ( + item[col.key] !== undefined && item[col.key] !== null ? item[col.key] : " --- " + )} + + + ))} {/* className={` ${hasUserPermission('660131a4-788c-4739-a082-cbbf7879cbf2') ? "":"d-none"}`}> */} diff --git a/vite.config.ts b/vite.config.ts index d66b0976..b5b23fd9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,7 +12,7 @@ export default defineConfig({ }, define: { 'process.env': { - VITE_BASE_URL: process.env.VITE_BASE_URL || 'http://localhost:8080', + VITE_BASE_URL: process.env.VITE_BASE_URL || 'http://localhost:5032', }, },