enhance (soapi): update payload

This commit is contained in:
Abizrh
2025-10-20 20:26:01 +07:00
parent 77c26171bb
commit a6f1abb20f
4 changed files with 84 additions and 21 deletions
+19 -3
View File
@@ -7,9 +7,16 @@ import { FunctionSoapiSchema } from '~/schemas/soapi.schema'
import { toast } from '~/components/pub/ui/toast'
import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handler'
const route = useRoute()
const isOpen = ref(false)
const data = ref([])
const schema = FunctionSoapiSchema
const payload = ref({
encounter_id: 0,
time: '',
typeCode: 'function',
value: '',
})
const model = ref({
'prim-compl': '',
'past-disease': '',
@@ -76,10 +83,19 @@ async function actionHandler(type: string) {
console.log(type)
const result = await entryRehabRef.value?.validate()
if (result?.valid) {
console.log('✅ Valid data:', result.data)
handleActionSave(result.data, {}, toast)
console.log('data', result.data)
handleActionSave(
{
...payload.value,
value: JSON.stringify(result.data),
encounter_id: +route.params.id,
time: new Date().toISOString(),
},
{},
toast,
)
} else {
console.log('Ada error di form', result)
console.log('Ada error di form', result)
}
}