feat: employee gender filter

This commit is contained in:
puriphatt 2024-06-13 11:07:04 +00:00
parent 27e85cee3b
commit 24a491288a
2 changed files with 66 additions and 9 deletions

View file

@ -22,6 +22,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
page?: number;
pageSize?: number;
query?: string;
gender?: string;
},
flow?: {
sessionId: string;
@ -36,6 +37,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
}
if (opts?.page && opts.page > 0) params.append('page', `${opts.page}`);
if (opts?.query) params.append('query', opts.query);
if (opts?.gender) params.append('gender', opts.gender);
const query = params.toString();
@ -227,6 +229,29 @@ const useEmployeeStore = defineStore('api-employee', () => {
}
}
async function getStatsEmployeeGender(
customerBranchId?: string,
flow?: {
sessionId: string;
refTransactionId: string;
transactionId: string;
},
) {
const res = await api.get(
`/employee/stats/gender${customerBranchId ? '?customerBranchId=' + customerBranchId : ''}/`,
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Tid': flow?.transactionId,
},
},
);
if (res && res.status === 200) {
return res.data;
}
}
return {
data,
globalOption,
@ -240,6 +265,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
fetchWork,
fetchOther,
getStatsEmployee,
getStatsEmployeeGender,
};
});