feat(specialist): finishing integrate specialist
This commit is contained in:
@@ -4,7 +4,7 @@ import Block from '~/components/pub/custom-ui/doc-entry/block.vue'
|
|||||||
import Cell from '~/components/pub/custom-ui/doc-entry/cell.vue'
|
import Cell from '~/components/pub/custom-ui/doc-entry/cell.vue'
|
||||||
import Field from '~/components/pub/custom-ui/doc-entry/field.vue'
|
import Field from '~/components/pub/custom-ui/doc-entry/field.vue'
|
||||||
import Label from '~/components/pub/custom-ui/doc-entry/label.vue'
|
import Label from '~/components/pub/custom-ui/doc-entry/label.vue'
|
||||||
import Combobox from '~/components/pub/custom-ui/form/combobox.vue'
|
// import Combobox from '~/components/pub/custom-ui/form/combobox.vue'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import type { SpecialistFormData } from '~/schemas/specialist.schema.ts'
|
import type { SpecialistFormData } from '~/schemas/specialist.schema.ts'
|
||||||
@@ -89,8 +89,8 @@ function onCancelForm() {
|
|||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
<Label height="compact">Unit</Label>
|
<Label height="compact">Unit</Label>
|
||||||
<Field :errMessage="errors.uom_code">
|
<Field :errMessage="errors.unit">
|
||||||
<Combobox
|
<!-- <Combobox
|
||||||
id="unit"
|
id="unit"
|
||||||
placeholder="Pilih Unit"
|
placeholder="Pilih Unit"
|
||||||
search-placeholder="Cari unit"
|
search-placeholder="Cari unit"
|
||||||
@@ -99,6 +99,15 @@ function onCancelForm() {
|
|||||||
v-bind="unitAttrs"
|
v-bind="unitAttrs"
|
||||||
:items="units"
|
:items="units"
|
||||||
:disabled="isLoading || isReadonly"
|
:disabled="isLoading || isReadonly"
|
||||||
|
/> -->
|
||||||
|
<Select
|
||||||
|
id="unit"
|
||||||
|
icon-name="i-lucide-chevron-down"
|
||||||
|
placeholder="Pilih unit"
|
||||||
|
v-model="unit"
|
||||||
|
v-bind="unitAttrs"
|
||||||
|
:items="units"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
</Cell>
|
</Cell>
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ export const funcParsed: RecStrFuncUnknown = {
|
|||||||
const recX = rec as SmallDetailDto
|
const recX = rec as SmallDetailDto
|
||||||
return `${recX.name}`.trim()
|
return `${recX.name}`.trim()
|
||||||
},
|
},
|
||||||
|
unit: (rec: unknown): unknown => {
|
||||||
|
const recX = rec as SmallDetailDto
|
||||||
|
return `${recX.unit_id}`
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export const funcComponent: RecStrFuncComponent = {
|
export const funcComponent: RecStrFuncComponent = {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const getUnitList = async () => {
|
|||||||
const result = await getUnits()
|
const result = await getUnits()
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const currentUnits = result.body?.data || []
|
const currentUnits = result.body?.data || []
|
||||||
units.value = currentUnits.map((item: Unit) => ({ value: item.code, label: item.name }))
|
units.value = currentUnits.map((item: Unit) => ({ value: item.id ? Number(item.id) : item.code, label: item.name }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export interface Specialist {
|
export interface Specialist {
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
unit_id: number
|
unit_id: number | string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export interface Unit {
|
export interface Unit {
|
||||||
|
id?: number
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
installation?: string | number
|
installation?: string | number
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { Specialist } from '~/models/specialist'
|
|||||||
const SpecialistSchema = z.object({
|
const SpecialistSchema = z.object({
|
||||||
code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
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'),
|
name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
|
||||||
unit_id: z.number().optional(),
|
unit_id: z.number().positive('Unit harus diisi'),
|
||||||
})
|
})
|
||||||
|
|
||||||
type SpecialistFormData = z.infer<typeof SpecialistSchema> & Specialist
|
type SpecialistFormData = z.infer<typeof SpecialistSchema> & Specialist
|
||||||
|
|||||||
Reference in New Issue
Block a user