34 lines
1.3 KiB
Svelte

<script>
import { Separator } from "$lib/components/ui/separator/index.js";
import { useMasterDetail } from "$lib/components/composable/use-master-detail.svelte";
import { getPatient } from "$lib/components/patient/api/patient-api";
import MasterPage from "$lib/components/patient/page/master-page.svelte";
import ViewPage from "$lib/components/patient/page/view-page.svelte";
import CreatePage from "$lib/components/patient/page/create-page.svelte";
import EditPage from "$lib/components/patient/page/edit-page.svelte";
const masterDetail = useMasterDetail({
onSelect: async (row) => {
return await getPatient(row.InternalPID);
},
});
</script>
<div class="flex w-full h-full overflow-hidden">
{#if masterDetail.showMaster}
<MasterPage {masterDetail} />
{/if}
<Separator orientation="vertical"/>
{#if masterDetail.showDetail}
<main class={`${masterDetail.isMobile ? 'w-full' : masterDetail.isFormMode ? 'w-[97%] flex flex-col items-start' : 'w-[65%]'} h-full overflow-y-auto flex flex-col items-center transition-all duration-300`}>
{#if masterDetail.mode === "view"}
<ViewPage {masterDetail}/>
{:else if masterDetail.mode === "create"}
<CreatePage {masterDetail}/>
{:else if masterDetail.mode === "edit"}
<EditPage {masterDetail}/>
{/if}
</main>
{/if}
</div>