chore: add shared handlers

This commit is contained in:
riefive
2025-10-01 13:01:24 +07:00
parent e78342829e
commit 59847dce34
6 changed files with 110 additions and 29 deletions
+1 -10
View File
@@ -29,12 +29,11 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/material.handler'
import { uoms, getUomList } from "~/handlers/_shared.handler"
// Services
import { getMaterials, getMaterialDetail } from '~/services/material.service'
import { getUoms } from '~/services/uom.service'
const uoms = ref<{ value: string; label: string }[]>([])
const title = ref('')
const {
@@ -93,14 +92,6 @@ const getCurrentMaterialDetail = async (id: number | string) => {
}
}
const getUomList = async () => {
const result = await getUoms()
if (result.success) {
const currentUoms = result.body?.data || []
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
// Watch for row actions when recId or recAction changes
watch([recId, recAction], () => {
switch (recAction.value) {
+1 -6
View File
@@ -124,12 +124,7 @@ onMounted(async () => {
/>
<AppInstallationList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<Dialog
v-model:open="isFormEntryDialogOpen"
:title="!!recItem ? title : 'Tambah Instalasi'"
size="lg"
prevent-outside
>
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Instalasi'" size="lg" prevent-outside>
<AppInstallationEntryForm
:schema="InstallationSchema"
:values="recItem"
+1 -11
View File
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
import { DeviceSchema, type DeviceFormData } from '~/schemas/device.schema'
import type { Uom } from '~/models/uom'
// Handlers
import {
@@ -29,12 +28,11 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/device.handler'
import { uoms, getUomList } from "~/handlers/_shared.handler"
// Services
import { getDevices, getDeviceDetail } from '~/services/device.service'
import { getUoms } from '~/services/uom.service'
const uoms = ref<{ value: string; label: string }[]>([])
const title = ref('')
const {
@@ -96,14 +94,6 @@ const getCurrentToolsDetail = async (id: number | string) => {
}
}
const getUomList = async () => {
const result = await getUoms()
if (result.success) {
const currentUoms = result.body?.data || []
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
// Watch for row actions
watch([recId, recAction], () => {
switch (recAction.value) {