Merge pull request #178 from dikstub-rssa/feat/adjustment-org-to-the-be-153
Feat/adjustment org to the be 153
This commit is contained in:
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [division, divisionAttrs] = defineField('division_id')
|
||||
const [division, divisionAttrs] = defineField('division_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.division_id !== undefined)
|
||||
division.value = props.values.division_id ? Number(props.values.division_id) : null
|
||||
if (props.values.division_code !== undefined)
|
||||
division.value = props.values.division_code ? String(props.values.division_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -72,7 +72,7 @@ if (props.values) {
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
division.value = null
|
||||
division.value = ''
|
||||
employee.value = null
|
||||
headStatus.value = false
|
||||
}
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
division_id: division.value || null,
|
||||
division_code: division.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Posisi Divisi</Label>
|
||||
<Field :errMessage="errors.division_id">
|
||||
<Field :errMessage="errors.division_code">
|
||||
<Combobox
|
||||
id="division"
|
||||
v-model="division"
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genDivisionPosition } from '~/models/division-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
divisionId: number
|
||||
divisionId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -36,25 +36,25 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
parent_id: null,
|
||||
parent_code: null,
|
||||
} as Partial<DivisionFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [parent, parentAttrs] = defineField('parent_id')
|
||||
const [parent, parentAttrs] = defineField('parent_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.parent_id !== undefined) parent.value = String(props.values.parent_id)
|
||||
if (props.values.parent_code !== undefined) parent.value = String(props.values.parent_code)
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
parent.value = null
|
||||
parent.value = ''
|
||||
}
|
||||
|
||||
// Form submission handler
|
||||
@@ -63,7 +63,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
parent_id: parent.value || null,
|
||||
parent_code: parent.value || '',
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
@@ -108,7 +108,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Divisi Induk</Label>
|
||||
<Field :errMessage="errors.parent_id">
|
||||
<Field :errMessage="errors.parent_code">
|
||||
<TreeSelect
|
||||
id="parent"
|
||||
v-model="parent"
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [installation, installationAttrs] = defineField('installation_id')
|
||||
const [installation, installationAttrs] = defineField('installation_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.installation_id !== undefined)
|
||||
installation.value = props.values.installation_id ? Number(props.values.installation_id) : null
|
||||
if (props.values.installation_code !== undefined)
|
||||
installation.value = props.values.installation_code ? String(props.values.installation_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
installation_id: installation.value || null,
|
||||
installation_code: String(installation.value) || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Instalasi</Label>
|
||||
<Field :errMessage="errors.installation_id">
|
||||
<Field :errMessage="errors.installation_code">
|
||||
<Combobox
|
||||
id="installation"
|
||||
v-model="installation"
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genSpecialistPosition } from '~/models/specialist-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
specialistId: number
|
||||
specialistId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_id')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.specialist_id !== undefined)
|
||||
specialist.value = props.values.specialist_id ? Number(props.values.specialist_id) : null
|
||||
if (props.values.specialist_code !== undefined)
|
||||
specialist.value = props.values.specialist_code ? String(props.values.specialist_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -72,7 +72,7 @@ if (props.values) {
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
specialist.value = null
|
||||
specialist.value = ''
|
||||
employee.value = null
|
||||
headStatus.value = false
|
||||
}
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
specialist_id: specialist.value || null,
|
||||
specialist_code: specialist.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Spesialis</Label>
|
||||
<Field :errMessage="errors.specialist_id">
|
||||
<Field :errMessage="errors.specialist_code">
|
||||
<Combobox
|
||||
id="specialist"
|
||||
v-model="specialist"
|
||||
|
||||
@@ -36,19 +36,19 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
unit_id: 0,
|
||||
unit_code: '',
|
||||
} as Partial<SpecialistFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [unit, unitAttrs] = defineField('unit_id')
|
||||
const [unit, unitAttrs] = defineField('unit_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.unit_id !== undefined) unit.value = props.values.unit_id ? String(props.values.unit_id) : null
|
||||
if (props.values.unit_code !== undefined) unit.value = props.values.unit_code ? String(props.values.unit_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -63,7 +63,7 @@ function onSubmitForm(values: any) {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
unit_id: unit.value ? Number(unit.value) : null,
|
||||
unit_code: unit.value ? String(unit.value) : null,
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { genSubSpecialistPosition } from '~/models/subspecialist-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
subspecialistId: number
|
||||
subspecialistId: string
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [subSpecialist, subSpecialistAttrs] = defineField('subspecialist_id')
|
||||
const [subSpecialist, subSpecialistAttrs] = defineField('subspecialist_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,8 +62,8 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.subspecialist_id !== undefined)
|
||||
subSpecialist.value = props.values.subspecialist_id ? Number(props.values.subspecialist_id) : null
|
||||
if (props.values.subspecialist_code !== undefined)
|
||||
subSpecialist.value = props.values.subspecialist_code ? String(props.values.subspecialist_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -83,7 +83,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
subspecialist_id: subSpecialist.value || null,
|
||||
subspecialist_code: subSpecialist.value || null,
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -130,7 +130,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Sub Spesialis</Label>
|
||||
<Field :errMessage="errors.subspecialist_id">
|
||||
<Field :errMessage="errors.subspecialist_code">
|
||||
<Combobox
|
||||
id="specialist"
|
||||
v-model="subSpecialist"
|
||||
|
||||
@@ -36,20 +36,20 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
specialist_id: 0,
|
||||
specialist_code: '',
|
||||
} as Partial<SubspecialistFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_id')
|
||||
const [specialist, specialistAttrs] = defineField('specialist_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.specialist_id !== undefined)
|
||||
specialist.value = props.values.specialist_id ? String(props.values.specialist_id) : null
|
||||
if (props.values.specialist_code !== undefined)
|
||||
specialist.value = props.values.specialist_code ? String(props.values.specialist_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -64,7 +64,7 @@ function onSubmitForm(values: any) {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
specialist_id: specialist.value ? Number(specialist.value) : null,
|
||||
specialist_code: specialist.value ? String(specialist.value) : "",
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
|
||||
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
|
||||
// Types
|
||||
import type { UnitPositionFormData } from '~/schemas/unit-position.schema'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { genBase } from '~/models/_base'
|
||||
import { genUnitPosition } from '~/models/unit-position'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
unitId: number
|
||||
employees: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const isLoading = props.isLoading !== undefined ? props.isLoading : false
|
||||
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
|
||||
const emit = defineEmits<{
|
||||
submit: [values: UnitPositionFormData, resetForm: () => void]
|
||||
cancel: [resetForm: () => void]
|
||||
}>()
|
||||
|
||||
const { defineField, errors, meta } = useForm({
|
||||
validationSchema: toTypedSchema(props.schema),
|
||||
initialValues: genUnitPosition() as Partial<UnitPositionFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
// RadioGroup uses string values; expose a string computed that maps to the boolean field
|
||||
const headStatusStr = computed<string>({
|
||||
get() {
|
||||
if (headStatus.value === true) return 'true'
|
||||
if (headStatus.value === false) return 'false'
|
||||
return ''
|
||||
},
|
||||
set(v: string) {
|
||||
if (v === 'true') headStatus.value = true
|
||||
else if (v === 'false') headStatus.value = false
|
||||
else headStatus.value = undefined
|
||||
},
|
||||
})
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
code.value = ''
|
||||
name.value = ''
|
||||
employee.value = null
|
||||
headStatus.value = false
|
||||
}
|
||||
|
||||
// Form submission handler
|
||||
function onSubmitForm() {
|
||||
const formData: UnitPositionFormData = {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
|
||||
// readonly based on detail unit
|
||||
unit_id: props.unitId,
|
||||
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
// Form cancel handler
|
||||
function onCancelForm() {
|
||||
emit('cancel', resetForm)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form
|
||||
id="form-unit-position"
|
||||
@submit.prevent
|
||||
>
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!mb-2.5 !pt-0 xl:!mb-3"
|
||||
:colCount="1"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">Kode Jabatan</Label>
|
||||
<Field :errMessage="errors.code">
|
||||
<Input
|
||||
id="code"
|
||||
v-model="code"
|
||||
v-bind="codeAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Nama Jabatan</Label>
|
||||
<Field :errMessage="errors.name">
|
||||
<Input
|
||||
id="name"
|
||||
v-model="name"
|
||||
v-bind="nameAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Pengisi Jabatan</Label>
|
||||
<Field :errMessage="errors.employee_id">
|
||||
<Combobox
|
||||
id="employee"
|
||||
v-model="employee"
|
||||
v-bind="employeeAttrs"
|
||||
:items="employees"
|
||||
:is-disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Karyawan"
|
||||
search-placeholder="Cari Karyawan"
|
||||
empty-message="Item tidak ditemukan"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Status Kepala</Label>
|
||||
<Field :errMessage="errors.headStatus">
|
||||
<RadioGroup
|
||||
v-model="headStatusStr"
|
||||
v-bind="headStatusAttrs"
|
||||
class="flex gap-4"
|
||||
>
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroupItem
|
||||
id="head-yes"
|
||||
value="true"
|
||||
/>
|
||||
<Label for="head-yes">Ya</Label>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroupItem
|
||||
id="head-no"
|
||||
value="false"
|
||||
/>
|
||||
<Label for="head-no">Tidak</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
<div class="my-2 flex justify-end gap-2 py-2">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
class="w-[120px]"
|
||||
@click="onCancelForm"
|
||||
>
|
||||
Kembali
|
||||
</Button>
|
||||
<Button
|
||||
v-if="!isReadonly"
|
||||
type="button"
|
||||
class="w-[120px]"
|
||||
:disabled="isLoading || !meta.valid"
|
||||
@click="onSubmitForm"
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
@@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [unit, unitAttrs] = defineField('unit_id')
|
||||
const [unit, unitAttrs] = defineField('unit_code')
|
||||
const [employee, employeeAttrs] = defineField('employee_id')
|
||||
const [headStatus, headStatusAttrs] = defineField('headStatus')
|
||||
|
||||
@@ -62,7 +62,7 @@ const headStatusStr = computed<string>({
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.unit_id !== undefined) unit.value = props.values.unit_id ? Number(props.values.unit_id) : null
|
||||
if (props.values.unit_code !== undefined) unit.value = props.values.unit_code ? String(props.values.unit_code) : null
|
||||
if (props.values.employee_id !== undefined)
|
||||
employee.value = props.values.employee_id ? Number(props.values.employee_id) : null
|
||||
if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus
|
||||
@@ -82,7 +82,7 @@ function onSubmitForm() {
|
||||
...genBase(),
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
unit_id: unit.value || null,
|
||||
unit_code: unit.value || '',
|
||||
employee_id: employee.value || null,
|
||||
headStatus: headStatus.value !== undefined ? headStatus.value : undefined,
|
||||
}
|
||||
@@ -129,7 +129,7 @@ function onCancelForm() {
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Unit</Label>
|
||||
<Field :errMessage="errors.unit_id">
|
||||
<Field :errMessage="errors.unit_code">
|
||||
<Combobox
|
||||
id="unit"
|
||||
v-model="unit"
|
||||
|
||||
@@ -35,20 +35,20 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
installation_id: 0,
|
||||
installation_code: '',
|
||||
} as Partial<UnitFormData>,
|
||||
})
|
||||
|
||||
const [code, codeAttrs] = defineField('code')
|
||||
const [name, nameAttrs] = defineField('name')
|
||||
const [installation, installationAttrs] = defineField('installation_id')
|
||||
const [installation, installationAttrs] = defineField('installation_code')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
if (props.values.name !== undefined) name.value = props.values.name
|
||||
if (props.values.installation_id !== undefined)
|
||||
installation.value = props.values.installation_id ? Number(props.values.installation_id) : null
|
||||
if (props.values.installation_code !== undefined)
|
||||
installation.value = props.values.installation_code ? String(props.values.installation_code) : null
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -62,7 +62,7 @@ function onSubmitForm() {
|
||||
const formData: UnitFormData = {
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
installation_id: installation.value ? Number(installation.value) : null,
|
||||
installation_code: installation.value ? String(installation.value) : "",
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ const getCurrentDivisionDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentDivisionDetail(recId.value)
|
||||
getCurrentDivisionDetail(recItem.value.code)
|
||||
title.value = 'Detail Divisi Position'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentDivisionDetail(recId.value)
|
||||
getCurrentDivisionDetail(recItem.value.code)
|
||||
title.value = 'Edit Divisi Position'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -122,7 +122,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
divisions.value = await getDivisionLabelList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
divisions.value = await getDivisionLabelList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
await getDivisionList()
|
||||
} catch (err) {
|
||||
@@ -172,9 +172,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: DivisionPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getDivisionList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getDivisionList, resetForm, toast)
|
||||
@@ -189,7 +188,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getDivisionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getDivisionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
divisionId: number
|
||||
divisionId: string
|
||||
}>()
|
||||
const division = ref<Division>({} as Division)
|
||||
// #endregion
|
||||
@@ -152,7 +152,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailDivisionPosition(recId.value)
|
||||
getDetailDivisionPosition(recItem.value.code)
|
||||
title.value = 'Edit Jabatan'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -201,8 +201,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: DivisionPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getDivisionPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getDivisionPositionList, onResetState, toast)
|
||||
@@ -215,7 +215,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getDivisionPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getDivisionPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -105,26 +105,23 @@ const getCurrentDivisionDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
if (Number(recId.value) > 0) {
|
||||
const id = Number(recId.value)
|
||||
if (recItem.value.code.length > 0) {
|
||||
navigateTo({
|
||||
name: 'org-src-division-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-division-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentDivisionDetail(recId.value)
|
||||
getCurrentDivisionDetail(recItem.value.code)
|
||||
title.value = 'Edit Divisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -146,7 +143,7 @@ watch(
|
||||
if (result.success) {
|
||||
const currentData = result.body.data || []
|
||||
const normalizedData = currentData.filter((division: Division) => !division.parent_id)
|
||||
divisionsTrees.value = getValueTreeItems(normalizedData)
|
||||
divisionsTrees.value = getValueTreeItems(normalizedData, true)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -190,9 +187,9 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: DivisionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionList, resetForm, toast)
|
||||
// console.log(values)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getDivisionList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getDivisionList, resetForm, toast)
|
||||
@@ -207,7 +204,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getDivisionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getDivisionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -85,8 +85,6 @@ const tabs: TabItem[] = [
|
||||
{ value: 'mcu-result', label: 'Hasil Penunjang' },
|
||||
{ value: 'consultation', label: 'Konsultasi', component: Consultation, props: { encounter: data } },
|
||||
{ value: 'resume', label: 'Resume', component: ResumeList, props: { encounter: data } },
|
||||
{ value: 'control', label: 'Surat Kontrol' },
|
||||
{ value: 'resume', label: 'Resume' },
|
||||
{ value: 'control', label: 'Surat Kontrol', component: ControlLetterList, props: { encounter: data } },
|
||||
{ value: 'screening', label: 'Skrinning MPP' },
|
||||
{ value: 'supporting-document', label: 'Upload Dokumen Pendukung', component: DocUploadList, props: { encounter: data }, },
|
||||
|
||||
@@ -108,7 +108,7 @@ watch([recId, recAction], () => {
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentInstallationDetail(recId.value)
|
||||
getCurrentInstallationDetail(recItem.value.code)
|
||||
title.value = 'Edit Instalasi - Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -120,7 +120,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
installations.value = await getInstallationLabelList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
installations.value = await getInstallationLabelList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -169,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: InstallationPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationPositionList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationPositionList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationPositionList, resetForm, toast)
|
||||
@@ -185,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
installationId: number
|
||||
installationId: string
|
||||
}>()
|
||||
const installation = ref<Installation>({} as Installation)
|
||||
// #endregion
|
||||
@@ -153,7 +153,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailInstallationPosition(recId.value)
|
||||
getDetailInstallationPosition(recItem.value.code)
|
||||
title.value = 'Edit Jabatan'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -202,8 +202,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: InstallationPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationPositionList, onResetState, toast)
|
||||
@@ -216,7 +216,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -102,26 +102,23 @@ const getCurrentInstallationDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
if (Number(recId.value) > 0) {
|
||||
const id = Number(recId.value)
|
||||
if (recItem.value.code.length > 0) {
|
||||
navigateTo({
|
||||
name: 'org-src-installation-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-installation-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentInstallationDetail(recId.value)
|
||||
getCurrentInstallationDetail(recItem.value.code)
|
||||
title.value = 'Edit Instalasi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -171,8 +168,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: InstallationFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getInstallationList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getInstallationList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getInstallationList, resetForm, toast)
|
||||
@@ -187,7 +184,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getInstallationList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getInstallationList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -105,12 +105,12 @@ const getCurrentSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Detail Spesialis Posisi'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Spesialis Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -122,7 +122,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
specialists.value = await getValueLabelSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
specialists.value = await getValueLabelSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -169,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSpecialistList, resetForm, toast)
|
||||
@@ -184,7 +184,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -48,7 +48,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
specialistId: number
|
||||
specialistId: string
|
||||
}>()
|
||||
const specialist = ref<Specialist>({} as Specialist)
|
||||
// #endregion
|
||||
@@ -154,7 +154,7 @@ provide('table_data_loader', isLoading)
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailSpecialistPosition(recId.value)
|
||||
getDetailSpecialistPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -203,8 +203,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: SpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -217,7 +217,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -103,26 +103,23 @@ const getCurrentSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
if (Number(recId.value) > 0) {
|
||||
const id = Number(recId.value)
|
||||
if (recItem.value.code.length > 0) {
|
||||
navigateTo({
|
||||
name: 'org-src-specialist-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-specialist-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSpecialistDetail(recId.value)
|
||||
getCurrentSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Spesialis'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -133,7 +130,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
units.value = await getUnitList()
|
||||
units.value = await getUnitList({}, true)
|
||||
await getSpecialistList()
|
||||
})
|
||||
</script>
|
||||
@@ -172,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SpecialistFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSpecialistList, resetForm, toast)
|
||||
@@ -188,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -110,12 +110,12 @@ const getCurrentSubSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Detail Sub Spesialis Posisi'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Sub Spesialis Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -127,7 +127,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
subSpecialists.value = await getValueLabelSubSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
subSpecialists.value = await getValueLabelSubSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -176,8 +176,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SubSpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSubSpecialistList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSubSpecialistList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSubSpecialistList, onResetState, toast)
|
||||
@@ -192,7 +192,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSubSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSubSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -51,7 +51,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
subspecialistId: number
|
||||
subspecialistId: string
|
||||
}>()
|
||||
const subSpecialist = ref<Subspecialist>({} as Subspecialist)
|
||||
// #endregion
|
||||
@@ -157,7 +157,7 @@ provide('table_data_loader', isLoading)
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailSubSpecialistPosition(recId.value)
|
||||
getDetailSubSpecialistPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -206,8 +206,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: SubSpecialistPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -220,7 +220,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -103,26 +103,23 @@ const getCurrentSubSpecialistDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
if (Number(recId.value) > 0) {
|
||||
const id = Number(recId.value)
|
||||
if (recItem.value.code.length > 0) {
|
||||
navigateTo({
|
||||
name: 'org-src-subspecialist-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-subspecialist-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentSubSpecialistDetail(recId.value)
|
||||
getCurrentSubSpecialistDetail(recItem.value.code)
|
||||
title.value = 'Edit Sub Spesialis'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -133,7 +130,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
specialists.value = await getSpecialistsList()
|
||||
specialists.value = await getSpecialistsList({}, true)
|
||||
await getSubSpecialistList()
|
||||
})
|
||||
</script>
|
||||
@@ -172,8 +169,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: SubspecialistFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getSubSpecialistList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getSubSpecialistList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getSubSpecialistList, resetForm, toast)
|
||||
@@ -188,7 +185,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getSubSpecialistList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getSubSpecialistList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -106,12 +106,12 @@ const getCurrentUnitDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentUnitDetail(recId.value)
|
||||
getCurrentUnitDetail(recItem.value.code)
|
||||
title.value = 'Detail Unit Posisi'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentUnitDetail(recId.value)
|
||||
getCurrentUnitDetail(recItem.value.code)
|
||||
title.value = 'Edit Unit Posisi'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -123,7 +123,7 @@ watch([recId, recAction], () => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
units.value = await getValueLabelUnitList({ sort: 'createdAt:asc', 'page-size': 100 })
|
||||
units.value = await getValueLabelUnitList({ sort: 'createdAt:asc', 'page-size': 100 }, true)
|
||||
employees.value = await getEmployeeLabelList({ sort: 'createdAt:asc', 'page-size': 100, includes: 'person' })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
@@ -172,8 +172,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: UnitPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getListUnit, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getListUnit, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getListUnit, resetForm, toast)
|
||||
@@ -187,7 +187,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getListUnit, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getListUnit, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -47,7 +47,7 @@ const title = ref('')
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
unitId: number
|
||||
unitId: string
|
||||
}>()
|
||||
const unit = ref<Unit>({} as Unit)
|
||||
// #endregion
|
||||
@@ -152,7 +152,7 @@ watch([recId, recAction], () => {
|
||||
console.log(recId, recAction)
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
getDetailUnitPosition(recId.value)
|
||||
getDetailUnitPosition(recItem.value.code)
|
||||
title.value = 'Edit Posisi'
|
||||
isReadonly.value = false
|
||||
isFormEntryDialogOpen.value = true
|
||||
@@ -201,8 +201,8 @@ watch([recId, recAction], () => {
|
||||
@submit="
|
||||
(values: UnitPositionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getPositionList, onResetState, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getPositionList, onResetState, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getPositionList, onResetState, toast)
|
||||
@@ -215,7 +215,7 @@ watch([recId, recAction], () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getPositionList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getPositionList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -103,26 +103,22 @@ const getCurrentUnitDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
if (Number(recId.value) > 0) {
|
||||
const id = Number(recId.value)
|
||||
|
||||
if (recItem.value.code.length > 0) {
|
||||
navigateTo({
|
||||
name: 'org-src-unit-id',
|
||||
params: {
|
||||
id: recItem.value.code,
|
||||
},
|
||||
})
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = false
|
||||
isReadonly.value = false
|
||||
|
||||
navigateTo({
|
||||
name: 'org-src-unit-id',
|
||||
params: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentUnitDetail(recId.value)
|
||||
getCurrentUnitDetail(recItem.value.code)
|
||||
title.value = 'Edit Unit'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -133,7 +129,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
installations.value = await getInstallationList()
|
||||
installations.value = await getInstallationList({}, true)
|
||||
await getUnitList()
|
||||
})
|
||||
</script>
|
||||
@@ -172,8 +168,8 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: UnitFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getUnitList, resetForm, toast)
|
||||
if (recItem?.code.length > 0) {
|
||||
handleActionEdit(recItem.code, values, getUnitList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getUnitList, resetForm, toast)
|
||||
@@ -188,7 +184,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getUnitList, toast)"
|
||||
@confirm="() => handleActionRemove(recItem.code, getUnitList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
@@ -42,6 +42,12 @@ export interface RefSearchNav {
|
||||
onClear: () => void
|
||||
}
|
||||
|
||||
export interface RefExportNav {
|
||||
onExportPdf?: () => void
|
||||
onExportCsv?: () => void
|
||||
onExportExcel?: () => void
|
||||
}
|
||||
|
||||
// prepared header for relatively common usage
|
||||
export interface HeaderPrep {
|
||||
title?: string
|
||||
|
||||
Reference in New Issue
Block a user