-
-
+
+
+
+
+
+
+
diff --git a/app/components/flow/division/list.vue b/app/components/flow/division/list.vue
index 96b3a66a..b154125f 100644
--- a/app/components/flow/division/list.vue
+++ b/app/components/flow/division/list.vue
@@ -2,9 +2,8 @@
import type { DataTableLoader } from '~/components/pub/base/data-table/type'
import type { HeaderPrep } from '~/components/pub/custom-ui/data/types'
import type { PaginationMeta } from '~/components/pub/custom-ui/pagination/pagination.type'
-import { toTypedSchema } from '@vee-validate/zod'
import { refDebounced, useUrlSearchParams } from '@vueuse/core'
-import Combobox from '~/components/pub/custom-ui/form/combobox.vue'
+import AppDivisonEntryForm from '~/components/app/divison/entry-form.vue'
import Header from '~/components/pub/custom-ui/nav-header/header.vue'
import { division as divisionConf, schema as schemaConf } from './entry'
import { defaultQuery, querySchema } from './schema.query'
@@ -73,8 +72,6 @@ const headerPrep: HeaderPrep = {
},
}
-const formSchema = toTypedSchema(schemaConf)
-
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
@@ -141,25 +138,16 @@ function handlePageChange(page: number) {
// #endregion region
-// #region Utilities & event handlers
+// #region Form event handlers
-function clearForm(setValues: (values: Record
) => void) {
- // Manually clear all form fields
- setValues({
- name: '',
- code: '',
- parentId: '',
- })
-}
-
-function onCancelForm(setValues: (values: Record) => void) {
+function onCancelForm(resetForm: () => void) {
isDialogOpen.value = false
setTimeout(() => {
- clearForm(setValues)
+ resetForm()
}, 500)
}
-async function onSubmitForm(values: any, setValues: (values: Record) => void) {
+async function onSubmitForm(values: any, resetForm: () => void) {
let isSuccess = false
try {
// TODO: Implement form submission logic
@@ -175,6 +163,9 @@ async function onSubmitForm(values: any, setValues: (values: Record
isDialogOpen.value = false
isSuccess = true
+ // Refresh data after successful submission
+ await getDivisionList()
+
// TODO: Show success message
console.log('Division created successfully')
} catch (error: unknown) {
@@ -185,7 +176,7 @@ async function onSubmitForm(values: any, setValues: (values: Record
} finally {
if (isSuccess) {
setTimeout(() => {
- clearForm(setValues)
+ resetForm()
}, 500)
}
}
@@ -221,70 +212,30 @@ watch(debouncedSearch, (newValue) => {
-