From 801c0a54f1d70593f11674ecdd75c4f1f82f07f7 Mon Sep 17 00:00:00 2001 From: faiztyanirh Date: Wed, 8 Apr 2026 17:11:45 +0700 Subject: [PATCH] continue testmap & bugfix --- .../testmap/config/testmap-form-config.js | 32 +++++++++---------- .../testmap/page/create-page.svelte | 30 +++++++++++------ .../testmap/page/master-page.svelte | 12 ++++--- .../patient/list/page/master-page.svelte | 12 ++++--- .../form/dictionary-form-renderer.svelte | 1 + src/lib/config/api.js | 1 + 6 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/lib/components/dictionary/testmap/config/testmap-form-config.js b/src/lib/components/dictionary/testmap/config/testmap-form-config.js index c0bf5a2..4baab34 100644 --- a/src/lib/components/dictionary/testmap/config/testmap-form-config.js +++ b/src/lib/components/dictionary/testmap/config/testmap-form-config.js @@ -8,23 +8,23 @@ export const testMapSchema = z HostID: z.string().optional(), ClientID: z.string().optional() }) - .superRefine((data, ctx) => { - const hostID = data.HostID; - const clientID = data.ClientID; + // .superRefine((data, ctx) => { + // const hostID = data.HostID; + // const clientID = data.ClientID; - if (hostID && clientID && hostID === clientID) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'ClientID must be different from HostID', - path: ['ClientID'] - }); - ctx.addIssue({ - code: z.ZodIssueCode.custom, - message: 'HostID must be different from ClientID', - path: ['HostID'] - }); - } - }); + // if (hostID && clientID && hostID === clientID) { + // ctx.addIssue({ + // code: z.ZodIssueCode.custom, + // message: 'ClientID must be different from HostID', + // path: ['ClientID'] + // }); + // ctx.addIssue({ + // code: z.ZodIssueCode.custom, + // message: 'HostID must be different from ClientID', + // path: ['HostID'] + // }); + // } + // }); export const testMapInitialForm = { TestMapID: '', diff --git a/src/lib/components/dictionary/testmap/page/create-page.svelte b/src/lib/components/dictionary/testmap/page/create-page.svelte index e367364..6c755f3 100644 --- a/src/lib/components/dictionary/testmap/page/create-page.svelte +++ b/src/lib/components/dictionary/testmap/page/create-page.svelte @@ -125,10 +125,10 @@ tempMap, }); console.log(payload) - // const result = await formState.save(masterDetail.mode, payload); + const result = await formState.save(masterDetail.mode, payload); - // toast('Test Map Created!'); - // masterDetail?.exitForm(true); + toast('Test Map Created!'); + masterDetail?.exitForm(true); } const primaryAction = $derived({ @@ -147,8 +147,15 @@ ...row, columns: row.columns.map((col) => { if (col.key === 'HostID') { - if (formState.form.HostType === 'SITE') { - console.log('ini jalan kok'); + if (formState.form.HostType === 'HIS') { + return { + ...col, + type: 'select', + optionsEndpoint: `${API.BASE_URL}${API.HOSTAPP}`, + valueKey: 'HostAppID', + labelKey: 'HostAppName' + } + } else if (formState.form.HostType === 'SITE') { return { ...col, type: 'select', @@ -156,7 +163,14 @@ valueKey: 'SiteID', labelKey: (item) => `${item.SiteCode} - ${item.SiteName}` }; - + } else if (formState.form.HostType === 'WST') { + return { + ...col, + type: 'select', + optionsEndpoint: `${API.BASE_URL}${API.WORKSTATION}`, + valueKey: 'WorkstationID', + labelKey: 'WorkstationName' + }; } return { ...col, type: 'text', optionsEndpoint: undefined }; } @@ -184,7 +198,6 @@ labelKey: (item) => `${item.TestSiteCode} - ${item.TestSiteName}` }; } - // kalau belum pilih HostID, kembalikan default (misal input biasa) return { ...col, type: 'text', @@ -202,7 +215,6 @@ labelKey: (item) => `${item.TestSiteCode} - ${item.TestSiteName}` }; } - // kalau belum pilih HostID, kembalikan default (misal input biasa) return { ...col, type: 'text', @@ -211,8 +223,6 @@ } return col; - - return col; }) })) })); diff --git a/src/lib/components/dictionary/testmap/page/master-page.svelte b/src/lib/components/dictionary/testmap/page/master-page.svelte index d1466a5..83bb814 100644 --- a/src/lib/components/dictionary/testmap/page/master-page.svelte +++ b/src/lib/components/dictionary/testmap/page/master-page.svelte @@ -8,6 +8,7 @@ import ReusableEmpty from "$lib/components/reusable/reusable-empty.svelte"; import ReusableDataTable from "$lib/components/reusable/reusable-data-table.svelte"; import MapIcon from "@lucide/svelte/icons/map"; + import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left"; let props = $props(); @@ -38,10 +39,13 @@ >
{#if props.masterDetail.isFormMode} - - {#each "TEST MAP".split("") as c} - {c} - {/each} + + +
+ {#each "BACK TO TEST MAP".split("") as c} + {c} + {/each} +
{/if} diff --git a/src/lib/components/patient/list/page/master-page.svelte b/src/lib/components/patient/list/page/master-page.svelte index 1ab42b4..b2628f4 100644 --- a/src/lib/components/patient/list/page/master-page.svelte +++ b/src/lib/components/patient/list/page/master-page.svelte @@ -7,6 +7,7 @@ import ReusableSearchParam from "$lib/components/reusable/reusable-search-param.svelte"; import ReusableEmpty from "$lib/components/reusable/reusable-empty.svelte"; import ReusableDataTable from "$lib/components/reusable/reusable-data-table.svelte"; + import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left"; let props = $props(); @@ -34,10 +35,13 @@ >
{#if props.masterDetail.isFormMode} - - {#each "PATIENT".split("") as c} - {c} - {/each} + + +
+ {#each "BACK TO PATIENT".split("") as c} + {c} + {/each} +
{/if} diff --git a/src/lib/components/reusable/form/dictionary-form-renderer.svelte b/src/lib/components/reusable/form/dictionary-form-renderer.svelte index 2b9a10f..c0220e6 100644 --- a/src/lib/components/reusable/form/dictionary-form-renderer.svelte +++ b/src/lib/components/reusable/form/dictionary-form-renderer.svelte @@ -255,6 +255,7 @@ formState.form.HostID = ''; formState.form.HostTestCode = ''; formState.form.HostTestName = ''; + formState.selectOptions.HostID = []; formState.selectOptions.HostTestCode = []; formState.selectOptions.HostTestName = []; } diff --git a/src/lib/config/api.js b/src/lib/config/api.js index 79591cd..58fd021 100644 --- a/src/lib/config/api.js +++ b/src/lib/config/api.js @@ -24,6 +24,7 @@ export const API = { DISCIPLINE: '/api/organization/discipline', DEPARTMENT: '/api/organization/department', WORKSTATION: '/api/organization/workstation', + HOSTAPP: '/api/organization/hostapp', TEST: '/api/test', TESTMAP: '/api/test/testmap', };