+
diff --git a/app/composables/useQueryCRUD.ts b/app/composables/useQueryCRUD.ts
index a48e9a2b..f81649bd 100644
--- a/app/composables/useQueryCRUD.ts
+++ b/app/composables/useQueryCRUD.ts
@@ -19,7 +19,17 @@ export function useQueryCRUDMode(key: string = 'mode') {
})
const goToEntry = () => (mode.value = 'entry')
- const backToList = () =>(mode.value = 'list')
+ const backToList = () => {
+ router.push({
+ path: route.path,
+ query: {
+ ...route.query,
+ mode: 'list',
+ // HAPUS record-id
+ 'record-id': undefined,
+ },
+ })
+ }
return { mode, goToEntry, backToList }
}
diff --git a/app/composables/useRBAC.ts b/app/composables/useRBAC.ts
index ced57e3e..fcc28144 100644
--- a/app/composables/useRBAC.ts
+++ b/app/composables/useRBAC.ts
@@ -1,5 +1,13 @@
import type { Permission, RoleAccess } from '~/models/role'
+export interface PageOperationPermission {
+ canRead: boolean
+ canCreate: boolean
+ canUpdate: boolean
+ canDelete: boolean
+}
+
+
/**
* Check if user has access to a page
*/
@@ -36,6 +44,14 @@ export function useRBAC() {
const hasUpdateAccess = (roleAccess: RoleAccess) => checkPermission(roleAccess, 'U')
const hasDeleteAccess = (roleAccess: RoleAccess) => checkPermission(roleAccess, 'D')
+ const getPagePermissions = (roleAccess: RoleAccess): PageOperationPermission => ({
+ canRead : hasReadAccess(roleAccess),
+ canCreate: hasCreateAccess(roleAccess),
+ canUpdate: hasUpdateAccess(roleAccess),
+ canDelete: hasDeleteAccess(roleAccess),
+ })
+
+
return {
checkRole,
checkPermission,
@@ -44,5 +60,7 @@ export function useRBAC() {
hasReadAccess,
hasUpdateAccess,
hasDeleteAccess,
+ getPagePermissions,
+
}
}
diff --git a/app/handlers/general-consent.handler.ts b/app/handlers/general-consent.handler.ts
new file mode 100644
index 00000000..2f949f3f
--- /dev/null
+++ b/app/handlers/general-consent.handler.ts
@@ -0,0 +1,24 @@
+// Handlers
+import { genCrudHandler } from '~/handlers/_handler'
+
+// Services
+import { create, update, remove } from '~/services/general-consent.service'
+
+export const {
+ recId,
+ recAction,
+ recItem,
+ isReadonly,
+ isProcessing,
+ isFormEntryDialogOpen,
+ isRecordConfirmationOpen,
+ onResetState,
+ handleActionSave,
+ handleActionEdit,
+ handleActionRemove,
+ handleCancelForm,
+} = genCrudHandler({
+ create,
+ update,
+ remove,
+})
diff --git a/app/lib/utils.ts b/app/lib/utils.ts
index 9c0aada8..67f3d04b 100644
--- a/app/lib/utils.ts
+++ b/app/lib/utils.ts
@@ -1,6 +1,7 @@
import type { ClassValue } from 'clsx'
import { clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
+import { toast } from '~/components/pub/ui/toast'
export interface SelectOptionType<_T = string> {
value: string
@@ -151,4 +152,12 @@ export function printFormData(formData: FormData) {
}
}
console.log("-------------------------");
-}
\ No newline at end of file
+}
+
+export function unauthorizedToast() {
+ toast({
+ title: 'Unauthorized',
+ description: 'You are not authorized to perform this action.',
+ variant: 'destructive',
+ })
+}
diff --git a/app/models/general-consent.ts b/app/models/general-consent.ts
new file mode 100644
index 00000000..fe3ac97a
--- /dev/null
+++ b/app/models/general-consent.ts
@@ -0,0 +1,49 @@
+export interface GeneralConsent {
+ id: number
+ encounter_id: number
+ value: string
+}
+
+export interface ValueCreateDto {
+ relatives: string[]
+ responsibleName: string
+ responsiblePhone: string
+ informant: string
+ witness1: string
+ witness2: string
+}
+
+export interface CreateDto {
+ encounter_id: number
+ value: string
+}
+
+export interface UpdateDto {
+ id: number
+ problem: string
+ unit_id: number
+}
+
+export interface DeleteDto {
+ id: number
+}
+
+export function genCreateDto(): CreateDto {
+ return {
+ encounter_id: 0,
+ problem: '',
+ unit_id: 0,
+ }
+}
+
+export function genConsultation(): GeneralConsent {
+ return {
+ id: 0,
+ encounter_id: 0,
+ unit_id: 0,
+ doctor_id: 0,
+ problem: '',
+ solution: '',
+ repliedAt: '',
+ }
+}
diff --git a/app/pages/(features)/resume/add.vue b/app/pages/(features)/resume/add.vue
new file mode 100644
index 00000000..7cc707f9
--- /dev/null
+++ b/app/pages/(features)/resume/add.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
diff --git a/app/schemas/_generate-file.ts b/app/schemas/_generate-file.ts
new file mode 100644
index 00000000..0e0b05fc
--- /dev/null
+++ b/app/schemas/_generate-file.ts
@@ -0,0 +1,5 @@
+export interface GenerateFile {
+ entityType_code: string
+ ref_id: number
+ type_code: string
+}
diff --git a/app/schemas/general-consent.schema.ts b/app/schemas/general-consent.schema.ts
new file mode 100644
index 00000000..e06c7240
--- /dev/null
+++ b/app/schemas/general-consent.schema.ts
@@ -0,0 +1,16 @@
+import { z } from 'zod'
+import type { CreateDto } from '~/models/general-consent'
+
+const GeneralConsentSchema = z.object({
+ relatives: z.array(z.object({ name: z.string(), phone: z.string() })),
+ responsibleName: z.string().optional(),
+ responsiblePhone: z.string().optional(),
+ informant: z.string().optional(),
+ witness1: z.string().optional(),
+ witness2: z.string().optional(),
+})
+
+type GeneralConsentFormData = z.infer
& CreateDto
+
+export { GeneralConsentSchema }
+export type { GeneralConsentFormData }
diff --git a/app/schemas/resume.schema.ts b/app/schemas/resume.schema.ts
new file mode 100644
index 00000000..3e466a33
--- /dev/null
+++ b/app/schemas/resume.schema.ts
@@ -0,0 +1,76 @@
+import { z } from 'zod'
+import type { CreateDto } from '~/models/consultation'
+
+export type ResumeArrangementType = "krs" | "mrs" | "rujukInternal" | "rujukExternal" | "meninggal" | "other"
+
+const SecondaryDiagnosisSchema = z.object({
+ diagnosis: z.string({ required_error: 'Diagnosis harus diisi' }),
+ icd10: z.string({ required_error: 'ICD 10 harus diisi' }),
+ diagnosisBasis: z.string({ required_error: 'Dasar Diagnosis harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+})
+
+const SecondaryActionSchema = z.object({
+ action: z.string({ required_error: 'Action harus diisi' }),
+ icd9: z.string({ required_error: 'ICD 10 harus diisi' }),
+ actionBasis: z.string({ required_error: 'Dasar Action harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+})
+
+const ConsultationSchema = z.object({
+ consultation: z.string({ required_error: 'Consultation harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+ consultationReply: z.string({ required_error: 'Jawaban Consultation harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+})
+
+const ResumeSchema = z.object({
+ inDate: z.string({ required_error: 'Tanggal harus diisi' }),
+ outDate: z.string({ required_error: 'Tanggal harus diisi' }),
+ anamnesis: z.number({ required_error: 'Anamnesis harus diisi' })
+ .min(1, 'Anamnesis minimum 1 karakter')
+ .max(2048, 'Anamnesis maksimum 2048 karakter'),
+ physicalCheckup: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+ supplementCheckup: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+
+ primaryDiagnosis: z.string({ required_error: 'Diagnosis harus diisi' }),
+ secondaryDiagnosis: z.array(SecondaryDiagnosisSchema).optional(),
+
+ primaryOperativeNonOperativeAct: z.string({ required_error: 'Diagnosis harus diisi' }),
+ secondaryOperativeNonOperativeAct: z.array(SecondaryActionSchema).optional(),
+ medikamentosa: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+
+ consultation: z.array(ConsultationSchema).optional(),
+
+ arrangement: z.custom().default("krs"),
+ inpatientIndication: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter'),
+ faskes: z.string({ required_error: 'Faskes harus diisi' }).optional(),
+ clinic: z.string({ required_error: 'Klinik harus diisi' }).optional(),
+ deathDate: z.string({ required_error: 'Tanggal harus diisi' }).optional(),
+ deathCause: z.array(z.string()).optional().default([]),
+ deathCauseDescription: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter')
+ .optional(),
+ keterangan: z.string({ required_error: 'Uraian harus diisi' })
+ .min(1, 'Uraian minimum 1 karakter')
+ .max(2048, 'Uraian maksimum 2048 karakter')
+ .optional(),
+})
+
+type ResumeFormData = z.infer & (CreateDto)
+
+export { ResumeSchema }
+export type { ResumeFormData }
diff --git a/app/schemas/verification.schema.ts b/app/schemas/verification.schema.ts
new file mode 100644
index 00000000..db0319cf
--- /dev/null
+++ b/app/schemas/verification.schema.ts
@@ -0,0 +1,19 @@
+import { z } from 'zod'
+
+const VerificationSchema = z.object({
+ name: z.string({
+ required_error: 'Mohon lengkapi Nama Anda',
+ }),
+ email: z.string({
+ required_error: 'Mohon lengkapi email',
+ }),
+ password: z.string({
+ required_error: 'Mohon lengkapi password',
+ }),
+})
+
+
+type VerificationFormData = z.infer
+
+export { VerificationSchema, }
+export type { VerificationFormData, }
\ No newline at end of file
diff --git a/app/services/general-consent.service.ts b/app/services/general-consent.service.ts
new file mode 100644
index 00000000..2a6611fc
--- /dev/null
+++ b/app/services/general-consent.service.ts
@@ -0,0 +1,23 @@
+import * as base from './_crud-base'
+
+const path = '/api/v1/general-consent'
+
+export function create(data: any) {
+ return base.create(path, data)
+}
+
+export function getList(params: any = null) {
+ return base.getList(path, params)
+}
+
+export function getDetail(id: number | string) {
+ return base.getDetail(path, id)
+}
+
+export function update(id: number | string, data: any) {
+ return base.update(path, id, data)
+}
+
+export function remove(id: number | string) {
+ return base.remove(path, id)
+}
diff --git a/app/services/generate-file.service.ts b/app/services/generate-file.service.ts
new file mode 100644
index 00000000..5849e3d0
--- /dev/null
+++ b/app/services/generate-file.service.ts
@@ -0,0 +1,15 @@
+import * as base from './_crud-base'
+
+const path = '/api/v1/generate-file'
+
+export function create(data: any) {
+ return base.create(path, data)
+}
+
+export function getList(params: any = null) {
+ return base.getList(path, params)
+}
+
+export function getDetail(id: number | string) {
+ return base.getDetail(path, id)
+}