Merge branch 'Feature_Expense' of https://git.marcoaiot.com/admin/marco.pms.web into Feature_DisplayList#779
This commit is contained in:
commit
71dabd5f3b
@ -1,5 +1,4 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import CreateRole from "./CreateRole";
|
||||
import DeleteMaster from "./DeleteMaster";
|
||||
import EditRole from "./EditRole";
|
||||
@ -19,66 +18,41 @@ import EditContactCategory from "./EditContactCategory";
|
||||
import EditContactTag from "./EditContactTag";
|
||||
import { useDeleteMasterItem } from "../../hooks/masterHook/useMaster";
|
||||
|
||||
|
||||
const MasterModal = ({ modaldata, closeModal }) => {
|
||||
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||
const { mutate: deleteMasterItem, isPending } = useDeleteMasterItem();
|
||||
|
||||
// const handleSelectedMasterDeleted = async () =>
|
||||
// {
|
||||
// debugger
|
||||
// const deleteFn = MasterRespository[modaldata.masterType];
|
||||
// if (!deleteFn) {
|
||||
// showToast(`No delete strategy defined for master type`,"error");
|
||||
// return false;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// const response = await deleteFn( modaldata?.item?.id );
|
||||
// const selected_cachedData = getCachedData( modaldata?.masterType );
|
||||
// const updated_master = selected_cachedData?.filter(item => item.id !== modaldata?.item.id);
|
||||
// cacheData( modaldata?.masterType, updated_master )
|
||||
|
||||
// showToast(`${modaldata?.masterType} is deleted successfully`, "success");
|
||||
// handleCloseDeleteModal()
|
||||
|
||||
// } catch ( error )
|
||||
// {
|
||||
// const message = error.response.data.message || error.message || "Error occured api during call"
|
||||
// showToast(message, "success");
|
||||
// }
|
||||
// }
|
||||
|
||||
const handleSelectedMasterDeleted = () => {
|
||||
if (!modaldata?.masterType || !modaldata?.item?.id) {
|
||||
const { masterType, item, validateFn } = modaldata || {};
|
||||
if (!masterType || !item?.id) {
|
||||
showToast("Missing master type or item", "error");
|
||||
return;
|
||||
}
|
||||
|
||||
deleteMasterItem(
|
||||
{
|
||||
masterType: modaldata.masterType,
|
||||
item: modaldata.item,
|
||||
validateFn: modaldata.validateFn, // optional
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
handleCloseDeleteModal();
|
||||
},
|
||||
}
|
||||
{ masterType, item, validateFn },
|
||||
{ onSuccess: handleCloseDeleteModal }
|
||||
);
|
||||
};
|
||||
|
||||
const handleCloseDeleteModal = () => {
|
||||
setIsDeleteModalOpen(false);
|
||||
closeModal();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (modaldata?.modalType === "delete") {
|
||||
setIsDeleteModalOpen(true);
|
||||
}
|
||||
}, [modaldata]);
|
||||
|
||||
const handleCloseDeleteModal = () => {
|
||||
setIsDeleteModalOpen(false);
|
||||
if (!modaldata?.modalType) {
|
||||
closeModal();
|
||||
};
|
||||
return null;
|
||||
}
|
||||
|
||||
if (modaldata?.modalType === "delete" && isDeleteModalOpen) {
|
||||
if (modaldata.modalType === "delete" && isDeleteModalOpen) {
|
||||
return (
|
||||
<div
|
||||
className="modal fade show"
|
||||
@ -90,86 +64,63 @@ const MasterModal = ({ modaldata, closeModal }) => {
|
||||
<ConfirmModal
|
||||
type="delete"
|
||||
header={`Delete ${modaldata.masterType}`}
|
||||
message={"Are you sure you want delete?"}
|
||||
message="Are you sure you want delete?"
|
||||
onSubmit={handleSelectedMasterDeleted}
|
||||
onClose={handleCloseDeleteModal}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const renderModalContent = () => {
|
||||
const { modalType, item, masterType } = modaldata;
|
||||
|
||||
const modalComponents = {
|
||||
"Application Role": <CreateRole masmodalType={masterType} onClose={closeModal} />,
|
||||
"Edit-Application Role": <EditRole master={modaldata} onClose={closeModal} />,
|
||||
"Job Role": <CreateJobRole onClose={closeModal} />,
|
||||
"Edit-Job Role": <EditJobRole data={item} onClose={closeModal} />,
|
||||
"Activity": <CreateActivity onClose={closeModal} />,
|
||||
"Edit-Activity": <EditActivity activityData={item} onClose={closeModal} />,
|
||||
"Work Category": <CreateWorkCategory onClose={closeModal} />,
|
||||
"Edit-Work Category": <EditWorkCategory data={item} onClose={closeModal} />,
|
||||
"Contact Category": <CreateCategory data={item} onClose={closeModal} />,
|
||||
"Edit-Contact Category": <EditContactCategory data={item} onClose={closeModal} />,
|
||||
"Contact Tag": <CreateContactTag data={item} onClose={closeModal} />,
|
||||
"Edit-Contact Tag": <EditContactTag data={item} onClose={closeModal} />,
|
||||
};
|
||||
|
||||
return modalComponents[modalType] || null;
|
||||
};
|
||||
|
||||
const isLargeModal = ["Application Role", "Edit-Application Role"].includes(
|
||||
modaldata.modalType
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal fade"
|
||||
className="modal fade show"
|
||||
id="master-modal"
|
||||
tabIndex="-1"
|
||||
aria-hidden="true"
|
||||
role="dialog"
|
||||
aria-hidden="true"
|
||||
aria-labelledby="modalToggleLabel"
|
||||
style={{ display: "block" }}
|
||||
>
|
||||
<div
|
||||
className={`modal-dialog mx-sm-auto mx-1 ${
|
||||
["Application Role", "Edit-Application Role"].includes(
|
||||
modaldata?.modalType
|
||||
)
|
||||
? "modal-lg"
|
||||
: "modal-md"
|
||||
} modal-simple`}
|
||||
>
|
||||
<div className={`modal-dialog mx-sm-auto mx-1 ${isLargeModal ? "modal-lg" : "modal-md"} modal-simple`}>
|
||||
<div className="modal-content">
|
||||
<div className="modal-body p-sm-4 p-0">
|
||||
<div className="d-flex justify-content-between">
|
||||
<h6>{`${modaldata?.modalType} `}</h6>
|
||||
<h6>{modaldata?.modalType}</h6>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
onClick={closeModal}
|
||||
></button>
|
||||
/>
|
||||
</div>
|
||||
|
||||
{modaldata.modalType === "Application Role" && (
|
||||
<CreateRole
|
||||
masmodalType={modaldata.masterType}
|
||||
onClose={closeModal}
|
||||
/>
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Application Role" && (
|
||||
<EditRole master={modaldata} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Job Role" && (
|
||||
<CreateJobRole onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Job Role" && (
|
||||
<EditJobRole data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Activity" && (
|
||||
<CreateActivity onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Activity" && (
|
||||
<EditActivity
|
||||
activityData={modaldata.item}
|
||||
onClose={closeModal}
|
||||
/>
|
||||
)}
|
||||
{modaldata.modalType === "Work Category" && (
|
||||
<CreateWorkCategory onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Work Category" && (
|
||||
<EditWorkCategory data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Contact Category" && (
|
||||
<CreateCategory data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Contact Category" && (
|
||||
<EditContactCategory data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Contact Tag" && (
|
||||
<CreateContactTag data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{modaldata.modalType === "Edit-Contact Tag" && (
|
||||
<EditContactTag data={modaldata.item} onClose={closeModal} />
|
||||
)}
|
||||
{renderModalContent()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,153 +1,157 @@
|
||||
// it important ------
|
||||
export const mastersList = [ {id: 1, name: "Application Role"}, {id: 2, name: "Job Role"}, {id: 3, name: "Activity"},{id: 4, name:"Work Category"},{id:5,name:"Contact Category"},{id:6,name:"Contact Tag"}]
|
||||
export const mastersList = [
|
||||
{ id: 1, name: "Application Role" },
|
||||
{ id: 2, name: "Job Role" },
|
||||
{ id: 3, name: "Activity" },
|
||||
{ id: 4, name: "Work Category" },
|
||||
{ id: 5, name: "Contact Category" },
|
||||
{ id: 6, name: "Contact Tag" },
|
||||
{ id: 7, name: "Expense Type" },
|
||||
{ id: 8, name: "Payment Mode" },
|
||||
{ id: 9, name: "Expense Status" },
|
||||
];
|
||||
// -------------------
|
||||
|
||||
export const dailyTask = [
|
||||
{
|
||||
id:1,
|
||||
project:{
|
||||
projectName:"Project Name1",
|
||||
building:"buildName1",
|
||||
floor:"floorName1",
|
||||
workArea:"workarea1"
|
||||
},
|
||||
target:80,
|
||||
employees:[
|
||||
{
|
||||
id:1,
|
||||
name:"Vishal Patil",
|
||||
role:"helper"
|
||||
},
|
||||
{
|
||||
id:202,
|
||||
name:"Vishal Patil",
|
||||
role:"helper"
|
||||
},
|
||||
{
|
||||
id:101,
|
||||
name:"Kushal Patil",
|
||||
role:"Engineer"
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
project:{
|
||||
projectName:"Project Name1",
|
||||
building:"buildName1",
|
||||
floor:"floorName1",
|
||||
workArea:"workarea1"
|
||||
},
|
||||
target:90,
|
||||
employees:[
|
||||
{
|
||||
id:1,
|
||||
name:"Vishal Patil",
|
||||
role:"welder"
|
||||
},
|
||||
{
|
||||
id:202,
|
||||
name:"Vishal Patil",
|
||||
role:"welder"
|
||||
},
|
||||
{
|
||||
id:101,
|
||||
name:"Kushal Patil",
|
||||
role:"Site Engineer"
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
export const jobRoles =[
|
||||
{
|
||||
id:1,
|
||||
name:"Project Manager"
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
name:"Software Developer"
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
name:"Estimation Engineer"
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
name:"Designer"
|
||||
},
|
||||
{
|
||||
id:5,
|
||||
name:"Site Engineer"
|
||||
}
|
||||
]
|
||||
|
||||
export const employee =[
|
||||
{
|
||||
id:1,
|
||||
FirtsName:"Pramod",
|
||||
LastName:"Mahajan",
|
||||
JobRoleId:2,
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
FirtsName:"Akahsy",
|
||||
LastName:"Patil",
|
||||
JobRoleId:1,
|
||||
},
|
||||
{
|
||||
id:3,
|
||||
FirtsName:"janvi",
|
||||
LastName:"Potdar",
|
||||
JobRoleId:3,
|
||||
},
|
||||
{
|
||||
id:4,
|
||||
FirtsName:"Aboli",
|
||||
LastName:"Patil",
|
||||
JobRoleId:2,
|
||||
},
|
||||
{
|
||||
id:5,
|
||||
FirtsName:"Shubham",
|
||||
LastName:"Tamboli",
|
||||
JobRoleId:1,
|
||||
},
|
||||
{
|
||||
id:6,
|
||||
FirtsName:"Alwin",
|
||||
LastName:"Joy",
|
||||
JobRoleId:4,
|
||||
},
|
||||
{
|
||||
id:7,
|
||||
FirtsName:"John",
|
||||
LastName:"kwel",
|
||||
JobRoleId:4,
|
||||
},
|
||||
{
|
||||
id:8,
|
||||
FirtsName:"Gita",
|
||||
LastName:"shaha",
|
||||
JobRoleId:1,
|
||||
},{
|
||||
id:9,
|
||||
FirtsName:"Pratik",
|
||||
LastName:"Joshi",
|
||||
JobRoleId:5,
|
||||
},
|
||||
{
|
||||
id:10,
|
||||
FirtsName:"Nikil",
|
||||
LastName:"Patil",
|
||||
JobRoleId:5,
|
||||
}
|
||||
]
|
||||
// export const dailyTask = [
|
||||
// {
|
||||
// id:1,
|
||||
// project:{
|
||||
// projectName:"Project Name1",
|
||||
// building:"buildName1",
|
||||
// floor:"floorName1",
|
||||
// workArea:"workarea1"
|
||||
// },
|
||||
// target:80,
|
||||
// employees:[
|
||||
// {
|
||||
// id:1,
|
||||
// name:"Vishal Patil",
|
||||
// role:"helper"
|
||||
// },
|
||||
// {
|
||||
// id:202,
|
||||
// name:"Vishal Patil",
|
||||
// role:"helper"
|
||||
// },
|
||||
// {
|
||||
// id:101,
|
||||
// name:"Kushal Patil",
|
||||
// role:"Engineer"
|
||||
// }
|
||||
// ]
|
||||
|
||||
// },
|
||||
// {
|
||||
// id:2,
|
||||
// project:{
|
||||
// projectName:"Project Name1",
|
||||
// building:"buildName1",
|
||||
// floor:"floorName1",
|
||||
// workArea:"workarea1"
|
||||
// },
|
||||
// target:90,
|
||||
// employees:[
|
||||
// {
|
||||
// id:1,
|
||||
// name:"Vishal Patil",
|
||||
// role:"welder"
|
||||
// },
|
||||
// {
|
||||
// id:202,
|
||||
// name:"Vishal Patil",
|
||||
// role:"welder"
|
||||
// },
|
||||
// {
|
||||
// id:101,
|
||||
// name:"Kushal Patil",
|
||||
// role:"Site Engineer"
|
||||
// }
|
||||
// ]
|
||||
|
||||
// }
|
||||
// ]
|
||||
|
||||
// export const jobRoles =[
|
||||
// {
|
||||
// id:1,
|
||||
// name:"Project Manager"
|
||||
// },
|
||||
// {
|
||||
// id:2,
|
||||
// name:"Software Developer"
|
||||
// },
|
||||
// {
|
||||
// id:3,
|
||||
// name:"Estimation Engineer"
|
||||
// },
|
||||
// {
|
||||
// id:4,
|
||||
// name:"Designer"
|
||||
// },
|
||||
// {
|
||||
// id:5,
|
||||
// name:"Site Engineer"
|
||||
// }
|
||||
// ]
|
||||
|
||||
// export const employee =[
|
||||
// {
|
||||
// id:1,
|
||||
// FirtsName:"Pramod",
|
||||
// LastName:"Mahajan",
|
||||
// JobRoleId:2,
|
||||
// },
|
||||
// {
|
||||
// id:2,
|
||||
// FirtsName:"Akahsy",
|
||||
// LastName:"Patil",
|
||||
// JobRoleId:1,
|
||||
// },
|
||||
// {
|
||||
// id:3,
|
||||
// FirtsName:"janvi",
|
||||
// LastName:"Potdar",
|
||||
// JobRoleId:3,
|
||||
// },
|
||||
// {
|
||||
// id:4,
|
||||
// FirtsName:"Aboli",
|
||||
// LastName:"Patil",
|
||||
// JobRoleId:2,
|
||||
// },
|
||||
// {
|
||||
// id:5,
|
||||
// FirtsName:"Shubham",
|
||||
// LastName:"Tamboli",
|
||||
// JobRoleId:1,
|
||||
// },
|
||||
// {
|
||||
// id:6,
|
||||
// FirtsName:"Alwin",
|
||||
// LastName:"Joy",
|
||||
// JobRoleId:4,
|
||||
// },
|
||||
// {
|
||||
// id:7,
|
||||
// FirtsName:"John",
|
||||
// LastName:"kwel",
|
||||
// JobRoleId:4,
|
||||
// },
|
||||
// {
|
||||
// id:8,
|
||||
// FirtsName:"Gita",
|
||||
// LastName:"shaha",
|
||||
// JobRoleId:1,
|
||||
// },{
|
||||
// id:9,
|
||||
// FirtsName:"Pratik",
|
||||
// LastName:"Joshi",
|
||||
// JobRoleId:5,
|
||||
// },
|
||||
// {
|
||||
// id:10,
|
||||
// FirtsName:"Nikil",
|
||||
// LastName:"Patil",
|
||||
// JobRoleId:5,
|
||||
// }
|
||||
// ]
|
||||
|
@ -12,213 +12,6 @@ import showToast from "../../services/toastService";
|
||||
|
||||
|
||||
|
||||
// const useMaster = () => {
|
||||
|
||||
// const selectedMaster = useSelector((store)=>store.localVariables.selectedMaster);
|
||||
// const [data, setData] = useState([]);
|
||||
// const [loading, setLoading] = useState(true);
|
||||
// const [error, setError] = useState("");
|
||||
// useEffect(() => {
|
||||
// const fetchData = async () => {
|
||||
// if (!selectedMaster) return;
|
||||
// setLoading(true);
|
||||
// try {
|
||||
// const cachedData = getCachedData(selectedMaster);
|
||||
// if (cachedData) {
|
||||
|
||||
// setData(cachedData);
|
||||
|
||||
// } else {
|
||||
// let response;
|
||||
// switch (selectedMaster) {
|
||||
// case "Application Role":
|
||||
// response = await MasterRespository.getRoles();
|
||||
// response = response.data;
|
||||
// break;
|
||||
// case "Job Role":
|
||||
// response = await MasterRespository.getJobRole();
|
||||
// response = response.data
|
||||
// break;
|
||||
// case "Activity":
|
||||
// response = await MasterRespository.getActivites();
|
||||
// response = response.data
|
||||
// break;
|
||||
// case "Work Category":
|
||||
// response = await MasterRespository.getWorkCategory();
|
||||
// response = response.data
|
||||
// break;
|
||||
// case "Contact Category":
|
||||
// response = await MasterRespository.getContactCategory();
|
||||
// response = response.data
|
||||
// break;
|
||||
// case "Contact Tag":
|
||||
// response = await MasterRespository.getContactTag();
|
||||
// response = response.data
|
||||
// break;
|
||||
// case "Status":
|
||||
// response = [{description: null,featurePermission: null,id: "02dd4761-363c-49ed-8851-3d2489a3e98d",status:"status 1"},{description: null,featurePermission: null,id: "03dy9761-363c-49ed-8851-3d2489a3e98d",status:"status 2"},{description: null,featurePermission: null,id: "03dy7761-263c-49ed-8851-3d2489a3e98d",status:"Status 3"}];
|
||||
// break;
|
||||
// default:
|
||||
// response = [];
|
||||
// }
|
||||
|
||||
// if (response) {
|
||||
// setData(response);
|
||||
// cacheData(selectedMaster, response);
|
||||
// }
|
||||
// }
|
||||
// } catch (err) {
|
||||
// setError("Failed to fetch data.");
|
||||
// } finally {
|
||||
// setLoading(false);
|
||||
// }
|
||||
// };
|
||||
|
||||
// if ( selectedMaster )
|
||||
// {
|
||||
|
||||
// fetchData();
|
||||
// }
|
||||
|
||||
// }, [selectedMaster]);
|
||||
|
||||
|
||||
|
||||
// return { data, loading, error }
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
// export const useActivitiesMaster = () =>
|
||||
// {
|
||||
// const [ activities, setActivites ] = useState( [] )
|
||||
// const [ loading, setloading ] = useState( false );
|
||||
// const [ error, setError ] = useState()
|
||||
// const fetchActivities =async () => {
|
||||
// setloading(true);
|
||||
// try {
|
||||
// const response = await MasterRespository.getActivites();
|
||||
// setActivites(response.data);
|
||||
// cacheData( "ActivityMaster", response.data );
|
||||
// setloading(false);
|
||||
// } catch (err) {
|
||||
// setError(err);
|
||||
// setloading(false);
|
||||
// }
|
||||
// }
|
||||
// useEffect( () =>
|
||||
// {
|
||||
// const cacheddata = getCachedData( "ActivityMaster" );
|
||||
// if ( !cacheddata )
|
||||
// {
|
||||
// fetchActivities()
|
||||
// } else
|
||||
// {
|
||||
// setActivites(cacheddata);
|
||||
// }
|
||||
// }, [] )
|
||||
|
||||
// return {activities,loading,error}
|
||||
// }
|
||||
|
||||
// export const useWorkCategoriesMaster = () =>
|
||||
// {
|
||||
// const [ categories, setCategories ] = useState( [] )
|
||||
// const [ categoryLoading, setloading ] = useState( false );
|
||||
// const [ categoryError, setError ] = useState( "" )
|
||||
|
||||
// const fetchCategories =async () => {
|
||||
// const cacheddata = getCachedData("Work Category");
|
||||
|
||||
// if (!cacheddata) {
|
||||
// setloading(true);
|
||||
// try {
|
||||
// const response = await MasterRespository.getWorkCategory();
|
||||
// setCategories(response.data);
|
||||
// cacheData("Work Category", response.data);
|
||||
// } catch (err) {
|
||||
// setError(err);
|
||||
// console.log(err);
|
||||
// } finally {
|
||||
// setloading(false);
|
||||
// }
|
||||
// } else {
|
||||
// setCategories(cacheddata);
|
||||
// }
|
||||
// }
|
||||
// useEffect( () =>
|
||||
// {
|
||||
// fetchCategories()
|
||||
// }, [] )
|
||||
|
||||
// return {categories,categoryLoading,categoryError}
|
||||
// }
|
||||
|
||||
// export const useContactCategory = () =>
|
||||
// {
|
||||
// const [ contactCategory, setContactCategory ] = useState( [] )
|
||||
// const [ loading, setLoading ] = useState( false )
|
||||
// const [ Error, setError ] = useState()
|
||||
|
||||
// const fetchConatctCategory = async() =>
|
||||
// {
|
||||
// const cache_Category = getCachedData( "Contact Category" );
|
||||
// if ( !cache_Category )
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// let resp = await MasterRespository.getContactCategory();
|
||||
// setContactCategory( resp.data );
|
||||
// cacheData("Contact Category",resp.data)
|
||||
// } catch ( error )
|
||||
// {
|
||||
// setError(error)
|
||||
// }
|
||||
// } else
|
||||
// {
|
||||
// setContactCategory(cache_Category)
|
||||
// }
|
||||
// }
|
||||
|
||||
// useEffect( () =>
|
||||
// {
|
||||
// fetchConatctCategory()
|
||||
// }, [] )
|
||||
// return { contactCategory,loading,Error}
|
||||
// }
|
||||
// export const useContactTags = () => {
|
||||
// const [contactTags, setContactTags] = useState([]);
|
||||
// const [loading, setLoading] = useState(false);
|
||||
// const [error, setError] = useState(null);
|
||||
|
||||
// useEffect(() => {
|
||||
// const fetchContactTag = async () => {
|
||||
// const cache_Tags = getCachedData("Contact Tag");
|
||||
|
||||
// if (!cache_Tags) {
|
||||
// setLoading(true);
|
||||
// try {
|
||||
// const resp = await MasterRespository.getContactTag();
|
||||
// setContactTags(resp.data);
|
||||
// cacheData("Contact Tag", resp.data);
|
||||
// } catch (err) {
|
||||
// setError(err);
|
||||
// } finally {
|
||||
// setLoading(false);
|
||||
// }
|
||||
// } else {
|
||||
// setContactTags(cache_Tags);
|
||||
// }
|
||||
// };
|
||||
|
||||
// fetchContactTag();
|
||||
// }, []);
|
||||
|
||||
// return { contactTags, loading, error };
|
||||
// };
|
||||
|
||||
// Separate matser-------------
|
||||
|
||||
export const useActivitiesMaster = () =>
|
||||
{
|
||||
@ -316,6 +109,12 @@ const fetchMasterData = async (masterType) => {
|
||||
return (await MasterRespository.getContactCategory()).data;
|
||||
case "Contact Tag":
|
||||
return (await MasterRespository.getContactTag()).data;
|
||||
case "Expense Type":
|
||||
return (await MasterRespository.getExpenseType()).data;
|
||||
case "Payment Mode":
|
||||
return (await MasterRespository.getPaymentMode()).data;
|
||||
case "Expense Status":
|
||||
return (await MasterRespository.getExpenseStatus()).data;
|
||||
case "Status":
|
||||
return [
|
||||
{
|
||||
|
@ -16,6 +16,8 @@ const MasterTable = ({ data, columns, loading, handleModalData }) => {
|
||||
"tenantId",
|
||||
"checkLists",
|
||||
"isSystem",
|
||||
"isActive",
|
||||
"noOfPersonsRequired"
|
||||
];
|
||||
|
||||
const safeData = Array.isArray(data) ? data : [];
|
||||
|
@ -56,6 +56,14 @@ export const MasterRespository = {
|
||||
createContactTag: (data ) => api.post( `/api/master/contact-tag`, data ),
|
||||
updateContactTag: ( id, data ) => api.post( `/api/master/contact-tag/edit/${ id }`, data ),
|
||||
|
||||
getAuditStatus:()=>api.get('/api/Master/work-status')
|
||||
getAuditStatus:()=>api.get('/api/Master/work-status'),
|
||||
|
||||
getExpenseType:()=>api.get('/api/Master/expenses-types'),
|
||||
|
||||
|
||||
getPaymentMode:()=>api.get('/api/Master/payment-modes'),
|
||||
|
||||
|
||||
getExpenseStatus:()=>api.get('/api/Master/expenses-status')
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user