mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 13:55:45 +00:00
refactor(FE-212): add updateStaffApproval method and enhance PurchaseStaffApprovalItem schema with optional purchase_item_id
This commit is contained in:
@@ -4,6 +4,7 @@ import { Purchase } from '@/types/api/purchase/purchase';
|
||||
type PurchaseRequestStaffApprovalFormSchemaType = {
|
||||
notes: string | null;
|
||||
items: {
|
||||
purchase_item_id?: number;
|
||||
product_id: number;
|
||||
warehouse_id: number;
|
||||
qty: number;
|
||||
@@ -45,6 +46,7 @@ type PurchaseRequestAcceptApprovalFormSchemaType = {
|
||||
};
|
||||
|
||||
export type PurchaseStaffApprovalItemSchema = {
|
||||
purchase_item_id?: number;
|
||||
product_id: number;
|
||||
warehouse_id: number;
|
||||
qty: number;
|
||||
@@ -83,6 +85,10 @@ export type PurchaseDeleteItemsSchema = {
|
||||
|
||||
const PurchaseStaffApprovalItemObjectSchema: Yup.ObjectSchema<PurchaseStaffApprovalItemSchema> =
|
||||
Yup.object({
|
||||
purchase_item_id: Yup.number()
|
||||
.optional()
|
||||
.min(1, 'Purchase item ID tidak valid!')
|
||||
.typeError('Purchase item ID harus berupa angka!'),
|
||||
product_id: Yup.number()
|
||||
.required('Produk wajib diisi!')
|
||||
.min(1, 'Produk wajib diisi!')
|
||||
@@ -281,6 +287,7 @@ export const PurchaseRequestStaffApprovalFormDefaultValues = (
|
||||
notes: purchase?.notes ?? null,
|
||||
items: purchase?.items
|
||||
? purchase.items.map((item) => ({
|
||||
purchase_item_id: item.id,
|
||||
product_id: item.product_id,
|
||||
warehouse_id: item.warehouse.id,
|
||||
qty: item.qty,
|
||||
|
||||
Reference in New Issue
Block a user