@7365admin1/layer-common 1.9.0 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 70c2b90: get latest changes
8
+
3
9
  ## 1.9.0
4
10
 
5
11
  ### Minor Changes
@@ -165,12 +165,6 @@
165
165
  Are you sure you want to delete this document? This action cannot be
166
166
  undone.
167
167
  </p>
168
-
169
- <v-row v-if="message" no-gutters justify="center" class="mt-4">
170
- <span class="text-caption text-error text-center">
171
- {{ message }}
172
- </span>
173
- </v-row>
174
168
  </v-card-text>
175
169
 
176
170
  <v-toolbar density="compact">
@@ -303,7 +297,7 @@ const selectedDocument = ref<TDocument>({
303
297
  _id: "",
304
298
  name: "",
305
299
  attachment: "",
306
- type: ""
300
+ type: "",
307
301
  });
308
302
  const deleteLoading = ref(false);
309
303
  const confirmDialog = ref(false);
@@ -354,7 +348,8 @@ function openEditDialog() {
354
348
  async function handleDeleteDocument() {
355
349
  deleteLoading.value = true;
356
350
  try {
357
- await deleteById(selectedDocument.value._id ?? "");
351
+ const response = await deleteById(selectedDocument.value._id ?? "");
352
+ showMessage(response.message, "success");
358
353
  await getDocuments();
359
354
  selectedDocumentId.value = null;
360
355
  confirmDialog.value = false;
@@ -372,5 +367,5 @@ function successUpdate() {
372
367
  previewDialog.value = false;
373
368
  getDocuments();
374
369
  showMessage("Document updated successfully!", "success");
375
- };
370
+ }
376
371
  </script>
@@ -0,0 +1,226 @@
1
+ <template>
2
+ <v-row no-gutters class="px-5 pt-4">
3
+ <!-- Authorities (Police/SCDF/Ambulance called in at the scene) -->
4
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
5
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
6
+ Authorities (Police/SCDF/Ambulance called in at the scene)?
7
+ </p>
8
+ <p
9
+ v-if="authorities?.authoritiesValue == 'no'"
10
+ class="mt-2 text-h6 text-capitalize"
11
+ >
12
+ {{ authorities?.authoritiesValue }}
13
+ </p>
14
+
15
+ <v-data-table
16
+ v-else
17
+ :headers="authoritiesTableHeader"
18
+ :items="authorities?.authoritiesCalled"
19
+ fixed-header
20
+ hide-default-footer
21
+ :hide-default-header="false"
22
+ items-per-page="100"
23
+ style="max-height: calc(100vh - (200px))"
24
+ class="border mt-5"
25
+ >
26
+ </v-data-table>
27
+ </v-col>
28
+
29
+ <!-- Input lists -->
30
+ <v-col cols="12" class="pb-3 mb-5 mt-1">
31
+ <v-row no-gutters>
32
+ <v-col cols="12" class="px-1 mb-7">
33
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
34
+ What was done to address the incident thereafter?
35
+ </p>
36
+ <p class="mt-2 text-h6 text-capitalize">
37
+ {{ authorities?.incidentThereAfter }}
38
+ </p>
39
+ </v-col>
40
+
41
+ <v-col cols="12" class="px-1 mb-7">
42
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
43
+ Were the management notified and who was notified?
44
+ </p>
45
+ <v-row no-gutters>
46
+ <v-col cols="12" sm="6" class="px-1">
47
+ <InputLabel class="text-capitalize" title="Action Taken" />
48
+ <p class="mt-2 text-h6 text-capitalize">
49
+ {{ authorities?.managementNotified?.actionTaken }}
50
+ </p>
51
+ </v-col>
52
+ <v-col cols="12" sm="6" class="px-1">
53
+ <InputLabel
54
+ class="text-capitalize"
55
+ title="Management Notified Time"
56
+ />
57
+ <p class="mt-2 text-h6 text-capitalize">
58
+ {{ authorities?.managementNotified?.time }}
59
+ </p>
60
+ </v-col>
61
+ </v-row>
62
+ </v-col>
63
+
64
+ <v-col cols="12" class="px-1 mb-7">
65
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
66
+ How the incident resolved?
67
+ </p>
68
+ <p class="mt-2 text-h6 text-capitalize">
69
+ {{ authorities?.incidentResolved }}
70
+ </p>
71
+ </v-col>
72
+
73
+ <v-col cols="12" class="px-1 mb-7">
74
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
75
+ What was the cause of the incident?
76
+ </p>
77
+ <p class="mt-2 text-h6 text-capitalize">
78
+ {{ authorities?.causeOfIncident }}
79
+ </p>
80
+ </v-col>
81
+
82
+ <v-col cols="12" class="px-1 mb-6">
83
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
84
+ Any system used to verify incident?
85
+ </p>
86
+ <p class="mt-2 text-h6 text-capitalize">
87
+ {{ authorities?.systemUsed }}
88
+ </p>
89
+ </v-col>
90
+
91
+ <v-col cols="12" class="px-1 mb-6">
92
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
93
+ Any cctv records or picture taken?
94
+ </p>
95
+ <p class="mt-2 text-h6 text-capitalize">
96
+ {{ authorities?.cctvRecord }}
97
+ </p>
98
+ </v-col>
99
+
100
+ <v-col cols="12" class="px-1 mb-6">
101
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
102
+ Particulars of tenant/Owner (if any)
103
+ </p>
104
+ <p class="mt-2 text-h6 text-capitalize">
105
+ {{ authorities?.particularsOwner }}
106
+ </p>
107
+ </v-col>
108
+
109
+ <v-col cols="12" class="px-1 mb-6">
110
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
111
+ When was the incident resolved?
112
+ </p>
113
+ <v-row no-gutters>
114
+ <v-col cols="12" sm="6" class="px-1">
115
+ <InputLabel class="text-capitalize" title="Action Taken" />
116
+ <p class="mt-2 text-h6 text-capitalize">
117
+ {{ authorities?.whenIncidentResolve?.actionTaken }}
118
+ </p>
119
+ </v-col>
120
+ <v-col cols="12" sm="6" class="px-1">
121
+ <InputLabel
122
+ class="text-capitalize"
123
+ title="Incident Resolve Time"
124
+ />
125
+ <p class="mt-2 text-h6 text-capitalize">
126
+ {{ authorities?.whenIncidentResolve?.time }}
127
+ </p>
128
+ </v-col>
129
+ </v-row>
130
+ </v-col>
131
+
132
+ <v-col cols="12" class="px-1 mb-6">
133
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
134
+ Name of shift in charge?
135
+ </p>
136
+ <v-row no-gutters>
137
+ <v-col cols="12" sm="6" class="px-1">
138
+ <InputLabel class="text-capitalize" title="Person in Charge" />
139
+ <p class="mt-2 text-h6 text-capitalize">
140
+ {{ authorities?.nameOfShiftIncharge?.personInCharge }}
141
+ </p>
142
+ </v-col>
143
+ <v-col cols="12" sm="6" class="px-1">
144
+ <InputLabel class="text-capitalize" title="Action Taken" />
145
+ <p class="mt-2 text-h6 text-capitalize">
146
+ {{ authorities?.nameOfShiftIncharge?.actionTaken }}
147
+ </p>
148
+ </v-col>
149
+ </v-row>
150
+ </v-col>
151
+
152
+ <v-col cols="12" class="px-1 mb-6">
153
+ <p class="mb-2" style="font-size: 17px; font-weight: 600"></p>
154
+ <v-row no-gutters>
155
+ <v-col cols="12" sm="6" class="px-1">
156
+ <InputLabel class="text-capitalize" title="Shift Start" />
157
+ <p class="mt-2 text-h6 text-capitalize">
158
+ {{ authorities?.nameOfShiftIncharge?.shiftStart }}
159
+ </p>
160
+ </v-col>
161
+ <v-col cols="12" sm="6" class="px-1">
162
+ <InputLabel class="text-capitalize" title="Shift End" />
163
+ <p class="mt-2 text-h6 text-capitalize">
164
+ {{ authorities?.nameOfShiftIncharge?.shiftEnd }}
165
+ </p>
166
+ </v-col>
167
+ </v-row>
168
+ </v-col>
169
+
170
+ <v-col cols="12" class="px-1">
171
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
172
+ Any security implication due to the incident?
173
+ </p>
174
+ <p class="mt-2 text-h6 text-capitalize">
175
+ {{ authorities?.securityImplication }}
176
+ </p>
177
+ </v-col>
178
+ </v-row>
179
+ </v-col>
180
+ </v-row>
181
+ </template>
182
+
183
+ <script lang="ts" setup>
184
+ definePageMeta({
185
+ middleware: ["01-auth", "02-org"],
186
+ memberOnly: true,
187
+ });
188
+
189
+ // imports
190
+
191
+ // utilities
192
+
193
+ // props
194
+ const props = defineProps({
195
+ authorities: {
196
+ type: Object as PropType<Record<string, any> | null>,
197
+ required: true,
198
+ },
199
+ });
200
+
201
+ // emits
202
+
203
+ // state
204
+ const authoritiesTableHeader = [
205
+ {
206
+ title: "Type of Authorities",
207
+ value: "type",
208
+ },
209
+ {
210
+ title: "Vehicle Number",
211
+ value: "vehicleNumber",
212
+ },
213
+ {
214
+ title: "Person in Charge",
215
+ value: "personInCharge",
216
+ },
217
+ {
218
+ title: "Case Report Reference",
219
+ value: "caseReportReference",
220
+ },
221
+ {
222
+ title: "Description",
223
+ value: "description",
224
+ },
225
+ ];
226
+ </script>
@@ -0,0 +1,258 @@
1
+ <template>
2
+ <v-row no-gutters class="px-5 pt-4">
3
+ <!-- Site Information -->
4
+ <v-col cols="12" class="border-b pb-3 mb-5">
5
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
6
+ Site Information
7
+ </p>
8
+ <v-row no-gutters class="mt-5">
9
+ <v-col cols="12" sm="6" md="3">
10
+ <InputLabel class="text-capitalize" title="Site" />
11
+ <p class="my-1 text-h6">{{ siteName || "NA" }}</p>
12
+ </v-col>
13
+ <v-col cols="12" sm="6" md="3">
14
+ <InputLabel
15
+ class="text-capitalize"
16
+ title="Incident Reference Number"
17
+ />
18
+ <p class="my-1 text-h6">
19
+ {{ incidentInformation?.siteInfo?.irNumber || "NA" }}
20
+ </p>
21
+ </v-col>
22
+ <v-col cols="12" sm="6" md="3">
23
+ <InputLabel class="text-capitalize" title="Submitted By" />
24
+ <p class="my-1 text-h6 text-capitalize">
25
+ {{ incidentInformation?.siteInfo?.submittedBy || "NA" }}
26
+ </p>
27
+ </v-col>
28
+ <v-col cols="12" sm="6" md="3">
29
+ <InputLabel class="text-capitalize" title="Designation" />
30
+ <p class="my-1 text-h6 text-capitalize">
31
+ {{ incidentInformation?.siteInfo?.designation || "NA" }}
32
+ </p>
33
+ </v-col>
34
+ </v-row>
35
+ </v-col>
36
+
37
+ <!-- Place of Incident -->
38
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
39
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
40
+ Place of Incident
41
+ </p>
42
+ <p class="my-1 text-h6 text-capitalize">
43
+ {{ incidentInformation?.placeOfIncident?.incidentLocation || "NA" }}
44
+ </p>
45
+ </v-col>
46
+
47
+ <!-- Incident Type / Time -->
48
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
49
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
50
+ Incident Type / Time
51
+ </p>
52
+ <v-row no-gutters class="mt-5">
53
+ <v-col cols="12" sm="3" md="3">
54
+ <InputLabel class="text-capitalize" title="Type of Incident" />
55
+ <p class="my-1 text-h6 text-capitalize">
56
+ {{
57
+ incidentInformation?.incidentTypeAndTime?.typeOfIncident || "NA"
58
+ }}
59
+ </p>
60
+ </v-col>
61
+ <v-col cols="12" sm="3" md="3">
62
+ <InputLabel class="text-capitalize" title="Incident Date" />
63
+ <p class="my-1 text-h6">
64
+ {{
65
+ toLocalDate(
66
+ incidentInformation?.incidentTypeAndTime?.dateOfIncident,
67
+ ) || "NA"
68
+ }}
69
+ </p>
70
+ </v-col>
71
+ <v-col cols="12" sm="3" md="3">
72
+ <InputLabel class="text-capitalize" title="Incident Start" />
73
+ <p class="my-1 text-h6">
74
+ {{
75
+ incidentInformation?.incidentTypeAndTime?.incidentStart || "NA"
76
+ }}
77
+ </p>
78
+ </v-col>
79
+ <v-col cols="12" sm="3" md="3">
80
+ <v-row no-gutters class="d-flex align-center">
81
+ <v-col cols="10">
82
+ <InputLabel class="text-capitalize" title="Incident End" />
83
+ <p class="my-1 text-h6">
84
+ {{
85
+ incidentInformation?.incidentTypeAndTime?.incidentEnd || "NA"
86
+ }}
87
+ </p>
88
+ </v-col>
89
+ </v-row>
90
+ </v-col>
91
+ </v-row>
92
+ </v-col>
93
+
94
+ <!-- Response/Submission From (1st Contact) -->
95
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
96
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
97
+ Response/Submission From (1st Contact)
98
+ </p>
99
+ <v-row no-gutters class="mt-5">
100
+ <v-col cols="12" sm="4" md="3">
101
+ <InputLabel class="text-capitalize" title="Time" />
102
+ <p class="my-1 text-h6">
103
+ {{ incidentInformation?.submissionForm?.time || "NA" }}
104
+ </p>
105
+ </v-col>
106
+ <v-col cols="12" sm="4" md="3">
107
+ <InputLabel
108
+ class="text-capitalize"
109
+ title="Time of Report Submission"
110
+ />
111
+ <p class="my-1 text-h6">
112
+ {{ incidentInformation?.submissionForm?.timeOfResponse || "NA" }}
113
+ </p>
114
+ </v-col>
115
+ <v-col cols="12" sm="4" md="3">
116
+ <InputLabel class="text-capitalize" title="Date" />
117
+ <p class="my-1 text-h6">
118
+ {{
119
+ toLocalDate(incidentInformation?.submissionForm?.dateOfReport) ||
120
+ "NA"
121
+ }}
122
+ </p>
123
+ </v-col>
124
+ </v-row>
125
+ </v-col>
126
+
127
+ <!-- Name of Informant/Complainant Information -->
128
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
129
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
130
+ Name of Informant/Complainant Information
131
+ </p>
132
+ <v-row no-gutters class="d-flex align-center mt-5">
133
+ <v-col cols="12" sm="4" md="3">
134
+ <InputLabel class="text-capitalize" title="Name" />
135
+ <p class="my-1 text-h6 text-capitalize">
136
+ {{ incidentInformation?.complaintInfo?.complainant || "NA" }}
137
+ </p>
138
+ </v-col>
139
+ <v-col cols="12" sm="4" md="3">
140
+ <InputLabel class="text-capitalize" title="NRIC/WP Number" />
141
+ <p class="my-1 text-h6 text-capitalize">
142
+ {{ incidentInformation?.complaintInfo?.nric || "NA" }}
143
+ </p>
144
+ </v-col>
145
+ <v-col cols="12" sm="4" md="3">
146
+ <InputLabel class="text-capitalize" title="Contact Number" />
147
+ <p class="my-1 text-h6 text-capitalize">
148
+ {{ incidentInformation?.complaintInfo?.contact || "NA" }}
149
+ </p>
150
+ </v-col>
151
+ </v-row>
152
+ </v-col>
153
+
154
+ <!-- Name of Recipient of Complaint (1st Contact) -->
155
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
156
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
157
+ Name of Recipient of Complaint (1st Contact)
158
+ </p>
159
+ <v-row no-gutters class="d-flex align-center mt-5">
160
+ <v-col cols="12" sm="4" md="3">
161
+ <InputLabel class="text-capitalize" title="Name" />
162
+ <p class="my-1 text-h6 text-capitalize">
163
+ {{ incidentInformation?.recipientOfComplaint?.recipient || "NA" }}
164
+ </p>
165
+ </v-col>
166
+ <v-col cols="12" sm="4" md="3">
167
+ <InputLabel class="text-capitalize" title="NRIC/WP Number" />
168
+ <p class="my-1 text-h6 text-capitalize">
169
+ {{ incidentInformation?.recipientOfComplaint?.nric || "NA" }}
170
+ </p>
171
+ </v-col>
172
+ <v-col cols="12" sm="4" md="3">
173
+ <InputLabel class="text-capitalize" title="Contact Number" />
174
+ <p class="my-1 text-h6 text-capitalize">
175
+ {{ incidentInformation?.recipientOfComplaint?.contact || "NA" }}
176
+ </p>
177
+ </v-col>
178
+ </v-row>
179
+ </v-col>
180
+
181
+ <!-- Complaint Received through -->
182
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
183
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
184
+ Complaint Received through
185
+ </p>
186
+ <v-col cols="12">
187
+ <InputLabel class="text-capitalize" title="Received through" />
188
+ <p
189
+ v-if="
190
+ incidentInformation?.complaintReceivedTo?.receivedVia != 'others'
191
+ "
192
+ class="my-1 text-h6 text-capitalize"
193
+ >
194
+ {{ incidentInformation?.complaintReceivedTo?.receivedVia || "NA" }}
195
+ </p>
196
+
197
+ <p v-else class="my-1 text-h6">
198
+ {{
199
+ incidentInformation?.complaintReceivedTo?.otherDescription || "NA"
200
+ }}
201
+ </p>
202
+ </v-col>
203
+ </v-col>
204
+
205
+ <!-- Brief Description -->
206
+ <v-col cols="12" class="mb-10">
207
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
208
+ Brief Description
209
+ </p>
210
+ <p class="mt-5 text-h6 text-capitalize">
211
+ {{ incidentInformation?.complaintReceivedTo?.briefDescription || "NA" }}
212
+ </p>
213
+ </v-col>
214
+ </v-row>
215
+ </template>
216
+
217
+ <script lang="ts" setup>
218
+ definePageMeta({
219
+ middleware: ["01-auth", "02-org"],
220
+ memberOnly: true,
221
+ });
222
+
223
+ // props
224
+ const props = defineProps({
225
+ incidentInformation: {
226
+ type: Object as PropType<Record<string, any> | null>,
227
+ required: true,
228
+ },
229
+ });
230
+
231
+ // utilities
232
+ const { getSiteById } = useSiteSettings();
233
+
234
+ // state
235
+ const siteName = ref("");
236
+
237
+ const siteId = computed(() => props.incidentInformation?.siteInfo?.site );
238
+
239
+ watch(
240
+ siteId,
241
+ async (newSiteId) => {
242
+ if (!newSiteId) return;
243
+
244
+ const siteDataValue = await getSiteById(newSiteId);
245
+
246
+ siteName.value = siteDataValue?.name ?? "";
247
+ },
248
+ { immediate: true }
249
+ );
250
+
251
+ function toLocalDate(utcString: string) {
252
+ return new Date(utcString).toLocaleString("en-US", {
253
+ year: "numeric",
254
+ month: "2-digit",
255
+ day: "2-digit",
256
+ });
257
+ }
258
+ </script>
@@ -0,0 +1,167 @@
1
+ <template>
2
+ <v-row no-gutters class="px-5 pt-4">
3
+ <!-- Any unit affected -->
4
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
5
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
6
+ Any unit affected?
7
+ </p>
8
+ <p
9
+ v-if="affectedEntities?.anyUnitAffectedValue == 'no'"
10
+ class="mt-2 text-h6 text-capitalize"
11
+ >
12
+ {{ affectedEntities?.anyUnitAffectedValue }}
13
+ </p>
14
+ <!-- Block Level Unit Section -->
15
+ <v-row v-else no-gutters class="d-flex align-center mt-5">
16
+ <v-row
17
+ v-if="affectedEntities?.affectedUnit.hasOwnProperty('block')"
18
+ no-gutters
19
+ >
20
+ <v-col cols="12" sm="4">
21
+ <InputLabel class="text-capitalize" title="Block" />
22
+ <p class="my-1 text-h6">
23
+ {{ affectedEntities?.affectedUnit?.block }}
24
+ </p>
25
+ </v-col>
26
+ <v-col cols="12" sm="4">
27
+ <InputLabel class="text-capitalize" title="Level" />
28
+ <p class="my-1 text-h6">
29
+ {{ affectedEntities?.affectedUnit?.level }}
30
+ </p>
31
+ </v-col>
32
+ <v-col cols="12" sm="4">
33
+ <InputLabel class="text-capitalize" title="Unit" />
34
+ <p class="my-1 text-h6">
35
+ {{ affectedEntities?.affectedUnit?.unit }}
36
+ </p>
37
+ </v-col>
38
+ </v-row>
39
+
40
+ <v-col v-else cols="12" class="px-1 mb-0">
41
+ <InputLabel class="text-capitalize" title="Location" />
42
+ <p class="my-1 text-h6 text-capitalize">
43
+ {{ affectedEntities?.affectedUnit?.other }}
44
+ </p>
45
+ </v-col>
46
+
47
+ <v-col cols="12" class="px-1 mb-0 mt-5">
48
+ <InputLabel class="text-capitalize" title="Remarks" />
49
+ <p class="my-1 text-h6 text-capitalize">
50
+ {{ affectedEntities?.affectedUnit?.remarks }}
51
+ </p>
52
+ </v-col>
53
+ </v-row>
54
+ </v-col>
55
+
56
+ <!-- Anyone affected/injured -->
57
+ <v-col cols="12" class="border-b pb-5 mb-5 mt-1">
58
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
59
+ Anyone affected/injured?
60
+ </p>
61
+ <p
62
+ v-if="affectedEntities?.anyoneAffectedValue == 'no'"
63
+ class="my-1 text-h6 text-capitalize"
64
+ >
65
+ {{ affectedEntities?.anyoneAffectedValue }}
66
+ </p>
67
+
68
+ <v-data-table
69
+ v-else
70
+ :headers="injuredTableHeader"
71
+ :items="affectedEntities?.affectedInjured"
72
+ fixed-header
73
+ hide-default-footer
74
+ :hide-default-header="false"
75
+ items-per-page="100"
76
+ style="max-height: calc(100vh - (200px))"
77
+ class="border mt-5"
78
+ >
79
+ </v-data-table>
80
+ </v-col>
81
+
82
+ <!-- Anyone damage to property -->
83
+ <v-col cols="12" class="pb-5 mb-5 mt-1">
84
+ <p class="mb-2" style="font-size: 17px; font-weight: 600">
85
+ Anyone damage to property?
86
+ </p>
87
+ <p
88
+ v-if="affectedEntities?.anyUnitAffectedValue == 'no'"
89
+ class="my-1 text-h6 text-capitalize"
90
+ >
91
+ {{ affectedEntities?.anyUnitAffectedValue }}
92
+ </p>
93
+
94
+ <v-data-table
95
+ v-else
96
+ :headers="damagePropertyTableHeader"
97
+ :items="affectedEntities?.anyoneDamageToProperty"
98
+ fixed-header
99
+ hide-default-footer
100
+ :hide-default-header="false"
101
+ items-per-page="100"
102
+ style="max-height: calc(100vh - (200px))"
103
+ class="border mt-5"
104
+ >
105
+ </v-data-table>
106
+ </v-col>
107
+ </v-row>
108
+ </template>
109
+
110
+ <script lang="ts" setup>
111
+ definePageMeta({
112
+ middleware: ["01-auth", "02-org"],
113
+ memberOnly: true,
114
+ });
115
+
116
+ // imports
117
+
118
+ // utilities
119
+
120
+ // props
121
+ const props = defineProps({
122
+ affectedEntities: {
123
+ type: Object as PropType<Record<string, any> | null>,
124
+ required: true,
125
+ },
126
+ });
127
+
128
+ // emits
129
+
130
+ // state
131
+ const injuredTableHeader = [
132
+ {
133
+ title: "Name",
134
+ value: "name",
135
+ },
136
+ {
137
+ title: "NRIC/WP No.",
138
+ value: "nric",
139
+ },
140
+ {
141
+ title: "Contact Number",
142
+ value: "contact",
143
+ },
144
+ ];
145
+ const damagePropertyTableHeader = [
146
+ {
147
+ title: "Description",
148
+ value: "description",
149
+ },
150
+ {
151
+ title: "Block / Level / Unit",
152
+ value: "blkLevelUnit",
153
+ },
154
+ {
155
+ title: "Name",
156
+ value: "name",
157
+ },
158
+ {
159
+ title: "Contact Number",
160
+ value: "contact",
161
+ },
162
+ {
163
+ title: "Action",
164
+ value: "action",
165
+ },
166
+ ];
167
+ </script>
@@ -93,7 +93,7 @@
93
93
  <v-icon v-bind="props">mdi-dots-horizontal</v-icon>
94
94
  </template>
95
95
  <v-list>
96
- <v-list-item @click="openConfirmDialog(item._id ?? '')">
96
+ <v-list-item @click="openConfirmDialog(item._id ?? '')" v-if="item.status === 'pending'">
97
97
  Cancel Invite
98
98
  </v-list-item>
99
99
  </v-list>
@@ -118,21 +118,23 @@
118
118
  </p>
119
119
  </template>
120
120
  <template #footer>
121
- <v-btn
122
- variant="text"
123
- @click="confirmDialog = false"
124
- :disabled="cancelLoading"
125
- >
126
- Close
127
- </v-btn>
128
- <v-btn
129
- color="primary"
130
- variant="flat"
131
- @click="onConfirmCancel"
132
- :loading="cancelLoading"
133
- >
134
- Cancel Invite
135
- </v-btn>
121
+ <div class="d-flex justify-center ga-3 w-100">
122
+ <v-btn
123
+ variant="text"
124
+ @click="confirmDialog = false"
125
+ :disabled="cancelLoading"
126
+ >
127
+ Close
128
+ </v-btn>
129
+ <v-btn
130
+ color="primary"
131
+ variant="flat"
132
+ @click="onConfirmCancel"
133
+ :loading="cancelLoading"
134
+ >
135
+ Cancel Invite
136
+ </v-btn>
137
+ </div>
136
138
  </template>
137
139
  </ConfirmDialog>
138
140
  <Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" />
@@ -245,7 +247,7 @@ const {
245
247
  status: props.status,
246
248
  search: headerSearch.value,
247
249
  type: "user-invite,member-invite",
248
- app: props.app
250
+ app: props.app,
249
251
  })
250
252
  );
251
253
 
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <v-card width="100%" :disabled="loading || processingPassword" :loading="loading || processingPassword">
3
+ <v-toolbar density="compact">
4
+ <v-row no-gutters class="pa-3 text-h6 font-weight-bold">
5
+ <span>{{ promptTitle }}</span>
6
+ </v-row>
7
+ </v-toolbar>
8
+ <v-card-text style="max-height: 100vh; overflow-y: auto" class="pa-5 my-5 px-7 text-center">
9
+ <v-row no-gutters class="w-100">
10
+ <v-col cols="12">
11
+ <v-icon icon="mdi-lock-outline" :color="'gray'" class="text-h2" />
12
+ </v-col>
13
+ <v-col cols="12" v-if="message" class="mt-2">
14
+ {{ message }}
15
+ </v-col>
16
+ <v-col cols="12" class="mt-5 text-start">
17
+ <v-text-field v-model="passwordInput" label="Password" type="password" density="compact" :error-messages="errorMessage"></v-text-field>
18
+ </v-col>
19
+ </v-row>
20
+ </v-card-text>
21
+
22
+ <v-toolbar class="pa-0" density="compact">
23
+ <v-row no-gutters>
24
+ <v-col cols="6" class="pa-0">
25
+ <v-btn block variant="text" class="text-none" size="large" tile @click="emit('cancel')" height="48">
26
+ Cancel
27
+ </v-btn>
28
+ </v-col>
29
+
30
+ <v-col cols="6" class="pa-0">
31
+ <v-btn block tile variant="flat" class="text-none" size="large" height="48" color="red" :disabled="!passwordInput"
32
+ @click="handleConfirm">
33
+ Confirm
34
+ </v-btn>
35
+ </v-col>
36
+ </v-row>
37
+ </v-toolbar>
38
+ </v-card>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+
43
+ const props = defineProps({
44
+ message: {
45
+ type: String,
46
+ default: "Confirm your digital signature with password to proceed."
47
+ },
48
+ promptTitle: {
49
+ type: String,
50
+ default: "Confirm Action"
51
+ },
52
+ loading: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ })
57
+
58
+ const { confirmPassword } = useDOBEntries();
59
+ const { currentUser } = useLocalAuth();
60
+
61
+ const emit = defineEmits(["cancel", "confirm"])
62
+
63
+ const processingPassword = ref(false)
64
+ const errorMessage = ref('')
65
+
66
+
67
+ const passwordInput = ref('')
68
+
69
+
70
+
71
+ async function handleConfirm() {
72
+ errorMessage.value = ''
73
+ try {
74
+ processingPassword.value = true;
75
+ const userId = currentUser.value?._id;
76
+ if (!userId) {
77
+ throw new Error('User not found. Please login again.');
78
+ }
79
+ const res = await confirmPassword({ userId, password: passwordInput.value });
80
+ if (res) {
81
+ emit('confirm');
82
+ }
83
+
84
+ } catch (err: any) {
85
+ const errMessage = err?.response?._data?.message || 'Something went wrong. Please try again.';
86
+ console.log('[ERROR]', err)
87
+ errorMessage.value = errMessage;
88
+ } finally {
89
+ processingPassword.value = false;
90
+ }
91
+ }
92
+
93
+ </script>
94
+
95
+ <style scoped></style>
@@ -119,21 +119,23 @@
119
119
  </template>
120
120
 
121
121
  <template #footer>
122
- <v-btn
123
- variant="text"
124
- @click="confirmDialog = false"
125
- :disabled="deleteLoading"
126
- >
127
- Close
128
- </v-btn>
129
- <v-btn
130
- color="primary"
131
- variant="flat"
132
- @click="handleDeleteRole"
133
- :loading="deleteLoading"
134
- >
135
- Delete Role
136
- </v-btn>
122
+ <div class="d-flex justify-center ga-3 w-100">
123
+ <v-btn
124
+ variant="text"
125
+ @click="confirmDialog = false"
126
+ :disabled="deleteLoading"
127
+ >
128
+ Close
129
+ </v-btn>
130
+ <v-btn
131
+ color="primary"
132
+ variant="flat"
133
+ @click="handleDeleteRole"
134
+ :loading="deleteLoading"
135
+ >
136
+ Delete Role
137
+ </v-btn>
138
+ </div>
137
139
  </template>
138
140
  </ConfirmDialog>
139
141
 
@@ -40,6 +40,7 @@
40
40
  </div>
41
41
 
42
42
  <v-text-field
43
+ v-model="searchText"
43
44
  placeholder="Search..."
44
45
  variant="outlined"
45
46
  density="comfortable"
@@ -420,19 +421,27 @@ const {
420
421
  invite: inviteServiceProvider,
421
422
  } = useServiceProvider();
422
423
 
423
- const loading = ref(true);
424
-
425
424
  const { getSiteById } = useSite();
426
425
 
426
+ const { getColorStatus, debounce } = useUtils();
427
+
427
428
  const { data: site } = await useLazyAsyncData(
428
429
  "get-site-by-id-" + props.siteId,
429
430
  () => getSiteById(props.siteId)
430
431
  );
431
432
 
432
- const { data: serviceProviderReq, refresh: _getAllServiceProvider } =
433
- await useLazyAsyncData("get-all-service-providers", () =>
434
- getAllServiceProvider({ siteId: props.siteId })
435
- );
433
+ const loading = computed(() => getAllReqStatus.value === "pending");
434
+
435
+ const {
436
+ data: serviceProviderReq,
437
+ refresh: _getAllServiceProvider,
438
+ status: getAllReqStatus,
439
+ } = await useLazyAsyncData("get-all-service-providers", () =>
440
+ getAllServiceProvider({
441
+ siteId: props.siteId,
442
+ search: searchText.value || "",
443
+ })
444
+ );
436
445
 
437
446
  watchEffect(() => {
438
447
  // console.log("serviceProviderReq", serviceProviderReq.value);
@@ -441,12 +450,14 @@ watchEffect(() => {
441
450
  pages.value = serviceProviderReq.value.pages;
442
451
  pageRange.value = serviceProviderReq.value.pageRange;
443
452
  }
444
- loading.value = false;
453
+ // loading.value = false;
445
454
  });
446
455
 
447
456
  const createDialog = ref(false);
448
457
  const createInviteDialog = ref(false);
449
458
 
459
+ const searchText = ref("");
460
+
450
461
  const success = () => {
451
462
  createDialog.value = false;
452
463
  // getServiceProvider();
@@ -544,4 +555,13 @@ async function submitServiceProviderInvite() {
544
555
  disableServiceProvider.value = false;
545
556
  }
546
557
  }
558
+
559
+ const debounceSearch = debounce(_getAllServiceProvider, 500);
560
+
561
+ watch(
562
+ () => searchText.value,
563
+ () => {
564
+ debounceSearch();
565
+ }
566
+ );
547
567
  </script>
@@ -0,0 +1,13 @@
1
+ export default function () {
2
+ async function confirmPassword({ userId, password} : { userId: string; password: string}) {
3
+ return await useNuxtApp().$api<Record<string, any>>(`/api/auth/verify-password/id/${userId}`, {
4
+ method: "POST",
5
+ body: { password},
6
+ });
7
+ }
8
+
9
+
10
+ return {
11
+ confirmPassword
12
+ };
13
+ }
@@ -26,8 +26,9 @@ export default function useDocument() {
26
26
  }
27
27
 
28
28
  function deleteById(id: string) {
29
- return useNuxtApp().$api(`/api/documents/${id}`, {
30
- method: "DELETE",
29
+ return useNuxtApp().$api<Record<string, any>>(`/api/documents/deleted/document`, {
30
+ method: "PUT",
31
+ query: { id },
31
32
  });
32
33
  }
33
34
 
@@ -30,12 +30,10 @@ export default function useFile() {
30
30
  }
31
31
 
32
32
  function deleteFile(attachmentId: string) {
33
- return useNuxtApp().$api<Record<string, any>>(
34
- `/api/files/${attachmentId}`,
35
- {
36
- method: "DELETE",
37
- }
38
- );
33
+ return useNuxtApp().$api<Record<string, any>>(`/api/files/deleted/file`, {
34
+ method: "PUT",
35
+ query: { id: attachmentId },
36
+ });
39
37
  }
40
38
 
41
39
  function getFileById(id: string) {
@@ -58,8 +58,9 @@ export default function useRole() {
58
58
  }
59
59
 
60
60
  function deleteRole(_id: string) {
61
- return useNuxtApp().$api<Record<string, any>>(`/api/roles/${_id}`, {
62
- method: "DELETE",
61
+ return useNuxtApp().$api<Record<string, any>>(`/api/roles/deleted/role`, {
62
+ method: "PUT",
63
+ query: { id: _id },
63
64
  });
64
65
  }
65
66
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.9.0",
5
+ "version": "1.10.0",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -5,7 +5,7 @@ declare type TVerificationMetadata = {
5
5
 
6
6
  declare type TMiniVerification = Pick<
7
7
  TVerification,
8
- "createdAt" | "email" | "_id"
8
+ "createdAt" | "email" | "_id" | "status"
9
9
  >;
10
10
 
11
11
  declare type TVerification = {