@7365admin1/layer-common 1.8.0
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.editorconfig +12 -0
- package/.github/workflows/main.yml +17 -0
- package/.github/workflows/publish.yml +39 -0
- package/.nuxtrc +1 -0
- package/.playground/app.vue +41 -0
- package/.playground/eslint.config.mjs +6 -0
- package/.playground/nuxt.config.ts +22 -0
- package/.playground/pages/feedback.vue +30 -0
- package/CHANGELOG.md +263 -0
- package/README.md +73 -0
- package/app.vue +3 -0
- package/components/AccessCardAddForm.vue +363 -0
- package/components/AccessManagement.vue +420 -0
- package/components/Avatar/Main.vue +68 -0
- package/components/BillingMain.vue +66 -0
- package/components/BtnUploadFile.vue +139 -0
- package/components/BuildingForm.vue +303 -0
- package/components/BuildingManagement/buildings.vue +335 -0
- package/components/BuildingManagement/units.vue +350 -0
- package/components/BuildingUnitFormAdd.vue +441 -0
- package/components/BuildingUnitFormEdit.vue +429 -0
- package/components/CameraForm.vue +264 -0
- package/components/CameraMain.vue +352 -0
- package/components/Card/DeleteConfirmation.vue +51 -0
- package/components/Card/MemberInfoSummary.vue +44 -0
- package/components/Card/Toggle.vue +25 -0
- package/components/Chat/Bubbles.vue +53 -0
- package/components/Chat/Information.vue +416 -0
- package/components/Chat/ListCard.vue +62 -0
- package/components/Chat/Message.vue +158 -0
- package/components/Chat/Navigation.vue +150 -0
- package/components/ConfirmDialog.vue +66 -0
- package/components/Container/Standard.vue +33 -0
- package/components/DashboardPlaceholder.vue +1524 -0
- package/components/Dialog/DeleteConfirmation.vue +51 -0
- package/components/Dialog/ReplaceAutofillPrompt.vue +49 -0
- package/components/Dialog/UpdateMoreAction.vue +103 -0
- package/components/DocumentForm.vue +187 -0
- package/components/DocumentManagement.vue +376 -0
- package/components/Editor.vue +95 -0
- package/components/EntryPassMain.vue +518 -0
- package/components/Feedback/Form.vue +173 -0
- package/components/FeedbackDetail.vue +599 -0
- package/components/FeedbackMain.vue +588 -0
- package/components/FormDialog.vue +65 -0
- package/components/ImageCarousel.vue +138 -0
- package/components/Input/Date.vue +177 -0
- package/components/Input/DateTimePicker.vue +131 -0
- package/components/Input/File.vue +236 -0
- package/components/Input/FileV2.vue +234 -0
- package/components/Input/InputPhoneNumberV2.vue +164 -0
- package/components/Input/ListGroupSelection.vue +96 -0
- package/components/Input/NRICNumber.vue +53 -0
- package/components/Input/NewDate.vue +123 -0
- package/components/Input/Number.vue +124 -0
- package/components/Input/Password.vue +22 -0
- package/components/Input/PhoneNumber.vue +188 -0
- package/components/Input/VehicleNumber.vue +49 -0
- package/components/InputLabel.vue +22 -0
- package/components/InvitationForm.vue +359 -0
- package/components/InvitationMain.vue +310 -0
- package/components/Layout/Header.vue +129 -0
- package/components/Layout/NavigationDrawer.vue +44 -0
- package/components/ListItem.vue +35 -0
- package/components/ListView.vue +87 -0
- package/components/LocalPagination.vue +31 -0
- package/components/MemberMain.vue +459 -0
- package/components/NFC/NFCPatrolReportMain.vue +591 -0
- package/components/NFC/NFCPatrolRouteForm.vue +596 -0
- package/components/NFC/NFCPatrolRouteMain.vue +539 -0
- package/components/NFC/NFCTagForm.vue +236 -0
- package/components/NFC/NFCTagMain.vue +337 -0
- package/components/NFC/PatrolSettings.vue +130 -0
- package/components/NavigationItem.vue +83 -0
- package/components/NumberSettingField.vue +107 -0
- package/components/OnlineFormConfigurationForm.vue +290 -0
- package/components/OnlineFormsConfiguration.vue +429 -0
- package/components/PeopleForm.vue +452 -0
- package/components/PlaceholderComponent.vue +34 -0
- package/components/RolePermissionFormCreate.vue +161 -0
- package/components/RolePermissionFormPreviewUpdate.vue +183 -0
- package/components/RolePermissionMain.vue +361 -0
- package/components/SearchVehicleNumberUser.vue +91 -0
- package/components/ServiceProviderFormCreate.vue +154 -0
- package/components/ServiceProviderMain.vue +547 -0
- package/components/SignaturePad.vue +73 -0
- package/components/Snackbar.vue +23 -0
- package/components/SpecificAttr.vue +53 -0
- package/components/SupplyManagement.vue +292 -0
- package/components/SwitchContext.vue +108 -0
- package/components/TableList.vue +150 -0
- package/components/TableListSecondary.vue +164 -0
- package/components/TableMain.vue +142 -0
- package/components/TableWithButton.vue +94 -0
- package/components/VehicleUpdateMoreAction.vue +84 -0
- package/components/VideoPlayer.vue +125 -0
- package/components/VisitorForm.vue +659 -0
- package/components/VisitorFormSelection.vue +53 -0
- package/components/VisitorManagement.vue +490 -0
- package/components/WorkOrder/Create.vue +284 -0
- package/components/WorkOrder/Detail.vue +71 -0
- package/components/WorkOrder/ListView.vue +96 -0
- package/components/WorkOrder/Main.vue +489 -0
- package/components/Workorder.vue +1 -0
- package/composables/useAddress.ts +107 -0
- package/composables/useBuilding.ts +250 -0
- package/composables/useBuildingUnit.ts +116 -0
- package/composables/useCard.ts +46 -0
- package/composables/useCommonPermission.ts +207 -0
- package/composables/useCustomer.ts +113 -0
- package/composables/useCustomerSite.ts +56 -0
- package/composables/useDashboard.ts +31 -0
- package/composables/useDashboardData.ts +425 -0
- package/composables/useDocument.ts +57 -0
- package/composables/useFacility.ts +246 -0
- package/composables/useFeedback.ts +119 -0
- package/composables/useFile.ts +55 -0
- package/composables/useInvoice.ts +18 -0
- package/composables/useLocal.ts +131 -0
- package/composables/useLocalAuth.ts +137 -0
- package/composables/useLocalSetup.ts +13 -0
- package/composables/useMember.ts +111 -0
- package/composables/useNFCPatrolRoute.ts +77 -0
- package/composables/useNFCPatrolSettings.ts +19 -0
- package/composables/useNFCPatrolTag.ts +53 -0
- package/composables/useOnlineForm.ts +67 -0
- package/composables/useOrg.ts +129 -0
- package/composables/usePDFDownload.ts +25 -0
- package/composables/usePaymentMethod.ts +101 -0
- package/composables/usePeople.ts +81 -0
- package/composables/usePermission.ts +54 -0
- package/composables/usePhoneCountries.ts +561 -0
- package/composables/usePrice.ts +15 -0
- package/composables/usePromoCode.ts +36 -0
- package/composables/useRecapPermission.ts +26 -0
- package/composables/useRole.ts +104 -0
- package/composables/useSecurityUtils.ts +18 -0
- package/composables/useServiceProvider.ts +224 -0
- package/composables/useSite.ts +109 -0
- package/composables/useSiteEntryPassSettings.ts +46 -0
- package/composables/useSiteSettings.ts +123 -0
- package/composables/useSubscription.ts +150 -0
- package/composables/useUser.ts +132 -0
- package/composables/useUtils.ts +445 -0
- package/composables/useVerification.ts +34 -0
- package/composables/useVisitor.ts +120 -0
- package/composables/useWorkOrder.ts +85 -0
- package/error.vue +41 -0
- package/layouts/plain.vue +7 -0
- package/middleware/01.auth.ts +20 -0
- package/middleware/02.org.ts +21 -0
- package/middleware/03.customer.ts +13 -0
- package/middleware/member.ts +4 -0
- package/nuxt.config.ts +54 -0
- package/package.json +39 -0
- package/pages/index.vue +3 -0
- package/pages/payment-method-linked.vue +31 -0
- package/pages/require-customer.vue +56 -0
- package/pages/require-organization-membership.vue +47 -0
- package/pages/unauthorized.vue +29 -0
- package/plugins/API.ts +21 -0
- package/plugins/iconify.client.ts +5 -0
- package/plugins/secure-member.client.ts +86 -0
- package/plugins/vuetify.ts +62 -0
- package/public/bg-camera.jpg +0 -0
- package/public/bg-city.jpg +0 -0
- package/public/bg-condo.jpg +0 -0
- package/public/images/icons/delete-icon.png +0 -0
- package/public/sprite.svg +1 -0
- package/tsconfig.json +3 -0
- package/types/address.d.ts +13 -0
- package/types/building.d.ts +27 -0
- package/types/camera.d.ts +31 -0
- package/types/card.d.ts +22 -0
- package/types/customer.d.ts +27 -0
- package/types/document.d.ts +6 -0
- package/types/feedback.d.ts +68 -0
- package/types/local.d.ts +74 -0
- package/types/member.d.ts +21 -0
- package/types/online-form.d.ts +15 -0
- package/types/org.d.ts +13 -0
- package/types/people.d.ts +24 -0
- package/types/permission.d.ts +25 -0
- package/types/phone-number.d.ts +10 -0
- package/types/price.d.ts +17 -0
- package/types/promo-code.d.ts +19 -0
- package/types/role.d.ts +11 -0
- package/types/select.d.ts +4 -0
- package/types/service-provider.d.ts +15 -0
- package/types/site.d.ts +20 -0
- package/types/subscription.d.ts +23 -0
- package/types/user.d.ts +19 -0
- package/types/verification.d.ts +20 -0
- package/types/visitor.d.ts +42 -0
- package/types/work-order.d.ts +42 -0
- package/utils/phoneMasks.ts +1703 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters>
|
|
3
|
+
<v-col cols="12" class="mb-2">
|
|
4
|
+
<v-row no-gutters>
|
|
5
|
+
<v-btn
|
|
6
|
+
class="text-none"
|
|
7
|
+
rounded="pill"
|
|
8
|
+
variant="tonal"
|
|
9
|
+
size="large"
|
|
10
|
+
@click="setOnlineForm()"
|
|
11
|
+
v-if="canCreate && canCreateOnlineFormConfiguration"
|
|
12
|
+
>
|
|
13
|
+
Add Online Form
|
|
14
|
+
</v-btn>
|
|
15
|
+
</v-row>
|
|
16
|
+
</v-col>
|
|
17
|
+
<v-col cols="12">
|
|
18
|
+
<v-card
|
|
19
|
+
width="100%"
|
|
20
|
+
variant="outlined"
|
|
21
|
+
border="thin"
|
|
22
|
+
rounded="lg"
|
|
23
|
+
:loading="loading"
|
|
24
|
+
>
|
|
25
|
+
<v-toolbar density="compact" color="grey-lighten-4">
|
|
26
|
+
<template #prepend>
|
|
27
|
+
<v-btn
|
|
28
|
+
fab
|
|
29
|
+
icon
|
|
30
|
+
density="comfortable"
|
|
31
|
+
@click="getOnlineFormConfigurations"
|
|
32
|
+
>
|
|
33
|
+
<v-icon>mdi-refresh</v-icon>
|
|
34
|
+
</v-btn>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<template #append>
|
|
38
|
+
<v-row no-gutters justify="end" align="center">
|
|
39
|
+
<span class="mr-2 text-caption text-fontgray">
|
|
40
|
+
{{ pageRange }}
|
|
41
|
+
</span>
|
|
42
|
+
<local-pagination
|
|
43
|
+
v-model="page"
|
|
44
|
+
:length="pages"
|
|
45
|
+
@update:value="getOnlineFormConfigurations"
|
|
46
|
+
/>
|
|
47
|
+
</v-row>
|
|
48
|
+
</template>
|
|
49
|
+
</v-toolbar>
|
|
50
|
+
<v-data-table
|
|
51
|
+
:headers="headers"
|
|
52
|
+
:items="items"
|
|
53
|
+
item-value="_id"
|
|
54
|
+
items-per-page="10"
|
|
55
|
+
fixed-header
|
|
56
|
+
hide-default-footer
|
|
57
|
+
@click:row="tableRowClickHandler"
|
|
58
|
+
style="max-height: calc(100vh - (200px))"
|
|
59
|
+
></v-data-table> </v-card
|
|
60
|
+
></v-col>
|
|
61
|
+
|
|
62
|
+
<!-- Create Dialog -->
|
|
63
|
+
<v-dialog v-model="createDialog" width="450" persistent>
|
|
64
|
+
<OnlineFormConfigurationForm
|
|
65
|
+
mode="add"
|
|
66
|
+
@cancel="createDialog = false"
|
|
67
|
+
@success="successCreate()"
|
|
68
|
+
/>
|
|
69
|
+
</v-dialog>
|
|
70
|
+
|
|
71
|
+
<!-- Edit Dialog -->
|
|
72
|
+
<v-dialog v-model="editDialog" width="450" persistent>
|
|
73
|
+
<OnlineFormConfigurationForm
|
|
74
|
+
mode="edit"
|
|
75
|
+
@cancel="editDialog = false"
|
|
76
|
+
@success="successUpdate()"
|
|
77
|
+
:online-form="selectedOnlineForm"
|
|
78
|
+
/>
|
|
79
|
+
</v-dialog>
|
|
80
|
+
|
|
81
|
+
<!-- Preview Dialog -->
|
|
82
|
+
<v-dialog v-model="previewDialog" width="450" persistent>
|
|
83
|
+
<v-card width="100%">
|
|
84
|
+
<v-card-text style="max-height: 100vh; overflow-y: auto" class="pb-0">
|
|
85
|
+
<v-row no-gutters class="mb-4">
|
|
86
|
+
<v-col cols="12">
|
|
87
|
+
<strong>Name:</strong> {{ selectedOnlineForm?.name ?? "N/A" }}
|
|
88
|
+
</v-col>
|
|
89
|
+
<v-col cols="12">
|
|
90
|
+
<strong>Document: </strong>
|
|
91
|
+
<NuxtLink
|
|
92
|
+
:to="getFileUrl(selectedOnlineForm?.attachment ?? '')"
|
|
93
|
+
external
|
|
94
|
+
target="_blank"
|
|
95
|
+
>
|
|
96
|
+
View Document
|
|
97
|
+
</NuxtLink>
|
|
98
|
+
</v-col>
|
|
99
|
+
<v-col cols="12">
|
|
100
|
+
<strong>Status:</strong> {{ selectedOnlineForm?.status ?? "N/A" }}
|
|
101
|
+
</v-col>
|
|
102
|
+
<v-col cols="12">
|
|
103
|
+
<strong>Inputs:</strong>
|
|
104
|
+
<div
|
|
105
|
+
v-if="selectedOnlineForm?.inputs?.length"
|
|
106
|
+
class="d-flex flex-wrap gap-2 mt-1"
|
|
107
|
+
>
|
|
108
|
+
<v-chip
|
|
109
|
+
v-for="(input, index) in selectedOnlineForm.inputs"
|
|
110
|
+
:key="index"
|
|
111
|
+
color="primary"
|
|
112
|
+
variant="elevated"
|
|
113
|
+
size="small"
|
|
114
|
+
class="me-1 mb-2"
|
|
115
|
+
>
|
|
116
|
+
{{ input.label }}
|
|
117
|
+
</v-chip>
|
|
118
|
+
</div>
|
|
119
|
+
</v-col>
|
|
120
|
+
</v-row>
|
|
121
|
+
</v-card-text>
|
|
122
|
+
<v-toolbar class="pa-0" density="compact">
|
|
123
|
+
<v-row no-gutters>
|
|
124
|
+
<v-col cols="6" class="pa-0">
|
|
125
|
+
<v-btn
|
|
126
|
+
block
|
|
127
|
+
variant="text"
|
|
128
|
+
class="text-none"
|
|
129
|
+
size="large"
|
|
130
|
+
@click="previewDialog = false"
|
|
131
|
+
height="48"
|
|
132
|
+
>
|
|
133
|
+
Close
|
|
134
|
+
</v-btn>
|
|
135
|
+
</v-col>
|
|
136
|
+
<v-col cols="6" class="pa-0" v-if="canUpdate">
|
|
137
|
+
<v-menu>
|
|
138
|
+
<template #activator="{ props }">
|
|
139
|
+
<v-btn
|
|
140
|
+
block
|
|
141
|
+
variant="flat"
|
|
142
|
+
color="black"
|
|
143
|
+
class="text-none"
|
|
144
|
+
height="48"
|
|
145
|
+
v-bind="props"
|
|
146
|
+
tile
|
|
147
|
+
:disabled="
|
|
148
|
+
!canUpdateOnlineFormConfiguration &&
|
|
149
|
+
!canDeleteOnlineFormConfiguration
|
|
150
|
+
"
|
|
151
|
+
>
|
|
152
|
+
More actions
|
|
153
|
+
</v-btn>
|
|
154
|
+
</template>
|
|
155
|
+
<v-list class="pa-0">
|
|
156
|
+
<v-list-item
|
|
157
|
+
v-if="canUpdateOnlineFormConfiguration"
|
|
158
|
+
@click="openEditDialog()"
|
|
159
|
+
>
|
|
160
|
+
<v-list-item-title class="text-subtitle-2">
|
|
161
|
+
Edit Online Form
|
|
162
|
+
</v-list-item-title>
|
|
163
|
+
</v-list-item>
|
|
164
|
+
|
|
165
|
+
<v-list-item
|
|
166
|
+
v-if="canDeleteOnlineFormConfiguration"
|
|
167
|
+
class="text-red"
|
|
168
|
+
@click="openDeleteDialog()"
|
|
169
|
+
>
|
|
170
|
+
<v-list-item-title class="text-subtitle-2">
|
|
171
|
+
Delete Online Form
|
|
172
|
+
</v-list-item-title>
|
|
173
|
+
</v-list-item>
|
|
174
|
+
</v-list>
|
|
175
|
+
</v-menu>
|
|
176
|
+
</v-col>
|
|
177
|
+
</v-row>
|
|
178
|
+
</v-toolbar>
|
|
179
|
+
</v-card>
|
|
180
|
+
</v-dialog>
|
|
181
|
+
|
|
182
|
+
<!-- Delete Dialog -->
|
|
183
|
+
<v-dialog
|
|
184
|
+
v-model="confirmDialog"
|
|
185
|
+
:loading="deleteLoading"
|
|
186
|
+
width="450"
|
|
187
|
+
persistent
|
|
188
|
+
>
|
|
189
|
+
<v-card width="100%">
|
|
190
|
+
<v-toolbar density="compact" class="pl-4">
|
|
191
|
+
<span class="font-weight-medium text-h5">Delete Online Form</span>
|
|
192
|
+
</v-toolbar>
|
|
193
|
+
<v-card-text>
|
|
194
|
+
<p class="text-subtitle-2 text-center">
|
|
195
|
+
Are you sure you want to delete this online form? This action cannot
|
|
196
|
+
be undone.
|
|
197
|
+
</p>
|
|
198
|
+
|
|
199
|
+
<v-row v-if="message" no-gutters justify="center" class="mt-4">
|
|
200
|
+
<span class="text-caption text-error text-center">
|
|
201
|
+
{{ message }}
|
|
202
|
+
</span>
|
|
203
|
+
</v-row>
|
|
204
|
+
</v-card-text>
|
|
205
|
+
<v-toolbar density="compact">
|
|
206
|
+
<v-row no-gutters>
|
|
207
|
+
<v-col cols="6">
|
|
208
|
+
<v-btn
|
|
209
|
+
tile
|
|
210
|
+
block
|
|
211
|
+
size="48"
|
|
212
|
+
variant="text"
|
|
213
|
+
class="text-none"
|
|
214
|
+
@click="confirmDialog = false"
|
|
215
|
+
:disabled="deleteLoading"
|
|
216
|
+
>
|
|
217
|
+
Close
|
|
218
|
+
</v-btn>
|
|
219
|
+
</v-col>
|
|
220
|
+
<v-col cols="6">
|
|
221
|
+
<v-btn
|
|
222
|
+
tile
|
|
223
|
+
block
|
|
224
|
+
size="48"
|
|
225
|
+
color="black"
|
|
226
|
+
variant="flat"
|
|
227
|
+
class="text-none"
|
|
228
|
+
:loading="deleteLoading"
|
|
229
|
+
:disabled="deleteLoading"
|
|
230
|
+
@click="handleDeleteOnlineFormConfiguration()"
|
|
231
|
+
>
|
|
232
|
+
Delete Online Form
|
|
233
|
+
</v-btn>
|
|
234
|
+
</v-col>
|
|
235
|
+
</v-row>
|
|
236
|
+
</v-toolbar>
|
|
237
|
+
</v-card>
|
|
238
|
+
</v-dialog>
|
|
239
|
+
|
|
240
|
+
<Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" />
|
|
241
|
+
</v-row>
|
|
242
|
+
</template>
|
|
243
|
+
<script setup lang="ts">
|
|
244
|
+
import OnlineFormConfigurationForm from "./OnlineFormConfigurationForm.vue";
|
|
245
|
+
|
|
246
|
+
definePageMeta({
|
|
247
|
+
middleware: ["01-auth", "02-org"],
|
|
248
|
+
memberOnly: true,
|
|
249
|
+
});
|
|
250
|
+
const props = defineProps({
|
|
251
|
+
headers: {
|
|
252
|
+
type: Array as PropType<Array<Record<string, any>>>,
|
|
253
|
+
default: () => [
|
|
254
|
+
{
|
|
255
|
+
title: "Name",
|
|
256
|
+
value: "name",
|
|
257
|
+
},
|
|
258
|
+
{ title: "Date Created", value: "createdAt" },
|
|
259
|
+
{ title: "Status", value: "status" },
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
canCreate: {
|
|
263
|
+
type: Boolean,
|
|
264
|
+
default: true,
|
|
265
|
+
},
|
|
266
|
+
canUpdate: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: true,
|
|
269
|
+
},
|
|
270
|
+
canDelete: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: true,
|
|
273
|
+
},
|
|
274
|
+
canCreateOnlineFormConfiguration: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: true,
|
|
277
|
+
},
|
|
278
|
+
canUpdateOnlineFormConfiguration: {
|
|
279
|
+
type: Boolean,
|
|
280
|
+
default: true,
|
|
281
|
+
},
|
|
282
|
+
canDeleteOnlineFormConfiguration: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
default: true,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const { headerSearch } = useLocal();
|
|
289
|
+
const {
|
|
290
|
+
getAllBySiteId: _getOnlineFormConfigurationsBySiteId,
|
|
291
|
+
deleteOnlineFormById: _deleteById,
|
|
292
|
+
} = useOnlineForm();
|
|
293
|
+
const { getFileUrl } = useFile();
|
|
294
|
+
|
|
295
|
+
const page = ref(1);
|
|
296
|
+
const pages = ref(0);
|
|
297
|
+
const pageRange = ref("-- - -- of --");
|
|
298
|
+
|
|
299
|
+
const message = ref("");
|
|
300
|
+
const messageSnackbar = ref(false);
|
|
301
|
+
const messageColor = ref("");
|
|
302
|
+
|
|
303
|
+
const route = useRoute();
|
|
304
|
+
const siteId = route.params.site as string;
|
|
305
|
+
const orgId = route.params.org as string;
|
|
306
|
+
|
|
307
|
+
const items = ref<Array<Record<string, any>>>([]);
|
|
308
|
+
|
|
309
|
+
const {
|
|
310
|
+
data: getOnlineFormConfigurationReq,
|
|
311
|
+
refresh: getOnlineFormConfigurations,
|
|
312
|
+
status: getAllReqStatus,
|
|
313
|
+
} = useLazyAsyncData("get-all-online-form-configuration", () =>
|
|
314
|
+
_getOnlineFormConfigurationsBySiteId(siteId, {
|
|
315
|
+
page: page.value,
|
|
316
|
+
search: headerSearch.value,
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
const loading = computed(() => getAllReqStatus.value === "pending");
|
|
321
|
+
|
|
322
|
+
watchEffect(() => {
|
|
323
|
+
if (getOnlineFormConfigurationReq.value) {
|
|
324
|
+
items.value = getOnlineFormConfigurationReq.value.items;
|
|
325
|
+
pages.value = getOnlineFormConfigurationReq.value.pages;
|
|
326
|
+
pageRange.value = getOnlineFormConfigurationReq.value.pageRange;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const createDialog = ref(false);
|
|
331
|
+
const editDialog = ref(false);
|
|
332
|
+
const previewDialog = ref(false);
|
|
333
|
+
const selectedOnlineForm = ref<TOnlineForm>({
|
|
334
|
+
_id: "",
|
|
335
|
+
name: "",
|
|
336
|
+
createdAt: "",
|
|
337
|
+
status: "",
|
|
338
|
+
attachment: "",
|
|
339
|
+
inputs: [
|
|
340
|
+
{
|
|
341
|
+
label: "",
|
|
342
|
+
dataType: "",
|
|
343
|
+
required: false,
|
|
344
|
+
multiple: false,
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
});
|
|
348
|
+
const deleteLoading = ref(false);
|
|
349
|
+
const confirmDialog = ref(false);
|
|
350
|
+
const selectedOnlineFormId = ref<string | null>(null);
|
|
351
|
+
|
|
352
|
+
watchEffect(() => {
|
|
353
|
+
// initial data
|
|
354
|
+
items.value = [
|
|
355
|
+
{
|
|
356
|
+
_id: "1",
|
|
357
|
+
name: "Bicycle Application Form",
|
|
358
|
+
createdAt: "2025/12/30",
|
|
359
|
+
status: "active",
|
|
360
|
+
},
|
|
361
|
+
];
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
function tableRowClickHandler(_: any, data: any) {
|
|
365
|
+
selectedOnlineForm.value = data.item as TOnlineForm;
|
|
366
|
+
previewDialog.value = true;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function setOnlineForm({
|
|
370
|
+
mode = "create",
|
|
371
|
+
dialog = true,
|
|
372
|
+
data = {} as any,
|
|
373
|
+
} = {}) {
|
|
374
|
+
if (mode === "create") {
|
|
375
|
+
createDialog.value = dialog;
|
|
376
|
+
} else if (mode === "edit") {
|
|
377
|
+
editDialog.value = dialog;
|
|
378
|
+
selectedOnlineForm.value = data;
|
|
379
|
+
} else if (mode === "preview") {
|
|
380
|
+
previewDialog.value = dialog;
|
|
381
|
+
selectedOnlineForm.value = data;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function openDeleteDialog() {
|
|
386
|
+
confirmDialog.value = true;
|
|
387
|
+
message.value = "";
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function openEditDialog() {
|
|
391
|
+
editDialog.value = true;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function successCreate() {
|
|
395
|
+
createDialog.value = false;
|
|
396
|
+
getOnlineFormConfigurations();
|
|
397
|
+
showMessage("Online form configuration created successfully!", "success");
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function showMessage(msg: string, color: string) {
|
|
401
|
+
message.value = msg;
|
|
402
|
+
messageColor.value = color;
|
|
403
|
+
messageSnackbar.value = true;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async function handleDeleteOnlineFormConfiguration() {
|
|
407
|
+
deleteLoading.value = true;
|
|
408
|
+
try {
|
|
409
|
+
await _deleteById(selectedOnlineForm.value._id ?? "");
|
|
410
|
+
await getOnlineFormConfigurations();
|
|
411
|
+
selectedOnlineFormId.value = null;
|
|
412
|
+
confirmDialog.value = false;
|
|
413
|
+
previewDialog.value = false;
|
|
414
|
+
} catch (error: any) {
|
|
415
|
+
message.value =
|
|
416
|
+
error?.response?._data?.message ||
|
|
417
|
+
"Failed to delete online form configuration";
|
|
418
|
+
} finally {
|
|
419
|
+
deleteLoading.value = false;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function successUpdate() {
|
|
424
|
+
editDialog.value = false;
|
|
425
|
+
previewDialog.value = false;
|
|
426
|
+
getOnlineFormConfigurations();
|
|
427
|
+
showMessage("Online form configuration updated successfully!", "success");
|
|
428
|
+
}
|
|
429
|
+
</script>
|