Fix: Refactor Organization CRUD {id} to {code}
This commit is contained in:
No files matched your search
@@ -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 }">
|
||||
|
||||
Reference in New Issue
Block a user