🐛 fix (employee): fix user entry component on employee add page
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
|
||||
import { MaterialSchema, type MaterialFormData } from '~/schemas/material'
|
||||
|
||||
const data = ref({
|
||||
name: '',
|
||||
password: '',
|
||||
status: '',
|
||||
type: 'doctor',
|
||||
})
|
||||
|
||||
function onClick(type: string) {
|
||||
if (type === 'cancel') {
|
||||
navigateTo('/human-src/employee')
|
||||
} else if (type === 'draft') {
|
||||
// do something
|
||||
} else if (type === 'submit') {
|
||||
// do something
|
||||
}
|
||||
}
|
||||
|
||||
const items = [
|
||||
{ value: 'doctor', label: 'Dokter' },
|
||||
{ value: 'nurse', label: 'Perawat' },
|
||||
{ value: 'nutritionist', label: 'Ahli Gizi' },
|
||||
{ value: 'laborant', label: 'Laboran' },
|
||||
{ value: 'pharmacy', label: 'Farmasi' },
|
||||
{ value: 'payment', label: 'Pembayaran' },
|
||||
{ value: 'payment-verificator', label: 'Konfirmasi Pembayaran' },
|
||||
{ value: 'management', label: 'Management' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
|
||||
<Icon name="i-lucide-user" class="me-2" />
|
||||
<span class="font-semibold">Tambah</span> Karyawan
|
||||
</div>
|
||||
|
||||
<AppEmployeeEntryForm v-model="data" :items="items" />
|
||||
|
||||
<AppPersonEntryForm v-model="data" :items="items" :schema="MaterialSchema" />
|
||||
<AppPersonAddressEntryForm v-model="data" :items="items" :schema="MaterialSchema" />
|
||||
<AppPersonContactEntryForm v-model="data" :items="items" :schema="MaterialSchema" />
|
||||
<AppPersonRelativeEntryForm v-model="data" :items="items" :schema="MaterialSchema" />
|
||||
|
||||
<AppDoctorEntryForm v-if="data.type === 'doctor'" v-model="data" />
|
||||
<AppNurseEntryForm v-else-if="data.type === 'nurse'" v-model="data" />
|
||||
<AppPharmacistEntryForm v-else-if="data.type === 'pharmacist'" v-model="data" />
|
||||
<AppLaborantEntryForm v-else-if="data.type === 'laborant'" v-model="data" />
|
||||
<AppNutritionistEntryForm v-else-if="data.type === 'nutritionist'" v-model="data" />
|
||||
|
||||
<AppUserEntryForm v-model="data" />
|
||||
<div class="my-2 flex justify-end py-2">
|
||||
<Action @click="onClick" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import type { DataTableLoader } from '~/components/pub/base/data-table/type'
|
||||
import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
|
||||
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
|
||||
|
||||
const data = ref([])
|
||||
|
||||
const refSearchNav: RefSearchNav = {
|
||||
onClick: () => {
|
||||
// open filter modal
|
||||
},
|
||||
onInput: (_val: string) => {
|
||||
// filter patient list
|
||||
},
|
||||
onClear: () => {
|
||||
// clear url param
|
||||
},
|
||||
}
|
||||
|
||||
const isLoading = reactive<DataTableLoader>({
|
||||
isTableLoading: false,
|
||||
})
|
||||
|
||||
const recId = ref<number>(0)
|
||||
const recAction = ref<string>('')
|
||||
const recItem = ref<any>(null)
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: 'User',
|
||||
icon: 'i-lucide-users',
|
||||
addNav: {
|
||||
label: 'Tambah',
|
||||
onClick: () => navigateTo('/human-src/employee/add'),
|
||||
},
|
||||
}
|
||||
|
||||
async function getDoctorList() {
|
||||
isLoading.dataListLoading = true
|
||||
|
||||
const resp = await xfetch('/api/v1/doctor')
|
||||
if (resp.success) {
|
||||
data.value = (resp.body as Record<string, any>).data
|
||||
}
|
||||
|
||||
isLoading.dataListLoading = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDoctorList()
|
||||
})
|
||||
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('table_data_loader', isLoading)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
|
||||
<div class="my-4 flex flex-1 flex-col gap-4 md:gap-8">
|
||||
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user