From ca1b0f4cb769edf2c4d3c0ba466e66011ec02e56 Mon Sep 17 00:00:00 2001 From: riefive Date: Fri, 26 Sep 2025 16:04:19 +0700 Subject: [PATCH] feat(uom): crate form, list and integrate --- app/components/content/uom/list.vue | 52 +++++++++---------- .../device/add.vue => common/uom/index.vue} | 19 ++++--- .../tools-equipment-src/equipment/add.vue | 41 --------------- 3 files changed, 35 insertions(+), 77 deletions(-) rename app/pages/(features)/{tools-equipment-src/device/add.vue => common/uom/index.vue} (70%) delete mode 100644 app/pages/(features)/tools-equipment-src/equipment/add.vue diff --git a/app/components/content/uom/list.vue b/app/components/content/uom/list.vue index fee2e16f..bcb01444 100644 --- a/app/components/content/uom/list.vue +++ b/app/components/content/uom/list.vue @@ -2,7 +2,7 @@ // Components import Dialog from '~/components/pub/base/modal/dialog.vue' import Header from '~/components/pub/custom-ui/nav-header/prep.vue' -import AppMedicineMethodEntryForm from '~/components/app/medicine-method/entry-form.vue' +import AppUomEntryForm from '~/components/app/uom/entry-form.vue' import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue' // Helpers @@ -11,7 +11,7 @@ import { toast } from '~/components/pub/ui/toast' // Types import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types' -import { MedicineBaseSchema, type MedicineBaseFormData } from '~/schemas/medicine.schema' +import { UomSchema, type UomFormData } from '~/schemas/uom.schema' // Handlers import { @@ -26,10 +26,10 @@ import { handleActionEdit, handleActionRemove, handleCancelForm, -} from '~/handlers/medicine-method.handler' +} from '~/handlers/uom.handler' // Services -import { getMedicineMethods, getMedicineMethodDetail } from '~/services/medicine-method.service' +import { getUoms, getUomDetail } from '~/services/uom.service' const title = ref('') @@ -40,18 +40,18 @@ const { searchInput, handlePageChange, handleSearch, - fetchData: getMedicineMethodList, + fetchData: getUomList, } = usePaginatedList({ fetchFn: async ({ page, search }) => { - const result = await getMedicineMethods({ search, page }) + const result = await getUoms({ search, page }) return { success: result.success || false, body: result.body || {} } }, - entityName: 'medicine-method', + entityName: 'uom', }) const headerPrep: HeaderPrep = { - title: 'Metode Obat', - icon: 'i-lucide-medicine-bottle', + title: 'Uom', + icon: 'i-lucide-layout-dashboard', refSearchNav: { placeholder: 'Cari (min. 3 karakter)...', minLength: 3, @@ -78,11 +78,11 @@ provide('rec_action', recAction) provide('rec_item', recItem) provide('table_data_loader', isLoading) -const getCurrentMedicineMethodDetail = async (id: number | string) => { - const result = await getMedicineMethodDetail(id) +const getCurrentUomDetail = async (id: number | string) => { + const result = await getUomDetail(id) if (result.success) { - const currentMaterial = result.body?.data || {} - recItem.value = currentMaterial + const currentValue = result.body?.data || {} + recItem.value = currentValue isFormEntryDialogOpen.value = true } } @@ -91,13 +91,13 @@ const getCurrentMedicineMethodDetail = async (id: number | string) => { watch([recId, recAction], () => { switch (recAction.value) { case ActionEvents.showDetail: - getCurrentMedicineMethodDetail(recId.value) - title.value = 'Detail Metode Obat' + getCurrentUomDetail(recId.value) + title.value = 'Detail Uom' isReadonly.value = true break case ActionEvents.showEdit: - getCurrentMedicineMethodDetail(recId.value) - title.value = 'Edit Metode Obat' + getCurrentUomDetail(recId.value) + title.value = 'Edit Uom' isReadonly.value = false break case ActionEvents.showConfirmDelete: @@ -107,7 +107,7 @@ watch([recId, recAction], () => { }) onMounted(async () => { - await getMedicineMethodList() + await getUomList() }) @@ -115,27 +115,27 @@ onMounted(async () => {
- +
- { v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem" - @confirm="() => handleActionRemove(recId, getMedicineMethodList, toast)" + @confirm="() => handleActionRemove(recId, getUomList, toast)" @cancel="" >