Compare commits
No commits in common. "295e63ec7f6d38bf11fb4189897eacf6e709fb5f" and "c58d4d684bc8ad03fa01e1d665aaf5fbee0004e0" have entirely different histories.
295e63ec7f
...
c58d4d684b
@ -1,155 +1,153 @@
|
|||||||
// it important ------
|
// it important ------
|
||||||
export const mastersList = [
|
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: 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" },
|
|
||||||
];
|
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
// export const dailyTask = [
|
export const dailyTask = [
|
||||||
// {
|
{
|
||||||
// id:1,
|
id:1,
|
||||||
// project:{
|
project:{
|
||||||
// projectName:"Project Name1",
|
projectName:"Project Name1",
|
||||||
// building:"buildName1",
|
building:"buildName1",
|
||||||
// floor:"floorName1",
|
floor:"floorName1",
|
||||||
// workArea:"workarea1"
|
workArea:"workarea1"
|
||||||
// },
|
},
|
||||||
// target:80,
|
target:80,
|
||||||
// employees:[
|
employees:[
|
||||||
// {
|
{
|
||||||
// id:1,
|
id:1,
|
||||||
// name:"Vishal Patil",
|
name:"Vishal Patil",
|
||||||
// role:"helper"
|
role:"helper"
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// id:202,
|
id:202,
|
||||||
// name:"Vishal Patil",
|
name:"Vishal Patil",
|
||||||
// role:"helper"
|
role:"helper"
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// id:101,
|
id:101,
|
||||||
// name:"Kushal Patil",
|
name:"Kushal Patil",
|
||||||
// role:"Engineer"
|
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,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 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,6 +12,213 @@ 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 = () =>
|
export const useActivitiesMaster = () =>
|
||||||
{
|
{
|
||||||
@ -109,8 +316,6 @@ const fetchMasterData = async (masterType) => {
|
|||||||
return (await MasterRespository.getContactCategory()).data;
|
return (await MasterRespository.getContactCategory()).data;
|
||||||
case "Contact Tag":
|
case "Contact Tag":
|
||||||
return (await MasterRespository.getContactTag()).data;
|
return (await MasterRespository.getContactTag()).data;
|
||||||
case "Expense Type":
|
|
||||||
return (await MasterRespository.getExpenseType()).data;
|
|
||||||
case "Status":
|
case "Status":
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,8 +16,6 @@ const MasterTable = ({ data, columns, loading, handleModalData }) => {
|
|||||||
"tenantId",
|
"tenantId",
|
||||||
"checkLists",
|
"checkLists",
|
||||||
"isSystem",
|
"isSystem",
|
||||||
"isActive",
|
|
||||||
"noOfPersonsRequired"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const safeData = Array.isArray(data) ? data : [];
|
const safeData = Array.isArray(data) ? data : [];
|
||||||
|
|||||||
@ -56,8 +56,6 @@ export const MasterRespository = {
|
|||||||
createContactTag: (data ) => api.post( `/api/master/contact-tag`, data ),
|
createContactTag: (data ) => api.post( `/api/master/contact-tag`, data ),
|
||||||
updateContactTag: ( id, data ) => api.post( `/api/master/contact-tag/edit/${ id }`, 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')
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user