Merge pull request 'Add Expense Type Master: API Integration, Table Display, and Hook Support : Get List' (#267) from Feature-#781-GetExpenseType into Feature_Expense

Reviewed-on: #267
Merged
This commit is contained in:
pramod.mahajan 2025-07-19 17:49:50 +00:00
commit 295e63ec7f
4 changed files with 155 additions and 354 deletions

View File

@ -1,153 +1,155 @@
// 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" },
];
// -------------------
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,
// }
// ]

View File

@ -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,8 @@ 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 "Status":
return [
{

View File

@ -16,6 +16,8 @@ const MasterTable = ({ data, columns, loading, handleModalData }) => {
"tenantId",
"checkLists",
"isSystem",
"isActive",
"noOfPersonsRequired"
];
const safeData = Array.isArray(data) ? data : [];

View File

@ -56,6 +56,8 @@ 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')
}