(null)
+const timestamp = ref(new Date().toISOString())
const headerPrep: HeaderPrep = {
title: "Surat Kontrol",
icon: 'i-lucide-newspaper',
- addNav: {
+}
+if (pagePermission.canCreate) {
+ headerPrep.addNav = {
label: "Surat Kontrol",
onClick: () => navigateTo({
name: 'rehab-encounter-id-control-letter-add',
params: { id: encounterId },
}),
- },
+ }
}
// #endregion
@@ -105,11 +127,12 @@ function handleCancelConfirmation() {
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
+provide('timestamp', isLoading)
provide('table_data_loader', isLoading)
// #endregion
// #region Watchers
-watch([recId, recAction], () => {
+watch([recId, recAction, timestamp], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
navigateTo({
@@ -119,17 +142,22 @@ watch([recId, recAction], () => {
break
case ActionEvents.showEdit:
- // TODO: Handle edit action
- // isFormEntryDialogOpen.value = true
- navigateTo({
- name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
- params: { id: encounterId, "control_letter_id": recId.value },
- })
+ if(pagePermission.canUpdate){
+ navigateTo({
+ name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
+ params: { id: encounterId, "control_letter_id": recId.value },
+ })
+ } else {
+ unauthorizedToast()
+ }
break
case ActionEvents.showConfirmDelete:
- // Trigger confirmation modal open
- isRecordConfirmationOpen.value = true
+ if(pagePermission.canDelete){
+ isRecordConfirmationOpen.value = true
+ } else {
+ unauthorizedToast()
+ }
break
}
})
@@ -151,8 +179,19 @@ watch([recId, recAction], () => {
:ref-search-nav="refSearchNav"
@search="handleSearch" />
+
+
+
+
+
+
@@ -172,5 +211,13 @@ watch([recId, recAction], () => {
+
+
+
diff --git a/app/components/pub/my-ui/data/print-btn.vue b/app/components/pub/my-ui/data/print-btn.vue
new file mode 100644
index 00000000..a3d131b8
--- /dev/null
+++ b/app/components/pub/my-ui/data/print-btn.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/lib/utils.ts b/app/lib/utils.ts
index 67f3d04b..e201a439 100644
--- a/app/lib/utils.ts
+++ b/app/lib/utils.ts
@@ -160,4 +160,4 @@ export function unauthorizedToast() {
description: 'You are not authorized to perform this action.',
variant: 'destructive',
})
-}
+}
\ No newline at end of file