From 3c74a123accd9cf3ef9d5ee831ad69dc4d446bd1 Mon Sep 17 00:00:00 2001 From: riefive Date: Wed, 3 Sep 2025 15:39:06 +0700 Subject: [PATCH] feat (material): update validation of attribute stock --- app/components/app/material/list-cfg.ts | 6 +++--- app/components/flow/material/entry.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/app/material/list-cfg.ts b/app/components/app/material/list-cfg.ts index 71ca97f6..b6ed7f4e 100644 --- a/app/components/app/material/list-cfg.ts +++ b/app/components/app/material/list-cfg.ts @@ -12,11 +12,11 @@ type SmallDetailDto = any const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue')) -export const cols: Col[] = [{ width: 100 }, { width: 250 }, { width: 100 }, { width: 100 }, { width: 50 }] +export const cols: Col[] = [{ width: 100 }, { width: 250 }, { width: 100 }, { width: 100 }, { width: 100 }, { width: 50 }] -export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Item' }, { label: 'Satuan' }]] +export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Stok' }, { label: 'Item' }, { label: 'Satuan' }]] -export const keys = ['code', 'name', 'item_id', 'uom_code', 'action'] +export const keys = ['code', 'name', 'stock', 'item_id', 'uom_code', 'action'] export const delKeyNames: KeyLabel[] = [ { key: 'code', label: 'Kode' }, diff --git a/app/components/flow/material/entry.vue b/app/components/flow/material/entry.vue index b5c8c491..c68449e5 100644 --- a/app/components/flow/material/entry.vue +++ b/app/components/flow/material/entry.vue @@ -14,7 +14,7 @@ const schema = z.object({ code: z.string().min(1, 'Code must be at least 1 characters long'), name: z.string().min(1, 'Name must be at least 1 characters long'), type: z.string(), - stock: z.preprocess((val) => Number(val), z.number({ invalid_type_error: 'Stok harus berupa angka' })), + stock: z.preprocess((val) => Number(val), z.number({ invalid_type_error: 'Stock must be a number' }).min(1)), }) function onClick(type: string) {