adminforth 1.0.27 → 1.0.29
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/dist/spa/spa/.eslintrc.cjs +14 -0
- package/dist/spa/spa/.vscode/extensions.json +6 -0
- package/dist/spa/spa/README.md +39 -0
- package/dist/spa/spa/env.d.ts +1 -0
- package/dist/spa/spa/index.html +23 -0
- package/dist/spa/spa/package-lock.json +4158 -0
- package/dist/spa/spa/package.json +41 -0
- package/dist/spa/spa/postcss.config.js +6 -0
- package/dist/spa/spa/public/favicon.ico +0 -0
- package/dist/spa/spa/src/App.vue +172 -0
- package/dist/spa/spa/src/assets/base.css +0 -0
- package/dist/spa/spa/src/assets/logo.svg +1 -0
- package/dist/spa/spa/src/components/AcceptModal.vue +52 -0
- package/dist/spa/spa/src/components/Breadcrumbs.vue +40 -0
- package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
- package/dist/spa/spa/src/components/CustomDatePicker.vue +161 -0
- package/dist/spa/spa/src/components/CustomDateRangePicker.vue +209 -0
- package/dist/spa/spa/src/components/Dropdown.vue +154 -0
- package/dist/spa/spa/src/components/Filters.vue +157 -0
- package/dist/spa/spa/src/components/HelloWorld.vue +17 -0
- package/dist/spa/spa/src/components/MenuLink.vue +24 -0
- package/dist/spa/spa/src/components/ResourceForm.vue +205 -0
- package/dist/spa/spa/src/components/SingleSkeletLoader.vue +13 -0
- package/dist/spa/spa/src/components/ValueRenderer.vue +44 -0
- package/dist/spa/spa/src/components/icons/IconCalendar.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconCommunity.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconDocumentation.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconEcosystem.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconSupport.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconTime.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconTooling.vue +19 -0
- package/dist/spa/spa/src/index.scss +26 -0
- package/dist/spa/spa/src/main.ts +18 -0
- package/dist/spa/spa/src/router/index.ts +53 -0
- package/dist/spa/spa/src/stores/core.ts +138 -0
- package/dist/spa/spa/src/stores/modal.ts +38 -0
- package/dist/spa/spa/src/utils.ts +44 -0
- package/dist/spa/spa/src/views/CreateView.vue +103 -0
- package/dist/spa/spa/src/views/EditView.vue +103 -0
- package/dist/spa/spa/src/views/HomeView.vue +8 -0
- package/dist/spa/spa/src/views/ListView.vue +529 -0
- package/dist/spa/spa/src/views/LoginView.vue +122 -0
- package/dist/spa/spa/src/views/ResourceParent.vue +18 -0
- package/dist/spa/spa/src/views/ShowView.vue +93 -0
- package/dist/spa/spa/tailwind.config.js +12 -0
- package/dist/spa/spa/tsconfig.app.json +14 -0
- package/dist/spa/spa/tsconfig.json +11 -0
- package/dist/spa/spa/tsconfig.node.json +19 -0
- package/dist/spa/spa/vite.config.ts +43 -0
- package/package.json +1 -1
- package/servers/express.ts +1 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative">
|
|
3
|
+
<Teleport to="body">
|
|
4
|
+
<Filters
|
|
5
|
+
:columns="coreStore.resourceColumns"
|
|
6
|
+
v-model:filters="filters"
|
|
7
|
+
:columnsMinMax="columnsMinMax" :show="filtersShow"
|
|
8
|
+
@hide="filtersShow = false"
|
|
9
|
+
/>
|
|
10
|
+
</Teleport>
|
|
11
|
+
|
|
12
|
+
<BreadcrumbsWithButtons>
|
|
13
|
+
<button
|
|
14
|
+
@click="()=>{checkboxes = []}"
|
|
15
|
+
v-if="checkboxes.length"
|
|
16
|
+
data-tooltip-target="tooltip-remove-all"
|
|
17
|
+
data-tooltip-placement="bottom"
|
|
18
|
+
class="flex gap-1 items-center py-1 px-3 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 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"
|
|
19
|
+
>
|
|
20
|
+
<IconBanOutline class="w-5 h-5 "/>
|
|
21
|
+
|
|
22
|
+
<div id="tooltip-remove-all" role="tooltip"
|
|
23
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
24
|
+
Remove selection
|
|
25
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
26
|
+
</div>
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
v-if="checkboxes.length" v-for="(action,i) in allCheckedActions" :key="action.id"
|
|
31
|
+
@click="startBulkAction(action.id)"
|
|
32
|
+
class="flex gap-1 items-center py-1 px-3 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 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"
|
|
33
|
+
:class="{'bg-red-100 text-red-800 border-red-400 dark:bg-red-700 dark:text-red-400 dark:border-red-400':action.state==='danger', 'bg-green-100 text-green-800 border-green-400 dark:bg-green-700 dark:text-green-400 dark:border-green-400':action.state==='success',
|
|
34
|
+
'bg-blue-100 text-blue-800 border-blue-400 dark:bg-blue-700 dark:text-blue-400 dark:border-blue-400':action.state==='active',
|
|
35
|
+
}"
|
|
36
|
+
>
|
|
37
|
+
<component
|
|
38
|
+
v-if="action.icon"
|
|
39
|
+
:is="getIcon(action.icon)"
|
|
40
|
+
class="w-5 h-5 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"></component>
|
|
41
|
+
|
|
42
|
+
{{ `${action.label} (${checkboxes.length})` }}
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
<RouterLink v-if="allowedActions.create"
|
|
46
|
+
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
47
|
+
class="flex items-center py-1 px-3 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 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"
|
|
48
|
+
>
|
|
49
|
+
<IconPlusOutline class="w-4 h-4 me-2"/>
|
|
50
|
+
Create
|
|
51
|
+
</RouterLink>
|
|
52
|
+
|
|
53
|
+
<button
|
|
54
|
+
class="flex gap-1 items-center py-1 px-3 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 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"
|
|
55
|
+
@click="()=>{filtersShow = !filtersShow}"
|
|
56
|
+
>
|
|
57
|
+
<IconFilterOutline class="w-4 h-4 me-2"/>
|
|
58
|
+
Filter
|
|
59
|
+
<span
|
|
60
|
+
class="bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-red-400 border border-red-400"
|
|
61
|
+
v-if="filters.length">
|
|
62
|
+
{{ filters.length }}
|
|
63
|
+
</span>
|
|
64
|
+
</button>
|
|
65
|
+
</BreadcrumbsWithButtons>
|
|
66
|
+
|
|
67
|
+
<!-- table -->
|
|
68
|
+
<div class="relative overflow-x-auto shadow-md sm:rounded-lg dark:shadow-2xl">
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
<!-- skelet loader -->
|
|
72
|
+
<div role="status" v-if="!coreStore.resourceColumns"
|
|
73
|
+
class="max-w p-4 space-y-4 divide-y divide-gray-200 rounded shadow animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700">
|
|
74
|
+
<div class="flex items-center justify-between h-16">
|
|
75
|
+
<div>
|
|
76
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
77
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="flex items-center justify-between h-16 pt-4" v-for="i in new Array(10)">
|
|
83
|
+
<div>
|
|
84
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
85
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
88
|
+
</div>
|
|
89
|
+
<span class="sr-only">Loading...</span>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<table v-else class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
|
93
|
+
<thead class="text-xs text-gray-700 bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
|
94
|
+
<tr>
|
|
95
|
+
<th scope="col" class="p-4">
|
|
96
|
+
<div v-if="rows && rows.length" class="flex items-center">
|
|
97
|
+
<input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
|
|
98
|
+
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
|
|
99
|
+
<label for="checkbox-all-search" class="sr-only">checkbox</label>
|
|
100
|
+
</div>
|
|
101
|
+
</th>
|
|
102
|
+
|
|
103
|
+
<th v-for="c in columnsListed" scope="col" class="px-6 py-3">
|
|
104
|
+
<div @click="() => c.sortable && onSortButtonClick(c.name)" class="flex items-center " :class="{'cursor-pointer':c.sortable}">
|
|
105
|
+
{{ c.label }}
|
|
106
|
+
|
|
107
|
+
<div v-if="c.sortable"
|
|
108
|
+
:style="{ 'color':ascArr.includes(c.name)?'green':descArr.includes(c.name)?'red':'currentColor'}">
|
|
109
|
+
<svg v-if="ascArr.includes(c.name) || descArr.includes(c.name)" class="w-3 h-3 ms-1.5"
|
|
110
|
+
:class="{'rotate-180':descArr.includes(c.name)}" viewBox="0 0 24 24">
|
|
111
|
+
<path
|
|
112
|
+
d="M8.574 11.024h6.852a2.075 2.075 0 0 0 1.847-1.086 1.9 1.9 0 0 0-.11-1.986L13.736 2.9a2.122 2.122 0 0 0-3.472 0L6.837 7.952a1.9 1.9 0 0 0-.11 1.986 2.074 2.074 0 0 0 1.847"/>
|
|
113
|
+
</svg>
|
|
114
|
+
<svg v-else class="w-3 h-3 ms-1.5 opacity-30" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
|
115
|
+
fill='currentColor'
|
|
116
|
+
viewBox="0 0 24 24">
|
|
117
|
+
<path
|
|
118
|
+
d="M8.574 11.024h6.852a2.075 2.075 0 0 0 1.847-1.086 1.9 1.9 0 0 0-.11-1.986L13.736 2.9a2.122 2.122 0 0 0-3.472 0L6.837 7.952a1.9 1.9 0 0 0-.11 1.986 2.074 2.074 0 0 0 1.847 1.086Zm6.852 1.952H8.574a2.072 2.072 0 0 0-1.847 1.087 1.9 1.9 0 0 0 .11 1.985l3.426 5.05a2.123 2.123 0 0 0 3.472 0l3.427-5.05a1.9 1.9 0 0 0 .11-1.985 2.074 2.074 0 0 0-1.846-1.087Z"/>
|
|
119
|
+
</svg>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</th>
|
|
123
|
+
|
|
124
|
+
<th scope="col" class="px-6 py-3">
|
|
125
|
+
Actions
|
|
126
|
+
</th>
|
|
127
|
+
</tr>
|
|
128
|
+
</thead>
|
|
129
|
+
<tbody>
|
|
130
|
+
<tr v-if="!rows" class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
|
131
|
+
<td :colspan="coreStore.resourceColumns.length + 2">
|
|
132
|
+
|
|
133
|
+
<div role="status"
|
|
134
|
+
class="max-w p-4 space-y-4 divide-y divide-gray-200 rounded animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700">
|
|
135
|
+
<div class="flex items-center justify-between">
|
|
136
|
+
<div>
|
|
137
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
138
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
139
|
+
</div>
|
|
140
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="flex items-center justify-between pt-4">
|
|
143
|
+
<div>
|
|
144
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
145
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="flex items-center justify-between pt-4">
|
|
150
|
+
<div>
|
|
151
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
152
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="flex items-center justify-between pt-4">
|
|
157
|
+
<div>
|
|
158
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
159
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="flex items-center justify-between pt-4">
|
|
164
|
+
<div>
|
|
165
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"></div>
|
|
166
|
+
<div class="w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"></div>
|
|
169
|
+
</div>
|
|
170
|
+
<span class="sr-only">Loading...</span>
|
|
171
|
+
</div>
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
<tr v-else-if="rows.length === 0" class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
|
|
175
|
+
<td :colspan="coreStore.resourceColumns.length + 2">
|
|
176
|
+
|
|
177
|
+
<div id="toast-simple"
|
|
178
|
+
class=" mx-auto my-5 flex items-center w-full max-w-xs p-4 space-x-4 rtl:space-x-reverse text-gray-500 bg-white divide-x rtl:divide-x-reverse divide-gray-200 dark:text-gray-400 dark:divide-gray-700 space-x dark:bg-gray-800"
|
|
179
|
+
role="alert">
|
|
180
|
+
<IconInboxOutline class="w-6 h-6 text-gray-500 dark:text-gray-400"/>
|
|
181
|
+
<div class="ps-4 text-sm font-normal">No items here yet</div>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
</td>
|
|
185
|
+
</tr>
|
|
186
|
+
|
|
187
|
+
<tr v-else v-for="(row, rowI) in rows" :key="row.id"
|
|
188
|
+
class="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600">
|
|
189
|
+
<td class="w-4 p-4">
|
|
190
|
+
<div class="flex items center">
|
|
191
|
+
<input
|
|
192
|
+
id="checkbox-table-search-1"
|
|
193
|
+
type="checkbox"
|
|
194
|
+
:checked="checkboxes.includes(row.id)"
|
|
195
|
+
@change="(e)=>{addToCheckedValues(row.id)}"
|
|
196
|
+
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
|
|
197
|
+
<label for="checkbox-table-search-1" class="sr-only">checkbox</label>
|
|
198
|
+
</div>
|
|
199
|
+
</td>
|
|
200
|
+
<td v-for="c in columnsListed" class="px-6 py-4">
|
|
201
|
+
<ValueRenderer :column="c" :row="row"/>
|
|
202
|
+
</td>
|
|
203
|
+
<td class="flex items-center px-6 py-4">
|
|
204
|
+
|
|
205
|
+
<RouterLink
|
|
206
|
+
:to="{ name: 'resource-show', params: { resourceId: $route.params.resourceId, primaryKey: row._primaryKeyValue } }"
|
|
207
|
+
class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
|
|
208
|
+
:data-tooltip-target="`tooltip-show-${rowI}`"
|
|
209
|
+
>
|
|
210
|
+
<IconEyeSolid class="w-5 h-5 me-2"/>
|
|
211
|
+
</RouterLink>
|
|
212
|
+
|
|
213
|
+
<div :id="`tooltip-show-${rowI}`"
|
|
214
|
+
role="tooltip"
|
|
215
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
216
|
+
Show item
|
|
217
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<RouterLink v-if="allowedActions.edit"
|
|
221
|
+
:to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: row._primaryKeyValue } }"
|
|
222
|
+
class="font-medium text-blue-600 dark:text-blue-500 hover:underline ms-3"
|
|
223
|
+
:data-tooltip-target="`tooltip-edit-${rowI}`"
|
|
224
|
+
>
|
|
225
|
+
<IconPenSolid class="w-5 h-5 me-2"/>
|
|
226
|
+
</RouterLink>
|
|
227
|
+
|
|
228
|
+
<div :id="`tooltip-edit-${rowI}`"
|
|
229
|
+
role="tooltip"
|
|
230
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
231
|
+
Edit
|
|
232
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<button v-if="allowedActions.delete"
|
|
236
|
+
class="font-medium text-red-600 dark:text-red-500 hover:underline ms-3"
|
|
237
|
+
:data-tooltip-target="`tooltip-delete-${rowI}`"
|
|
238
|
+
@click="showDeleteModal(row)"
|
|
239
|
+
>
|
|
240
|
+
<IconTrashBinSolid class="w-5 h-5 me-2"/>
|
|
241
|
+
</button>
|
|
242
|
+
|
|
243
|
+
<div :id="`tooltip-delete-${rowI}`"
|
|
244
|
+
role="tooltip"
|
|
245
|
+
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
|
246
|
+
Delete
|
|
247
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
248
|
+
</div>
|
|
249
|
+
</td>
|
|
250
|
+
</tr>
|
|
251
|
+
</tbody>
|
|
252
|
+
</table>
|
|
253
|
+
</div>
|
|
254
|
+
<!-- pagination -->
|
|
255
|
+
<div class="flex flex-col items-center mt-4 xs:flex-row xs:justify-between xs:items-center"
|
|
256
|
+
v-if="rows && totalRows >= pageSize && totalRows > 0"
|
|
257
|
+
>
|
|
258
|
+
<!-- Help text -->
|
|
259
|
+
<span class="text-sm text-gray-700 dark:text-gray-400">
|
|
260
|
+
Showing <span class="font-semibold text-gray-900 dark:text-white">
|
|
261
|
+
{{ (page - 1) * pageSize + 1 }}
|
|
262
|
+
</span> to <span class="font-semibold text-gray-900 dark:text-white">
|
|
263
|
+
{{ Math.min(page * pageSize, totalRows) }}
|
|
264
|
+
</span> of <span class="font-semibold text-gray-900 dark:text-white">{{
|
|
265
|
+
totalRows
|
|
266
|
+
}}</span> Entries
|
|
267
|
+
</span>
|
|
268
|
+
<div class="inline-flex mt-2 xs:mt-0">
|
|
269
|
+
<!-- Buttons -->
|
|
270
|
+
<button
|
|
271
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-r-0 rounded-s border border-gray-300 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 disabled:opacity-50"
|
|
272
|
+
@click="page--" :disabled="page <= 1">
|
|
273
|
+
<svg class="w-3.5 h-3.5 me-2 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
274
|
+
viewBox="0 0 14 10">
|
|
275
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
276
|
+
d="M13 5H1m0 0 4 4M1 5l4-4"/>
|
|
277
|
+
</svg>
|
|
278
|
+
Prev
|
|
279
|
+
</button>
|
|
280
|
+
<button
|
|
281
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-r-0 border border-gray-300 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 disabled:opacity-50"
|
|
282
|
+
@click="page = 1" :disabled="page <= 1">
|
|
283
|
+
<!-- <IconChevronDoubleLeftOutline class="w-4 h-4" /> -->
|
|
284
|
+
1
|
|
285
|
+
</button>
|
|
286
|
+
<input type="text"
|
|
287
|
+
class="w-10 py-1.5 px-3 text-sm text-center text-gray-700 border border-gray-300 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800 z-10"
|
|
288
|
+
v-model="page"/>
|
|
289
|
+
|
|
290
|
+
<button
|
|
291
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-l-0 border border-gray-300 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 disabled:opacity-50"
|
|
292
|
+
@click="page = totalPages" :disabled="page >= totalPages">
|
|
293
|
+
{{ totalPages }}
|
|
294
|
+
<!-- <IconChevronDoubleRightOutline class="w-4 h-4" /> -->
|
|
295
|
+
</button>
|
|
296
|
+
<button
|
|
297
|
+
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-l-0 rounded-e border border-gray-300 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 disabled:opacity-50"
|
|
298
|
+
|
|
299
|
+
@click="page++" :disabled="page >= totalPages">
|
|
300
|
+
Next
|
|
301
|
+
<svg class="w-3.5 h-3.5 ms-2 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
302
|
+
viewBox="0 0 14 10">
|
|
303
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
304
|
+
d="M1 5h12m0 0L9 1m4 4L9 9"/>
|
|
305
|
+
</svg>
|
|
306
|
+
</button>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
</template>
|
|
311
|
+
|
|
312
|
+
<script setup>
|
|
313
|
+
import {ref, onMounted, watch, computed} from 'vue';
|
|
314
|
+
import {callAdminForthApi, getIcon} from '@/utils';
|
|
315
|
+
import {useRoute} from 'vue-router';
|
|
316
|
+
import {useCoreStore} from '@/stores/core';
|
|
317
|
+
import {useModalStore} from '@/stores/modal';
|
|
318
|
+
import BreadcrumbsWithButtons from '@/components/BreadcrumbsWithButtons.vue';
|
|
319
|
+
import {initFlowbite} from 'flowbite'
|
|
320
|
+
|
|
321
|
+
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
322
|
+
|
|
323
|
+
import {
|
|
324
|
+
IconChevronDoubleLeftOutline,
|
|
325
|
+
IconChevronDoubleRightOutline,
|
|
326
|
+
IconInboxFullSolid,
|
|
327
|
+
IconInboxOutline,
|
|
328
|
+
IconPlusOutline
|
|
329
|
+
} from '@iconify-prerendered/vue-flowbite';
|
|
330
|
+
|
|
331
|
+
import {
|
|
332
|
+
IconEyeSolid,
|
|
333
|
+
IconTrashBinSolid,
|
|
334
|
+
IconPenSolid,
|
|
335
|
+
IconFilterOutline, IconBanOutline
|
|
336
|
+
} from '@iconify-prerendered/vue-flowbite';
|
|
337
|
+
|
|
338
|
+
import Filters from '@/components/Filters.vue';
|
|
339
|
+
|
|
340
|
+
const filtersShow = ref(false);
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
const coreStore = useCoreStore();
|
|
344
|
+
const modalStore = useModalStore();
|
|
345
|
+
|
|
346
|
+
const route = useRoute();
|
|
347
|
+
const checkboxes = ref([]);
|
|
348
|
+
|
|
349
|
+
const page = ref(1);
|
|
350
|
+
const filters = ref([]);
|
|
351
|
+
const columnsMinMax = ref({});
|
|
352
|
+
const sort = ref([]);
|
|
353
|
+
const fetchStatus = ref({pending: false, error: null, success: false});
|
|
354
|
+
|
|
355
|
+
const rows = ref(null);
|
|
356
|
+
const totalRows = ref(0);
|
|
357
|
+
const allCheckedActions = ref([]);
|
|
358
|
+
const allowedActions = ref({});
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
362
|
+
|
|
363
|
+
const columnsListed = computed(() => coreStore.resourceColumns?.filter(c => c.showIn.includes('list')));
|
|
364
|
+
|
|
365
|
+
async function selectAll(value) {
|
|
366
|
+
console.log('select all');
|
|
367
|
+
rows.value.forEach((r) => {
|
|
368
|
+
if (!checkboxes.value.includes(r.id)) {
|
|
369
|
+
checkboxes.value.push(r.id)
|
|
370
|
+
} else {
|
|
371
|
+
checkboxes.value = checkboxes.value.filter((item) => item !== r.id)
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
// checkboxes.value = rows.value.map((v) => v.id);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const pageSize = computed(() => coreStore.resourceById[route.params.resourceId]?.pageSize || DEFAULT_PAGE_SIZE);
|
|
378
|
+
const totalPages = computed(() => Math.ceil(totalRows.value / pageSize.value));
|
|
379
|
+
const allFromThisPageChecked = computed(() => {
|
|
380
|
+
if (!rows.value) return false;
|
|
381
|
+
return rows.value.every((r) => checkboxes.value.includes(r.id));
|
|
382
|
+
});
|
|
383
|
+
const ascArr = computed(() => sort.value.filter((s) => s.direction === 'asc').map((s) => s.field));
|
|
384
|
+
const descArr = computed(() => sort.value.filter((s) => s.direction === 'desc').map((s) => s.field));
|
|
385
|
+
|
|
386
|
+
watch([page], async () => {
|
|
387
|
+
await init();
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
watch([filters], async () => {
|
|
391
|
+
page.value = 1;
|
|
392
|
+
await getList();
|
|
393
|
+
}, {deep: true});
|
|
394
|
+
|
|
395
|
+
watch([sort], async () => {
|
|
396
|
+
await init();
|
|
397
|
+
}, {deep: true});
|
|
398
|
+
|
|
399
|
+
function onSortButtonClick(field) {
|
|
400
|
+
if (fetchStatus.value.pending) return;
|
|
401
|
+
const sortIndex = sort.value.findIndex((s) => s.field === field);
|
|
402
|
+
console.log('sortIndex', sortIndex);
|
|
403
|
+
if (sortIndex === -1) {
|
|
404
|
+
sort.value = [{field, direction: 'asc'}, ...sort.value];
|
|
405
|
+
} else {
|
|
406
|
+
const sortField = sort.value[sortIndex];
|
|
407
|
+
if (sortField.direction === 'asc') {
|
|
408
|
+
sort.value[sortIndex].direction = 'desc';
|
|
409
|
+
} else {
|
|
410
|
+
sort.value.splice(sortIndex, 1);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
async function getList() {
|
|
416
|
+
rows.value = null;
|
|
417
|
+
fetchStatus.value.pending = true;
|
|
418
|
+
const data = await callAdminForthApi({
|
|
419
|
+
path: '/get_resource_data',
|
|
420
|
+
method: 'POST',
|
|
421
|
+
body: {
|
|
422
|
+
resourceId: route.params.resourceId,
|
|
423
|
+
limit: pageSize.value,
|
|
424
|
+
offset: (page.value - 1) * pageSize.value,
|
|
425
|
+
filters: filters.value,
|
|
426
|
+
sort: sort.value,
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
fetchStatus.value.pending = false;
|
|
430
|
+
rows.value = data.data?.map(row => {
|
|
431
|
+
row._primaryKeyValue = row[coreStore.resourceColumns.find(c => c.primaryKey).name];
|
|
432
|
+
return row;
|
|
433
|
+
});
|
|
434
|
+
totalRows.value = data.total;
|
|
435
|
+
allCheckedActions.value = data.options?.bulkActions || [];
|
|
436
|
+
allowedActions.value = data.options?.allowedActions;
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
setTimeout(() => {
|
|
440
|
+
initFlowbite();
|
|
441
|
+
console.log('initFlowbite');
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
function showDeleteModal(row) {
|
|
447
|
+
if (!coreStore.config?.deleteConfirmation) {
|
|
448
|
+
return deleteRecord(row);
|
|
449
|
+
}
|
|
450
|
+
modalStore.setModalContent({
|
|
451
|
+
content: 'Are you sure you want to delete this item?',
|
|
452
|
+
acceptText: 'Delete',
|
|
453
|
+
cancelText: 'Cancel',
|
|
454
|
+
});
|
|
455
|
+
modalStore.setOnAcceptFunction(() => {
|
|
456
|
+
return deleteRecord(row)
|
|
457
|
+
})
|
|
458
|
+
console.log('row', row);
|
|
459
|
+
modalStore.togleModal();
|
|
460
|
+
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
async function deleteRecord(row) {
|
|
464
|
+
await callAdminForthApi({
|
|
465
|
+
path: '/delete_record',
|
|
466
|
+
method: 'POST',
|
|
467
|
+
body: {
|
|
468
|
+
resourceId: route.params.resourceId,
|
|
469
|
+
primaryKey: row._primaryKeyValue,
|
|
470
|
+
recordId: row.id
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
await getList();
|
|
474
|
+
modalStore.resetmodalState()
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
async function startBulkAction(actionId) {
|
|
478
|
+
const data = await callAdminForthApi({
|
|
479
|
+
path: '/start_bulk_action',
|
|
480
|
+
method: 'POST',
|
|
481
|
+
body: {
|
|
482
|
+
resourceId: route.params.resourceId,
|
|
483
|
+
actionId: actionId,
|
|
484
|
+
recordIds: checkboxes.value
|
|
485
|
+
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
if (data?.status === 'success') {
|
|
489
|
+
checkboxes.value = [];
|
|
490
|
+
}
|
|
491
|
+
await getList();
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function addToCheckedValues(id) {
|
|
495
|
+
if (checkboxes.value.includes(id)) {
|
|
496
|
+
checkboxes.value = checkboxes.value.filter((item) => item !== id);
|
|
497
|
+
} else {
|
|
498
|
+
checkboxes.value.push(id);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
async function init() {
|
|
503
|
+
await coreStore.fetchColumns({
|
|
504
|
+
resourceId: route.params.resourceId
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
await getList();
|
|
508
|
+
columnsMinMax.value = await callAdminForthApi({
|
|
509
|
+
path: '/get_min_max_for_columns',
|
|
510
|
+
method: 'POST',
|
|
511
|
+
body: {
|
|
512
|
+
resourceId: route.params.resourceId
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
onMounted(async () => {
|
|
518
|
+
await init();
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// on route param change
|
|
522
|
+
watch(() => route.params.resourceId, async () => {
|
|
523
|
+
filters.value = [];
|
|
524
|
+
checkboxes.value = [];
|
|
525
|
+
sort.value = [];
|
|
526
|
+
await init();
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
</script>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800"
|
|
3
|
+
:style="coreStore.config?.loginBackgroundImage ? {
|
|
4
|
+
'background-image': 'url(' + coreStore.config?.loginBackgroundImage + ')',
|
|
5
|
+
'background-size': 'cover',
|
|
6
|
+
'background-position': 'center',
|
|
7
|
+
'background-blend-mode': 'darken'
|
|
8
|
+
}: {}"
|
|
9
|
+
>
|
|
10
|
+
<!-- Main modal -->
|
|
11
|
+
<div id="authentication-modal" tabindex="-1" class=" overflow-y-auto overflow-x-hidden z-50 min-w-[400px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
12
|
+
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
13
|
+
<!-- Modal content -->
|
|
14
|
+
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
|
15
|
+
<!-- Modal header -->
|
|
16
|
+
<div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
|
|
17
|
+
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
|
|
18
|
+
Sign in to {{ coreStore.config?.brandName }}
|
|
19
|
+
</h3>
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
<!-- Modal body -->
|
|
23
|
+
<div class="p-4 md:p-5">
|
|
24
|
+
<form class="space-y-4" @submit.prevent>
|
|
25
|
+
<div>
|
|
26
|
+
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
|
|
27
|
+
<input type="username" name="username" id="username" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" placeholder="name@company.com" required />
|
|
28
|
+
</div>
|
|
29
|
+
<div class="relative">
|
|
30
|
+
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your password</label>
|
|
31
|
+
<input :type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white" required />
|
|
32
|
+
<button type="button" @click="showPw = !showPw" class="absolute top-12 right-3 -translate-y-1/2 text-gray-400 dark:text-gray-300">
|
|
33
|
+
<IconEyeSolid class="w-5 h-5" v-if="!showPw" />
|
|
34
|
+
<IconEyeSlashSolid class="w-5 h-5" v-else />
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
<!-- <div class="flex justify-between">
|
|
38
|
+
<div class="flex items-start"> -->
|
|
39
|
+
<!-- <div class="flex items-center h-5">
|
|
40
|
+
<input id="remember" type="checkbox" value="" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-600 dark:border-gray-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800" required />
|
|
41
|
+
</div>
|
|
42
|
+
<label for="remember" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300">Remember me</label> -->
|
|
43
|
+
<!-- </div> -->
|
|
44
|
+
<!-- <a href="#" class="text-sm text-blue-700 hover:underline dark:text-blue-500">Lost Password?</a> -->
|
|
45
|
+
<!-- </div> -->
|
|
46
|
+
|
|
47
|
+
<div v-if="error" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
|
|
48
|
+
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
49
|
+
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
|
50
|
+
</svg>
|
|
51
|
+
<span class="sr-only">Info</span>
|
|
52
|
+
<div>
|
|
53
|
+
{{ error }}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<button
|
|
58
|
+
@click="login"
|
|
59
|
+
type="submit" class="flex items-center justify-center gap-1 w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
|
|
60
|
+
<svg v-if="inProgress"
|
|
61
|
+
aria-hidden="true" class="w-4 h-4 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>
|
|
62
|
+
|
|
63
|
+
Login to your account
|
|
64
|
+
|
|
65
|
+
</button>
|
|
66
|
+
</form>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<script setup>
|
|
80
|
+
|
|
81
|
+
import { onMounted, ref } from 'vue';
|
|
82
|
+
import { useCoreStore } from '@/stores/core';
|
|
83
|
+
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
84
|
+
import { callAdminForthApi } from '@/utils';
|
|
85
|
+
import { useRouter } from 'vue-router';
|
|
86
|
+
|
|
87
|
+
const router = useRouter();
|
|
88
|
+
const inProgress = ref(false);
|
|
89
|
+
|
|
90
|
+
const coreStore = useCoreStore();
|
|
91
|
+
|
|
92
|
+
const showPw = ref(false);
|
|
93
|
+
|
|
94
|
+
const error = ref(null);
|
|
95
|
+
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
coreStore.getPublicConfig()
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
async function login() {
|
|
101
|
+
inProgress.value = true;
|
|
102
|
+
const resp = await callAdminForthApi({
|
|
103
|
+
path: '/login',
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: {
|
|
106
|
+
username: document.getElementById('username').value,
|
|
107
|
+
password: document.getElementById('password').value,
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
inProgress.value = false;
|
|
111
|
+
if (resp.error) {
|
|
112
|
+
error.value = resp.error;
|
|
113
|
+
} else {
|
|
114
|
+
error.value = null;
|
|
115
|
+
router.push('/');
|
|
116
|
+
await coreStore.fetchMenuAndResource();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<RouterView/>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
</style>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import { useCoreStore } from '@/stores/core';
|
|
14
|
+
import { onMounted } from 'vue';
|
|
15
|
+
|
|
16
|
+
const coreStore = useCoreStore()
|
|
17
|
+
|
|
18
|
+
</script>
|