test: call division position
This commit is contained in:
@@ -35,7 +35,7 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
code: '',
|
||||
name: '',
|
||||
division_id: '',
|
||||
division_id: 0,
|
||||
} as Partial<DivisionFormData>,
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ const resetForm = () => {
|
||||
}
|
||||
|
||||
// Form submission handler
|
||||
function onSubmitForm(values: any) {
|
||||
function onSubmitForm() {
|
||||
const formData: DivisionFormData = {
|
||||
name: name.value || '',
|
||||
code: code.value || '',
|
||||
|
||||
@@ -32,6 +32,7 @@ import { divisions, getDivisionParentList } from '~/handlers/_shared.handler'
|
||||
|
||||
// Services
|
||||
import { getDivisions, getDivisionDetail } from '~/services/division.service'
|
||||
import { getDivisionPositions } from '~/services/division-position.service'
|
||||
|
||||
const title = ref('')
|
||||
|
||||
@@ -114,10 +115,15 @@ watch([recId, recAction], () => {
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getDivisionList()
|
||||
watch(() => data.value, async () => {
|
||||
if (!data.value) return
|
||||
await getDivisionParentList(false, data.value || [])
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getDivisionPositions()
|
||||
await getDivisionList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -129,7 +135,7 @@ onMounted(async () => {
|
||||
class="mb-4 xl:mb-5"
|
||||
/>
|
||||
<AppDivisionList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
{{ recId }} - {{ recAction }}
|
||||
|
||||
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Divisi'" size="lg" prevent-outside>
|
||||
<AppDivisionEntryForm
|
||||
:schema="DivisionSchema"
|
||||
@@ -139,6 +145,7 @@ onMounted(async () => {
|
||||
:is-readonly="isReadonly"
|
||||
@submit="
|
||||
(values: DivisionFormData | Record<string, any>, resetForm: () => void) => {
|
||||
console.log(values)
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getDivisionList, resetForm, toast)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user