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