adminforth 1.1.70 → 1.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.ts +2 -1
- package/dist/auth.js +2 -1
- package/dist/spa/index.html +4 -4
- package/dist/spa/package-lock.json +206 -5
- package/dist/spa/package.json +8 -2
- package/dist/spa/public/assets/favicon.png +0 -0
- package/dist/spa/spa/src/views/LoginView.vue +2 -0
- package/dist/spa/src/App.vue +171 -72
- package/dist/spa/src/assets/logo.svg +19 -1
- package/dist/spa/src/components/AcceptModal.vue +3 -10
- package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
- package/dist/spa/src/components/CustomDatePicker.vue +19 -6
- package/dist/spa/src/components/CustomDateRangePicker.vue +14 -5
- package/dist/spa/src/components/CustomRangePicker.vue +148 -0
- package/dist/spa/src/components/Dropdown.vue +19 -5
- package/dist/spa/src/components/Filters.vue +91 -37
- package/dist/spa/src/components/MenuLink.vue +2 -2
- package/dist/spa/src/components/ResourceForm.vue +163 -103
- package/dist/spa/src/components/ResourceListTable.vue +419 -0
- package/dist/spa/src/components/Toast.vue +66 -0
- package/dist/spa/src/components/ValueRenderer.vue +22 -6
- package/dist/spa/src/composables/useFrontendApi.ts +26 -0
- package/dist/spa/src/composables/useStores.ts +113 -0
- package/dist/spa/src/main.ts +1 -1
- package/dist/spa/src/router/index.ts +30 -19
- package/dist/spa/src/spa_types/core.ts +51 -0
- package/dist/spa/src/stores/core.ts +65 -59
- package/dist/spa/src/stores/filters.ts +22 -0
- package/dist/spa/src/stores/modal.ts +13 -3
- package/dist/spa/src/stores/toast.ts +15 -0
- package/dist/spa/src/stores/user.ts +54 -0
- package/dist/spa/src/utils.ts +65 -8
- package/dist/spa/src/views/CreateView.vue +76 -16
- package/dist/spa/src/views/EditView.vue +76 -14
- package/dist/spa/src/views/ListView.vue +88 -360
- package/dist/spa/src/views/LoginView.vue +17 -5
- package/dist/spa/src/views/ResourceParent.vue +1 -1
- package/dist/spa/src/views/ShowView.vue +114 -19
- package/dist/spa/tailwind.config.js +5 -2
- package/dist/spa/vite.config.ts +6 -0
- package/package.json +1 -1
- package/spa/src/views/LoginView.vue +2 -0
- package/dist/spa/public/favicon.ico +0 -0
- package/dist/spa/spa/public/favicon.ico +0 -0
- package/dist/spa/spa/src/views/HomeView.vue +0 -8
- package/dist/spa/src/views/HomeView.vue +0 -8
- package/dist/types.js +0 -30
package/dist/spa/src/App.vue
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<nav
|
|
3
|
-
v-if="loggedIn"
|
|
4
|
-
|
|
5
|
-
class="fixed h-14 top-0 z-50 w-full bg-white border-b border-gray-200 dark:bg-gray-800 dark:border-gray-700">
|
|
3
|
+
v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
|
|
4
|
+
class="fixed h-14 top-0 z-20 w-full border-b shadow-sm bg-header-bg shadow-header-shadow dark:bg-header-bg-hover dark:border-nav-menu-devider">
|
|
6
5
|
<div class="px-3 py-3 lg:px-5 lg:pl-3">
|
|
7
6
|
<div class="flex items-center justify-between">
|
|
8
7
|
<div class="flex items-center justify-start rtl:justify-end">
|
|
9
|
-
<button
|
|
8
|
+
<button @click="sideBarOpen = !sideBarOpen"
|
|
9
|
+
type="button" class="inline-flex items-center p-2 text-sm rounded-lg sm:hidden hover:bg-nav-menu-bg-hover focus:outline-none focus:ring-2 focus:ring-nav-menu-devider dark:text-nav-menu-icons dark:hover:bg-nav-menu-bg-hover dark:focus:ring-nav-menu-devider">
|
|
10
10
|
<span class="sr-only">Open sidebar</span>
|
|
11
11
|
<svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
12
12
|
<path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
|
|
13
13
|
</svg>
|
|
14
14
|
</button>
|
|
15
|
-
|
|
16
|
-
<img src="https://flowbite.com/docs/images/logo.svg" class="h-8 me-3" alt="FlowBite Logo" />
|
|
17
|
-
<span class="self-center text-xl font-semibold sm:text-2xl whitespace-nowrap dark:text-white">
|
|
18
|
-
{{ coreStore.config?.brandName }}
|
|
19
|
-
</span>
|
|
20
|
-
</div>
|
|
15
|
+
|
|
21
16
|
</div>
|
|
22
17
|
<div class="flex items-center">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
<div class="flex items-center ms-3 ">
|
|
19
|
+
<div>
|
|
20
|
+
<button type="button" class="flex text-sm bg-header-bg-hover rounded-full focus:ring-4 focus:ring-nav-menu-devider dark:focus:ring-nav-menu-devider dark:bg-header-bg-hover" aria-expanded="false" data-dropdown-toggle="dropdown-user">
|
|
21
|
+
<span class="sr-only">Open user menu</span>
|
|
22
|
+
<svg class="w-8 h-8 text-nav-menu-icons dark:text-header-icons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
|
|
23
|
+
<path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
|
|
24
|
+
</svg>
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-nav-menu-bg dark:divide-nav-menu-devider dark:shadow-black" id="dropdown-user">
|
|
28
|
+
<div class="px-4 py-3" role="none">
|
|
29
|
+
<p class="text-sm text-gray-900 dark:text-header-text" role="none" v-if="coreStore.userFullname">
|
|
30
|
+
{{ coreStore.userFullname }}
|
|
31
|
+
</p>
|
|
32
|
+
<p class="text-sm font-medium text-gray-900 truncate dark:text-nav-menu-text" role="none">
|
|
33
|
+
{{ coreStore.username }}
|
|
34
|
+
</p>
|
|
34
35
|
</div>
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
{{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</
|
|
43
|
-
</div>
|
|
44
|
-
<ul class="py-1" role="none">
|
|
45
|
-
<li>
|
|
46
|
-
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">Dashboard</a>
|
|
47
|
-
</li>
|
|
48
|
-
<li >
|
|
49
|
-
<span @click="toggleTheme" class=" cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
|
|
50
|
-
{{ theme === 'dark' ? 'Light' : 'Dark' }}
|
|
51
|
-
<IconMoonSolid class="w-5 h-5 text-blue-300
|
|
52
|
-
" v-if="theme !== 'dark'"/>
|
|
53
|
-
<IconSunSolid class="w-5 h-5 text-yellow-300
|
|
54
|
-
" v-else/>
|
|
55
|
-
mode
|
|
56
|
-
</span>
|
|
57
|
-
</li>
|
|
58
|
-
|
|
59
|
-
<li>
|
|
60
|
-
<button @click="logout" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">Sign out</button>
|
|
36
|
+
<ul class="py-1" role="none">
|
|
37
|
+
<li>
|
|
38
|
+
<span @click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html-bg dark:text-nav-menu-text-hover dark:hover:bg-nav-menu-hover dark:hover:text-nav-menu-text-active" role="menuitem">
|
|
39
|
+
{{ theme === 'dark' ? 'Light' : 'Dark' }}
|
|
40
|
+
<IconMoonSolid class="w-5 h-5 text-blue-300" v-if="theme !== 'dark'" />
|
|
41
|
+
<IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
|
|
42
|
+
mode
|
|
43
|
+
</span>
|
|
61
44
|
</li>
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
<li>
|
|
46
|
+
<button @click="logout" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html-bg dark:text-nav-menu-text-hover dark:hover:bg-nav-menu-hover dark:hover:text-nav-menu-text-active w-full" role="menuitem">Sign out</button>
|
|
47
|
+
</li>
|
|
48
|
+
</ul>
|
|
64
49
|
</div>
|
|
65
50
|
</div>
|
|
51
|
+
</div>
|
|
66
52
|
</div>
|
|
67
53
|
</div>
|
|
68
|
-
|
|
54
|
+
</nav>
|
|
55
|
+
|
|
56
|
+
|
|
69
57
|
|
|
70
58
|
<aside
|
|
71
|
-
v-if="loggedIn"
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady"
|
|
61
|
+
|
|
62
|
+
id="logo-sidebar" class="fixed border-none top-0 left-0 z-20 w-64 h-screen transition-transform border-r border-nav-menu-border sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
|
|
63
|
+
:class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
|
|
64
|
+
aria-label="Sidebar"
|
|
65
|
+
>
|
|
66
|
+
<div class="h-full px-3 pb-4 overflow-y-auto bg-white dark:bg-gray-800 border-r">
|
|
67
|
+
<div class="flex ms-2 md:me-24 m-4 ">
|
|
68
|
+
<img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="h-8 me-3" />
|
|
69
|
+
<span class="self-center text-header-text-size font-semibold sm:text-header-text-size whitespace-nowrap dark:text-header-text text-header-logo-color">
|
|
70
|
+
{{ coreStore.config?.brandName }}
|
|
71
|
+
</span>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
75
74
|
<ul class="space-y-2 font-medium">
|
|
76
75
|
<template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
|
|
77
|
-
<div v-if="item.type === 'divider'" class="border-t border-
|
|
76
|
+
<div v-if="item.type === 'divider'" class="border-t border-nav-menu-devider dark:border-gray-700"></div>
|
|
78
77
|
<div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
|
|
79
|
-
|
|
78
|
+
<div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-gray-400 dark:text-gray-400
|
|
79
|
+
">{{ item.label }}</div>
|
|
80
80
|
<li v-else-if="item.children">
|
|
81
|
-
<button
|
|
81
|
+
<button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-nav-menu-text rounded-default transition duration-75 group hover:bg-nav-menu-bg-hover dark:text-white dark:hover:bg-gray-700"
|
|
82
82
|
:aria-controls="`dropdown-example${i}`"
|
|
83
83
|
:data-collapse-toggle="`dropdown-example${i}`"
|
|
84
84
|
>
|
|
85
|
-
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-gray-500 transition duration-75 dark:text-gray-400
|
|
85
|
+
<component v-if="item.icon" :is="getIcon(item.icon)" class="w-5 h-5 text-gray-500 transition duration-75 dark:text-gray-400 dark:group-hover:text-white" ></component>
|
|
86
86
|
|
|
87
87
|
<span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">{{ item.label }}</span>
|
|
88
|
-
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
|
88
|
+
<svg :class="{'rotate-180': opened.includes(i) }" class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
|
89
89
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
90
90
|
</svg>
|
|
91
91
|
</button>
|
|
92
92
|
|
|
93
|
-
<ul :id="`dropdown-example${i}`" role="none" class="
|
|
93
|
+
<ul :id="`dropdown-example${i}`" role="none" class="pt-1 space-y-1" :class="{ 'hidden': !opened.includes(i) }">
|
|
94
94
|
<template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
|
|
95
95
|
<li>
|
|
96
96
|
<MenuLink :item="child" isChild="true" />
|
|
@@ -105,20 +105,61 @@
|
|
|
105
105
|
</ul>
|
|
106
106
|
</div>
|
|
107
107
|
</aside>
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<div class="p-4 sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
|
|
110
111
|
<div class="p-0 dark:border-gray-700 mt-14">
|
|
111
112
|
<RouterView/>
|
|
112
113
|
</div>
|
|
113
114
|
</div>
|
|
114
115
|
|
|
115
|
-
<div v-else>
|
|
116
|
+
<div v-else-if="routerIsReady && loginRedirectCheckIsReady">
|
|
116
117
|
<RouterView/>
|
|
117
118
|
</div>
|
|
119
|
+
<div v-else class="flex items-center justify-center h-screen">
|
|
120
|
+
<div class="text-3xl text-gray-400 animate-bounce">
|
|
121
|
+
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
|
|
122
|
+
<span class="sr-only">Loading...</span>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
118
125
|
<AcceptModal />
|
|
126
|
+
<div v-if="toastStore.toasts.length>0" class="fixed bottom-5 right-5 flex gap-1 flex-col-reverse">
|
|
127
|
+
<transition-group
|
|
128
|
+
name="fade"
|
|
129
|
+
tag="div"
|
|
130
|
+
class="flex flex-col-reverse gap-1"
|
|
131
|
+
>
|
|
132
|
+
<Toast :toast="t" @close="toastStore.removeToast(t)" v-for="(t,i) in toastStore.toasts" :key="`t-${t.id}`" ></Toast>
|
|
133
|
+
</transition-group>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div v-if="sideBarOpen"
|
|
137
|
+
@click="sideBarOpen = false"
|
|
138
|
+
|
|
139
|
+
drawer-backdrop="" class="bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-5"></div>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
119
143
|
</template>
|
|
120
144
|
|
|
121
|
-
<style scoped>
|
|
145
|
+
<style lang="scss" scoped>
|
|
146
|
+
|
|
147
|
+
.fade-leave-active {
|
|
148
|
+
@apply transition-opacity duration-500;
|
|
149
|
+
}
|
|
150
|
+
.fade-leave-to {
|
|
151
|
+
@apply opacity-0;
|
|
152
|
+
}
|
|
153
|
+
.fade-enter-active {
|
|
154
|
+
@apply transition-opacity duration-500;
|
|
155
|
+
}
|
|
156
|
+
.fade-enter-from {
|
|
157
|
+
@apply opacity-0;
|
|
158
|
+
}
|
|
159
|
+
.fade-enter-to {
|
|
160
|
+
@apply opacity-100;
|
|
161
|
+
}
|
|
162
|
+
|
|
122
163
|
</style>
|
|
123
164
|
|
|
124
165
|
<script setup lang="ts">
|
|
@@ -127,19 +168,43 @@ import { RouterLink, RouterView } from 'vue-router';
|
|
|
127
168
|
import { initFlowbite } from 'flowbite'
|
|
128
169
|
import './index.scss'
|
|
129
170
|
import { useCoreStore } from '@/stores/core';
|
|
171
|
+
import { useUserStore } from '@/stores/user';
|
|
172
|
+
import {useModalStore} from '@/stores/modal';
|
|
130
173
|
import { IconMoonSolid, IconSunSolid } from '@iconify-prerendered/vue-flowbite';
|
|
131
174
|
import AcceptModal from './components/AcceptModal.vue';
|
|
132
175
|
import MenuLink from './components/MenuLink.vue';
|
|
133
176
|
import { useRoute, useRouter } from 'vue-router';
|
|
134
177
|
import { getIcon } from '@/utils';
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
import { useHead } from 'unhead'
|
|
179
|
+
import { createHead } from 'unhead'
|
|
180
|
+
import { loadFile } from '@/utils';
|
|
181
|
+
import Toast from './components/Toast.vue';
|
|
182
|
+
import {useToastStore} from '@/stores/toast';
|
|
183
|
+
import { FrontendAPI } from '@/composables/useStores'
|
|
184
|
+
// import { link } from 'fs';
|
|
185
|
+
const coreStore = useCoreStore();
|
|
186
|
+
const modalStore = useModalStore();
|
|
187
|
+
const toastStore = useToastStore();
|
|
188
|
+
const userStore = useUserStore();
|
|
189
|
+
const frontendApi = new FrontendAPI();
|
|
190
|
+
frontendApi.init();
|
|
191
|
+
const splitAtLast = (str: string, separator: string) => {
|
|
192
|
+
const index = str.lastIndexOf(separator);
|
|
193
|
+
return [str.slice(0, index), str.slice(index + 1)];
|
|
194
|
+
}
|
|
195
|
+
createHead()
|
|
196
|
+
const sideBarOpen = ref(false);
|
|
137
197
|
const route = useRoute();
|
|
138
198
|
const router = useRouter();
|
|
199
|
+
const title = ref('');
|
|
200
|
+
//create a ref to store the opened menu items with ts type;
|
|
201
|
+
const opened = ref<string[]>([]);
|
|
202
|
+
|
|
139
203
|
|
|
140
204
|
const routerIsReady = ref(false);
|
|
205
|
+
const loginRedirectCheckIsReady = ref(false);
|
|
141
206
|
|
|
142
|
-
const loggedIn = computed(() => route.name !== 'login'
|
|
207
|
+
const loggedIn = computed(() => route.name !== 'login');
|
|
143
208
|
|
|
144
209
|
const theme = ref('light');
|
|
145
210
|
|
|
@@ -148,12 +213,21 @@ function toggleTheme() {
|
|
|
148
213
|
document.documentElement.classList.toggle('dark');
|
|
149
214
|
}
|
|
150
215
|
|
|
216
|
+
function clickOnMenuItem (label: string) {
|
|
217
|
+
if (opened.value.includes(label)) {
|
|
218
|
+
opened.value = opened.value.filter((item) => item !== label);
|
|
219
|
+
} else {
|
|
220
|
+
opened.value.push(label);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
151
225
|
async function logout() {
|
|
152
|
-
|
|
153
|
-
|
|
226
|
+
userStore.unauthorize();
|
|
227
|
+
await userStore.logout();
|
|
228
|
+
router.push({ name: 'login' })
|
|
154
229
|
}
|
|
155
230
|
|
|
156
|
-
const coreStore = useCoreStore();
|
|
157
231
|
|
|
158
232
|
|
|
159
233
|
|
|
@@ -162,11 +236,36 @@ async function initRouter() {
|
|
|
162
236
|
routerIsReady.value = true;
|
|
163
237
|
}
|
|
164
238
|
|
|
239
|
+
async function loadMenu() {
|
|
240
|
+
await coreStore.fetchMenuAndResource()
|
|
241
|
+
loginRedirectCheckIsReady.value = true;
|
|
242
|
+
|
|
243
|
+
coreStore.menu.forEach((item, i) => {
|
|
244
|
+
if (item.open) {
|
|
245
|
+
opened.value.push(i);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
watch(route, () => {
|
|
253
|
+
title.value = `${coreStore.config?.title || coreStore.config?.brandName || 'Adminforth'} | ${ Object.values(route.params)[0] || route.meta.title || ' '}`;
|
|
254
|
+
useHead({
|
|
255
|
+
title: title.value,
|
|
256
|
+
})
|
|
257
|
+
});
|
|
258
|
+
|
|
165
259
|
// initialize components based on data attribute selectors
|
|
166
260
|
onMounted(async () => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
await
|
|
261
|
+
loadMenu(); // run this in async mode
|
|
262
|
+
// before init flowbite we have to wait router initialized because it affects dom(our v-ifs) and fetch menu
|
|
263
|
+
await initRouter()
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
initFlowbite();
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
|
|
170
269
|
})
|
|
171
270
|
|
|
172
271
|
</script>
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
<svg
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1_8)">
|
|
3
|
+
<path d="M8.034 6.006V13H6.097V12.194C5.59433 12.8007 4.86633 13.104 3.913 13.104C3.25433 13.104 2.65633 12.9567 2.119 12.662C1.59033 12.3673 1.17433 11.947 0.871 11.401C0.567667 10.855 0.416 10.2223 0.416 9.503C0.416 8.78367 0.567667 8.151 0.871 7.605C1.17433 7.059 1.59033 6.63867 2.119 6.344C2.65633 6.04933 3.25433 5.902 3.913 5.902C4.80567 5.902 5.50333 6.18367 6.006 6.747V6.006H8.034ZM4.264 11.44C4.77533 11.44 5.2 11.2667 5.538 10.92C5.876 10.5647 6.045 10.0923 6.045 9.503C6.045 8.91367 5.876 8.44567 5.538 8.099C5.2 7.74367 4.77533 7.566 4.264 7.566C3.744 7.566 3.315 7.74367 2.977 8.099C2.639 8.44567 2.47 8.91367 2.47 9.503C2.47 10.0923 2.639 10.5647 2.977 10.92C3.315 11.2667 3.744 11.44 4.264 11.44Z" fill="url(#paint0_linear_1_8)"/>
|
|
4
|
+
<path d="M13.317 5.538C12.589 5.538 12.0387 5.69833 11.666 6.019C11.2933 6.331 11.107 6.80333 11.107 7.436V7.995H14.851V9.685H11.107V13H9.001V7.449C9.001 6.279 9.365 5.369 10.093 4.719C10.8297 4.069 11.8567 3.744 13.174 3.744C13.694 3.744 14.1837 3.80033 14.643 3.913C15.1023 4.017 15.501 4.173 15.839 4.381L15.189 6.045C14.669 5.707 14.045 5.538 13.317 5.538Z" fill="url(#paint1_linear_1_8)"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<linearGradient id="paint0_linear_1_8" x1="1.5" y1="6.93333" x2="7.31883" y2="11.8926" gradientUnits="userSpaceOnUse">
|
|
8
|
+
<stop stop-color="#656E7A"/>
|
|
9
|
+
<stop offset="1" stop-color="#99A6B8"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<linearGradient id="paint1_linear_1_8" x1="12.5" y1="3.73333" x2="9.68642" y2="12.7016" gradientUnits="userSpaceOnUse">
|
|
12
|
+
<stop stop-color="#48C5FF"/>
|
|
13
|
+
<stop offset="1" stop-color="#A1E1FF"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
<clipPath id="clip0_1_8">
|
|
16
|
+
<rect width="16" height="16" fill="white"/>
|
|
17
|
+
</clipPath>
|
|
18
|
+
</defs>
|
|
19
|
+
</svg>
|
|
@@ -3,20 +3,13 @@ import { ref,onMounted } from 'vue'
|
|
|
3
3
|
import { useModalStore } from '@/stores/modal';
|
|
4
4
|
|
|
5
5
|
const modalStore = useModalStore();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
6
|
</script>
|
|
14
7
|
|
|
15
8
|
<template>
|
|
16
9
|
<Teleport to="body">
|
|
17
10
|
<div v-if="modalStore.isOpened" class="bg-gray-900/50 dark:bg-gray-900/80 overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
18
11
|
<div class="relative p-4 w-full max-w-md max-h-full top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 " >
|
|
19
|
-
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
|
12
|
+
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black">
|
|
20
13
|
<button type="button"@click="modalStore.togleModal" class="absolute top-3 end-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" >
|
|
21
14
|
<svg class="w-3 h-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
|
22
15
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
|
|
@@ -28,10 +21,10 @@ const modalStore = useModalStore();
|
|
|
28
21
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
|
|
29
22
|
</svg>
|
|
30
23
|
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{{ modalStore?.modalContent?.content }}</h3>
|
|
31
|
-
<button @click="()=>{modalStore.onAcceptFunction();modalStore.togleModal()}" type="button" class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center">
|
|
24
|
+
<button @click="()=>{ modalStore.onAcceptFunction(true);modalStore.togleModal()}" type="button" class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center">
|
|
32
25
|
{{ modalStore?.modalContent?.acceptText }}
|
|
33
26
|
</button>
|
|
34
|
-
<button @click="modalStore.togleModal" type="button" class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700">{{ modalStore?.modalContent?.cancelText }}</button>
|
|
27
|
+
<button @click="()=>{modalStore.onAcceptFunction(false);modalStore.togleModal()}" type="button" class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700">{{ modalStore?.modalContent?.cancelText }}</button>
|
|
35
28
|
</div>
|
|
36
29
|
</div>
|
|
37
30
|
</div>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<label for="start-time" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ label }}</label>
|
|
6
6
|
|
|
7
7
|
<div class="relative">
|
|
8
|
-
<div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5">
|
|
8
|
+
<div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
|
|
9
9
|
<IconCalendar class="w-4 h-4 text-gray-500 dark:text-gray-400"/>
|
|
10
10
|
</div>
|
|
11
11
|
|
|
@@ -67,6 +67,9 @@ const props = defineProps({
|
|
|
67
67
|
},
|
|
68
68
|
label: {
|
|
69
69
|
type: String,
|
|
70
|
+
},
|
|
71
|
+
autoHide: {
|
|
72
|
+
type: Boolean,
|
|
70
73
|
}
|
|
71
74
|
});
|
|
72
75
|
|
|
@@ -97,11 +100,10 @@ const start = computed(() => {
|
|
|
97
100
|
})
|
|
98
101
|
|
|
99
102
|
function updateFromProps() {
|
|
100
|
-
if (props.valueStart
|
|
103
|
+
if (!props.valueStart) {
|
|
101
104
|
datepickerStartEl.value.value = '';
|
|
102
105
|
startTime.value = '';
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
106
|
+
} else {
|
|
105
107
|
datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
|
|
106
108
|
startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
|
|
107
109
|
}
|
|
@@ -121,7 +123,13 @@ watch(start, () => {
|
|
|
121
123
|
})
|
|
122
124
|
|
|
123
125
|
function initDatepickers() {
|
|
124
|
-
|
|
126
|
+
const options = {format: 'dd M yyyy'};
|
|
127
|
+
|
|
128
|
+
if (props.autoHide) {
|
|
129
|
+
options.autohide = true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
datepickerObject.value = new Datepicker(datepickerStartEl.value, options);
|
|
125
133
|
|
|
126
134
|
addChangeDateListener();
|
|
127
135
|
}
|
|
@@ -134,6 +142,10 @@ function removeChangeDateListener() {
|
|
|
134
142
|
datepickerStartEl.value.removeEventListener('changeDate', setStartDate);
|
|
135
143
|
}
|
|
136
144
|
|
|
145
|
+
function destroyDatepickerElement() {
|
|
146
|
+
datepickerObject.value.destroy();
|
|
147
|
+
}
|
|
148
|
+
|
|
137
149
|
function setStartDate(event) {
|
|
138
150
|
startDate.value = event.detail.date
|
|
139
151
|
}
|
|
@@ -157,5 +169,6 @@ onMounted(() => {
|
|
|
157
169
|
|
|
158
170
|
onBeforeUnmount(() => {
|
|
159
171
|
removeChangeDateListener();
|
|
160
|
-
|
|
172
|
+
destroyDatepickerElement();
|
|
173
|
+
});
|
|
161
174
|
</script>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<div class="mx-auto grid grid-cols-2 gap-4 mb-2" :class="{hidden: !showTimeInputs}">
|
|
27
27
|
<div>
|
|
28
28
|
<div class="relative">
|
|
29
|
-
<div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5">
|
|
29
|
+
<div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
|
|
30
30
|
<IconTime class="w-4 h-4 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-700"/>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
@@ -101,6 +101,9 @@ const endDate = ref('');
|
|
|
101
101
|
const startTime = ref('');
|
|
102
102
|
const endTime = ref('');
|
|
103
103
|
|
|
104
|
+
const datepickerStartObject = ref('')
|
|
105
|
+
const datepickerEndObject = ref('')
|
|
106
|
+
|
|
104
107
|
const start = computed(() => {
|
|
105
108
|
if (!startDate.value) {
|
|
106
109
|
return;
|
|
@@ -132,11 +135,11 @@ const end = computed(() => {
|
|
|
132
135
|
})
|
|
133
136
|
|
|
134
137
|
function updateFromProps() {
|
|
135
|
-
if (props.valueStart
|
|
138
|
+
if (!props.valueStart) {
|
|
136
139
|
datepickerStartEl.value.value = '';
|
|
137
140
|
startTime.value = '';
|
|
138
141
|
}
|
|
139
|
-
if (props.valueEnd
|
|
142
|
+
if (!props.valueEnd) {
|
|
140
143
|
datepickerEndEl.value.value = '';
|
|
141
144
|
endTime.value = '';
|
|
142
145
|
}
|
|
@@ -162,9 +165,9 @@ watch(end, () => {
|
|
|
162
165
|
|
|
163
166
|
function initDatepickers() {
|
|
164
167
|
|
|
165
|
-
new Datepicker(datepickerStartEl.value, {format: 'dd M yyyy'});
|
|
168
|
+
datepickerStartObject.value = new Datepicker(datepickerStartEl.value, {format: 'dd M yyyy'});
|
|
166
169
|
|
|
167
|
-
new Datepicker(datepickerEndEl.value, {format: 'dd M yyyy'});
|
|
170
|
+
datepickerEndObject.value = new Datepicker(datepickerEndEl.value, {format: 'dd M yyyy'});
|
|
168
171
|
addChangeDateListener();
|
|
169
172
|
}
|
|
170
173
|
|
|
@@ -178,6 +181,11 @@ function removeChangeDateListener() {
|
|
|
178
181
|
datepickerEndEl.value.removeEventListener('changeDate', setEndDate);
|
|
179
182
|
}
|
|
180
183
|
|
|
184
|
+
function destroyDatepickerElement() {
|
|
185
|
+
datepickerStartObject.value.destroy();
|
|
186
|
+
datepickerEndObject.value.destroy();
|
|
187
|
+
}
|
|
188
|
+
|
|
181
189
|
function setStartDate(event) {
|
|
182
190
|
startDate.value = event.detail.date
|
|
183
191
|
}
|
|
@@ -205,5 +213,6 @@ onMounted(() => {
|
|
|
205
213
|
|
|
206
214
|
onBeforeUnmount(() => {
|
|
207
215
|
removeChangeDateListener();
|
|
216
|
+
destroyDatepickerElement();
|
|
208
217
|
})
|
|
209
218
|
</script>
|