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 @@ >