adminforth 1.1.59 → 1.1.61

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.
Files changed (67) hide show
  1. package/dist/index.js +68 -63
  2. package/dist/modules/styleGenerator.js +22 -18
  3. package/dist/modules/styles.js +44 -36
  4. package/dist/modules/utils.js +75 -0
  5. package/dist/plugins/AccessControl/index.js +66 -0
  6. package/dist/plugins/AccessControl/types.js +1 -0
  7. package/dist/plugins/AuditLogPlugin/custom/AuditLogView.vue +20 -0
  8. package/dist/plugins/AuditLogPlugin/index.js +83 -0
  9. package/dist/plugins/AuditLogPlugin/types.js +1 -0
  10. package/dist/spa/index.html +2 -2
  11. package/dist/spa/package-lock.json +4 -17
  12. package/dist/spa/package.json +1 -2
  13. package/dist/spa/public/favicon.ico +0 -0
  14. package/dist/spa/spa/package-lock.json +111 -0
  15. package/dist/spa/spa/package.json +1 -0
  16. package/dist/spa/spa/public/favicon.ico +0 -0
  17. package/dist/spa/spa/src/App.vue +4 -4
  18. package/dist/spa/spa/src/components/MenuLink.vue +1 -1
  19. package/dist/spa/spa/src/components/ResourceForm.vue +2 -2
  20. package/dist/spa/src/App.vue +45 -125
  21. package/dist/spa/src/assets/logo.svg +1 -19
  22. package/dist/spa/src/components/AcceptModal.vue +9 -2
  23. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  24. package/dist/spa/src/components/CustomDatePicker.vue +3 -16
  25. package/dist/spa/src/components/CustomDateRangePicker.vue +2 -11
  26. package/dist/spa/src/components/Dropdown.vue +1 -6
  27. package/dist/spa/src/components/Filters.vue +19 -40
  28. package/dist/spa/src/components/ResourceForm.vue +24 -26
  29. package/dist/spa/src/components/ValueRenderer.vue +8 -14
  30. package/dist/spa/src/main.ts +1 -1
  31. package/dist/spa/src/router/index.ts +20 -30
  32. package/dist/spa/src/stores/core.ts +31 -48
  33. package/dist/spa/src/stores/modal.ts +3 -13
  34. package/dist/spa/src/utils.ts +7 -62
  35. package/dist/spa/src/views/CreateView.vue +15 -67
  36. package/dist/spa/src/views/EditView.vue +11 -45
  37. package/dist/spa/src/views/ListView.vue +366 -82
  38. package/dist/spa/src/views/LoginView.vue +4 -16
  39. package/dist/spa/src/views/ShowView.vue +21 -105
  40. package/dist/spa/tailwind.config.js +1 -1
  41. package/dist/spa/vite.config.ts +0 -6
  42. package/dist/types.js +30 -0
  43. package/index.ts +62 -61
  44. package/modules/styleGenerator.ts +25 -18
  45. package/modules/styles.ts +46 -36
  46. package/modules/utils.ts +91 -1
  47. package/package.json +2 -1
  48. package/plugins/AuditLogPlugin/custom/AuditLogView.vue +20 -0
  49. package/plugins/AuditLogPlugin/index.ts +99 -0
  50. package/plugins/AuditLogPlugin/types.ts +40 -0
  51. package/spa/package-lock.json +111 -0
  52. package/spa/package.json +1 -0
  53. package/spa/src/App.vue +4 -4
  54. package/spa/src/components/MenuLink.vue +1 -1
  55. package/spa/src/components/ResourceForm.vue +2 -2
  56. package/types/AdminForthConfig.ts +6 -1
  57. package/dist/spa/src/components/ResourceListTable.vue +0 -419
  58. package/dist/spa/src/components/Toast.vue +0 -66
  59. package/dist/spa/src/composables/useFrontendApi.ts +0 -26
  60. package/dist/spa/src/composables/useStores.ts +0 -113
  61. package/dist/spa/src/spa_types/core.ts +0 -51
  62. package/dist/spa/src/stores/filters.ts +0 -22
  63. package/dist/spa/src/stores/toast.ts +0 -15
  64. package/dist/spa/src/stores/user.ts +0 -54
  65. package/plugins/AuditLog/index.ts +0 -29
  66. package/plugins/AuditLog/types.ts +0 -4
  67. /package/dist/spa/{public/assets → spa/public}/favicon.png +0 -0
@@ -17,7 +17,6 @@
17
17
  "flowbite-datepicker": "^1.2.6",
18
18
  "pinia": "^2.1.7",
19
19
  "unhead": "^1.9.12",
20
- "uuid": "^10.0.0",
21
20
  "vue": "^3.4.21",
22
21
  "vue-router": "^4.3.0",
23
22
  "vue-slider-component": "^4.1.0-beta.7"
@@ -37,7 +36,7 @@
37
36
  "sass": "^1.77.2",
38
37
  "tailwindcss": "^3.4.3",
39
38
  "typescript": "~5.4.0",
40
- "vite": "^5.2.13",
39
+ "vite": "^5.2.12",
41
40
  "vue-tsc": "^2.0.11"
42
41
  }
43
42
  },
@@ -4033,22 +4032,10 @@
4033
4032
  "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
4034
4033
  "dev": true
4035
4034
  },
4036
- "node_modules/uuid": {
4037
- "version": "10.0.0",
4038
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
4039
- "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
4040
- "funding": [
4041
- "https://github.com/sponsors/broofa",
4042
- "https://github.com/sponsors/ctavan"
4043
- ],
4044
- "bin": {
4045
- "uuid": "dist/bin/uuid"
4046
- }
4047
- },
4048
4035
  "node_modules/vite": {
4049
- "version": "5.2.13",
4050
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.13.tgz",
4051
- "integrity": "sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==",
4036
+ "version": "5.2.12",
4037
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.12.tgz",
4038
+ "integrity": "sha512-/gC8GxzxMK5ntBwb48pR32GGhENnjtY30G4A0jemunsBkiEZFw60s8InGpN8gkhHEkjnRK1aSAxeQgwvFhUHAA==",
4052
4039
  "dev": true,
4053
4040
  "dependencies": {
4054
4041
  "esbuild": "^0.20.1",
@@ -21,7 +21,6 @@
21
21
  "flowbite-datepicker": "^1.2.6",
22
22
  "pinia": "^2.1.7",
23
23
  "unhead": "^1.9.12",
24
- "uuid": "^10.0.0",
25
24
  "vue": "^3.4.21",
26
25
  "vue-router": "^4.3.0",
27
26
  "vue-slider-component": "^4.1.0-beta.7"
@@ -41,7 +40,7 @@
41
40
  "sass": "^1.77.2",
42
41
  "tailwindcss": "^3.4.3",
43
42
  "typescript": "~5.4.0",
44
- "vite": "^5.2.13",
43
+ "vite": "^5.2.12",
45
44
  "vue-tsc": "^2.0.11"
46
45
  }
47
46
  }
Binary file
@@ -19,6 +19,7 @@
19
19
  "unhead": "^1.9.12",
20
20
  "uuid": "^10.0.0",
21
21
  "vue": "^3.4.21",
22
+ "vue-diff": "^1.2.4",
22
23
  "vue-router": "^4.3.0",
23
24
  "vue-slider-component": "^4.1.0-beta.7"
24
25
  },
@@ -1902,6 +1903,11 @@
1902
1903
  "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
1903
1904
  "dev": true
1904
1905
  },
1906
+ "node_modules/diff-match-patch": {
1907
+ "version": "1.0.5",
1908
+ "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.5.tgz",
1909
+ "integrity": "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw=="
1910
+ },
1905
1911
  "node_modules/dir-glob": {
1906
1912
  "version": "3.0.1",
1907
1913
  "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -2526,6 +2532,14 @@
2526
2532
  "he": "bin/he"
2527
2533
  }
2528
2534
  },
2535
+ "node_modules/highlight.js": {
2536
+ "version": "11.9.0",
2537
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz",
2538
+ "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==",
2539
+ "engines": {
2540
+ "node": ">=12.0.0"
2541
+ }
2542
+ },
2529
2543
  "node_modules/hookable": {
2530
2544
  "version": "5.5.3",
2531
2545
  "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
@@ -4120,6 +4134,103 @@
4120
4134
  }
4121
4135
  }
4122
4136
  },
4137
+ "node_modules/vue-diff": {
4138
+ "version": "1.2.4",
4139
+ "resolved": "https://registry.npmjs.org/vue-diff/-/vue-diff-1.2.4.tgz",
4140
+ "integrity": "sha512-9z+0uPHigi/DdE3Zhdg1zR3VkiBaDN4czjWa/Zznvizn4znckVqz20p1KytaWq5NJtJ7UnkqRbuWsaCuC1ZHaA==",
4141
+ "dependencies": {
4142
+ "@vueuse/core": "^8.3.1",
4143
+ "diff-match-patch": "^1.0.5",
4144
+ "highlight.js": "^11.5.1"
4145
+ }
4146
+ },
4147
+ "node_modules/vue-diff/node_modules/@types/web-bluetooth": {
4148
+ "version": "0.0.14",
4149
+ "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.14.tgz",
4150
+ "integrity": "sha512-5d2RhCard1nQUC3aHcq/gHzWYO6K0WJmAbjO7mQJgCQKtZpgXxv1rOM6O/dBDhDYYVutk1sciOgNSe+5YyfM8A=="
4151
+ },
4152
+ "node_modules/vue-diff/node_modules/@vueuse/core": {
4153
+ "version": "8.9.4",
4154
+ "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-8.9.4.tgz",
4155
+ "integrity": "sha512-B/Mdj9TK1peFyWaPof+Zf/mP9XuGAngaJZBwPaXBvU3aCTZlx3ltlrFFFyMV4iGBwsjSCeUCgZrtkEj9dS2Y3Q==",
4156
+ "dependencies": {
4157
+ "@types/web-bluetooth": "^0.0.14",
4158
+ "@vueuse/metadata": "8.9.4",
4159
+ "@vueuse/shared": "8.9.4",
4160
+ "vue-demi": "*"
4161
+ },
4162
+ "funding": {
4163
+ "url": "https://github.com/sponsors/antfu"
4164
+ },
4165
+ "peerDependencies": {
4166
+ "@vue/composition-api": "^1.1.0",
4167
+ "vue": "^2.6.0 || ^3.2.0"
4168
+ },
4169
+ "peerDependenciesMeta": {
4170
+ "@vue/composition-api": {
4171
+ "optional": true
4172
+ },
4173
+ "vue": {
4174
+ "optional": true
4175
+ }
4176
+ }
4177
+ },
4178
+ "node_modules/vue-diff/node_modules/@vueuse/metadata": {
4179
+ "version": "8.9.4",
4180
+ "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-8.9.4.tgz",
4181
+ "integrity": "sha512-IwSfzH80bnJMzqhaapqJl9JRIiyQU0zsRGEgnxN6jhq7992cPUJIRfV+JHRIZXjYqbwt07E1gTEp0R0zPJ1aqw==",
4182
+ "funding": {
4183
+ "url": "https://github.com/sponsors/antfu"
4184
+ }
4185
+ },
4186
+ "node_modules/vue-diff/node_modules/@vueuse/shared": {
4187
+ "version": "8.9.4",
4188
+ "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-8.9.4.tgz",
4189
+ "integrity": "sha512-wt+T30c4K6dGRMVqPddexEVLa28YwxW5OFIPmzUHICjphfAuBFTTdDoyqREZNDOFJZ44ARH1WWQNCUK8koJ+Ag==",
4190
+ "dependencies": {
4191
+ "vue-demi": "*"
4192
+ },
4193
+ "funding": {
4194
+ "url": "https://github.com/sponsors/antfu"
4195
+ },
4196
+ "peerDependencies": {
4197
+ "@vue/composition-api": "^1.1.0",
4198
+ "vue": "^2.6.0 || ^3.2.0"
4199
+ },
4200
+ "peerDependenciesMeta": {
4201
+ "@vue/composition-api": {
4202
+ "optional": true
4203
+ },
4204
+ "vue": {
4205
+ "optional": true
4206
+ }
4207
+ }
4208
+ },
4209
+ "node_modules/vue-diff/node_modules/vue-demi": {
4210
+ "version": "0.14.8",
4211
+ "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz",
4212
+ "integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==",
4213
+ "hasInstallScript": true,
4214
+ "bin": {
4215
+ "vue-demi-fix": "bin/vue-demi-fix.js",
4216
+ "vue-demi-switch": "bin/vue-demi-switch.js"
4217
+ },
4218
+ "engines": {
4219
+ "node": ">=12"
4220
+ },
4221
+ "funding": {
4222
+ "url": "https://github.com/sponsors/antfu"
4223
+ },
4224
+ "peerDependencies": {
4225
+ "@vue/composition-api": "^1.0.0-rc.1",
4226
+ "vue": "^3.0.0-0 || ^2.6.0"
4227
+ },
4228
+ "peerDependenciesMeta": {
4229
+ "@vue/composition-api": {
4230
+ "optional": true
4231
+ }
4232
+ }
4233
+ },
4123
4234
  "node_modules/vue-eslint-parser": {
4124
4235
  "version": "9.4.2",
4125
4236
  "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.2.tgz",
@@ -23,6 +23,7 @@
23
23
  "unhead": "^1.9.12",
24
24
  "uuid": "^10.0.0",
25
25
  "vue": "^3.4.21",
26
+ "vue-diff": "^1.2.4",
26
27
  "vue-router": "^4.3.0",
27
28
  "vue-slider-component": "^4.1.0-beta.7"
28
29
  },
Binary file
@@ -19,7 +19,7 @@
19
19
  <div>
20
20
  <button type="button" class="flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded="false" data-dropdown-toggle="dropdown-user">
21
21
  <span class="sr-only">Open user menu</span>
22
- <svg class="w-8 h-8 text-lightSidebarIcons dark:text-darkSidebarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
22
+ <svg class="w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
23
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
24
  </svg>
25
25
  </button>
@@ -63,10 +63,10 @@
63
63
  :class="{ '-translate-x-full': !sideBarOpen, 'transform-none': sideBarOpen }"
64
64
  aria-label="Sidebar"
65
65
  >
66
- <div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r dark:border-darkSidebarBorder">
66
+ <div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder dark:border-darkSidebarBorder">
67
67
  <div class="flex ms-2 md:me-24 m-4 ">
68
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-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkNavbarText text-lightNavbarLogo">
69
+ <span class="self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText">
70
70
  {{ coreStore.config?.brandName }}
71
71
  </span>
72
72
  </div>
@@ -75,7 +75,7 @@
75
75
  <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
76
76
  <div v-if="item.type === 'divider'" class="border-t border-lightSidebarDevider dark:border-darkSidebarDevider"></div>
77
77
  <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
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
78
+ <div v-else-if="item.type === 'heading'" class="flex items-center justify-left pl-2 h-8 text-lightSidebarHeading dark:text-darkSidebarHeading
79
79
  ">{{ item.label }}</div>
80
80
  <li v-else-if="item.children" class=" ">
81
81
  <button @click="clickOnMenuItem(i)" type="button" class="flex items-center w-full p-2 text-base text-lightSidebarText rounded-default transition duration-75 group hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:text-darkSidebarText dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <RouterLink
3
3
  :to="{name: item.resourceId ? 'resource-list' : item.path, params: item.resourceId ? { resourceId: item.resourceId }: {}}"
4
- class="flex group items-center py-2 text-lightSidebarText dark:text-darkSidebarText rounded-default hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:hover:bg-darkSidebarHover dark:hover:text-darkSidebarTextHover active:bg-lightSidebarActive dark:active:bg-darkSidebarHover" role="menuitem"
4
+ class="flex group items-center py-2 text-lightSidebarText dark:text-darkSidebarText rounded-default hover:bg-lightSidebarItemHover hover:text-lightSidebarTextHover dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextHover active:bg-lightSidebarActive dark:active:bg-darkSidebarHover" role="menuitem"
5
5
  :class="{
6
6
  'px-4': isChild,
7
7
  'px-2': !isChild,
@@ -21,7 +21,7 @@
21
21
  class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700"
22
22
  >
23
23
  <!-- if column is in customComponentsPerColumn, use this component. If not, use this code -->
24
- <template v-if="column?.components?.[props.source].file">
24
+ <template v-if="column?.components?.[props.source]?.file">
25
25
  <component
26
26
  :is="getCustomComponent(column.components[props.source])"
27
27
  :column="column"
@@ -49,7 +49,7 @@
49
49
  single
50
50
  v-if="column.foreignResource"
51
51
  :options="columnOptions[column.name] || []"
52
- :placeholder = "columnOptions[column.name]?.length || 'There are no options available'"
52
+ :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
53
53
  :modelValue="currentValues[column.name]"
54
54
  @update:modelValue="setCurrentValue(column.name, $event)"
55
55
  ></Dropdown>
@@ -1,12 +1,11 @@
1
1
  <template>
2
2
  <nav
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">
3
+ v-if="loggedIn"
4
+ class="fixed h-14 top-0 z-40 w-full border-b shadow-sm bg-header-bg shadow-header-shadow dark:bg-header-bg-hover dark:border-nav-menu-devider">
5
5
  <div class="px-3 py-3 lg:px-5 lg:pl-3">
6
6
  <div class="flex items-center justify-between">
7
7
  <div class="flex items-center justify-start rtl:justify-end">
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">
8
+ <button data-drawer-target="logo-sidebar" data-drawer-toggle="logo-sidebar" aria-controls="logo-sidebar" 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
9
  <span class="sr-only">Open sidebar</span>
11
10
  <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
12
11
  <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>
@@ -56,41 +55,38 @@
56
55
 
57
56
 
58
57
  <aside
58
+ v-if="loggedIn"
59
59
 
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">
60
+ id="logo-sidebar" class="fixed border-none top-0 left-0 z-50 w-64 h-screen transition-transform -translate-x-full bg-nav-menu-bg border-r border- sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700" aria-label="Sidebar">
61
+ <div class="h-full px-3 pb-4 overflow-y-auto bg-nav-menu-bg dark:bg-gray-800">
67
62
  <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
-
63
+ <img src="https://flowbite.com/docs/images/logo.svg" class="h-8 me-3" alt="FlowBite Logo" />
64
+ <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">
65
+ {{ coreStore.config?.brandName }}
66
+ </span>
67
+ </div>
74
68
  <ul class="space-y-2 font-medium">
75
69
  <template v-for="(item, i) in coreStore.menu" :key="`menu-${i}`">
76
70
  <div v-if="item.type === 'divider'" class="border-t border-nav-menu-devider dark:border-gray-700"></div>
77
71
  <div v-else-if="item.type === 'gap'" class="flex items-center justify-center h-8"></div>
78
72
  <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
73
  ">{{ item.label }}</div>
74
+
75
+
80
76
  <li v-else-if="item.children">
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"
77
+ <button 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
78
  :aria-controls="`dropdown-example${i}`"
83
79
  :data-collapse-toggle="`dropdown-example${i}`"
84
80
  >
85
81
  <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
82
 
87
83
  <span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">{{ item.label }}</span>
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">
84
+ <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
89
85
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
90
86
  </svg>
91
87
  </button>
92
88
 
93
- <ul :id="`dropdown-example${i}`" role="none" class="pt-1 space-y-1" :class="{ 'hidden': !opened.includes(i) }">
89
+ <ul :id="`dropdown-example${i}`" role="none" class="pt-1 space-y-1" :class="{ 'hidden': !item.open }">
94
90
  <template v-for="(child, j) in item.children" :key="`menu-${i}-${j}`">
95
91
  <li>
96
92
  <MenuLink :item="child" isChild="true" />
@@ -105,61 +101,20 @@
105
101
  </ul>
106
102
  </div>
107
103
  </aside>
108
-
109
-
110
- <div class="p-4 sm:ml-64 dark:bg-gray-800" v-if="loggedIn && routerIsReady && loginRedirectCheckIsReady">
104
+
105
+ <div class="p-4 sm:ml-64 dark:bg-gray-800" v-if="loggedIn">
111
106
  <div class="p-0 dark:border-gray-700 mt-14">
112
107
  <RouterView/>
113
108
  </div>
114
109
  </div>
115
110
 
116
- <div v-else-if="routerIsReady && loginRedirectCheckIsReady">
111
+ <div v-else-if="routerIsReady">
117
112
  <RouterView/>
118
113
  </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>
125
114
  <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
-
143
115
  </template>
144
116
 
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
-
117
+ <style scoped>
163
118
  </style>
164
119
 
165
120
  <script setup lang="ts">
@@ -168,8 +123,6 @@ import { RouterLink, RouterView } from 'vue-router';
168
123
  import { initFlowbite } from 'flowbite'
169
124
  import './index.scss'
170
125
  import { useCoreStore } from '@/stores/core';
171
- import { useUserStore } from '@/stores/user';
172
- import {useModalStore} from '@/stores/modal';
173
126
  import { IconMoonSolid, IconSunSolid } from '@iconify-prerendered/vue-flowbite';
174
127
  import AcceptModal from './components/AcceptModal.vue';
175
128
  import MenuLink from './components/MenuLink.vue';
@@ -177,34 +130,25 @@ import { useRoute, useRouter } from 'vue-router';
177
130
  import { getIcon } from '@/utils';
178
131
  import { useHead } from 'unhead'
179
132
  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
133
  // import { link } from 'fs';
185
134
  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
- }
135
+
136
+
195
137
  createHead()
196
- const sideBarOpen = ref(false);
138
+
139
+
140
+
141
+
142
+
143
+
197
144
  const route = useRoute();
198
145
  const router = useRouter();
199
146
  const title = ref('');
200
- //create a ref to store the opened menu items with ts type;
201
- const opened = ref<string[]>([]);
202
147
 
203
148
 
204
149
  const routerIsReady = ref(false);
205
- const loginRedirectCheckIsReady = ref(false);
206
150
 
207
- const loggedIn = computed(() => route.name !== 'login');
151
+ const loggedIn = computed(() => route.name !== 'login' && routerIsReady.value);
208
152
 
209
153
  const theme = ref('light');
210
154
 
@@ -213,19 +157,9 @@ function toggleTheme() {
213
157
  document.documentElement.classList.toggle('dark');
214
158
  }
215
159
 
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
-
225
160
  async function logout() {
226
- userStore.unauthorize();
227
- await userStore.logout();
228
- router.push({ name: 'login' })
161
+ await coreStore.logout();
162
+ router.push({ name: 'login' });
229
163
  }
230
164
 
231
165
 
@@ -236,36 +170,22 @@ async function initRouter() {
236
170
  routerIsReady.value = true;
237
171
  }
238
172
 
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
-
259
173
  // initialize components based on data attribute selectors
260
174
  onMounted(async () => {
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
-
175
+ initRouter();
176
+ initFlowbite();
177
+ await coreStore.fetchMenuAndResource();
178
+ title.value = coreStore.config.title || 'Admin Forth';
179
+ useHead({
180
+ title: title.value,
181
+ link: [
182
+ {
183
+ rel: 'icon',
184
+ href: coreStore.config.favicon || '/favicon.ico',
185
+ },
186
+ ],
187
+
188
+ })
269
189
  })
270
190
 
271
191
  </script>
@@ -1,19 +1 @@
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>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
@@ -3,6 +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
+
6
13
  </script>
7
14
 
8
15
  <template>
@@ -21,10 +28,10 @@ const modalStore = useModalStore();
21
28
  <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"/>
22
29
  </svg>
23
30
  <h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{{ modalStore?.modalContent?.content }}</h3>
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">
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">
25
32
  {{ modalStore?.modalContent?.acceptText }}
26
33
  </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>
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>
28
35
  </div>
29
36
  </div>
30
37
  </div>
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <div class="flex items-center justify-between mb-3 flex-wrap gap-y-2">
4
4
  <Breadcrumbs />
5
- <div class="flex items-center space-x-1 flex-wrap gap-y-1">
5
+ <div class="flex items-center space-x-1">
6
6
  <slot></slot>
7
7
  </div>
8
8
  </div>
@@ -67,9 +67,6 @@ const props = defineProps({
67
67
  },
68
68
  label: {
69
69
  type: String,
70
- },
71
- autoHide: {
72
- type: Boolean,
73
70
  }
74
71
  });
75
72
 
@@ -103,7 +100,8 @@ function updateFromProps() {
103
100
  if (!props.valueStart) {
104
101
  datepickerStartEl.value.value = '';
105
102
  startTime.value = '';
106
- } else {
103
+ }
104
+ else {
107
105
  datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
108
106
  startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
109
107
  }
@@ -123,13 +121,7 @@ watch(start, () => {
123
121
  })
124
122
 
125
123
  function initDatepickers() {
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);
124
+ datepickerObject.value = new Datepicker(datepickerStartEl.value, { format: 'dd M yyyy' });
133
125
 
134
126
  addChangeDateListener();
135
127
  }
@@ -142,10 +134,6 @@ function removeChangeDateListener() {
142
134
  datepickerStartEl.value.removeEventListener('changeDate', setStartDate);
143
135
  }
144
136
 
145
- function destroyDatepickerElement() {
146
- datepickerObject.value.destroy();
147
- }
148
-
149
137
  function setStartDate(event) {
150
138
  startDate.value = event.detail.date
151
139
  }
@@ -169,6 +157,5 @@ onMounted(() => {
169
157
 
170
158
  onBeforeUnmount(() => {
171
159
  removeChangeDateListener();
172
- destroyDatepickerElement();
173
160
  });
174
161
  </script>