Fix: Refactor Surat Kontrol CRUD {id} to {code}
This commit is contained in:
@@ -39,9 +39,9 @@ async function fetchDpjp(specialistId: string, subspecialistId: string) {
|
||||
specialistCode: 0,
|
||||
includes: 'employee-person',
|
||||
// "unit-id": parseInt(unitId),
|
||||
"specialist-id": parseInt(specialistId),
|
||||
"subspecialist-id": parseInt(subspecialistId),
|
||||
})
|
||||
"specialist-id": String(specialistId),
|
||||
"subspecialist-id": String(subspecialistId),
|
||||
}, true)
|
||||
}
|
||||
|
||||
// const selectedUnitId = inject<Ref<string | null>>("selectedUnitId")!
|
||||
|
||||
@@ -38,8 +38,8 @@ async function fetchSpecialists(unitId: string) {
|
||||
serviceType: 1,
|
||||
serviceDate: new Date().toISOString().substring(0, 10),
|
||||
specialistCode: 0,
|
||||
"unit-id": parseInt(unitId),
|
||||
})
|
||||
"unit-id": String(unitId),
|
||||
}, true)
|
||||
}
|
||||
|
||||
const selectedUnitId = inject<Ref<string | null>>("selectedUnitId")!
|
||||
|
||||
@@ -37,8 +37,8 @@ async function fetchSubSpecialists(specialistId: string) {
|
||||
serviceType: 1,
|
||||
serviceDate: new Date().toISOString().substring(0, 10),
|
||||
specialistCode: 0,
|
||||
"specialist-id": parseInt(specialistId),
|
||||
})
|
||||
"specialist-id": String(specialistId),
|
||||
}, true)
|
||||
}
|
||||
|
||||
const selectedSpecialistId = inject<Ref<string | null>>("selectedSpecialistId")!
|
||||
|
||||
@@ -33,7 +33,7 @@ const {
|
||||
const units = ref<Array<Item>>([])
|
||||
|
||||
async function fetchData() {
|
||||
units.value = await getUnitLabelList()
|
||||
units.value = await getUnitLabelList({}, true)
|
||||
}
|
||||
|
||||
const selectedUnitId = inject<Ref<string | null>>("selectedUnitId")!
|
||||
|
||||
@@ -60,28 +60,28 @@ defineExpose({
|
||||
<DE.Cell :col-span="2">
|
||||
<DE.Block :col-count="4" :cell-flex="false">
|
||||
<SelectUnit
|
||||
field-name="unit_id"
|
||||
field-name="unit_code"
|
||||
label="Unit"
|
||||
placeholder="Pilih Unit"
|
||||
:errors="errors"
|
||||
is-required
|
||||
/>
|
||||
<SelectSpecialist
|
||||
field-name="specialist_id"
|
||||
field-name="specialist_code"
|
||||
label="Spesialis/Sub Spesialis"
|
||||
placeholder="Pilih Spesialis/Sub Spesialis"
|
||||
:errors="errors"
|
||||
is-required
|
||||
/>
|
||||
<SelectSubspecialist
|
||||
field-name="subspecialist_id"
|
||||
field-name="subspecialist_code"
|
||||
label="Spesialis/Sub Spesialis"
|
||||
placeholder="Pilih Spesialis/Sub Spesialis"
|
||||
:errors="errors"
|
||||
is-required
|
||||
/>
|
||||
<SelectDpjp
|
||||
field-name="doctor_id"
|
||||
field-name="doctor_code"
|
||||
label="DPJP"
|
||||
placeholder="Pilih DPJP"
|
||||
:errors="errors"
|
||||
|
||||
@@ -13,14 +13,6 @@ const btnClass = props.smallMode ? '[&_button]:w-7 [&_button]:h-7 [&_button]:2xl
|
||||
|
||||
type ClickType = 'back' | 'draft' | 'submit'
|
||||
|
||||
const props = defineProps({
|
||||
enableDraft: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click', type: ClickType): void
|
||||
}>()
|
||||
|
||||
@@ -8,10 +8,11 @@ export interface Doctor extends Base {
|
||||
employee: Employee
|
||||
ihs_number: string
|
||||
sip_number: string
|
||||
unit_id?: number
|
||||
specialist_id?: number
|
||||
code?: string
|
||||
unit_icode?: number
|
||||
specialist_icode?: number
|
||||
specialist?: Specialist
|
||||
subspecialist_id?: number
|
||||
subspecialist_icode?: number
|
||||
subspecialist?: Subspecialist
|
||||
bpjs_code?: string
|
||||
}
|
||||
@@ -21,9 +22,9 @@ export interface CreateDto {
|
||||
employee_id: number
|
||||
ihs_number: string
|
||||
sip_number: string
|
||||
unit_id?: number
|
||||
specialist_id?: number
|
||||
subspecialist_id?: number
|
||||
unit_code?: number
|
||||
specialist_code?: number
|
||||
subspecialist_code?: number
|
||||
bpjs_code: string
|
||||
}
|
||||
|
||||
|
||||
@@ -4,19 +4,19 @@ const ControlLetterSchema = z.object({
|
||||
sepStatus: z.string({
|
||||
required_error: 'Mohon isi status SEP',
|
||||
}).default('SEP Internal'),
|
||||
unit_id: z.number({
|
||||
unit_code: z.string({
|
||||
required_error: 'Mohon isi Unit',
|
||||
}),
|
||||
specialist_id: z.number({
|
||||
specialist_code: z.string({
|
||||
required_error: 'Mohon isi Spesialis',
|
||||
}),
|
||||
subspecialist_id: z.number({
|
||||
subspecialist_code: z.string({
|
||||
required_error: 'Mohon isi Sub Spesialis',
|
||||
}),
|
||||
doctor_id: z.number({
|
||||
doctor_code: z.string({
|
||||
required_error: 'Mohon isi DPJP',
|
||||
}),
|
||||
encounter_id: z.number().optional(),
|
||||
encounter_code: z.string().optional(),
|
||||
date: z.string({
|
||||
required_error: 'Mohon lengkapi Tanggal Kontrol',
|
||||
})
|
||||
|
||||
@@ -27,13 +27,15 @@ export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Doctor) => ({
|
||||
value: item.id ? Number(item.id) : item.id,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
label: item.employee.person.name,
|
||||
parent: item.unit_id ? Number(item.unit_id) : null,
|
||||
}))
|
||||
|
||||
@@ -27,13 +27,15 @@ export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Specialist) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
label: item.name,
|
||||
parent: item.unit_id ? Number(item.unit_id) : null,
|
||||
}))
|
||||
|
||||
@@ -27,13 +27,15 @@ export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Subspecialist) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
label: item.name,
|
||||
parent: item.specialist_id ? Number(item.specialist_id) : null,
|
||||
}))
|
||||
|
||||
@@ -27,13 +27,15 @@ export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Unit) => ({
|
||||
value: item.id,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user