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:
@@ -2,9 +2,13 @@
|
||||
// Components
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import AppCounterList from '~/components/app/counter/list.vue'
|
||||
import AppCounterEntryForm from '~/components/app/counter/entry-form.vue'
|
||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||
|
||||
// Constants
|
||||
import { infraGroupCodesKeys } from '~/lib/constants'
|
||||
|
||||
// Helpers
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
@@ -22,6 +26,7 @@ import {
|
||||
isProcessing,
|
||||
isFormEntryDialogOpen,
|
||||
isRecordConfirmationOpen,
|
||||
onResetState,
|
||||
handleActionSave,
|
||||
handleActionEdit,
|
||||
handleActionRemove,
|
||||
@@ -32,6 +37,7 @@ import {
|
||||
import { getList, getDetail } from '~/services/infra.service'
|
||||
|
||||
const title = ref('')
|
||||
|
||||
const {
|
||||
data,
|
||||
isLoading,
|
||||
@@ -39,10 +45,16 @@ const {
|
||||
searchInput,
|
||||
handlePageChange,
|
||||
handleSearch,
|
||||
fetchData: getCounterList,
|
||||
fetchData: getItemList,
|
||||
} = usePaginatedList({
|
||||
fetchFn: async ({ page, search }) => {
|
||||
const result = await getList({ search, page, infraGroup_code: 'counter' })
|
||||
fetchFn: async (params: any) => {
|
||||
const result = await getList({
|
||||
search: params.search,
|
||||
sort: 'createdAt:asc',
|
||||
'page-number': params['page-number'] || 0,
|
||||
'page-size': params['page-size'] || 10,
|
||||
'infraGroup-code': infraGroupCodesKeys.counter,
|
||||
})
|
||||
return { success: result.success || false, body: result.body || {} }
|
||||
},
|
||||
entityName: 'counter',
|
||||
@@ -52,7 +64,7 @@ const headerPrep: HeaderPrep = {
|
||||
title: 'Counter',
|
||||
icon: 'i-lucide-layout-list',
|
||||
refSearchNav: {
|
||||
placeholder: 'Cari counter...',
|
||||
placeholder: 'Cari (min. 3 karakter)...',
|
||||
minLength: 3,
|
||||
debounceMs: 500,
|
||||
showValidationFeedback: true,
|
||||
@@ -79,7 +91,7 @@ provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
const getCurrentCounterDetail = async (id: number | string) => {
|
||||
const getCurrentDetail = async (id: number | string) => {
|
||||
const result = await getDetail(id)
|
||||
if (result.success) {
|
||||
const currentValue = result.body?.data || {}
|
||||
@@ -91,12 +103,12 @@ const getCurrentCounterDetail = async (id: number | string) => {
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
getCurrentCounterDetail(recId.value)
|
||||
getCurrentDetail(recId.value)
|
||||
title.value = 'Detail Counter'
|
||||
isReadonly.value = true
|
||||
break
|
||||
case ActionEvents.showEdit:
|
||||
getCurrentCounterDetail(recId.value)
|
||||
getCurrentDetail(recId.value)
|
||||
title.value = 'Edit Counter'
|
||||
isReadonly.value = false
|
||||
break
|
||||
@@ -107,7 +119,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getCounterList()
|
||||
await getItemList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -115,6 +127,7 @@ onMounted(async () => {
|
||||
<Header
|
||||
v-model="searchInput"
|
||||
:prep="headerPrep"
|
||||
:ref-search-nav="headerPrep.refSearchNav"
|
||||
@search="handleSearch"
|
||||
class="mb-4 xl:mb-5"
|
||||
/>
|
||||
@@ -129,6 +142,12 @@ onMounted(async () => {
|
||||
:title="!!recItem ? title : 'Tambah Counter'"
|
||||
size="lg"
|
||||
prevent-outside
|
||||
@update:open="
|
||||
(value: any) => {
|
||||
onResetState()
|
||||
isFormEntryDialogOpen = value
|
||||
}
|
||||
"
|
||||
>
|
||||
<AppCounterEntryForm
|
||||
:schema="InfraSchema"
|
||||
@@ -138,10 +157,10 @@ onMounted(async () => {
|
||||
@submit="
|
||||
(values: InfraFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getCounterList, resetForm, toast)
|
||||
handleActionEdit(recId, values, getItemList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getCounterList, resetForm, toast)
|
||||
handleActionSave(values, getItemList, resetForm, toast)
|
||||
}
|
||||
"
|
||||
@cancel="handleCancelForm"
|
||||
@@ -152,7 +171,7 @@ onMounted(async () => {
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
action="delete"
|
||||
:record="recItem"
|
||||
@confirm="() => handleActionRemove(recId, getCounterList, toast)"
|
||||
@confirm="() => handleActionRemove(recId, getItemList, toast)"
|
||||
@cancel=""
|
||||
>
|
||||
<template #default="{ record }">
|
||||
|
||||
Reference in New Issue
Block a user