fix: resolve list organization source
This commit is contained in:
No files matched your search
@@ -4,6 +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'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import type { InstallationFormData } from '~/schemas/installation.schema.ts'
|
import type { InstallationFormData } from '~/schemas/installation.schema.ts'
|
||||||
@@ -86,6 +87,21 @@ function onCancelForm() {
|
|||||||
<Input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" />
|
<Input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" />
|
||||||
</Field>
|
</Field>
|
||||||
</Cell>
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Label height="compact">Encounter Class</Label>
|
||||||
|
<Field :errMessage="errors.encounterClass_code">
|
||||||
|
<Combobox
|
||||||
|
id="encounterClass_code"
|
||||||
|
v-model="encounterClassCode"
|
||||||
|
v-bind="encounterClassCodeAttrs"
|
||||||
|
:items="encounterClasses"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
placeholder="Pilih Encounter Class"
|
||||||
|
search-placeholder="Cari Encounter Class"
|
||||||
|
empty-message="Encounter tidak ditemukan"
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</Cell>
|
||||||
</Block>
|
</Block>
|
||||||
<div class="my-2 flex justify-end gap-2 py-2">
|
<div class="my-2 flex justify-end gap-2 py-2">
|
||||||
<Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
|
<Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
|
||||||
|
|||||||
@@ -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'
|
||||||
@@ -90,24 +90,15 @@ function onCancelForm() {
|
|||||||
<Cell>
|
<Cell>
|
||||||
<Label height="compact">Unit</Label>
|
<Label height="compact">Unit</Label>
|
||||||
<Field :errMessage="errors.unit">
|
<Field :errMessage="errors.unit">
|
||||||
<!-- <Combobox
|
<Combobox
|
||||||
id="unit"
|
id="unit"
|
||||||
|
v-model="unit"
|
||||||
|
v-bind="unitAttrs"
|
||||||
|
:items="units"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
placeholder="Pilih Unit"
|
placeholder="Pilih Unit"
|
||||||
search-placeholder="Cari unit"
|
search-placeholder="Cari unit"
|
||||||
empty-message="Unit tidak ditemukan"
|
empty-message="Unit tidak ditemukan"
|
||||||
v-model="unit"
|
|
||||||
v-bind="unitAttrs"
|
|
||||||
:items="units"
|
|
||||||
: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>
|
||||||
|
|||||||
@@ -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 { SubspecialistFormData } from '~/schemas/subspecialist.schema.ts'
|
import type { SubspecialistFormData } from '~/schemas/subspecialist.schema.ts'
|
||||||
@@ -90,24 +90,15 @@ function onCancelForm() {
|
|||||||
<Cell>
|
<Cell>
|
||||||
<Label height="compact">Spesialis</Label>
|
<Label height="compact">Spesialis</Label>
|
||||||
<Field :errMessage="errors.specialist">
|
<Field :errMessage="errors.specialist">
|
||||||
<!-- <Combobox
|
<Combobox
|
||||||
id="specialis"
|
id="specialist"
|
||||||
|
v-model="specialist"
|
||||||
|
v-bind="specialistAttrs"
|
||||||
|
:items="specialists"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
placeholder="Pilih spesialis"
|
placeholder="Pilih spesialis"
|
||||||
search-placeholder="Cari spesialis"
|
search-placeholder="Cari spesialis"
|
||||||
empty-message="Spesialis tidak ditemukan"
|
empty-message="Spesialis tidak ditemukan"
|
||||||
v-model="specialist"
|
|
||||||
v-bind="specialistAttrs"
|
|
||||||
:items="specialists"
|
|
||||||
:disabled="isLoading || isReadonly"
|
|
||||||
/> -->
|
|
||||||
<Select
|
|
||||||
id="specialist"
|
|
||||||
icon-name="i-lucide-chevron-down"
|
|
||||||
placeholder="Pilih spesialis"
|
|
||||||
v-model="specialist"
|
|
||||||
v-bind="specialistAttrs"
|
|
||||||
:items="specialists"
|
|
||||||
:disabled="isLoading || isReadonly"
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
</Cell>
|
</Cell>
|
||||||
|
|||||||
@@ -4,6 +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'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import type { UnitFormData } from '~/schemas/unit.schema.ts'
|
import type { UnitFormData } from '~/schemas/unit.schema.ts'
|
||||||
@@ -15,6 +16,7 @@ import { useForm } from 'vee-validate'
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
schema: z.ZodSchema<any>
|
schema: z.ZodSchema<any>
|
||||||
|
installations: any[]
|
||||||
values: any
|
values: any
|
||||||
isLoading?: boolean
|
isLoading?: boolean
|
||||||
isReadonly?: boolean
|
isReadonly?: boolean
|
||||||
@@ -33,13 +35,13 @@ const { defineField, errors, meta } = useForm({
|
|||||||
initialValues: {
|
initialValues: {
|
||||||
code: '',
|
code: '',
|
||||||
name: '',
|
name: '',
|
||||||
installation: '',
|
installation_id: 0,
|
||||||
} as Partial<UnitFormData>,
|
} as Partial<UnitFormData>,
|
||||||
})
|
})
|
||||||
|
|
||||||
const [code, codeAttrs] = defineField('code')
|
const [code, codeAttrs] = defineField('code')
|
||||||
const [name, nameAttrs] = defineField('name')
|
const [name, nameAttrs] = defineField('name')
|
||||||
const [installation, installationAttrs] = defineField('installation')
|
const [installation, installationAttrs] = defineField('installation_id')
|
||||||
|
|
||||||
// Fill fields from props.values if provided
|
// Fill fields from props.values if provided
|
||||||
if (props.values) {
|
if (props.values) {
|
||||||
@@ -59,7 +61,7 @@ function onSubmitForm(values: any) {
|
|||||||
const formData: UnitFormData = {
|
const formData: UnitFormData = {
|
||||||
name: name.value || '',
|
name: name.value || '',
|
||||||
code: code.value || '',
|
code: code.value || '',
|
||||||
installation: installation.value || '',
|
installation_id: installation.value || '',
|
||||||
}
|
}
|
||||||
emit('submit', formData, resetForm)
|
emit('submit', formData, resetForm)
|
||||||
}
|
}
|
||||||
@@ -85,6 +87,21 @@ function onCancelForm() {
|
|||||||
<Input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" />
|
<Input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" />
|
||||||
</Field>
|
</Field>
|
||||||
</Cell>
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Label height="compact">Instalasi</Label>
|
||||||
|
<Field :errMessage="errors.installation">
|
||||||
|
<Combobox
|
||||||
|
id="installation"
|
||||||
|
v-model="installation"
|
||||||
|
v-bind="installationAttrs"
|
||||||
|
:items="installations"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
placeholder="Pilih Instalasi"
|
||||||
|
search-placeholder="Cari instalasi"
|
||||||
|
empty-message="Instalasi tidak ditemukan"
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</Cell>
|
||||||
</Block>
|
</Block>
|
||||||
<div class="my-2 flex justify-end gap-2 py-2">
|
<div class="my-2 flex justify-end gap-2 py-2">
|
||||||
<Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
|
<Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
|
|||||||
// Types
|
// Types
|
||||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
|
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
|
||||||
import { SpecialistSchema, type SpecialistFormData } from '~/schemas/specialist.schema'
|
import { SpecialistSchema, type SpecialistFormData } from '~/schemas/specialist.schema'
|
||||||
import type { Unit } from '~/models/unit'
|
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import {
|
import {
|
||||||
@@ -29,12 +28,11 @@ import {
|
|||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleCancelForm,
|
handleCancelForm,
|
||||||
} from '~/handlers/specialist.handler'
|
} from '~/handlers/specialist.handler'
|
||||||
|
import { units, getUnitList } from '~/handlers/_shared.handler'
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getSpecialists, getSpecialistDetail } from '~/services/specialist.service'
|
import { getSpecialists, getSpecialistDetail } from '~/services/specialist.service'
|
||||||
import { getUnits } from '~/services/unit.service'
|
|
||||||
|
|
||||||
const units = ref<{ value: string; label: string }[]>([])
|
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -93,14 +91,6 @@ const getCurrentSpecialistDetail = async (id: number | string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getUnitList = async () => {
|
|
||||||
const result = await getUnits()
|
|
||||||
if (result.success) {
|
|
||||||
const currentUnits = result.body?.data || []
|
|
||||||
units.value = currentUnits.map((item: Unit) => ({ value: item.id ? Number(item.id) : item.code, label: item.name }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch for row actions when recId or recAction changes
|
// Watch for row actions when recId or recAction changes
|
||||||
watch([recId, recAction], () => {
|
watch([recId, recAction], () => {
|
||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
|
|||||||
// Types
|
// Types
|
||||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
|
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
|
||||||
import { SubspecialistSchema, type SubspecialistFormData } from '~/schemas/subspecialist.schema'
|
import { SubspecialistSchema, type SubspecialistFormData } from '~/schemas/subspecialist.schema'
|
||||||
import type { Specialist } from '~/models/specialist'
|
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import {
|
import {
|
||||||
@@ -29,12 +28,11 @@ import {
|
|||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleCancelForm,
|
handleCancelForm,
|
||||||
} from '~/handlers/subspecialist.handler'
|
} from '~/handlers/subspecialist.handler'
|
||||||
|
import { specialists, getSpecialistsList } from '~/handlers/_shared.handler'
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getSubspecialists, getSubspecialistDetail } from '~/services/subspecialist.service'
|
import { getSubspecialists, getSubspecialistDetail } from '~/services/subspecialist.service'
|
||||||
import { getSpecialists } from '~/services/specialist.service'
|
|
||||||
|
|
||||||
const specialists = ref<{ value: string; label: string }[]>([])
|
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -93,17 +91,6 @@ const getCurrentSubSpecialistDetail = async (id: number | string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSpecialistsList = async () => {
|
|
||||||
const result = await getSpecialists()
|
|
||||||
if (result.success) {
|
|
||||||
const currentSpecialists = result.body?.data || []
|
|
||||||
specialists.value = currentSpecialists.map((item: Specialist) => ({
|
|
||||||
value: item.id ? Number(item.id) : item.code,
|
|
||||||
label: item.name,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch for row actions when recId or recAction changes
|
// Watch for row actions when recId or recAction changes
|
||||||
watch([recId, recAction], () => {
|
watch([recId, recAction], () => {
|
||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleCancelForm,
|
handleCancelForm,
|
||||||
} from '~/handlers/unit.handler'
|
} from '~/handlers/unit.handler'
|
||||||
|
import { installations, getInstallationList } from '~/handlers/_shared.handler'
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getUnits, getUnitDetail } from '~/services/unit.service'
|
import { getUnits, getUnitDetail } from '~/services/unit.service'
|
||||||
@@ -110,6 +111,7 @@ watch([recId, recAction], () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await getInstallationList()
|
||||||
await getUnitList()
|
await getUnitList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -127,6 +129,7 @@ onMounted(async () => {
|
|||||||
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Unit'" size="lg" prevent-outside>
|
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Unit'" size="lg" prevent-outside>
|
||||||
<AppUnitEntryForm
|
<AppUnitEntryForm
|
||||||
:schema="UnitSchema"
|
:schema="UnitSchema"
|
||||||
|
:installations="installations"
|
||||||
:values="recItem"
|
:values="recItem"
|
||||||
:is-loading="isProcessing"
|
:is-loading="isProcessing"
|
||||||
:is-readonly="isReadonly"
|
:is-readonly="isReadonly"
|
||||||
|
|||||||
@@ -1,19 +1,28 @@
|
|||||||
// types
|
// types
|
||||||
import type { MedicineGroup } from '~/models/medicine-group'
|
import type { MedicineGroup } from '~/models/medicine-group'
|
||||||
import type { MedicineMethod } from '~/models/medicine-method'
|
import type { MedicineMethod } from '~/models/medicine-method'
|
||||||
|
import type { Installation } from "~/models/installation"
|
||||||
|
import type { Specialist } from '~/models/specialist'
|
||||||
import type { Uom } from '~/models/uom'
|
import type { Uom } from '~/models/uom'
|
||||||
|
import type { Unit } from '~/models/unit'
|
||||||
|
|
||||||
// services
|
// services
|
||||||
import { getMedicineGroups } from '~/services/medicine-group.service'
|
import { getMedicineGroups } from '~/services/medicine-group.service'
|
||||||
import { getMedicineMethods } from '~/services/medicine-method.service'
|
import { getMedicineMethods } from '~/services/medicine-method.service'
|
||||||
import { getUoms } from '~/services/uom.service'
|
|
||||||
import { getEncounters } from '~/services/encounter.service'
|
import { getEncounters } from '~/services/encounter.service'
|
||||||
|
import { getInstallations } from '~/services/installation.service'
|
||||||
|
import { getSpecialists } from '~/services/specialist.service'
|
||||||
|
import { getUoms } from '~/services/uom.service'
|
||||||
|
import { getUnits } from '~/services/unit.service'
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
export const medicineGroups = ref<{ value: string; label: string }[]>([])
|
export const medicineGroups = ref<{ value: string; label: string }[]>([])
|
||||||
export const medicineMethods = ref<{ value: string; label: string }[]>([])
|
export const medicineMethods = ref<{ value: string; label: string }[]>([])
|
||||||
export const uoms = ref<{ value: string; label: string }[]>([])
|
|
||||||
export const encounterClasses = ref<{ value: string; label: string }[]>([])
|
export const encounterClasses = ref<{ value: string; label: string }[]>([])
|
||||||
|
export const installations = ref<{ value: string; label: string }[]>([])
|
||||||
|
export const specialists = ref<{ value: string; label: string }[]>([])
|
||||||
|
export const uoms = ref<{ value: string; label: string }[]>([])
|
||||||
|
export const units = ref<{ value: string; label: string }[]>([])
|
||||||
|
|
||||||
export const getMedicineGroupList = async () => {
|
export const getMedicineGroupList = async () => {
|
||||||
const result = await getMedicineGroups()
|
const result = await getMedicineGroups()
|
||||||
@@ -37,14 +46,6 @@ export const getMedicineMethodList = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUomList = async () => {
|
|
||||||
const result = await getUoms()
|
|
||||||
if (result.success) {
|
|
||||||
const currentUoms = result.body?.data || []
|
|
||||||
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getEncounterClassList = async () => {
|
export const getEncounterClassList = async () => {
|
||||||
const result = await getEncounters()
|
const result = await getEncounters()
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -52,3 +53,41 @@ export const getEncounterClassList = async () => {
|
|||||||
encounterClasses.value = currentValues.map((item: any) => ({ value: item.code || item.id, label: item.name }))
|
encounterClasses.value = currentValues.map((item: any) => ({ value: item.code || item.id, label: item.name }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getInstallationList = async () => {
|
||||||
|
const result = await getInstallations()
|
||||||
|
if (result.success) {
|
||||||
|
const currentInstallations = result.body?.data || []
|
||||||
|
installations.value = currentInstallations.map((item: Installation) => ({
|
||||||
|
value: item.id ? Number(item.id) : item.code,
|
||||||
|
label: item.name,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getSpecialistsList = async () => {
|
||||||
|
const result = await getSpecialists()
|
||||||
|
if (result.success) {
|
||||||
|
const currentSpecialists = result.body?.data || []
|
||||||
|
specialists.value = currentSpecialists.map((item: Specialist) => ({
|
||||||
|
value: item.id ? Number(item.id) : item.code,
|
||||||
|
label: item.name,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUnitList = async () => {
|
||||||
|
const result = await getUnits()
|
||||||
|
if (result.success) {
|
||||||
|
const currentUnits = result.body?.data || []
|
||||||
|
units.value = currentUnits.map((item: Unit) => ({ value: item.id ? Number(item.id) : item.code, label: item.name }))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUomList = async () => {
|
||||||
|
const result = await getUoms()
|
||||||
|
if (result.success) {
|
||||||
|
const currentUoms = result.body?.data || []
|
||||||
|
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export interface Installation {
|
export interface Installation {
|
||||||
|
id?: number | null
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
encounterClass_code?: string | null
|
encounterClass_code?: string | null
|
||||||
|
|||||||
+1
-1
@@ -2,5 +2,5 @@ export interface Unit {
|
|||||||
id?: number
|
id?: number
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
installation?: string | number
|
installation_id?: string | number
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import type { Unit } from '~/models/unit'
|
|||||||
const UnitSchema = z.object({
|
const UnitSchema = 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'),
|
||||||
|
installation_id: z.number().min(1, 'Instalasi harus diisi').nullable(),
|
||||||
})
|
})
|
||||||
|
|
||||||
type UnitFormData = z.infer<typeof UnitSchema> & Unit
|
type UnitFormData = z.infer<typeof UnitSchema> & Unit
|
||||||
|
|||||||
Reference in New Issue
Block a user