fix(FE): adding capacity to kandang and change confirmation modal marketing with note

This commit is contained in:
randy-ar
2025-11-19 13:00:21 +07:00
parent 8662bcb63b
commit 429f2b9109
7 changed files with 97 additions and 40 deletions
+29 -4
View File
@@ -69,7 +69,8 @@ export class SalesOrderService 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`;
@@ -78,7 +79,7 @@ export class SalesOrderService extends BaseApiService<
body: {
action: action,
approvable_ids: [id],
notes: `${action} marketing ${id}`,
notes: notes || `${action} marketing ${id}`,
},
});
} catch (error) {
@@ -92,7 +93,8 @@ export class SalesOrderService extends BaseApiService<
*/
async bulkApprovals(
ids: number[],
action: 'APPROVED' | 'REJECTED'
action: 'APPROVED' | 'REJECTED',
notes?: string
): Promise<BaseApiResponse<{ message: string }> | undefined> {
try {
const path = `${this.basePath}/approvals`;
@@ -101,7 +103,7 @@ export class SalesOrderService extends BaseApiService<
body: {
action: action,
approvable_ids: ids,
notes: `${action} marketing ${ids.join(', ')}`,
notes: notes || `${action} marketing ${ids.join(', ')}`,
},
});
} catch (error) {
@@ -109,6 +111,29 @@ export class SalesOrderService extends BaseApiService<
return undefined;
}
}
/**
* Delivery
*/
async delivery(
id: number,
notes?: string
): Promise<BaseApiResponse<{ message: string }> | undefined> {
try {
const path = `${this.basePath}/deliveries`;
return await httpClient<BaseApiResponse<{ message: string }>>(path, {
method: 'POST',
body: {
action: 'APPROVED',
approvable_ids: [id],
notes: notes || `Delivery marketing ${id}`,
},
});
} catch (error) {
console.error('Error delivery marketing:', error);
return undefined;
}
}
}
export const SalesOrderApi = new SalesOrderService('/marketing/sales-orders');