mirror of
https://github.com/faiztyanirh/clqms-shadcn-v1.git
synced 2026-04-23 01:29:27 +07:00
continue testmap & bugfix
This commit is contained in:
parent
60bf81d439
commit
801c0a54f1
@ -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: '',
|
||||
|
||||
@ -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;
|
||||
})
|
||||
}))
|
||||
}));
|
||||
|
||||
@ -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 @@
|
||||
>
|
||||
<div class={`flex w-full ${props.masterDetail.isFormMode ? "flex-col justify-center h-full items-center" : "flex-col justify-start h-full"}`} >
|
||||
{#if props.masterDetail.isFormMode}
|
||||
<span class="flex flex-col items-center justify-center gap-4 tracking-widest font-semibold select-none">
|
||||
{#each "TEST MAP".split("") as c}
|
||||
<span class="leading-none">{c}</span>
|
||||
{/each}
|
||||
<span class="flex flex-col items-center justify-start gap-4 tracking-widest font-semibold select-none h-full">
|
||||
<ArrowLeftIcon />
|
||||
<div class="flex flex-col items-center justify-center flex-grow gap-4">
|
||||
{#each "BACK TO TEST MAP".split("") as c}
|
||||
<span class="leading-none">{c}</span>
|
||||
{/each}
|
||||
</div>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
|
||||
@ -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 @@
|
||||
>
|
||||
<div class={`flex w-full ${props.masterDetail.isFormMode ? "flex-col justify-center h-full items-center" : "flex-col justify-start h-full"}`} >
|
||||
{#if props.masterDetail.isFormMode}
|
||||
<span class="flex flex-col items-center justify-center gap-4 tracking-widest font-semibold select-none">
|
||||
{#each "PATIENT".split("") as c}
|
||||
<span class="leading-none">{c}</span>
|
||||
{/each}
|
||||
<span class="flex flex-col items-center justify-start gap-4 tracking-widest font-semibold select-none h-full">
|
||||
<ArrowLeftIcon />
|
||||
<div class="flex flex-col items-center justify-center flex-grow gap-4">
|
||||
{#each "BACK TO PATIENT".split("") as c}
|
||||
<span class="leading-none">{c}</span>
|
||||
{/each}
|
||||
</div>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
|
||||
@ -255,6 +255,7 @@
|
||||
formState.form.HostID = '';
|
||||
formState.form.HostTestCode = '';
|
||||
formState.form.HostTestName = '';
|
||||
formState.selectOptions.HostID = [];
|
||||
formState.selectOptions.HostTestCode = [];
|
||||
formState.selectOptions.HostTestName = [];
|
||||
}
|
||||
|
||||
@ -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',
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user