feat: Implement item management module and add encounter initialization handler.
This commit is contained in:
@@ -41,6 +41,8 @@ const { defineField, errors, meta } = useForm({
|
||||
uom_code: '',
|
||||
infra_code: '',
|
||||
stock: 0,
|
||||
buyingPrice: 0,
|
||||
sellingPrice: 0,
|
||||
} as Partial<ItemFormData>,
|
||||
})
|
||||
|
||||
@@ -50,6 +52,8 @@ const [itemGroup_code, itemGroup_codeAttrs] = defineField('itemGroup_code')
|
||||
const [uom, uomAttrs] = defineField('uom_code')
|
||||
const [infra_code, infra_codeAttrs] = defineField('infra_code')
|
||||
const [stock, stockAttrs] = defineField('stock')
|
||||
const [buyingPrice, buyingPriceAttrs] = defineField('buyingPrice')
|
||||
const [sellingPrice, sellingPriceAttrs] = defineField('sellingPrice')
|
||||
|
||||
if (props.values) {
|
||||
if (props.values.code !== undefined) code.value = props.values.code
|
||||
@@ -58,6 +62,8 @@ if (props.values) {
|
||||
if (props.values.uom_code !== undefined) uom.value = props.values.uom_code
|
||||
if (props.values.infra_code !== undefined) infra_code.value = props.values.infra_code
|
||||
if (props.values.stock !== undefined) stock.value = props.values.stock
|
||||
if (props.values.buyingPrice !== undefined) buyingPrice.value = props.values.buyingPrice
|
||||
if (props.values.sellingPrice !== undefined) sellingPrice.value = props.values.sellingPrice
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -67,6 +73,8 @@ const resetForm = () => {
|
||||
uom.value = ''
|
||||
infra_code.value = ''
|
||||
stock.value = 0
|
||||
buyingPrice.value = 0
|
||||
sellingPrice.value = 0
|
||||
}
|
||||
|
||||
function onSubmitForm() {
|
||||
@@ -77,6 +85,8 @@ function onSubmitForm() {
|
||||
uom_code: uom.value || '',
|
||||
infra_code: infra_code.value || '',
|
||||
stock: Number(stock.value) || 0,
|
||||
buyingPrice: Number(buyingPrice.value) || 0,
|
||||
sellingPrice: Number(sellingPrice.value) || 0,
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
@@ -169,6 +179,30 @@ function onCancelForm() {
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Harga Beli</Label>
|
||||
<Field :errMessage="errors.buyingPrice">
|
||||
<Input
|
||||
id="buyingPrice"
|
||||
type="number"
|
||||
v-model="buyingPrice"
|
||||
v-bind="buyingPriceAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Harga Jual</Label>
|
||||
<Field :errMessage="errors.sellingPrice">
|
||||
<Input
|
||||
id="sellingPrice"
|
||||
type="number"
|
||||
v-model="sellingPrice"
|
||||
v-bind="sellingPriceAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
<div class="my-2 flex justify-end gap-2 py-2">
|
||||
<Button
|
||||
|
||||
@@ -4,7 +4,17 @@ import { defineAsyncComponent } from 'vue'
|
||||
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, {}, {}, {}, {}, {}, { width: 50 }],
|
||||
cols: [
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 100 },
|
||||
{ width: 50 },
|
||||
],
|
||||
|
||||
headers: [
|
||||
[
|
||||
@@ -14,11 +24,13 @@ export const config: Config = {
|
||||
{ label: 'UOM' },
|
||||
{ label: 'Infra' },
|
||||
{ label: 'Stok' },
|
||||
{ label: 'Harga Beli' },
|
||||
{ label: 'Harga Jual' },
|
||||
{ label: 'Aksi' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: ['code', 'name', 'itemGroup_code', 'uom_code', 'infra_code', 'stock', 'action'],
|
||||
keys: ['code', 'name', 'itemGroup_code', 'uom_code', 'infra_code', 'stock', 'buyingPrice', 'sellingPrice', 'action'],
|
||||
|
||||
delKeyNames: [
|
||||
{ key: 'code', label: 'Kode' },
|
||||
@@ -40,7 +52,27 @@ export const config: Config = {
|
||||
},
|
||||
stock: (rec: unknown): unknown => {
|
||||
const recX = rec as any
|
||||
return recX.stock || '-'
|
||||
const value = recX.stock
|
||||
if (value === null || value === undefined) {
|
||||
return '-'
|
||||
}
|
||||
return value
|
||||
},
|
||||
buyingPrice: (rec: unknown): unknown => {
|
||||
const recX = rec as any
|
||||
const value = recX.buyingPrice
|
||||
if (value === null || value === undefined) {
|
||||
return '-'
|
||||
}
|
||||
return value
|
||||
},
|
||||
sellingPrice: (rec: unknown): unknown => {
|
||||
const recX = rec as any
|
||||
const value = recX.sellingPrice
|
||||
if (value === null || value === undefined) {
|
||||
return '-'
|
||||
}
|
||||
return value
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import AppItemEntryForm from '~/components/app/item/entry-form.vue'
|
||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||
|
||||
// Constants
|
||||
import { infraGroupCodesKeys } from '~/lib/constants'
|
||||
import { itemGroupCodes } from '~/lib/constants'
|
||||
|
||||
// Helpers
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
@@ -33,9 +33,6 @@ import {
|
||||
handleCancelForm,
|
||||
} from '~/handlers/item.handler'
|
||||
|
||||
// Constants
|
||||
import { itemGroupCodes } from '~/lib/constants'
|
||||
|
||||
// Services
|
||||
import { getList, getDetail } from '~/services/item.service'
|
||||
import { getValueLabelList as getUomList } from '~/services/uom.service'
|
||||
@@ -171,7 +168,7 @@ onMounted(async () => {
|
||||
@submit="
|
||||
(values: ItemFormData | Record<string, any>, resetForm: () => void) => {
|
||||
if (recId > 0) {
|
||||
handleActionEdit(recId, values, getItemList, resetForm, toast)
|
||||
handleActionEdit(recItem?.code ? recItem.code : recId, values, getItemList, resetForm, toast)
|
||||
return
|
||||
}
|
||||
handleActionSave(values, getItemList, resetForm, toast)
|
||||
|
||||
@@ -56,211 +56,248 @@ const VaccineDataListAsync = defineAsyncComponent(() => import('~/components/con
|
||||
const InitialNursingStudyAsync = defineAsyncComponent(() => import('~/components/content/initial-nursing/entry.vue'))
|
||||
|
||||
const defaultKeys: Record<string, any> = {
|
||||
status: 'status',
|
||||
earlyNurseryAssessment: 'early-nursery-assessment',
|
||||
earlyMedicalAssessment: 'early-medical-assessment',
|
||||
earlyMedicalRehabAssessment: 'early-medical-rehab-assessment',
|
||||
functionAssessment: 'function-assessment',
|
||||
therapyProtocol: 'therapy-protocol',
|
||||
chemotherapyProtocol: 'chemotherapy-protocol',
|
||||
chemotherapyMedicine: 'chemotherapy-medicine',
|
||||
educationAssessment: 'education-assessment',
|
||||
generalConsent: 'general-consent',
|
||||
patientAmbNote: 'patient-amb-note',
|
||||
patientDevNote: 'patient-dev-note',
|
||||
prescription: 'prescription',
|
||||
deviceOrder: 'device-order',
|
||||
radiologyOrder: 'radiology-order',
|
||||
cpLabOrder: 'cp-lab-order',
|
||||
microLabOrder: 'micro-lab-order',
|
||||
paLabOrder: 'pa-lab-order',
|
||||
procedureRoomOrder: 'procedure-room-order',
|
||||
mcuResult: 'mcu-result',
|
||||
actionReport: 'action-report',
|
||||
surgeryReport: 'surgery-report',
|
||||
vaccineData: 'vaccine-data',
|
||||
consultation: 'consultation',
|
||||
controlLetter: 'control-letter',
|
||||
inpatientLetter: 'inpatient-letter',
|
||||
kfr: 'kfr',
|
||||
refBack: 'reference-back',
|
||||
screening: 'screening',
|
||||
supportingDocument: 'supporting-document',
|
||||
resume: 'resume',
|
||||
ambResume: 'amb-resume',
|
||||
priceList: 'price-list',
|
||||
initialNursingStudy: 'initial-nursing-study',
|
||||
}
|
||||
|
||||
const defaultMenus: Record<string, any> = {
|
||||
status: {
|
||||
id: 'status',
|
||||
id: defaultKeys.status,
|
||||
title: 'Status Masuk/Keluar',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
earlyNurseryAssessment: {
|
||||
id: 'early-nursery-assessment',
|
||||
id: defaultKeys.earlyNurseryAssessment,
|
||||
title: 'Pengkajian Awal Keperawatan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
earlyMedicalAssessment: {
|
||||
id: 'early-medical-assessment',
|
||||
id: defaultKeys.earlyMedicalAssessment,
|
||||
title: 'Pengkajian Awal Medis',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
earlyMedicalRehabAssessment: {
|
||||
id: 'rehab-medical-assessment',
|
||||
id: defaultKeys.earlyMedicalRehabAssessment,
|
||||
title: 'Pengkajian Awal Medis Rehabilitasi Medis',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'rehab',
|
||||
afterId: 'early-medical-assessment',
|
||||
afterId: defaultKeys.earlyMedicalAssessment,
|
||||
},
|
||||
functionAssessment: {
|
||||
id: 'function-assessment',
|
||||
id: defaultKeys.functionAssessment,
|
||||
title: 'Asesmen Fungsi',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'rehab',
|
||||
afterId: 'rehab-medical-assessment',
|
||||
afterId: defaultKeys.rehabMedicalAssessment,
|
||||
},
|
||||
therapyProtocol: {
|
||||
id: 'therapy-protocol',
|
||||
id: defaultKeys.therapyProtocol,
|
||||
classCode: ['ambulatory'],
|
||||
title: 'Protokol Terapi',
|
||||
unit: 'rehab',
|
||||
afterId: 'function-assessment',
|
||||
afterId: defaultKeys.functionAssessment,
|
||||
},
|
||||
chemotherapyProtocol: {
|
||||
id: 'chemotherapy-protocol',
|
||||
id: defaultKeys.chemotherapyProtocol,
|
||||
title: 'Protokol Kemoterapi',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'chemo',
|
||||
afterId: 'early-medical-assessment',
|
||||
afterId: defaultKeys.earlyMedicalAssessment,
|
||||
},
|
||||
chemotherapyMedicine: {
|
||||
id: 'chemotherapy-medicine',
|
||||
title: 'Protokol Obat Kemoterapi',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'chemo',
|
||||
afterId: 'chemotherapy-protocol',
|
||||
afterId: defaultKeys.chemotherapyProtocol,
|
||||
},
|
||||
educationAssessment: {
|
||||
id: 'education-assessment',
|
||||
id: defaultKeys.educationAssessment,
|
||||
title: 'Asesmen Kebutuhan Edukasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
generalConsent: {
|
||||
id: 'general-consent',
|
||||
id: defaultKeys.generalConsent,
|
||||
title: 'General Consent',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
patientAmbNote: {
|
||||
id: 'patient-amb-note',
|
||||
id: defaultKeys.patientAmbNote,
|
||||
title: 'CPRJ',
|
||||
classCode: ['ambulatory', 'emergency'],
|
||||
unit: 'all',
|
||||
},
|
||||
patientDevNote: {
|
||||
id: 'patient-dev-note',
|
||||
id: defaultKeys.patientDevNote,
|
||||
title: 'CPP',
|
||||
classCode: ['inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
prescription: {
|
||||
id: 'prescription',
|
||||
id: defaultKeys.prescription,
|
||||
title: 'Order Obat',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
deviceOrder: {
|
||||
id: 'device-order',
|
||||
id: defaultKeys.deviceOrder,
|
||||
title: 'Order Alkes',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
radiologyOrder: {
|
||||
id: 'radiology-order',
|
||||
id: defaultKeys.radiologyOrder,
|
||||
title: 'Order Radiologi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
cpLabOrder: {
|
||||
id: 'cp-lab-order',
|
||||
id: defaultKeys.cpLabOrder,
|
||||
title: 'Order Lab PK',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
microLabOrder: {
|
||||
id: 'micro-lab-order',
|
||||
id: defaultKeys.microLabOrder,
|
||||
title: 'Order Lab Mikro',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
paLabOrder: {
|
||||
id: 'pa-lab-order',
|
||||
id: defaultKeys.paLabOrder,
|
||||
title: 'Order Lab PA',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
procedureRoomOrder: {
|
||||
id: 'procedure-room-order',
|
||||
id: defaultKeys.procedureRoomOrder,
|
||||
title: 'Order Ruang Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
mcuResult: {
|
||||
id: 'mcu-result',
|
||||
id: defaultKeys.mcuResult,
|
||||
title: 'Hasil Penunjang',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
actionReport: {
|
||||
id: 'action-report',
|
||||
id: defaultKeys.actionReport,
|
||||
title: 'Laporan Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
surgeryReport: {
|
||||
id: 'surgery-report',
|
||||
id: defaultKeys.surgeryReport,
|
||||
title: 'Laporan Operasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
vaccineData: {
|
||||
id: 'vaccine-data',
|
||||
id: defaultKeys.vaccineData,
|
||||
title: 'Data Vaksin',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
consultation: {
|
||||
id: 'consultation',
|
||||
id: defaultKeys.consultation,
|
||||
title: 'Konsultasi',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
controlLetter: {
|
||||
id: 'control-letter',
|
||||
id: defaultKeys.controlLetter,
|
||||
title: 'Surat Kontrol',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
inpatientLetter: {
|
||||
id: 'inpatient-letter',
|
||||
id: defaultKeys.inpatientLetter,
|
||||
title: 'SPRI',
|
||||
classCode: ['ambulatory', 'emergency'],
|
||||
unit: 'all',
|
||||
},
|
||||
kfr: {
|
||||
id: 'kfr',
|
||||
id: defaultKeys.kfr,
|
||||
title: 'KFR',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
refBack: {
|
||||
id: 'reference-back',
|
||||
id: defaultKeys.refBack,
|
||||
title: 'PRB',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
screening: {
|
||||
id: 'screening',
|
||||
id: defaultKeys.screening,
|
||||
title: 'Skrinning MPP',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
supportingDocument: {
|
||||
id: 'supporting-document',
|
||||
id: defaultKeys.supportingDocument,
|
||||
title: 'Upload Dokumen Pendukung',
|
||||
classCode: ['ambulatory'],
|
||||
unit: 'all',
|
||||
},
|
||||
resume: {
|
||||
id: 'resume',
|
||||
id: defaultKeys.resume,
|
||||
title: 'Resume',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
ambResume: {
|
||||
id: 'amb-resume',
|
||||
id: defaultKeys.ambResume,
|
||||
title: 'Resume Medis Rawat Jalan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
priceList: {
|
||||
id: 'price-list',
|
||||
id: defaultKeys.priceList,
|
||||
title: 'Tarif Tindakan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
},
|
||||
initialNursingStudy: {
|
||||
id: 'initial-nursing-study',
|
||||
id: defaultKeys.initialNursingStudy,
|
||||
title: 'Kajian Awal Keperawatan',
|
||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||
unit: 'all',
|
||||
@@ -298,7 +335,7 @@ export function insertItemByAfterId(id: string, items: EncounterItem[], newItem:
|
||||
}
|
||||
|
||||
export function injectComponents(id: string | number, data: EncounterListData, meta: EncounterListData) {
|
||||
const currentKeys = { ...defaultKeys }
|
||||
const currentKeys = { ...defaultMenus }
|
||||
if (currentKeys?.status) {
|
||||
currentKeys.status['component'] = StatusAsync
|
||||
currentKeys.status['props'] = { encounter: data?.encounter }
|
||||
|
||||
@@ -7,6 +7,8 @@ const ItemSchema = z.object({
|
||||
uom_code: z.string({ required_error: 'UOM harus diisi' }).min(1, 'UOM harus diisi'),
|
||||
infra_code: z.string({ required_error: 'Infra harus diisi' }).optional(),
|
||||
stock: z.number({ required_error: 'Stok harus diisi' }).min(0, 'Stok tidak boleh kurang dari 0').optional(),
|
||||
buyingPrice: z.number({ required_error: 'Harga Beli harus diisi' }).min(0, 'Harga Beli tidak boleh kurang dari 0').optional(),
|
||||
sellingPrice: z.number({ required_error: 'Harga Jual harus diisi' }).min(0, 'Harga Jual tidak boleh kurang dari 0').optional(),
|
||||
})
|
||||
|
||||
type ItemFormData = z.infer<typeof ItemSchema>
|
||||
|
||||
Reference in New Issue
Block a user