@7365admin1/layer-common 1.10.9 → 1.11.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/components/AccessCardAddForm.vue +1 -1
  3. package/components/AccessCardAssignToUnitForm.vue +10 -13
  4. package/components/AccessCardQrTagging.vue +2 -2
  5. package/components/BulletinBoardManagement.vue +18 -8
  6. package/components/Chat/SkeletonLoader.vue +71 -0
  7. package/components/DashboardMain.vue +176 -0
  8. package/components/DeliveryCompany.vue +240 -0
  9. package/components/EntryPassInformation.vue +38 -8
  10. package/components/FeedbackMain.vue +4 -19
  11. package/components/FileInputWithList.vue +304 -0
  12. package/components/IncidentReport/Authorities.vue +189 -151
  13. package/components/IncidentReport/IncidentInformation.vue +28 -12
  14. package/components/IncidentReport/IncidentInformationDownload.vue +225 -0
  15. package/components/IncidentReport/affectedEntities.vue +13 -57
  16. package/components/Signature.vue +133 -0
  17. package/components/SiteSettings.vue +285 -0
  18. package/components/SlideCardGroup.vue +194 -0
  19. package/components/Tooltip/Info.vue +33 -0
  20. package/components/VisitorForm.vue +65 -3
  21. package/components/VisitorManagement.vue +23 -6
  22. package/composables/useAccessManagement.ts +44 -6
  23. package/composables/useBulletin.ts +8 -3
  24. package/composables/useBulletinBoardPermission.ts +48 -0
  25. package/composables/useCleaningPermission.ts +2 -0
  26. package/composables/useComment.ts +147 -0
  27. package/composables/useCommonPermission.ts +29 -1
  28. package/composables/useFeedback.ts +79 -29
  29. package/composables/useFile.ts +6 -0
  30. package/composables/usePDFDownload.ts +1 -1
  31. package/composables/useSiteSettings.ts +1 -1
  32. package/composables/useVisitor.ts +6 -5
  33. package/composables/useWorkOrder.ts +61 -26
  34. package/constants/app.ts +12 -0
  35. package/nuxt.config.ts +2 -0
  36. package/package.json +3 -1
  37. package/plugins/vue-draggable-next.client.ts +5 -0
  38. package/public/default-image.svg +4 -0
  39. package/public/placeholder-image.svg +6 -0
  40. package/types/comment.d.ts +38 -0
  41. package/types/dashboard.d.ts +12 -0
  42. package/types/feedback.d.ts +56 -20
  43. package/types/site.d.ts +2 -1
  44. package/types/work-order.d.ts +54 -18
  45. package/utils/data.ts +31 -0
@@ -25,158 +25,178 @@
25
25
  >
26
26
  </v-data-table>
27
27
  </v-col>
28
+ <div class="w-100 my-8 mx-2">
29
+ <v-table class="responsive-table border elevation-0">
30
+ <thead>
31
+ <tr>
32
+ <th
33
+ v-for="(item, index) in concernHeader"
34
+ :key="index"
35
+ class="text-left font-weight-bold text-black border-e"
36
+ >
37
+ {{ item }}
38
+ </th>
39
+ </tr>
40
+ </thead>
41
+ <tbody>
42
+ <!-- 1 -->
43
+ <tr>
44
+ <td class="border-e">1.</td>
45
+ <td class="border-e">
46
+ What was done to address the incident thereafter?
47
+ </td>
48
+ <td class="border-e pa-2">
49
+ {{ authorities?.incidentThereAfter.actionTaken }}
50
+ </td>
51
+ <td class="border-e pa-2">
52
+ {{ authorities?.incidentThereAfter.status }}
53
+ </td>
54
+ <td class="pa-2">
55
+ {{ authorities?.incidentThereAfter.time }}
56
+ </td>
57
+ </tr>
28
58
 
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>
59
+ <!-- 2 -->
60
+ <tr>
61
+ <td class="border-e">2.</td>
62
+ <td class="border-e">
63
+ Were the management notified and who was notified?
64
+ </td>
65
+ <td class="border-e pa-2">
66
+ {{ authorities?.managementNotified.actionTaken }}
67
+ </td>
68
+ <td class="border-e pa-2">
69
+ {{ authorities?.managementNotified.status }}
70
+ </td>
71
+ <td class="pa-2">
72
+ {{ authorities?.managementNotified.time }}
73
+ </td>
74
+ </tr>
75
+
76
+ <!-- 3 -->
77
+ <tr>
78
+ <td class="border-e">3.</td>
79
+ <td class="border-e">How was the incident resolved?</td>
80
+ <td class="border-e pa-2">
81
+ {{ authorities?.incidentResolved.actionTaken }}
82
+ </td>
83
+ <td class="border-e pa-2">
84
+ {{ authorities?.incidentResolved.status }}
85
+ </td>
86
+ <td class="pa-2">
87
+ {{ formatDate(authorities?.incidentResolved.time) }}
88
+ </td>
89
+ </tr>
90
+
91
+ <!-- 4 -->
92
+ <tr>
93
+ <td class="border-e">4.</td>
94
+ <td class="border-e">What was the cause of the incident?</td>
95
+ <td class="border-e pa-2">
96
+ {{ authorities?.causeOfIncident.actionTaken }}
97
+ </td>
98
+ <td class="border-e pa-2">
99
+ {{ authorities?.causeOfIncident.status }}
100
+ </td>
101
+ <td class="pa-2">
102
+ {{ authorities?.causeOfIncident.time }}
103
+ </td>
104
+ </tr>
105
+
106
+ <!-- 5 -->
107
+ <tr>
108
+ <td class="border-e">5.</td>
109
+ <td class="border-e">Any systems used to verify the incident?</td>
110
+ <td class="border-e pa-2">
111
+ {{ authorities?.systemUsed.actionTaken }}
112
+ </td>
113
+ <td class="border-e pa-2">
114
+ {{ authorities?.systemUsed.status }}
115
+ </td>
116
+ <td class="pa-2">
117
+ {{ formatDate(authorities?.systemUsed.time) }}
118
+ </td>
119
+ </tr>
120
+
121
+ <!-- 6 -->
122
+ <tr>
123
+ <td class="border-e">6.</td>
124
+ <td class="border-e">Any CCTV records or pictures taken?</td>
125
+ <td class="border-e pa-2">
126
+ {{ authorities?.cctvRecord.actionTaken }}
127
+ </td>
128
+ <td class="border-e pa-2">
129
+ {{ authorities?.cctvRecord.status }}
130
+ </td>
131
+ <td class="pa-2">
132
+ {{ formatDate(authorities?.cctvRecord.time) }}
133
+ </td>
134
+ </tr>
135
+
136
+ <!-- 7 -->
137
+ <tr>
138
+ <td class="border-e">7.</td>
139
+ <td class="border-e">Particulars of tenant / owner (if any)</td>
140
+ <td class="border-e pa-2">
141
+ {{ authorities?.particularsOwner.actionTaken }}
142
+ </td>
143
+ <td class="border-e pa-2">
144
+ {{ authorities?.particularsOwner.status }}
145
+ </td>
146
+ <td class="pa-2">
147
+ {{ authorities?.particularsOwner.time }}
148
+ </td>
149
+ </tr>
150
+
151
+ <!-- 8 -->
152
+ <tr>
153
+ <td class="border-e">8.</td>
154
+ <td class="border-e">When was the incident resolved?</td>
155
+ <td class="border-e pa-2">
156
+ {{ authorities?.whenIncidentResolve.actionTaken }}
157
+ </td>
158
+ <td class="border-e pa-2">
159
+ {{ authorities?.whenIncidentResolve.status }}
160
+ </td>
161
+ <td class="pa-2">
162
+ {{ authorities?.whenIncidentResolve.time }}
163
+ </td>
164
+ </tr>
165
+
166
+ <!-- 9 -->
167
+ <tr>
168
+ <td class="border-e">9.</td>
169
+ <td class="border-e">Name of Shift In charge</td>
170
+ <td class="border-e pa-2">
171
+ {{ authorities?.nameOfShiftIncharge.actionTaken }}
172
+ </td>
173
+ <td class="border-e pa-2">
174
+ {{ authorities?.nameOfShiftIncharge.status }}
175
+ </td>
176
+ <td class="pa-2">
177
+ {{ authorities?.nameOfShiftIncharge.time }}
178
+ </td>
179
+ </tr>
180
+
181
+ <!-- 10 -->
182
+ <tr>
183
+ <td class="border-e">10.</td>
184
+ <td class="border-e">
185
+ Any security implication due to the incident?
186
+ </td>
187
+ <td class="border-e pa-2">
188
+ {{ authorities?.securityImplication.actionTaken }}
189
+ </td>
190
+ <td class="border-e pa-2">
191
+ {{ authorities?.securityImplication.status }}
192
+ </td>
193
+ <td class="pa-2">
194
+ {{ formatDate(authorities?.securityImplication.time) }}
195
+ </td>
196
+ </tr>
197
+ </tbody>
198
+ </v-table>
199
+ </div>
180
200
  </v-row>
181
201
  </template>
182
202
 
@@ -223,4 +243,22 @@ const authoritiesTableHeader = [
223
243
  value: "description",
224
244
  },
225
245
  ];
246
+
247
+ const concernHeader = [
248
+ "S/No",
249
+ "Areas of Concern",
250
+ "Actions Taken",
251
+ "Status",
252
+ "Time",
253
+ ];
254
+
255
+ const formatDate = (date: Date | string | null) => {
256
+ if (!date) return "";
257
+
258
+ const d = typeof date === "string" ? new Date(date) : date;
259
+
260
+ if (isNaN(d.getTime())) return ""; // safeguard for invalid date
261
+
262
+ return new Intl.DateTimeFormat("en-GB").format(d);
263
+ };
226
264
  </script>
@@ -89,6 +89,19 @@
89
89
  </v-row>
90
90
  </v-col>
91
91
  </v-row>
92
+ <v-row no-gutters class="mt-5">
93
+ <v-col cols="12" sm="3" md="3">
94
+ <InputLabel
95
+ class="text-capitalize"
96
+ title="Time of Response (1st Contact)"
97
+ />
98
+ <p class="my-1 text-h6">
99
+ {{
100
+ incidentInformation?.incidentTypeAndTime?.timeOfResponse || "NA"
101
+ }}
102
+ </p>
103
+ </v-col>
104
+ </v-row>
92
105
  </v-col>
93
106
 
94
107
  <!-- Response/Submission From (1st Contact) -->
@@ -103,15 +116,6 @@
103
116
  {{ incidentInformation?.submissionForm?.time || "NA" }}
104
117
  </p>
105
118
  </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
119
  <v-col cols="12" sm="4" md="3">
116
120
  <InputLabel class="text-capitalize" title="Date" />
117
121
  <p class="my-1 text-h6">
@@ -140,11 +144,11 @@
140
144
  <div>
141
145
  <InputLabel class="text-capitalize mr-1" title="NRIC/WP Number" />
142
146
  <v-icon
143
- v-if="incidentInformation?.complaintInfo?.nric"
147
+ v-if="incidentInformation?.complaintInfo?.nric"
144
148
  size="small"
145
149
  color="blue"
146
150
  class="cursor-pointer"
147
- @click="showNRICComplainant = !showNRICComplainant"
151
+ @click="toggleNRICComplainant"
148
152
  >
149
153
  {{ showNRICComplainant ? "mdi-eye-off" : "mdi-eye" }}
150
154
  </v-icon>
@@ -186,7 +190,7 @@
186
190
  size="small"
187
191
  color="blue"
188
192
  class="cursor-pointer"
189
- @click="showNRICRecipient = !showNRICRecipient"
193
+ @click="toggleNRICRecipient"
190
194
  >
191
195
  {{ showNRICRecipient ? "mdi-eye-off" : "mdi-eye" }}
192
196
  </v-icon>
@@ -258,6 +262,8 @@ const props = defineProps({
258
262
  },
259
263
  });
260
264
 
265
+ const emit = defineEmits(["showNRICComplainant", "showNRICRecipient"]);
266
+
261
267
  // utilities
262
268
  const { getSiteById } = useSiteSettings();
263
269
 
@@ -289,6 +295,16 @@ function toLocalDate(utcString: string) {
289
295
  });
290
296
  }
291
297
 
298
+ const toggleNRICComplainant = () => {
299
+ showNRICComplainant.value = !showNRICComplainant.value;
300
+ emit("showNRICComplainant", showNRICComplainant.value);
301
+ };
302
+
303
+ const toggleNRICRecipient = () => {
304
+ showNRICRecipient.value = !showNRICRecipient.value;
305
+ emit("showNRICRecipient", showNRICRecipient.value);
306
+ };
307
+
292
308
  const maskNRIC = (value: any) => {
293
309
  if (!value) return "NA";
294
310
 
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <v-row no-gutters class="px-5 pt-4">
3
+ <!-- Site Information -->
4
+ <p
5
+ class="text-uppercase text-center w-100 text-h6"
6
+ style="background: #aa212a; color: #fff; padding: 10px"
7
+ >
8
+ Incident Report
9
+ </p>
10
+ <v-row no-gutters class="mt-5 border pb-5">
11
+ <p
12
+ class="w-100 text-h6 pa-2 text-white text-center"
13
+ style="background: #fcbf49"
14
+ >
15
+ Incident Information
16
+ </p>
17
+
18
+ <v-col cols="6" class="pa-3 border-b border-e">
19
+ <p class="font-weight-bold">Site</p>
20
+ <p>{{ siteName || "-" }}</p>
21
+ </v-col>
22
+ <v-col cols="6" class="pa-3 border-b">
23
+ <p class="font-weight-bold">Reference</p>
24
+ <p>{{ incidentInformation?.siteInfo?.irNumber || "-" }}</p>
25
+ </v-col>
26
+
27
+ <v-col cols="6" class="pa-3 border-b border-e">
28
+ <p class="font-weight-bold">Place of Incident</p>
29
+ <p>
30
+ {{ incidentInformation?.placeOfIncident?.incidentLocation || "-" }}
31
+ </p>
32
+ </v-col>
33
+ <v-col cols="6" class="pa-3 border-b">
34
+ <p class="font-weight-bold">Type of Incident</p>
35
+ <p>
36
+ {{ incidentInformation?.incidentTypeAndTime?.typeOfIncident || "-" }}
37
+ </p>
38
+ </v-col>
39
+
40
+ <v-col cols="6" class="pa-3 border-b border-e">
41
+ <p class="font-weight-bold">Date of Incident</p>
42
+ <p>
43
+ {{
44
+ toLocalDate(
45
+ incidentInformation?.incidentTypeAndTime?.dateOfIncident
46
+ ) || "NA"
47
+ }}
48
+ </p>
49
+ </v-col>
50
+ <v-col cols="6" class="pa-3 border-b">
51
+ <p class="font-weight-bold">Incident Start Time</p>
52
+ <p>
53
+ {{ incidentInformation?.incidentTypeAndTime?.incidentStart || "-" }}
54
+ </p>
55
+ </v-col>
56
+
57
+ <v-col cols="6" class="pa-3 border-b border-e">
58
+ <p class="font-weight-bold">Time of Response (From 1st Contact)</p>
59
+ <p>
60
+ {{ incidentInformation?.incidentTypeAndTime?.timeOfResponse || "-" }}
61
+ </p>
62
+ </v-col>
63
+ <v-col cols="6" class="pa-3 border-b">
64
+ <p class="font-weight-bold">Incident End Time</p>
65
+ <p>
66
+ {{ incidentInformation?.incidentTypeAndTime?.incidentEnd || "-" }}
67
+ </p>
68
+ </v-col>
69
+
70
+ <v-col cols="6" class="pa-3 border-b border-e">
71
+ <p class="font-weight-bold">Date of Report Submission</p>
72
+ {{
73
+ toLocalDate(incidentInformation?.submissionForm?.dateOfReport) || "NA"
74
+ }}
75
+ </v-col>
76
+ <v-col cols="6" class="pa-3 border-b">
77
+ <p class="font-weight-bold">Time of Report Submission</p>
78
+ <p>{{ incidentInformation?.submissionForm?.time || "-" }}</p>
79
+ </v-col>
80
+
81
+ <v-col cols="6" class="pa-3 border-b border-e">
82
+ <p class="font-weight-bold">Report Submitted By</p>
83
+ <p>{{ incidentInformation?.siteInfo?.submittedBy || "-" }}</p>
84
+ </v-col>
85
+ <v-col cols="6" class="pa-3 border-b">
86
+ <p class="font-weight-bold">Designation</p>
87
+ <p>{{ incidentInformation?.siteInfo?.designation || "-" }}</p>
88
+ </v-col>
89
+
90
+ <v-col cols="4" class="pa-3 border-b border-e">
91
+ <p class="font-weight-bold">Name of Informant/Complainant</p>
92
+ <p>{{ incidentInformation?.complaintInfo?.complainant || "-" }}</p>
93
+ </v-col>
94
+ <v-col cols="4" class="pa-3 border-b border-e">
95
+ <p class="font-weight-bold">Contact No.</p>
96
+ <p>{{ incidentInformation?.complaintInfo?.contact || "-" }}</p>
97
+ </v-col>
98
+ <v-col cols="4" class="pa-3 border-b">
99
+ <p class="font-weight-bold">NRIC/WP No.</p>
100
+ <p>
101
+ {{
102
+ showNRICComplainant
103
+ ? incidentInformation?.complaintInfo?.nric || "-"
104
+ : maskNRIC(incidentInformation?.complaintInfo?.nric)
105
+ }}
106
+ </p>
107
+ </v-col>
108
+
109
+ <v-col cols="4" class="pa-3 border-b border-e">
110
+ <p class="font-weight-bold">
111
+ Name of Recipient of Complaint (1st Contact)
112
+ </p>
113
+ <p>{{ incidentInformation?.recipientOfComplaint?.recipient || "-" }}</p>
114
+ </v-col>
115
+ <v-col cols="4" class="pa-3 border-b border-e">
116
+ <p class="font-weight-bold">Contact No.</p>
117
+ <p>{{ incidentInformation?.recipientOfComplaint?.contact || "-" }}</p>
118
+ </v-col>
119
+ <v-col cols="4" class="pa-3 border-b">
120
+ <p class="font-weight-bold">NRIC/WP No.</p>
121
+ <p>
122
+ {{
123
+ showNRICRecipient
124
+ ? incidentInformation?.recipientOfComplaint?.nric || "-"
125
+ : maskNRIC(incidentInformation?.recipientOfComplaint?.nric)
126
+ }}
127
+ </p>
128
+ </v-col>
129
+
130
+ <v-col cols="12" class="pa-3 border-b border-e">
131
+ <p class="font-weight-bold">Complaint Received through</p>
132
+ <p
133
+ v-if="
134
+ incidentInformation?.complaintReceivedTo?.receivedVia != 'others'
135
+ "
136
+ >
137
+ {{ incidentInformation?.complaintReceivedTo?.receivedVia || "-" }}
138
+ </p>
139
+
140
+ <p v-else>
141
+ {{
142
+ incidentInformation?.complaintReceivedTo?.otherDescription || "-"
143
+ }}
144
+ </p>
145
+ </v-col>
146
+ <v-col cols="6" class="pa-3">
147
+ <p class="font-weight-bold">Brief Description</p>
148
+ <p>
149
+ {{
150
+ incidentInformation?.complaintReceivedTo?.briefDescription || "-"
151
+ }}
152
+ </p>
153
+ </v-col>
154
+ </v-row>
155
+ </v-row>
156
+ </template>
157
+
158
+ <script lang="ts" setup>
159
+ definePageMeta({
160
+ middleware: ["01-auth", "02-org"],
161
+ memberOnly: true,
162
+ });
163
+
164
+ // props
165
+ const props = defineProps({
166
+ incidentInformation: {
167
+ type: Object as PropType<Record<string, any> | null>,
168
+ required: true,
169
+ },
170
+ });
171
+
172
+ // utilities
173
+ const { getSiteById } = useSiteSettings();
174
+ const route = useRoute();
175
+
176
+ // state
177
+ const siteName = ref("");
178
+
179
+ const siteId = computed(() => props.incidentInformation?.siteInfo?.site);
180
+
181
+ const showNRICComplainant = ref(false);
182
+ const showNRICRecipient = ref(false);
183
+
184
+ watch(
185
+ () => route.query.nricComp,
186
+ (val) => {
187
+ showNRICComplainant.value = val === "true";
188
+ },
189
+ { immediate: true }
190
+ );
191
+
192
+ watch(
193
+ () => route.query.nricRec,
194
+ (val) => {
195
+ showNRICRecipient.value = val === "true";
196
+ },
197
+ { immediate: true }
198
+ );
199
+
200
+ watch(
201
+ siteId,
202
+ async (newSiteId) => {
203
+ if (!newSiteId) return;
204
+
205
+ const siteDataValue = await getSiteById(newSiteId);
206
+
207
+ siteName.value = siteDataValue?.name ?? "";
208
+ },
209
+ { immediate: true }
210
+ );
211
+
212
+ function toLocalDate(utcString: string) {
213
+ return new Date(utcString).toLocaleString("en-US", {
214
+ year: "numeric",
215
+ month: "2-digit",
216
+ day: "2-digit",
217
+ });
218
+ }
219
+
220
+ const maskNRIC = (value: any) => {
221
+ if (!value) return "NA";
222
+
223
+ return value.replace(/.(?=.{3})/g, "*");
224
+ };
225
+ </script>