-
+
+
-
\ No newline at end of file
+
+
diff --git a/src/components/AsideWhite.vue b/src/components/AsideWhite.vue
deleted file mode 100644
index 3e614f3..0000000
--- a/src/components/AsideWhite.vue
+++ /dev/null
@@ -1,285 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/Header.vue b/src/components/Header.vue
index 85408d2..5f6f129 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -8,6 +8,7 @@ import { useAuthStore } from '@/stores/auth'
import { useUserStore } from '@/stores/user'
import { useCommandPalattesStore } from '@/stores/command'
import { useMessageStore } from '@/stores/message'
+import { useMenuStore } from '@/stores/menu'
import {
Menu,
MenuButton,
@@ -23,22 +24,18 @@ import {
import { MagnifyingGlassIcon } from '@heroicons/vue/24/solid'
import { onMounted, onUnmounted, ref } from 'vue'
import PictureInitial from './PictureInitial.vue'
+import Icon from '@/assets/images/pln-with-text.png'
+import { useDialogStore } from '@/stores/dialog'
const authStore = useAuthStore()
const userStore = useUserStore()
const messageStore = useMessageStore()
const commandStore = useCommandPalattesStore()
+const menu = useMenuStore()
+const dialog = useDialogStore()
-const props = defineProps({ sideBarStatus: Boolean })
-const status = ref(props.sideBarStatus)
-const emits = defineEmits(['onChangeSideBarStatus'])
+const openSideBar = () => menu.toggleSidebar()
-const openSideBar = () => {
- status.value = true
- emits('onChangeSideBarStatus', true)
-};
-
-const dialogLogout = ref(false)
const dialogChangePassword = ref(false)
const handleOnDismissDialogChangePassword = () => {
@@ -49,38 +46,30 @@ const showDialogChangePassword = () => {
dialogChangePassword.value = true
}
-const handleOnDismissDialogLogout = () => {
- dialogLogout.value = false
-}
-
const showDialogLogout = () => {
- dialogLogout.value = true
+ dialog.type = 'error'
+ dialog.title = 'Keluar dari akun?'
+ dialog.content = 'Apakah Anda sudah yakin akan keluar dari akun ini?'
+ dialog.cancelText = 'Batalkan'
+ dialog.confirmText = 'Ya, keluar'
+ dialog.showCancelButton = true
+ dialog.onConfirm = () => {
+ window.location.href = '/login'
+ }
+ dialog.open = true
}
-
-const handleOnConfirmDialogLogout = () => {
- authStore.logout()
- window.location.href = '/login'
-}
-
-onMounted(() => {
- // document.addEventListener('keydown', commandStore.onKeyPressed);
- // document.addEventListener('keyup', commandStore.onKeyUp);
-});
-
-onUnmounted(() => {
- // document.removeEventListener('keydown', commandStore.onKeyPressed);
- // document.removeEventListener('keyup', commandStore.onKeyUp);
-});
-
-
diff --git a/src/components/Menus/MenuProvider.vue b/src/components/Menus/MenuProvider.vue
index 012d85f..6f314ac 100644
--- a/src/components/Menus/MenuProvider.vue
+++ b/src/components/Menus/MenuProvider.vue
@@ -1,5 +1,6 @@
-
+
{{ currentRouteName }}
diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue
index 09883ce..b37e4fc 100644
--- a/src/components/Navigation.vue
+++ b/src/components/Navigation.vue
@@ -1,16 +1,9 @@
-
-
+
+
\ No newline at end of file
diff --git a/src/stores/dialog.ts b/src/stores/dialog.ts
new file mode 100644
index 0000000..651b640
--- /dev/null
+++ b/src/stores/dialog.ts
@@ -0,0 +1,50 @@
+
+import { defineStore } from 'pinia'
+import { ref, watch } from 'vue'
+
+export const useDialogStore = defineStore('dialog', () => {
+ const onConfirm = ref()
+ const onCancel = ref()
+ const confirmText = ref('')
+ const cancelText = ref('')
+ const open = ref(false)
+ const title = ref('')
+ const content = ref('')
+ const type = ref('normal')
+ const showCancelButton = ref(true)
+ const dismissOnAction = ref(true)
+
+ const timer = ref()
+ watch(open, (value) => {
+ if (!value) {
+ // check if timer is set
+ if (timer.value) {
+ clearTimeout(timer.value)
+ }
+
+ timer.value = setTimeout(() => {
+ onConfirm.value = () => { }
+ onCancel.value = () => { }
+ dismissOnAction.value = true
+ showCancelButton.value = true
+ }, 2000)
+ } else {
+ if (timer.value) {
+ clearTimeout(timer.value)
+ }
+ }
+ })
+
+ return {
+ showCancelButton,
+ dismissOnAction,
+ onConfirm,
+ onCancel,
+ title,
+ content,
+ type,
+ open,
+ confirmText,
+ cancelText,
+ }
+})
\ No newline at end of file
diff --git a/src/stores/menu.ts b/src/stores/menu.ts
index 4faeaee..2984f8a 100644
--- a/src/stores/menu.ts
+++ b/src/stores/menu.ts
@@ -2,11 +2,9 @@ import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import {
BoltIcon,
- Cog6ToothIcon,
ComputerDesktopIcon,
DocumentDuplicateIcon,
DocumentTextIcon,
- FolderArrowDownIcon,
FolderOpenIcon,
ShieldCheckIcon,
} from '@heroicons/vue/24/outline'
@@ -252,8 +250,12 @@ export const useMenuStore = defineStore('menu', () => {
],
},
]
+ const sidebarOpen = ref(false)
+ const toggleSidebar = () => (sidebarOpen.value = !sidebarOpen.value)
-
- // expose everything
- return { navigation }
+ return {
+ navigation,
+ toggleSidebar,
+ sidebarOpen
+ }
})
\ No newline at end of file