Informasi Umum
-
+ {selectedFlock}
{
+ return flock.label === selectedFlock;
+ })?.value,
+ } as OptionType)
+ : undefined
+ }
onChange={(val) => {
optionChangeHandler(val, 'flock');
- setSelectedFlock((val as OptionType)?.value as number);
+ setSelectedFlock((val as OptionType)?.label as string);
formik.setFieldValue(
'flock_name',
(val as OptionType)?.label
@@ -816,7 +824,7 @@ const ProjectFlockForm = ({
}}
/>
- {
- confirmationModalClickHandler({
- action: approvalAction,
- });
+ onClick: (notes) => {
+ confirmApprovalHandler(notes, approvalAction);
},
}}
/>
diff --git a/src/services/api/production/chickin.ts b/src/services/api/production/chickin.ts
index 39eb2501..31221ed1 100644
--- a/src/services/api/production/chickin.ts
+++ b/src/services/api/production/chickin.ts
@@ -21,7 +21,8 @@ export class ChickinService extends BaseApiService<
*/
async singleApproval(
id: number,
- action: 'APPROVED' | 'REJECTED'
+ action: 'APPROVED' | 'REJECTED',
+ notes?: string
): Promise | 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) {
diff --git a/src/services/api/production/project-flock.ts b/src/services/api/production/project-flock.ts
index 03d29a56..e8b23602 100644
--- a/src/services/api/production/project-flock.ts
+++ b/src/services/api/production/project-flock.ts
@@ -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 | 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 | 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 | 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 | 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 | 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) {