mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
feat(FE-212): refactor purchase requisitions services and update item schema for approval process
This commit is contained in:
@@ -8,18 +8,12 @@ import {
|
|||||||
import { BaseApiService } from '@/services/api/base';
|
import { BaseApiService } from '@/services/api/base';
|
||||||
import { BaseApiResponse } from '@/types/api/api-general';
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
|
|
||||||
export const PurchaseRequisitionsApi = new BaseApiService<
|
export class PurchaseRequisitionsService extends BaseApiService<
|
||||||
Purchase,
|
Purchase,
|
||||||
CreatePurchaseRequisitionsPayload,
|
CreatePurchaseRequisitionsPayload,
|
||||||
UpdatePurchaseRequisitionsPayload
|
UpdatePurchaseRequisitionsPayload
|
||||||
>('/purchases/requisitions');
|
|
||||||
|
|
||||||
export class StaffApprovalService extends BaseApiService<
|
|
||||||
Purchase,
|
|
||||||
CreateStaffApprovalRequisitionsPayload,
|
|
||||||
CreateAcceptApprovalRequisitionsPayload
|
|
||||||
> {
|
> {
|
||||||
constructor(basePath: string = '') {
|
constructor(basePath: string = '/purchases/requisitions') {
|
||||||
super(basePath);
|
super(basePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +46,18 @@ export class StaffApprovalService extends BaseApiService<
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PurchaseRequisitionsApi = new PurchaseRequisitionsService();
|
||||||
|
|
||||||
|
export class StaffApprovalService extends BaseApiService<
|
||||||
|
Purchase,
|
||||||
|
CreateStaffApprovalRequisitionsPayload,
|
||||||
|
CreateAcceptApprovalRequisitionsPayload
|
||||||
|
> {
|
||||||
|
constructor(basePath: string = '') {
|
||||||
|
super(basePath);
|
||||||
|
}
|
||||||
|
|
||||||
async createStaffApproval(
|
async createStaffApproval(
|
||||||
purchaseRequisitionId: number,
|
purchaseRequisitionId: number,
|
||||||
@@ -66,12 +72,23 @@ export class StaffApprovalService extends BaseApiService<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AcceptApprovalService extends BaseApiService<
|
||||||
|
Purchase,
|
||||||
|
CreateAcceptApprovalRequisitionsPayload,
|
||||||
|
CreateAcceptApprovalRequisitionsPayload
|
||||||
|
> {
|
||||||
|
constructor(basePath: string = '') {
|
||||||
|
super(basePath);
|
||||||
|
}
|
||||||
|
|
||||||
async acceptApproval(
|
async acceptApproval(
|
||||||
purchaseRequisitionId: number,
|
purchaseRequisitionId: number,
|
||||||
payload: CreateAcceptApprovalRequisitionsPayload
|
payload: CreateAcceptApprovalRequisitionsPayload
|
||||||
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
): Promise<BaseApiResponse<{ message: string }> | undefined> {
|
||||||
return await this.customRequest<BaseApiResponse<{ message: string }>>(
|
return await this.customRequest<BaseApiResponse<{ message: string }>>(
|
||||||
`${purchaseRequisitionId}/approvals/accept`,
|
`${purchaseRequisitionId}/approvals/receipts`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
payload,
|
payload,
|
||||||
@@ -83,3 +100,7 @@ export class StaffApprovalService extends BaseApiService<
|
|||||||
export const StaffApprovalApi = new StaffApprovalService(
|
export const StaffApprovalApi = new StaffApprovalService(
|
||||||
'/purchases/requisitions'
|
'/purchases/requisitions'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const AcceptApprovalApi = new AcceptApprovalService(
|
||||||
|
'/purchases/requisitions'
|
||||||
|
);
|
||||||
|
|||||||
Vendored
+9
-9
@@ -60,15 +60,15 @@ export type CreateAcceptApprovalRequisitionsPayload = {
|
|||||||
notes?: string;
|
notes?: string;
|
||||||
items: {
|
items: {
|
||||||
purchase_item_id: number;
|
purchase_item_id: number;
|
||||||
accepted_date: string;
|
received_date: string;
|
||||||
destination_warehouse_id: number;
|
warehouse_id: number;
|
||||||
delivery_document_number: string;
|
travel_number: string;
|
||||||
delivery_vehicle_plate: string;
|
travel_document_path: string;
|
||||||
document_index?: number;
|
vehicle_number: string;
|
||||||
received_quantity: number;
|
expedition_vendor_id: number;
|
||||||
expedition_id: number;
|
received_qty: number;
|
||||||
transport_cost: number;
|
transport_per_item: number;
|
||||||
transport_cost_per_item: number;
|
transport_total: number;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user