feat(material): finishing integration of material
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
recId,
|
||||
recAction,
|
||||
recItem,
|
||||
isReadonly,
|
||||
isProcessing,
|
||||
isFormEntryDialogOpen,
|
||||
isRecordConfirmationOpen,
|
||||
@@ -29,6 +30,7 @@ import { getSourceMaterials, getSourceMaterialDetail } from '~/services/material
|
||||
import { getSourceUoms } from '~/services/uom.service'
|
||||
|
||||
const uoms = ref<{ value: string; label: string }[]>([])
|
||||
const title = ref('')
|
||||
|
||||
const getEquipmentDetail = async (id: number | string) => {
|
||||
const result = await getSourceMaterialDetail(id)
|
||||
@@ -85,7 +87,10 @@ const headerPrep: HeaderPrep = {
|
||||
label: 'Tambah Perlengkapan',
|
||||
icon: 'i-lucide-plus',
|
||||
onClick: () => {
|
||||
recItem.value = null
|
||||
recId.value = 0
|
||||
isFormEntryDialogOpen.value = true
|
||||
isReadonly.value = false
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -98,8 +103,15 @@ provide('table_data_loader', isLoading)
|
||||
// Watch for row actions
|
||||
watch(recId, () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getEquipmentDetail(recId.value)
|
||||
title.value = 'Detail Perlengkapan'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getEquipmentDetail(recId.value)
|
||||
title.value = 'Edit Perlengkapan'
|
||||
isReadonly.value = false
|
||||
break
|
||||
case ActionEvents.showConfirmDelete:
|
||||
isRecordConfirmationOpen.value = true
|
||||
@@ -122,7 +134,7 @@ onMounted(async () => {
|
||||
|
||||
<Dialog
|
||||
v-model:open="isFormEntryDialogOpen"
|
||||
:title="!!recItem ? 'Edit Perlengkapan' : 'Tambah Perlengkapan'"
|
||||
:title="!!recItem ? title : 'Tambah Perlengkapan'"
|
||||
size="lg"
|
||||
prevent-outside
|
||||
>
|
||||
@@ -131,11 +143,12 @@ onMounted(async () => {
|
||||
:values="recItem"
|
||||
:uoms="uoms"
|
||||
:is-loading="isProcessing"
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: MaterialFormData, resetForm: any) => {
|
||||
if (!!recId) {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getEquipmentList, resetForm)
|
||||
return
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getEquipmentList, resetForm)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user