finish: integrasi create education assessment
note: masih perlu cek terkait new api domain
This commit is contained in:
@@ -1,30 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import type { ExposedForm } from '~/types/form'
|
||||
import { type AssessmentEducationFormData, AssessmentEducationSchema } from '~/schemas/assessment-education'
|
||||
import { type AssessmentEducationFormData, AssessmentEducationSchema, encode } from '~/schemas/assessment-education'
|
||||
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
|
||||
|
||||
// Handlers
|
||||
import { isReadonly, isProcessing, onResetState, handleActionSave, handleCancelForm } from '~/handlers/infra.handler'
|
||||
import {
|
||||
isReadonly,
|
||||
isProcessing,
|
||||
onResetState,
|
||||
handleActionSave,
|
||||
handleCancelForm,
|
||||
} from '~/handlers/assessment-education.handler'
|
||||
|
||||
// Helpers
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
|
||||
// Services
|
||||
import { getList, getDetail } from '~/services/infra.service'
|
||||
|
||||
const form = ref<ExposedForm<AssessmentEducationFormData> | null>(null)
|
||||
|
||||
async function saveData(values: AssessmentEducationFormData) {
|
||||
const transform = encode(1, values)
|
||||
|
||||
handleActionSave(
|
||||
values,
|
||||
transform,
|
||||
() => {
|
||||
window.location.reload()
|
||||
},
|
||||
() => {},
|
||||
toast,
|
||||
)
|
||||
console.log('sending data')
|
||||
console.log(values)
|
||||
}
|
||||
|
||||
async function cancelData() {}
|
||||
@@ -32,6 +35,7 @@ async function cancelData() {}
|
||||
async function handleActionClick(eventType: string) {
|
||||
if (eventType === 'submit') {
|
||||
const formValidate = await form.value?.validate()
|
||||
console.log(formValidate)
|
||||
if (!formValidate?.valid) return
|
||||
saveData(formValidate?.values)
|
||||
}
|
||||
@@ -49,8 +53,6 @@ async function handleActionClick(eventType: string) {
|
||||
:is-readonly="isReadonly"
|
||||
:is-loading="isProcessing"
|
||||
:schema="AssessmentEducationSchema"
|
||||
@submit=""
|
||||
@cancel=""
|
||||
/>
|
||||
|
||||
<div class="my-2 flex justify-end py-2">
|
||||
|
||||
Reference in New Issue
Block a user