mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 06:15:47 +00:00
fix(FE-270): adjust flock_name in select input and fixing project flock approval
This commit is contained in:
@@ -21,7 +21,8 @@ export class ChickinService extends BaseApiService<
|
||||
*/
|
||||
async singleApproval(
|
||||
id: number,
|
||||
action: 'APPROVED' | 'REJECTED'
|
||||
action: 'APPROVED' | 'REJECTED',
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
try {
|
||||
const path = `${this.basePath}/approvals`;
|
||||
@@ -30,7 +31,7 @@ export class ChickinService extends BaseApiService<
|
||||
body: {
|
||||
action: action,
|
||||
approvable_ids: [id],
|
||||
notes: `${action} chickin ${id}`,
|
||||
notes: notes ?? `${action} chickin ${id}`,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -120,7 +120,7 @@ export class ProjectFlockService extends BaseApiService<
|
||||
| undefined
|
||||
> {
|
||||
try {
|
||||
const path = `${this.basePath}/kandangs/${locationId.toString()}/periods`;
|
||||
const path = `${this.basePath}/location/${locationId.toString()}/periods`;
|
||||
return await httpClient<
|
||||
SuccessApiResponse<
|
||||
{
|
||||
@@ -145,36 +145,40 @@ export class ProjectFlockService extends BaseApiService<
|
||||
* Approve single Project Flock
|
||||
*/
|
||||
async approve(
|
||||
id: number
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
return await this.bulkApprovalAction([id], 'APPROVED');
|
||||
return await this.bulkApprovalAction([id], 'APPROVED', notes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject single Project Flock
|
||||
*/
|
||||
async reject(
|
||||
id: number
|
||||
id: number,
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
return await this.bulkApprovalAction([id], 'REJECTED');
|
||||
return await this.bulkApprovalAction([id], 'REJECTED', notes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve Bulk Project Flock
|
||||
*/
|
||||
async bulkApprove(
|
||||
ids: number[]
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
return await this.bulkApprovalAction(ids, 'APPROVED');
|
||||
return await this.bulkApprovalAction(ids, 'APPROVED', notes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject Bulk Project Flock
|
||||
*/
|
||||
async bulkReject(
|
||||
ids: number[]
|
||||
ids: number[],
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
return await this.bulkApprovalAction(ids, 'REJECTED');
|
||||
return await this.bulkApprovalAction(ids, 'REJECTED', notes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,7 +186,8 @@ export class ProjectFlockService extends BaseApiService<
|
||||
*/
|
||||
async bulkApprovalAction(
|
||||
ids: number[],
|
||||
action: 'APPROVED' | 'REJECTED'
|
||||
action: 'APPROVED' | 'REJECTED',
|
||||
notes?: string
|
||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||
try {
|
||||
const path = `${this.basePath}/approvals`;
|
||||
@@ -191,7 +196,7 @@ export class ProjectFlockService extends BaseApiService<
|
||||
body: {
|
||||
action: action,
|
||||
approvable_ids: ids,
|
||||
notes: `Bulk ${action} Project Flock ${ids.join(', ')}`,
|
||||
notes: notes ?? `Bulk ${action} Project Flock ${ids.join(', ')}`,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user