-
-
-
-
-
-
-
-
-
-
- {{ props.errors.code }}
-
-
-
-
-
-
-
-
-
- {{ props.errors.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/app/components/app/material/list-cfg.ts b/app/components/app/material/list-cfg.ts
index 71ca97f6..a2a9f54c 100644
--- a/app/components/app/material/list-cfg.ts
+++ b/app/components/app/material/list-cfg.ts
@@ -3,7 +3,6 @@ import type {
KeyLabel,
RecComponent,
RecStrFuncComponent,
- RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
@@ -12,11 +11,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/content/material/entry.vue b/app/components/content/material/entry.vue
index a78ebb8e..50d68455 100644
--- a/app/components/content/material/entry.vue
+++ b/app/components/content/material/entry.vue
@@ -1,64 +1,34 @@
-
- Tambah Alat Kesehatan
-
-
-
-
+
+
Tambah Perlengkapan (BMHP)
+
diff --git a/app/components/content/material/list.vue b/app/components/content/material/list.vue
index 28fb6290..fa719f46 100644
--- a/app/components/content/material/list.vue
+++ b/app/components/content/material/list.vue
@@ -26,21 +26,21 @@ const recAction = ref
('')
const recItem = ref(null)
const headerPrep: HeaderPrep = {
- title: 'BMHP',
- icon: 'i-lucide-paint-bucket',
+ title: 'Perlengkapan (BMHP)',
+ icon: 'i-lucide-panel-bottom',
addNav: {
label: 'Tambah',
- onClick: () => navigateTo('/tools-equipment-src/material/add'),
+ onClick: () => navigateTo('/tools-equipment-src/equipment/add'),
},
}
async function getMaterialList() {
isLoading.dataListLoading = true
- const resp = await xfetch('/api/v1/material')
- if (resp.success) {
- data.value = (resp.body as Record).data
- }
+ // const resp = await xfetch('/api/v1/material')
+ // if (resp.success) {
+ // data.value = (resp.body as Record).data
+ // }
isLoading.dataListLoading = false
}
diff --git a/app/components/pub/ui/select/Select.vue b/app/components/pub/ui/select/Select.vue
index b18bba63..37720694 100644
--- a/app/components/pub/ui/select/Select.vue
+++ b/app/components/pub/ui/select/Select.vue
@@ -18,6 +18,7 @@ interface Item {
const props = defineProps<
SelectRootProps & {
items: Item[]
+ iconName?: string
placeholder?: string
label?: string
separator?: boolean
@@ -30,7 +31,7 @@ const forwarded = useForwardPropsEmits(props, emits)
-
+
diff --git a/app/components/pub/ui/select/SelectTrigger.vue b/app/components/pub/ui/select/SelectTrigger.vue
index 3cc71097..eb4c6b0f 100644
--- a/app/components/pub/ui/select/SelectTrigger.vue
+++ b/app/components/pub/ui/select/SelectTrigger.vue
@@ -5,15 +5,15 @@ import { SelectIcon, SelectTrigger, useForwardProps } from 'radix-vue'
import { computed } from 'vue'
import { cn } from '~/lib/utils'
-const props = defineProps()
+const props = defineProps()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
-
return delegated
})
const forwardedProps = useForwardProps(delegatedProps)
+const iconName = computed(() => props.iconName || 'i-radix-icons-caret-sort')
diff --git a/app/pages/(features)/tools-equipment-src/material/add.vue b/app/pages/(features)/tools-equipment-src/equipment/add.vue
similarity index 100%
rename from app/pages/(features)/tools-equipment-src/material/add.vue
rename to app/pages/(features)/tools-equipment-src/equipment/add.vue
diff --git a/app/pages/(features)/tools-equipment-src/material/index.vue b/app/pages/(features)/tools-equipment-src/equipment/index.vue
similarity index 100%
rename from app/pages/(features)/tools-equipment-src/material/index.vue
rename to app/pages/(features)/tools-equipment-src/equipment/index.vue
diff --git a/app/schemas/material.ts b/app/schemas/material.ts
new file mode 100644
index 00000000..7d0a4c7e
--- /dev/null
+++ b/app/schemas/material.ts
@@ -0,0 +1,14 @@
+import { z } from 'zod'
+
+const schema = z.object({
+ code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
+ name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
+ uom_code: z.string({ required_error: 'Kode unit harus diisi' }).min(1, 'Kode unit harus diisi'),
+ item_id: z.string({ required_error: 'Tipe harus diisi' }).min(1, 'Tipe harus diisi'),
+ stock: z.preprocess((val) => Number(val), z.number({ invalid_type_error: 'Stok harus berupa angka' }).min(1, 'Stok harus lebih besar dari 0')),
+})
+
+type formData = z.infer
+
+export { schema as MaterialSchema }
+export type { formData as MaterialFormData }