Merge branch 'dev' of github.com:dikstub-rssa/simrs-fe into feat/satusehat

This commit is contained in:
Khafid Prayoga
2025-08-25 14:58:45 +07:00
44 changed files with 307 additions and 113 deletions

No files matched your search

+6 -5
View File
@@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import Block from '~/components/pub/form/block.vue' import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/form/field-group.vue' import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/form/field.vue' import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/form/label.vue' import Label from '~/components/pub/custom-ui/form/label.vue'
import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
const props = defineProps<{ modelValue: any }>() const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event']) const emit = defineEmits(['update:modelValue', 'event'])
@@ -110,7 +111,7 @@ function onClick(type: string) {
</div> </div>
</div> </div>
<div class="my-2 flex justify-end py-2"> <div class="my-2 flex justify-end py-2">
<PubNavFooterCsd @click="onClick" /> <Action @click="onClick" />
</div> </div>
</form> </form>
</template> </template>
+15 -2
View File
@@ -1,11 +1,23 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '../../pub/nav/types' import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/nav/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue')) const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [ export const cols: Col[] = [
{ width: 100 }, { width: 100 },
{ width: 250 }, { width: 250 },
@@ -32,6 +44,7 @@ export const header: Th[][] = [
{ label: 'Fee Ranap' }, { label: 'Fee Ranap' },
{ label: 'Fee Rajal' }, { label: 'Fee Rajal' },
{ label: 'Status' }, { label: 'Status' },
{ label: '' },
], ],
] ]
+6 -5
View File
@@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import Block from '~/components/pub/form/block.vue' import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/form/field-group.vue' import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/form/field.vue' import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/form/label.vue' import Label from '~/components/pub/custom-ui/form/label.vue'
import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
</script> </script>
<template> <template>
@@ -41,7 +42,7 @@ import Label from '~/components/pub/form/label.vue'
</Block> </Block>
</div> </div>
<div class="my-2 flex justify-end py-2"> <div class="my-2 flex justify-end py-2">
<PubNavFooterCsd /> <Action />
</div> </div>
</form> </form>
</template> </template>
+9 -2
View File
@@ -1,9 +1,16 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '../../pub/nav/types' import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/nav/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue')) const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
export const cols: Col[] = [ export const cols: Col[] = [
@@ -1,9 +1,9 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '../../pub/nav/types' import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/nav/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [ export const cols: Col[] = [
{}, {},
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Summary } from '~/components/pub/base/summary-card.type'; import type { Summary } from '~/components/pub/base/summary-card/type';
const props = defineProps<{ const props = defineProps<{
isLoading: boolean isLoading: boolean
-1
View File
@@ -15,7 +15,6 @@ export const rowStatus = {
2: 'Terkirim', 2: 'Terkirim',
} }
const action = defineAsyncComponent(() => import('~/components/pub/nav/dropdown-action-dud.vue'))
const patientBadge = defineAsyncComponent(() => import('./badge-patient.vue')) const patientBadge = defineAsyncComponent(() => import('./badge-patient.vue'))
const statusBadge = defineAsyncComponent(() => import('./badge-status.vue')) const statusBadge = defineAsyncComponent(() => import('./badge-status.vue'))
+7 -5
View File
@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/nav/types' import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
import type { DataTableLoader } from '~/components/pub/base/data-table/type';
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
const data = ref([]) const data = ref([])
@@ -15,8 +17,8 @@ const refSearchNav: RefSearchNav = {
}, },
} }
const isLoading = reactive({ const isLoading = reactive<DataTableLoader>({
dataListLoading: false, isTableLoading: false,
}) })
const recId = ref<number>(0) const recId = ref<number>(0)
@@ -51,10 +53,10 @@ onMounted(() => {
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('pull_data', isLoading) provide('table_data_loader', isLoading)
</script> </script>
<template> <template>
<PubNavHeaderPrep :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" /> <Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" /> <AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
</template> </template>
+13 -11
View File
@@ -1,7 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Summary } from '~/components/pub/base/summary-card.type' import type { DataTableLoader } from '~/components/pub/base/data-table/type';
import type { HeaderPrep, RefSearchNav } from '~/components/pub/nav/types' import type { Summary } from '~/components/pub/base/summary-card/type'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next' import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next'
import SummaryCard from '~/components/pub/base/summary-card/summary-card.vue'
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
const data = ref([]) const data = ref([])
@@ -18,9 +21,9 @@ const refSearchNav: RefSearchNav = {
} }
// Loading state management // Loading state management
const isLoading = reactive({ const isLoading = reactive<DataTableLoader>({
summary: false, summary: false,
dataListLoading: false, isTableLoading: false,
}) })
const recId = ref<number>(0) const recId = ref<number>(0)
@@ -83,13 +86,12 @@ async function getPatientSummary() {
} }
async function getPatientList() { async function getPatientList() {
isLoading.dataListLoading = true isLoading.isTableLoading = true
const resp = await xfetch('/api/v1/patient') const resp = await xfetch('/api/v1/patient')
console.log('data patient', resp)
if (resp.success) { if (resp.success) {
data.value = (resp.body as Record<string, any>).data data.value = (resp.body as Record<string, any>).data
} }
isLoading.dataListLoading = false isLoading.isTableLoading = false
} }
onMounted(() => { onMounted(() => {
@@ -100,18 +102,18 @@ onMounted(() => {
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('pull_data', isLoading) provide('table_data_loader', isLoading)
</script> </script>
<template> <template>
<PubNavHeaderPrep :prep="{ ...hreaderPrep }" :ref-search-nav="refSearchNav" /> <Header :prep="{ ...hreaderPrep }" :ref-search-nav="refSearchNav" />
<div class="my-4 flex flex-1 flex-col gap-4 md:gap-8"> <div class="my-4 flex flex-1 flex-col gap-4 md:gap-8">
<div class="grid gap-4 md:grid-cols-2 md:gap-8 lg:grid-cols-4"> <div class="grid gap-4 md:grid-cols-2 md:gap-8 lg:grid-cols-4">
<template v-if="isLoading.summary"> <template v-if="isLoading.summary">
<PubBaseSummaryCard v-for="n in 4" :key="n" is-skeleton /> <SummaryCard v-for="n in 4" :key="n" is-skeleton />
</template> </template>
<template v-else> <template v-else>
<PubBaseSummaryCard v-for="card in summaryData" :key="card.title" :stat="card" /> <SummaryCard v-for="card in summaryData" :key="card.title" :stat="card" />
</template> </template>
</div> </div>
<AppPatientList :data="data" /> <AppPatientList :data="data" />
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/nav/types' import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
import type { DataTableLoader } from '~/components/pub/base/data-table/type';
import RehabSepProsedurList from '~/components/app/rehab/registration/sep-prosedur/list.vue' import RehabSepProsedurList from '~/components/app/rehab/registration/sep-prosedur/list.vue'
const props = defineProps<{ const props = defineProps<{
@@ -21,9 +22,9 @@ const refSearchNav: RefSearchNav = {
} }
// Loading state management // Loading state management
const isLoading = reactive({ const isLoading = reactive<DataTableLoader>({
summary: false, isTableLoading: false,
table: false,
}) })
const recId = ref<number>(0) const recId = ref<number>(0)
const recAction = ref<string>('') const recAction = ref<string>('')
@@ -40,7 +41,6 @@ const hreaderPrep: HeaderPrep = {
async function getPatientList() { async function getPatientList() {
const resp = await xfetch('/api/v1/patient') const resp = await xfetch('/api/v1/patient')
console.log('data patient', resp)
if (resp.success) { if (resp.success) {
data.value = (resp.body as Record<string, any>).data data.value = (resp.body as Record<string, any>).data
} }
@@ -53,12 +53,12 @@ onMounted(() => {
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('table_data_loader', isLoading)
</script> </script>
<template> <template>
<PubNavHeaderPrep :prep="{ ...hreaderPrep }" :ref-search-nav="refSearchNav" /> <Header :prep="{ ...hreaderPrep }" :ref-search-nav="refSearchNav" />
<div class="my-4 flex flex-1 flex-col gap-4 md:gap-8"> <div class="my-4 flex flex-1 flex-col gap-4 md:gap-8">
<RehabSepProsedurList :data="data" /> <RehabSepProsedurList :data="data" />
</div> </div>
</template> </template>
/template>
+14 -12
View File
@@ -1,15 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ServiceStatus } from '~/components/pub/base/service-status.type' import type { DataTableLoader } from '~/components/pub/base/data-table/type';
import type { Summary } from '~/components/pub/base/summary-card.type' import type { ServiceStatus } from '~/components/pub/base/service-status/type'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/nav/types' import type { Summary } from '~/components/pub/base/summary-card/type'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
import { useUrlSearchParams } from '@vueuse/core' import { useUrlSearchParams } from '@vueuse/core'
import { CircleCheckBig, CircleDashed, CircleX, Ellipsis, Search, Send } from 'lucide-vue-next' import { CircleCheckBig, CircleDashed, CircleX, Ellipsis, Search, Send } from 'lucide-vue-next'
import Header from '~/components/pub/custom-ui/nav-header/header.vue';
// State management // State management
const data = ref([]) const data = ref([])
const isLoading = reactive({ const isLoading = reactive<DataTableLoader>({
satusehatConn: true, satusehatConn: true,
dataListLoading: false, isTableLoading: false,
}) })
const params = useUrlSearchParams('history', { const params = useUrlSearchParams('history', {
@@ -38,7 +40,7 @@ const pagination = ref({
// API function to fetch data // API function to fetch data
async function fetchData() { async function fetchData() {
try { try {
isLoading.dataListLoading = true isLoading.isTableLoading = true
const response: any = await $fetch('/api/v1/satusehat/list', { const response: any = await $fetch('/api/v1/satusehat/list', {
method: 'POST', method: 'POST',
body: { body: {
@@ -59,7 +61,7 @@ async function fetchData() {
} catch (error) { } catch (error) {
console.error('Error fetching data:', error) console.error('Error fetching data:', error)
} finally { } finally {
isLoading.dataListLoading = false isLoading.isTableLoading = false
} }
} }
@@ -161,7 +163,7 @@ onMounted(async () => {
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('pull_data', isLoading) provide('table_data_loader', isLoading)
const tabs = [ const tabs = [
{ {
@@ -206,10 +208,10 @@ const activeTabFilter = computed({
</script> </script>
<template> <template>
<PubNavHeaderPrep :prep="headerPrep" /> <Header :prep="headerPrep" />
<div class="my-4 flex flex-1 flex-col gap-3 md:gap-4"> <div class="my-4 flex flex-1 flex-col gap-3 md:gap-4">
<PubBaseServiceStatus v-bind="service" /> <PubBaseServiceStatus v-bind="service" />
<AppSatusehatCardSummary :is-loading="isLoading.satusehatConn" :summary-data="summaryData" /> <AppSatusehatCardSummary :is-loading="isLoading.satusehatConn!" :summary-data="summaryData" />
</div> </div>
<div class="rounded-md border p-4"> <div class="rounded-md border p-4">
<h2 class="text-md font-semibold py-2">FHIR Resource</h2> <h2 class="text-md font-semibold py-2">FHIR Resource</h2>
@@ -298,11 +300,11 @@ const activeTabFilter = computed({
<TabsContent v-for="tab in tabs" :key="`content-${tab.value}`" :value="tab.value"> <TabsContent v-for="tab in tabs" :key="`content-${tab.value}`" :value="tab.value">
<div class="rounded-md border p-4"> <div class="rounded-md border p-4">
<!-- <Ellipsis v-if="isLoading.satusehatConn || isLoading.dataList" --> <!-- <Ellipsis v-if="isLoading.satusehatConn || isLoading.dataList" -->
<!-- class="size-6 animate-pulse text-muted-foreground mx-auto" /> --> <!-- class="size-6 animate-pulse text-muted-foreground mx-auto" /> -->
<AppSatusehatList v-if="!isLoading.satusehatConn" :data="data" /> <AppSatusehatList v-if="!isLoading.satusehatConn" :data="data" />
<!-- Pagination --> <!-- Pagination -->
<div v-if="!isLoading.satusehatConn && !isLoading.dataListLoading && pagination.total > 0" <div v-if="!isLoading.satusehatConn && !isLoading.isTableLoading && pagination.total > 0"
class="mt-4 flex justify-between items-center"> class="mt-4 flex justify-between items-center">
<div class="text-sm text-muted-foreground"> <div class="text-sm text-muted-foreground">
Menampilkan {{ ((pagination.page - 1) * pagination.limit) + 1 }} - Menampilkan {{ ((pagination.page - 1) * pagination.limit) + 1 }} -
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
import type { DataTableLoader } from './type'
defineProps<{ defineProps<{
rows: unknown[] rows: unknown[]
cols: any[] cols: any[]
@@ -11,7 +11,7 @@ defineProps<{
funcComponent: Record<string, (row: any, idx: number) => any> funcComponent: Record<string, (row: any, idx: number) => any>
}>() }>()
const pullData = inject('pull_data') as any const loader = inject('table_data_loader') as DataTableLoader
</script> </script>
<template> <template>
@@ -25,7 +25,7 @@ const pullData = inject('pull_data') as any
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<TableBody v-if="pullData.dataListLoading"> <TableBody v-if="loader.isTableLoading">
<!-- Loading state with 5 skeleton rows --> <!-- Loading state with 5 skeleton rows -->
<TableRow v-for="n in 5" :key="`skeleton-${n}`"> <TableRow v-for="n in 5" :key="`skeleton-${n}`">
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-skel-${n}-${cellIndex}`"> <TableCell v-for="(key, cellIndex) in keys" :key="`cell-skel-${n}-${cellIndex}`">
@@ -0,0 +1,4 @@
export interface DataTableLoader {
isTableLoading: boolean
[key: string]: boolean
}
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ServiceStatus } from './service-status.type' import type { ServiceStatus } from './type'
import { Loader, Loader2 } from 'lucide-vue-next' import { Loader, Loader2 } from 'lucide-vue-next'
import { cn } from '~/lib/utils' import { cn } from '~/lib/utils'
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Summary } from './summary-card.type' import type { Summary } from './type'
import { ChevronDown, ChevronUp } from 'lucide-vue-next' import { ChevronDown, ChevronUp } from 'lucide-vue-next'
import { cn } from '~/lib/utils' import { cn } from '~/lib/utils'
@@ -0,0 +1,32 @@
<script setup lang="ts">
type ClickType = 'cancel' | 'draft' | 'submit'
const emit = defineEmits<{
(e: 'click', type: ClickType): void
}>()
function onClick(type: ClickType) {
emit('click', type)
}
</script>
<template>
<div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Back
</Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2" />
Draf
</Button>
<Button class="bg-primary" type="button" @click="onClick('submit')">
<Icon name="i-lucide-check" class="me-2 align-middle" />
Submit
</Button>
<Button class="bg-primary" type="button" @click="onClick('print')">
<Icon name="i-lucide-printer" class="me-2 align-middle" />
Print
</Button>
</div>
</template>
@@ -14,15 +14,15 @@ function onClick(type: ClickType) {
<div class="m-2 flex gap-2 px-2"> <div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')"> <Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" /> <Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Kembali Back
</Button> </Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')"> <Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2" /> <Icon name="i-lucide-file" class="me-2" />
Draf Draft
</Button> </Button>
<Button class="bg-primary" type="button" @click="onClick('submit')"> <Button class="bg-primary" type="button" @click="onClick('submit')">
<Icon name="i-lucide-check" class="me-2 align-middle" /> <Icon name="i-lucide-check" class="me-2 align-middle" />
Selesai Submit
</Button> </Button>
</div> </div>
</template> </template>
@@ -0,0 +1,32 @@
<script setup lang="ts">
type ClickType = 'cancel' | 'draft' | 'submit'
const emit = defineEmits<{
(e: 'click', type: ClickType): void
}>()
function onClick(type: ClickType) {
emit('click', type)
}
</script>
<template>
<div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Back
</Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2" />
Edit
</Button>
<Button class="bg-red-500" type="button" @click="onClick('submit')">
<Icon name="i-lucide-trash" class="me-2 align-middle" />
Delete
</Button>
<Button class="bg-primary" type="button" @click="onClick('print')">
<Icon name="i-lucide-printer" class="me-2 align-middle" />
Print
</Button>
</div>
</template>
@@ -0,0 +1,28 @@
<script setup lang="ts">
type ClickType = 'cancel' | 'draft' | 'submit'
const emit = defineEmits<{
(e: 'click', type: ClickType): void
}>()
function onClick(type: ClickType) {
emit('click', type)
}
</script>
<template>
<div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Back
</Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2" />
Edit
</Button>
<Button class="bg-red-500" type="button" @click="onClick('submit')">
<Icon name="i-lucide-trash" class="me-2 align-middle" />
Delete
</Button>
</div>
</template>
@@ -0,0 +1,28 @@
<script setup lang="ts">
type ClickType = 'cancel' | 'draft' | 'submit'
const emit = defineEmits<{
(e: 'click', type: ClickType): void
}>()
function onClick(type: ClickType) {
emit('click', type)
}
</script>
<template>
<div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Back
</Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2" />
Edit
</Button>
<Button class="bg-primary" type="button" @click="onClick('print')">
<Icon name="i-lucide-printer" class="me-2 align-middle" />
Print
</Button>
</div>
</template>
@@ -0,0 +1,24 @@
<script setup lang="ts">
type ClickType = 'cancel' | 'draft' | 'submit'
const emit = defineEmits<{
(e: 'click', type: ClickType): void
}>()
function onClick(type: ClickType) {
emit('click', type)
}
</script>
<template>
<div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" type="button" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Back
</Button>
<Button class="bg-orange-500" variant="outline" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" class="me-2 align-middle" />
Edit
</Button>
</div>
</template>
@@ -14,11 +14,11 @@ function onClick(type: ClickType) {
<div class="m-2 flex gap-2 px-2"> <div class="m-2 flex gap-2 px-2">
<Button class="bg-gray-400" @click="onClick('cancel')"> <Button class="bg-gray-400" @click="onClick('cancel')">
<Icon name="i-lucide-arrow-left" class="me-2 align-middle" /> <Icon name="i-lucide-arrow-left" class="me-2 align-middle" />
Kembali Back
</Button> </Button>
<Button class="bg-primary" @click="onClick('submit')"> <Button class="bg-primary" @click="onClick('submit')">
<Icon name="i-lucide-check" class="me-2 align-middle" /> <Icon name="i-lucide-check" class="me-2 align-middle" />
Selesai Submit
</Button> </Button>
</div> </div>
</template> </template>
@@ -0,0 +1,19 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '../types.ts'
const props = defineProps<{
prep: HeaderPrep
refSearchNav: RefSearchNav
}>()
</script>
<template>
<header>
<div class="flex items-center">
<div class="ml-3 text-lg font-bold text-gray-900">
<Icon :name="prep.icon" class="mr-2 h-4 w-4 align-middle" />
{{ prep.title }}
</div>
</div>
</header>
</template>
@@ -0,0 +1,42 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '../types.ts'
const props = defineProps<{
prep: HeaderPrep
refSearchNav: RefSearchNav
}>()
function emitSearchNavClick() {
props.refSearchNav.onClick()
}
function onInput(event: Event) {
props.refSearchNav.onInput((event.target as HTMLInputElement).value)
}
function btnClick() {
props.prep.addNav?.onClick()
}
</script>
<template>
<header>
<div class="flex items-center">
<div class="ml-3 text-lg text-gray-900">
<Input
type="text"
placeholder="Search"
class="w-full rounded-md border bg-white px-4 py-2 text-gray-900 sm:text-sm"
@click="emitSearchNavClick"
@input="onInput"
/>
</div>
<div v-if="prep.addNav" class="m-2 flex items-center">
<Button size="md" class="rounded-md border border-gray-300 px-4 py-2 text-white sm:text-sm" @click="btnClick">
<Icon name="i-lucide-plus" class="mr-2 h-4 w-4 align-middle" />
{{ prep.addNav.label }}
</Button>
</div>
</div>
</header>
</template>
-46
View File
@@ -1,46 +0,0 @@
<script setup lang="ts">
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
defineProps<{
rows: unknown[]
cols: object
header: object[]
keys: string[]
funcParsed: object
funcHtml: object
funcComponent: object
}>()
</script>
<template>
<Table>
<TableHeader>
<TableRow>
<TableHead
v-for="(h, idx) in header[0]"
:key="`head-${idx}`"
:style="{ width: cols[idx]?.width ? `${cols[idx].width}px` : undefined }"
>
{{ h.label }}
</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="(row, rowIndex) in rows" :key="`row-${rowIndex}`">
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-${rowIndex}-${cellIndex}`">
<!-- If funcComponent has a renderer -->
<component
:is="funcComponent[key](row, rowIndex).component"
v-if="funcComponent[key]"
v-bind="funcComponent[key](row, rowIndex)"
/>
<!-- If funcParsed or funcHtml returns a value -->
<template v-else>
{{ funcParsed[key]?.(row) ?? funcHtml[key]?.(row) ?? row[key] }}
</template>
</TableCell>
</TableRow>
</TableBody>
</Table>
</template>
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PagePermission } from '~/models/role' import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/base/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission' import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({ definePageMeta({
@@ -36,5 +37,5 @@ const canCreate = hasCreateAccess(roleAccess)
<div v-if="canCreate"> <div v-if="canCreate">
<FlowDoctorAdd /> <FlowDoctorAdd />
</div> </div>
<PubBaseError v-else :status-code="403" /> <Error v-else :status-code="403" />
</template> </template>
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PagePermission } from '~/models/role' import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/base/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission' import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({ definePageMeta({
@@ -34,6 +35,6 @@ const canRead = hasReadAccess(roleAccess)
<div v-if="canRead"> <div v-if="canRead">
<FlowDoctorList /> <FlowDoctorList />
</div> </div>
<PubBaseError v-else :status-code="403" /> <Error v-else :status-code="403" />
</div> </div>
</template> </template>
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PagePermission } from '~/models/role' import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/base/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission' import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({ definePageMeta({
@@ -36,5 +37,5 @@ const canCreate = hasCreateAccess(roleAccess)
<div v-if="canCreate"> <div v-if="canCreate">
<FlowPatientAdd /> <FlowPatientAdd />
</div> </div>
<PubBaseError v-else :status-code="403" /> <Error v-else :status-code="403" />
</template> </template>
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PagePermission } from '~/models/role' import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/base/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission' import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({ definePageMeta({
@@ -34,6 +35,6 @@ const canRead = hasReadAccess(roleAccess)
<div v-if="canRead"> <div v-if="canRead">
<FlowPatientList /> <FlowPatientList />
</div> </div>
<PubBaseError v-else :status-code="403" /> <Error v-else :status-code="403" />
</div> </div>
</template> </template>