diff --git a/src/lib/components/dictionary/test/config/test-form-config.js b/src/lib/components/dictionary/test/config/test-form-config.js index 979f267..ed243c8 100644 --- a/src/lib/components/dictionary/test/config/test-form-config.js +++ b/src/lib/components/dictionary/test/config/test-form-config.js @@ -456,7 +456,7 @@ export const testFormFields = [ type: 'row', columns: [ { - key: 'VSet', + key: 'Vset', label: 'Value Set', required: false, type: 'select', @@ -1066,7 +1066,7 @@ export function buildTestPayload({ mainForm, activeFormStates, testType, refNumD })) } else if (key === 'refTxt' && refTxtData?.length > 0) { // payload[key] = refTxtData; - payload.refTxt = refTxtData.map(row => ({ + payload.reftxt = refTxtData.map(row => ({ ...row, AgeStart: toDays(row.AgeStart), AgeEnd: toDays(row.AgeEnd), @@ -1077,7 +1077,7 @@ export function buildTestPayload({ mainForm, activeFormStates, testType, refNumD Members: state.form?.Members?.map((m) => m.value).filter(Boolean) ?? [] }; } else if (key === 'map' && mapData?.length > 0) { - payload.testMap = mapData; + payload.testmap = mapData; } else if (key === 'cal') { payload[key] = { ...state.form diff --git a/src/lib/components/dictionary/test/page/create-page.svelte b/src/lib/components/dictionary/test/page/create-page.svelte index d3825cf..f04224a 100644 --- a/src/lib/components/dictionary/test/page/create-page.svelte +++ b/src/lib/components/dictionary/test/page/create-page.svelte @@ -220,7 +220,7 @@ let hiddenFields = $derived.by(() => { const resultType = formState?.form?.ResultType; - return resultType !== 'VSET' ? ['VSet'] : []; + return resultType !== 'VSET' ? ['Vset'] : []; }); let refComponent = $derived.by(() => { @@ -238,7 +238,7 @@ columns: row.columns.map((col) => { if (col.key !== 'RefTxt') return col; - if (formState.form.ResultType !== 'VSET' || !formState.form.VSet) { + if (formState.form.ResultType !== 'VSET' || !formState.form.Vset) { return { ...col, type: 'textarea', @@ -249,7 +249,7 @@ return { ...col, type: 'select', - optionsEndpoint: `${API.BASE_URL}${API.VALUESET}/${formState.form.VSet}`, + optionsEndpoint: `${API.BASE_URL}${API.VALUESET}/${formState.form.Vset}`, fullWidth: false }; }) diff --git a/src/lib/components/dictionary/test/page/edit-page.svelte b/src/lib/components/dictionary/test/page/edit-page.svelte index 330cb6a..ffbd140 100644 --- a/src/lib/components/dictionary/test/page/edit-page.svelte +++ b/src/lib/components/dictionary/test/page/edit-page.svelte @@ -52,8 +52,6 @@ const { formState } = masterDetail; - $inspect(formState.form) - const calFormState = useForm({ schema: testCalSchema, initialForm: testCalInitialForm, @@ -213,7 +211,7 @@ let hiddenFields = $derived.by(() => { const resultType = formState?.form?.ResultType; - return resultType !== 'VSET' ? ['VSet'] : []; + return resultType !== 'VSET' ? ['Vset'] : []; }); let refComponent = $derived.by(() => { @@ -231,7 +229,7 @@ columns: row.columns.map((col) => { if (col.key !== 'RefTxt') return col; - if (formState.form.ResultType !== 'VSET' || !formState.form.VSet) { + if (formState.form.ResultType !== 'VSET' || !formState.form.Vset) { return { ...col, type: 'textarea', @@ -242,7 +240,7 @@ return { ...col, type: 'select', - optionsEndpoint: `${API.BASE_URL}${API.VALUESET}/${formState.form.VSet}`, + optionsEndpoint: `${API.BASE_URL}${API.VALUESET}/${formState.form.Vset}`, fullWidth: false }; }) @@ -328,14 +326,28 @@ $effect(() => { const mainForm = formState.form; - if (mainForm.refnum && Array.isArray(mainForm.refnum)) { - refNumData = mainForm.refnum.map((row, index) => ({ + if (mainForm.refnum && Array.isArray(mainForm.refnum)) { + refNumData = mainForm.refnum.map((row, index) => ({ id: row.id ?? index + 1, ...row, AgeStart: typeof row.AgeStart === 'number' ? buildAgeText(daysToAge(row.AgeStart)) : row.AgeStart, AgeEnd: typeof row.AgeEnd === 'number' ? buildAgeText(daysToAge(row.AgeEnd)) : row.AgeEnd, })); } + if (mainForm.reftxt && Array.isArray(mainForm.reftxt)) { + refTxtData = mainForm.reftxt.map((row, index) => ({ + id: row.id ?? index + 1, + ...row, + AgeStart: typeof row.AgeStart === 'number' ? buildAgeText(daysToAge(row.AgeStart)) : row.AgeStart, + AgeEnd: typeof row.AgeEnd === 'number' ? buildAgeText(daysToAge(row.AgeEnd)) : row.AgeEnd, + })); + } + // if (mainForm.testmap && Array.isArray(mainForm.testmap)) { + // mapData = mainForm.testmap.map((row, index) => ({ + // id: row.id ?? index + 1, + // ...row, + // })); + // } }) $effect(() => { diff --git a/src/lib/components/dictionary/test/page/tabs/ref-num.svelte b/src/lib/components/dictionary/test/page/tabs/ref-num.svelte index 41951a1..18f45a1 100644 --- a/src/lib/components/dictionary/test/page/tabs/ref-num.svelte +++ b/src/lib/components/dictionary/test/page/tabs/ref-num.svelte @@ -434,14 +434,14 @@ - {/if} -