mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Add Unit VP approval and rename Manager
This commit is contained in:
+116
-8
@@ -169,13 +169,13 @@ export class ExpenseApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async approveManager(
|
||||
async approveHeadArea(
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const approveRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/manager`,
|
||||
`${this.basePath}/approvals/head-area`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
@@ -196,13 +196,67 @@ export class ExpenseApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async bulkApproveManager(
|
||||
async bulkApproveHeadArea(
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const bulkApproveRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/manager`,
|
||||
`${this.basePath}/approvals/head-area`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'APPROVED',
|
||||
approvable_ids: ids,
|
||||
notes: notes,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return bulkApproveRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async approveUnitVicePresident(
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const approveRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/unit-vice-president`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'APPROVED',
|
||||
approvable_ids: [id],
|
||||
notes: notes,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return approveRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async bulkApproveUnitVicePresident(
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const bulkApproveRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/unit-vice-president`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
@@ -277,13 +331,13 @@ export class ExpenseApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async rejectManager(
|
||||
async rejectHeadArea(
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const rejectRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/manager`,
|
||||
`${this.basePath}/approvals/head-area`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
@@ -304,13 +358,67 @@ export class ExpenseApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async bulkRejectManager(
|
||||
async bulkRejectHeadArea(
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const bulkRejectRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/manager`,
|
||||
`${this.basePath}/approvals/head-area`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'REJECTED',
|
||||
approvable_ids: ids,
|
||||
notes: notes,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return bulkRejectRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async rejectUnitVicePresident(
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const rejectRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/unit-vice-president`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
action: 'REJECTED',
|
||||
approvable_ids: [id],
|
||||
notes: notes,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return rejectRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async bulkRejectUnitVicePresident(
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<Expense> | undefined> {
|
||||
try {
|
||||
const bulkRejectRes = await httpClient<BaseApiResponse<Expense>>(
|
||||
`${this.basePath}/approvals/unit-vice-president`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: {
|
||||
|
||||
Reference in New Issue
Block a user