feat: implement bulk approval in expense

This commit is contained in:
ValdiANS
2026-04-22 01:14:16 +07:00
parent b77a8ef56f
commit 727ac8ccdb
2 changed files with 289 additions and 101 deletions
+35
View File
@@ -330,6 +330,41 @@ export class ExpenseApiService extends BaseApiService<
}
}
async bulkApprovals(
ids: number[],
status:
| 'HEAD_AREA'
| 'UNIT_VICE_PRESIDENT'
| 'FINANCE'
| 'REALISASI'
| 'SELESAI',
date: string, // YYYY-MM-DD
notes: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const bulkApproveRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/bulk`,
{
method: 'POST',
body: {
approvable_ids: ids,
status: status,
date: date,
notes: notes,
},
}
);
return bulkApproveRes;
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async rejectHeadArea(
id: number,
notes?: string