Feat Infra (#108)

* fix: adjustment some schemas

* fix(room): fixing integrate unit of room

* feat(warehouse): modify form and integration

* feat(counter): modify form and integration

* feat(screen): add list, form and integration

* feat(screen): add page for public screen

* fix: add on reset state at list

* fix: solve list of relation

* feat(chamber): integrate form to api chamber

* feat(bed): integrate form to api bed

* fix: add searching function on list service

* fix: rewrite style for dropdown and tree select

* fix: add sort params

* fix: add sort params on division + medicine

* feat(division-position): layouting form + list

* fix: add sort params for getValueList

* chore: modify side menu style

* chore: fix ui dashboard

* feat(division-position): add content list

* feat(division-position): add temporary page

* feat(division-position): modify content and entry form
This commit is contained in:
Muhammad Rifai
2025-10-10 20:36:07 +07:00
committed by GitHub
parent 4f0c1f4318
commit f94b6d273a
73 changed files with 2638 additions and 416 deletions
+92 -25
View File
@@ -26,6 +26,7 @@ import {
isProcessing,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
onResetState,
handleActionSave,
handleActionEdit,
handleActionRemove,
@@ -37,11 +38,14 @@ import { getList, getDetail, getValueLabelList } from '~/services/infra.service'
import { getValueLabelList as getSpecialistList } from '~/services/specialist.service'
import { getValueLabelList as getSubspecialistList } from '~/services/subspecialist.service'
import { getValueLabelList as getUnitList } from '~/services/unit.service'
import { getDetail as getItemDetail } from '~/services/item.service'
const parents = ref<{ value: string | number; label: string }[]>([])
const specialists = ref<{ value: string; label: string }[]>([])
const subspecialists = ref<{ value: string; label: string }[]>([])
const units = ref<{ value: string; label: string }[]>([])
const specialists = ref<{ value: string | number; label: string }[]>([])
const specialistsFiltered = ref<{ value: string | number; label: string }[]>([])
const subspecialists = ref<{ value: string | number; label: string }[]>([])
const subspecialistsFiltered = ref<{ value: string | number; label: string }[]>([])
const units = ref<{ value: string | number; label: string }[]>([])
const selectedUnit = ref<string | number | null>(null)
const selectedSpecialist = ref<string | number | null>(null)
const title = ref('')
@@ -58,10 +62,11 @@ const {
fetchFn: async (params: any) => {
const result = await getList({
search: params.search,
sort: 'createdAt:asc',
'page-number': params['page-number'] || 2,
'page-size': params['page-size'] || 10,
'infraGroup-code': infraGroupCodesKeys.room,
includes: 'parent,specialist,subspecialist,unit',
includes: 'parent',
})
return { success: result.success || false, body: result.body || {} }
},
@@ -72,7 +77,7 @@ const headerPrep: HeaderPrep = {
title: 'Ruangan',
icon: 'i-lucide-layout-list',
refSearchNav: {
placeholder: 'Cari Ruangan...',
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
@@ -103,6 +108,34 @@ const getCurrentDetail = async (id: number | string) => {
const result = await getDetail(id)
if (result.success) {
const currentValue = result.body?.data || {}
if (currentValue.item_id) {
const itemResult = await getItemDetail(currentValue.item_id)
if (itemResult.success) {
currentValue.item = itemResult.body?.data || {}
}
}
if (currentValue.rooms) {
const rooms: any = Array.isArray(currentValue.rooms) && currentValue.rooms.length > 0 ? currentValue.rooms[0] : {}
specialistsFiltered.value = rooms?.specialist
? [
{
value: rooms.specialist?.id ? Number(rooms.specialist.id) : '',
label: rooms.specialist?.name || '',
},
]
: []
subspecialistsFiltered.value = rooms?.subspecialist
? [
{
value: rooms.subspecialist?.id ? Number(rooms.subspecialist.id) : '',
label: rooms.subspecialist?.name || '',
},
]
: []
currentValue.unit_id = rooms?.unit_id || null
currentValue.specialist_id = rooms?.specialist_id || null
currentValue.subspecialist_id = rooms?.subspecialist_id || null
}
recItem.value = currentValue
isFormEntryDialogOpen.value = true
}
@@ -126,42 +159,67 @@ watch([recId, recAction], () => {
}
})
watch(selectedUnit, async (val) => {
if (val) {
specialists.value = await getSpecialistList({ 'unit-id': val, 'page-size': 100 })
watch(selectedUnit, async (value: string | number | null) => {
specialistsFiltered.value = []
if (value) {
selectedSpecialist.value = null
subspecialists.value = []
specialistsFiltered.value = specialists.value.filter((item: any) => Number(item.parent) === Number(value))
subspecialistsFiltered.value = []
} else {
specialists.value = []
selectedSpecialist.value = null
subspecialists.value = []
specialistsFiltered.value = []
subspecialistsFiltered.value = []
}
})
watch(selectedSpecialist, async (val) => {
if (val) {
subspecialists.value = await getSubspecialistList({ 'specialist-id': val, 'page-size': 100 })
watch(selectedSpecialist, async (value: string | number | null) => {
subspecialistsFiltered.value = []
if (value) {
subspecialistsFiltered.value = subspecialists.value.filter((item: any) => Number(item.parent) === Number(value))
} else {
subspecialists.value = []
subspecialistsFiltered.value = []
}
})
onMounted(async () => {
parents.value = await getValueLabelList({ 'infraGroup-code': infraGroupCodesKeys.floor })
units.value = await getUnitList({ 'page-size': 100 })
parents.value = await getValueLabelList({ sort: 'createdAt:asc', 'infraGroup-code': infraGroupCodesKeys.floor })
specialists.value = await getSpecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
subspecialists.value = await getSubspecialistList({ sort: 'createdAt:asc', 'page-size': 100 })
units.value = await getUnitList({ sort: 'createdAt:asc', 'page-size': 100 })
await getItemList()
})
</script>
<template>
<Header v-model="searchInput" :prep="headerPrep" @search="handleSearch" class="mb-4 xl:mb-5" />
<AppRoomList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<Header
v-model="searchInput"
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
@search="handleSearch"
class="mb-4 xl:mb-5"
/>
<AppRoomList
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Ruangan'" size="lg" prevent-outside>
<Dialog
v-model:open="isFormEntryDialogOpen"
:title="!!recItem ? title : 'Tambah Ruangan'"
size="lg"
prevent-outside
@update:open="
(value: any) => {
onResetState()
isFormEntryDialogOpen = value
}
"
>
<AppRoomEntryForm
:schema="InfraSchema"
:specialists="specialists"
:subspecialists="subspecialists"
:specialists="specialistsFiltered"
:subspecialists="subspecialistsFiltered"
:units="units"
:parents="parents"
:values="recItem"
@@ -191,9 +249,18 @@ onMounted(async () => {
>
<template #default="{ record }">
<div class="text-sm">
<p><strong>ID:</strong> {{ record?.id }}</p>
<p v-if="record?.name"><strong>Nama:</strong> {{ record.name }}</p>
<p v-if="record?.code"><strong>Kode:</strong> {{ record.code }}</p>
<p>
<strong>ID:</strong>
{{ record?.id }}
</p>
<p v-if="record?.name">
<strong>Nama:</strong>
{{ record.name }}
</p>
<p v-if="record?.code">
<strong>Kode:</strong>
{{ record.code }}
</p>
</div>
</template>
</RecordConfirmation>