feat (material): update validation of attribute stock

This commit is contained in:
riefive
2025-09-03 15:39:06 +07:00
parent 6afa968b7b
commit 3c74a123ac
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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' },
+1 -1
View File
@@ -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) {