mirror of
https://github.com/faiztyanirh/clqms-shadcn-v1.git
synced 2026-04-28 04:55:54 +07:00
fix errors editpage
This commit is contained in:
parent
8fc4f0ee79
commit
cc22abb033
@ -67,6 +67,10 @@ function enterCreate(initialData = null) {
|
|||||||
|
|
||||||
formState.reset();
|
formState.reset();
|
||||||
Object.assign(formState.form, data);
|
Object.assign(formState.form, data);
|
||||||
|
|
||||||
|
Object.keys(formState.errors).forEach(key => {
|
||||||
|
formState.errors[key] = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitForm() {
|
function exitForm() {
|
||||||
|
|||||||
@ -7,9 +7,10 @@
|
|||||||
import { API } from "$lib/config/api";
|
import { API } from "$lib/config/api";
|
||||||
|
|
||||||
let props = $props();
|
let props = $props();
|
||||||
const { masterDetail, formFields, formActions, schema } = props.context;
|
const { masterDetail, formFields, formActions, schema, initialForm } = props.context;
|
||||||
|
|
||||||
const { formState } = masterDetail;
|
const { formState } = masterDetail;
|
||||||
|
|
||||||
console.log(formState);
|
console.log(formState);
|
||||||
|
|
||||||
const helpers = usePatientForm(formState, schema);
|
const helpers = usePatientForm(formState, schema);
|
||||||
@ -22,9 +23,9 @@
|
|||||||
const formData = {
|
const formData = {
|
||||||
...backendData,
|
...backendData,
|
||||||
|
|
||||||
PatIdt: backendData.PatIdt ?? formState.form.PatIdt,
|
PatIdt: backendData.PatIdt ?? initialForm.PatIdt,
|
||||||
LinkTo: backendData.LinkTo ?? [],
|
LinkTo: backendData.LinkTo ?? [],
|
||||||
Custodian: backendData.Custodian ?? formState.form.Custodian,
|
Custodian: backendData.Custodian ?? initialForm.Custodian,
|
||||||
|
|
||||||
Sex: backendData.SexKey || backendData.Sex,
|
Sex: backendData.SexKey || backendData.Sex,
|
||||||
Religion: backendData.ReligionKey || backendData.Religion,
|
Religion: backendData.ReligionKey || backendData.Religion,
|
||||||
|
|||||||
@ -28,6 +28,11 @@
|
|||||||
formFields: patientFormFields,
|
formFields: patientFormFields,
|
||||||
formActions: getPatientFormActions,
|
formActions: getPatientFormActions,
|
||||||
schema: patientSchema,
|
schema: patientSchema,
|
||||||
|
initialForm: patientInitialForm,
|
||||||
|
defaultErrors: {
|
||||||
|
create: patientDefaultErrors,
|
||||||
|
edit: {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user