fix(FE-270): adjust flock_name in select input and fixing project flock approval

This commit is contained in:
randy-ar
2025-11-21 00:31:25 +07:00
parent af939ee225
commit d523a01e34
8 changed files with 118 additions and 78 deletions
+3 -2
View File
@@ -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) {
+16 -11
View File
@@ -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) {