@7365admin1/layer-common 4.97.1-staging.540 → 4.97.1-staging.541

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
@@ -2082,11 +2082,11 @@
2082
2082
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
2083
2083
  own rule from two endpoints the console already calls, unprojected:
2084
2084
 
2085
- GET /api/members/user/:user/app/admin the Seven365 staff membership
2086
- GET /api/roles/id/:role that membership's role document
2085
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
2086
+ GET /api/roles/id/:role that membership's role document
2087
2087
 
2088
- owner = member.type === "admin" && role.type === "admin" && role.default === true
2089
- staff = member.type === "admin" && role.type === "admin"
2088
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
2089
+ staff = member.type === "admin" && role.type === "admin"
2090
2090
 
2091
2091
  `role.default` is the marker because it is the only property of a platform
2092
2092
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -873,6 +873,12 @@ watch(activeTab, () => {
873
873
  page.value = 1;
874
874
  });
875
875
 
876
+ // Same for a search: typed on page 21 of the full list, it would ask for page
877
+ // 21 of the matches and show an empty table, as if nothing matched.
878
+ watch(headerSearch, () => {
879
+ page.value = 1;
880
+ });
881
+
876
882
  const loading = computed(() => getAllReqStatus.value === "pending");
877
883
 
878
884
  // The page totals are the server's count of the WHOLE list, read through the
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div class="ir-att">
3
+ <p class="ir-att-title">Attachments</p>
4
+ <div v-if="items.length" class="ir-att-grid">
5
+ <div v-for="item in items" :key="item.id" class="ir-att-card">
6
+ <div class="ir-att-frame">
7
+ <img v-if="item.isImage" :src="item.url" :alt="item.name" />
8
+ <div v-else class="ir-att-icon">
9
+ <v-icon size="48">{{ item.icon }}</v-icon>
10
+ </div>
11
+ </div>
12
+ <p class="ir-att-name">{{ item.name }}</p>
13
+ <a class="ir-att-link" :href="item.url" target="_blank" rel="noopener">Download</a>
14
+ </div>
15
+ </div>
16
+ <p v-else class="mt-2 text-h6">No Attachments Available</p>
17
+ </div>
18
+ </template>
19
+
20
+ <script lang="ts" setup>
21
+ // Print/PDF attachments: 2 per row in fixed frames so tall phone screenshots and
22
+ // wide photos line up. The Download link is a plain <a href>, which the PDF
23
+ // renderer keeps as a live link. Files live in the public file store, so the
24
+ // link works for anyone holding the PDF.
25
+ const props = defineProps({
26
+ photos: {
27
+ type: Array as PropType<string[]>,
28
+ default: () => [],
29
+ },
30
+ });
31
+
32
+ const { getFileUrl, getFileById } = useFile();
33
+
34
+ const IMAGE = /\.(jpe?g|png|gif|webp|bmp|heic|svg)$/i;
35
+ const VIDEO = /\.(mp4|mov|avi|mkv|webm|3gp)$/i;
36
+
37
+ type Item = { id: string; name: string; url: string; isImage: boolean; icon: string };
38
+ const items = ref<Item[]>([]);
39
+
40
+ watch(
41
+ () => props.photos,
42
+ async (ids) => {
43
+ items.value = await Promise.all(
44
+ (ids ?? []).map(async (id) => {
45
+ let name = "";
46
+ try {
47
+ const res: any = await getFileById(id);
48
+ name = res?.data?.name ?? res?.name ?? "";
49
+ } catch {
50
+ // keep the link even if the name lookup fails
51
+ }
52
+ // No name known: treat as an image (that is what reports carry).
53
+ const isImage = !name || IMAGE.test(name);
54
+ return {
55
+ id,
56
+ name: name || "Attachment",
57
+ url: getFileUrl(id),
58
+ isImage,
59
+ icon: VIDEO.test(name) ? "mdi-file-video-outline" : "mdi-file-document-outline",
60
+ };
61
+ })
62
+ );
63
+ },
64
+ { immediate: true }
65
+ );
66
+ </script>
67
+
68
+ <style scoped>
69
+ .ir-att-title {
70
+ font-size: 17px;
71
+ font-weight: 600;
72
+ margin: 0 0 12px;
73
+ break-after: avoid;
74
+ page-break-after: avoid;
75
+ }
76
+ .ir-att-grid {
77
+ display: grid;
78
+ grid-template-columns: 1fr 1fr;
79
+ gap: 16px;
80
+ /* Keep every tile border fully inside the printable area: a border drawn on
81
+ the very edge of the page content is half cut off. */
82
+ padding: 0 2px 2px;
83
+ }
84
+ .ir-att-card {
85
+ box-sizing: border-box;
86
+ break-inside: avoid;
87
+ page-break-inside: avoid;
88
+ border: 1px solid #8a8a8a;
89
+ padding: 8px;
90
+ min-width: 0;
91
+ }
92
+ .ir-att-frame {
93
+ height: 260px;
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ background: #f5f5f5;
98
+ overflow: hidden;
99
+ }
100
+ .ir-att-frame img {
101
+ width: 100%;
102
+ height: 100%;
103
+ object-fit: contain;
104
+ }
105
+ .ir-att-name {
106
+ margin: 6px 0 2px;
107
+ font-size: 12px;
108
+ overflow-wrap: anywhere;
109
+ }
110
+ .ir-att-link {
111
+ font-size: 12px;
112
+ font-weight: 600;
113
+ color: #1565c0;
114
+ text-decoration: underline;
115
+ }
116
+ </style>
@@ -31,6 +31,10 @@
31
31
  {{ incidentInformation?.siteInfo?.designation || "NA" }}
32
32
  </p>
33
33
  </v-col>
34
+ <v-col v-if="companyName" cols="12" sm="6" md="3">
35
+ <InputLabel class="text-capitalize" title="Reported by" />
36
+ <p class="my-1 text-h6">{{ companyName }}</p>
37
+ </v-col>
34
38
  </v-row>
35
39
  </v-col>
36
40
 
@@ -256,8 +260,15 @@ const props = defineProps({
256
260
  type: Object as PropType<Record<string, any> | null>,
257
261
  required: true,
258
262
  },
263
+ // The report's `organization` id: the company that filed it.
264
+ organizationId: {
265
+ type: String,
266
+ default: "",
267
+ },
259
268
  });
260
269
 
270
+ const companyName = useIncidentCompany(() => props.organizationId);
271
+
261
272
  const emit = defineEmits(["showNRICComplainant", "showNRICRecipient"]);
262
273
 
263
274
  // utilities
@@ -1,157 +1,198 @@
1
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 bg-error text-on-error"
6
- style="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-center bg-warning text-on-warning"
13
- >
14
- Incident Information
2
+ <div class="ir-doc px-5 pt-4">
3
+ <!-- Report header: title with the status inside it, so the two never float apart. -->
4
+ <div class="ir-title bg-error text-on-error">
5
+ <p class="text-uppercase text-h6 ma-0">Incident Report</p>
6
+ <p v-if="status" class="ir-status ma-0 mt-2" :class="`ir-status--${statusKey}`">
7
+ Status: {{ String(status).toUpperCase() }}
15
8
  </p>
16
-
17
- <v-col cols="6" class="pa-3 border-b border-e">
18
- <p class="font-weight-bold">Site</p>
19
- <p>{{ siteName || "-" }}</p>
20
- </v-col>
21
- <v-col cols="6" class="pa-3 border-b">
22
- <p class="font-weight-bold">Reference</p>
23
- <p>{{ incidentInformation?.siteInfo?.irNumber || "-" }}</p>
24
- </v-col>
25
-
26
- <v-col cols="6" class="pa-3 border-b border-e">
27
- <p class="font-weight-bold">Place of Incident</p>
28
- <p>
29
- {{ incidentInformation?.placeOfIncident?.incidentLocation || "-" }}
30
- </p>
31
- </v-col>
32
- <v-col cols="6" class="pa-3 border-b">
33
- <p class="font-weight-bold">Type of Incident</p>
34
- <p>
35
- {{ incidentInformation?.incidentTypeAndTime?.typeOfIncident || "-" }}
36
- </p>
37
- </v-col>
38
-
39
- <v-col cols="6" class="pa-3 border-b border-e">
40
- <p class="font-weight-bold">Date of Incident</p>
41
- <p>
42
- {{
43
- toLocalDate(
44
- incidentInformation?.incidentTypeAndTime?.dateOfIncident
45
- ) || "NA"
46
- }}
47
- </p>
48
- </v-col>
49
- <v-col cols="6" class="pa-3 border-b">
50
- <p class="font-weight-bold">Incident Start Time</p>
51
- <p>
52
- {{ incidentInformation?.incidentTypeAndTime?.incidentStart || "-" }}
53
- </p>
54
- </v-col>
55
-
56
- <v-col cols="6" class="pa-3 border-b border-e">
57
- <p class="font-weight-bold">Time of Response (From 1st Contact)</p>
58
- <p>
59
- {{ incidentInformation?.incidentTypeAndTime?.timeOfResponse || "-" }}
60
- </p>
61
- </v-col>
62
- <v-col cols="6" class="pa-3 border-b">
63
- <p class="font-weight-bold">Incident End Time</p>
64
- <p>
65
- {{ incidentInformation?.incidentTypeAndTime?.incidentEnd || "-" }}
66
- </p>
67
- </v-col>
68
-
69
- <v-col cols="6" class="pa-3 border-b border-e">
70
- <p class="font-weight-bold">Date of Report Submission</p>
71
- {{
72
- toLocalDate(incidentInformation?.submissionForm?.dateOfReport) || "NA"
73
- }}
74
- </v-col>
75
- <v-col cols="6" class="pa-3 border-b">
76
- <p class="font-weight-bold">Time of Report Submission</p>
77
- <p>{{ incidentInformation?.submissionForm?.time || "-" }}</p>
78
- </v-col>
79
-
80
- <v-col cols="6" class="pa-3 border-b border-e">
81
- <p class="font-weight-bold">Report Submitted By</p>
82
- <p>{{ incidentInformation?.siteInfo?.submittedBy || "-" }}</p>
83
- </v-col>
84
- <v-col cols="6" class="pa-3 border-b">
85
- <p class="font-weight-bold">Designation</p>
86
- <p>{{ incidentInformation?.siteInfo?.designation || "-" }}</p>
87
- </v-col>
88
-
89
- <v-col cols="4" class="pa-3 border-b border-e">
90
- <p class="font-weight-bold">Name of Informant/Complainant</p>
91
- <p>{{ incidentInformation?.complaintInfo?.complainant || "-" }}</p>
92
- </v-col>
93
- <v-col cols="4" class="pa-3 border-b border-e">
94
- <p class="font-weight-bold">Contact No.</p>
95
- <p>{{ incidentInformation?.complaintInfo?.contact || "-" }}</p>
96
- </v-col>
97
- <v-col cols="4" class="pa-3 border-b">
98
- <p class="font-weight-bold">NRIC/WP No.</p>
99
- <p>
100
- {{
101
- showNRICComplainant
102
- ? incidentInformation?.complaintInfo?.nric || "-"
103
- : maskNRIC(incidentInformation?.complaintInfo?.nric)
104
- }}
105
- </p>
106
- </v-col>
107
-
108
- <v-col cols="4" class="pa-3 border-b border-e">
109
- <p class="font-weight-bold">
110
- Name of Recipient of Complaint (1st Contact)
111
- </p>
112
- <p>{{ incidentInformation?.recipientOfComplaint?.recipient || "-" }}</p>
113
- </v-col>
114
- <v-col cols="4" class="pa-3 border-b border-e">
115
- <p class="font-weight-bold">Contact No.</p>
116
- <p>{{ incidentInformation?.recipientOfComplaint?.contact || "-" }}</p>
117
- </v-col>
118
- <v-col cols="4" class="pa-3 border-b">
119
- <p class="font-weight-bold">NRIC/WP No.</p>
120
- <p>
121
- {{
122
- showNRICRecipient
123
- ? incidentInformation?.recipientOfComplaint?.nric || "-"
124
- : maskNRIC(incidentInformation?.recipientOfComplaint?.nric)
125
- }}
126
- </p>
127
- </v-col>
128
-
129
- <v-col cols="12" class="pa-3 border-b border-e">
130
- <p class="font-weight-bold">Complaint Received through</p>
131
- <p
132
- v-if="
9
+ <p v-if="companyName" class="ma-0 mt-2 ir-company">
10
+ Reported by: {{ companyName }}
11
+ </p>
12
+ </div>
13
+ <table class="ir-table mt-5">
14
+ <colgroup>
15
+ <col style="width: 8.3333%" />
16
+ <col style="width: 8.3333%" />
17
+ <col style="width: 8.3333%" />
18
+ <col style="width: 8.3333%" />
19
+ <col style="width: 8.3333%" />
20
+ <col style="width: 8.3333%" />
21
+ <col style="width: 8.3333%" />
22
+ <col style="width: 8.3333%" />
23
+ <col style="width: 8.3333%" />
24
+ <col style="width: 8.3333%" />
25
+ <col style="width: 8.3333%" />
26
+ <col style="width: 8.3333%" />
27
+ </colgroup>
28
+ <thead>
29
+ <tr>
30
+ <th colspan="12" class="ir-section text-h6 pa-2 text-center bg-warning text-on-warning">Incident Information</th>
31
+ </tr>
32
+ </thead>
33
+ <tbody>
34
+ <tr>
35
+ <td colspan="6" class="pa-3 ir-cell">
36
+ <p class="font-weight-bold">Site</p>
37
+ <p>{{ siteName || "-" }}</p>
38
+ </td>
39
+ <td colspan="6" class="pa-3 ir-cell">
40
+ <p class="font-weight-bold">Reference</p>
41
+ <p>{{ incidentInformation?.siteInfo?.irNumber || "-" }}</p>
42
+ </td>
43
+ </tr>
44
+ <tr v-if="companyName">
45
+ <td colspan="12" class="pa-3 ir-cell">
46
+ <p class="font-weight-bold">Reported by (Company)</p>
47
+ <p>{{ companyName }}</p>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <td colspan="6" class="pa-3 ir-cell">
52
+ <p class="font-weight-bold">Place of Incident</p>
53
+ <p>
54
+ {{ incidentInformation?.placeOfIncident?.incidentLocation || "-" }}
55
+ </p>
56
+ </td>
57
+ <td colspan="6" class="pa-3 ir-cell">
58
+ <p class="font-weight-bold">Type of Incident</p>
59
+ <p>
60
+ {{ incidentInformation?.incidentTypeAndTime?.typeOfIncident || "-" }}
61
+ </p>
62
+ </td>
63
+ </tr>
64
+ <tr>
65
+ <td colspan="6" class="pa-3 ir-cell">
66
+ <p class="font-weight-bold">Date of Incident</p>
67
+ <p>
68
+ {{
69
+ toLocalDate(
70
+ incidentInformation?.incidentTypeAndTime?.dateOfIncident
71
+ ) || "NA"
72
+ }}
73
+ </p>
74
+ </td>
75
+ <td colspan="6" class="pa-3 ir-cell">
76
+ <p class="font-weight-bold">Incident Start Time</p>
77
+ <p>
78
+ {{ incidentInformation?.incidentTypeAndTime?.incidentStart || "-" }}
79
+ </p>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <td colspan="6" class="pa-3 ir-cell">
84
+ <p class="font-weight-bold">Time of Response (From 1st Contact)</p>
85
+ <p>
86
+ {{ incidentInformation?.incidentTypeAndTime?.timeOfResponse || "-" }}
87
+ </p>
88
+ </td>
89
+ <td colspan="6" class="pa-3 ir-cell">
90
+ <p class="font-weight-bold">Incident End Time</p>
91
+ <p>
92
+ {{ incidentInformation?.incidentTypeAndTime?.incidentEnd || "-" }}
93
+ </p>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td colspan="6" class="pa-3 ir-cell">
98
+ <p class="font-weight-bold">Date of Report Submission</p>
99
+ <p>
100
+ {{
101
+ toLocalDate(incidentInformation?.submissionForm?.dateOfReport) ||
102
+ "NA"
103
+ }}
104
+ </p>
105
+ </td>
106
+ <td colspan="6" class="pa-3 ir-cell">
107
+ <p class="font-weight-bold">Time of Report Submission</p>
108
+ <p>{{ incidentInformation?.submissionForm?.time || "-" }}</p>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td colspan="6" class="pa-3 ir-cell">
113
+ <p class="font-weight-bold">Report Submitted By</p>
114
+ <p>{{ incidentInformation?.siteInfo?.submittedBy || "-" }}</p>
115
+ </td>
116
+ <td colspan="6" class="pa-3 ir-cell">
117
+ <p class="font-weight-bold">Designation</p>
118
+ <p>{{ incidentInformation?.siteInfo?.designation || "-" }}</p>
119
+ </td>
120
+ </tr>
121
+ <tr>
122
+ <td colspan="4" class="pa-3 ir-cell">
123
+ <p class="font-weight-bold">Name of Informant/Complainant</p>
124
+ <p>{{ incidentInformation?.complaintInfo?.complainant || "-" }}</p>
125
+ </td>
126
+ <td colspan="4" class="pa-3 ir-cell">
127
+ <p class="font-weight-bold">Contact No.</p>
128
+ <p>{{ incidentInformation?.complaintInfo?.contact || "-" }}</p>
129
+ </td>
130
+ <td colspan="4" class="pa-3 ir-cell">
131
+ <p class="font-weight-bold">NRIC/WP No.</p>
132
+ <p>
133
+ {{
134
+ showNRICComplainant
135
+ ? incidentInformation?.complaintInfo?.nric || "-"
136
+ : maskNRIC(incidentInformation?.complaintInfo?.nric)
137
+ }}
138
+ </p>
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td colspan="4" class="pa-3 ir-cell">
143
+ <p class="font-weight-bold">
144
+ Name of Recipient of Complaint (1st Contact)
145
+ </p>
146
+ <p>{{ incidentInformation?.recipientOfComplaint?.recipient || "-" }}</p>
147
+ </td>
148
+ <td colspan="4" class="pa-3 ir-cell">
149
+ <p class="font-weight-bold">Contact No.</p>
150
+ <p>{{ incidentInformation?.recipientOfComplaint?.contact || "-" }}</p>
151
+ </td>
152
+ <td colspan="4" class="pa-3 ir-cell">
153
+ <p class="font-weight-bold">NRIC/WP No.</p>
154
+ <p>
155
+ {{
156
+ showNRICRecipient
157
+ ? incidentInformation?.recipientOfComplaint?.nric || "-"
158
+ : maskNRIC(incidentInformation?.recipientOfComplaint?.nric)
159
+ }}
160
+ </p>
161
+ </td>
162
+ </tr>
163
+ <tr v-if="
133
164
  incidentInformation?.complaintReceivedTo?.receivedVia != 'others'
134
- "
135
- >
136
- {{ incidentInformation?.complaintReceivedTo?.receivedVia || "-" }}
137
- </p>
138
-
139
- <p v-else>
140
- {{
141
- incidentInformation?.complaintReceivedTo?.otherDescription || "-"
142
- }}
143
- </p>
144
- </v-col>
145
- <v-col cols="12" class="pa-3">
146
- <p class="font-weight-bold">Brief Description</p>
147
- <p>
148
- {{
149
- incidentInformation?.complaintReceivedTo?.briefDescription || "-"
150
- }}
151
- </p>
152
- </v-col>
153
- </v-row>
154
- </v-row>
165
+ ">
166
+ <td colspan="12" class="pa-3 ir-cell">
167
+ <p class="font-weight-bold">Complaint Received through</p>
168
+ <p
169
+ v-if="
170
+ incidentInformation?.complaintReceivedTo?.receivedVia != 'others'
171
+ "
172
+ >
173
+ {{ incidentInformation?.complaintReceivedTo?.receivedVia || "-" }}
174
+ </p>
175
+
176
+ <p v-else>
177
+ {{
178
+ incidentInformation?.complaintReceivedTo?.otherDescription || "-"
179
+ }}
180
+ </p>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td colspan="12" class="pa-3 ir-cell">
185
+ <p class="font-weight-bold">Brief Description</p>
186
+ <p>
187
+ {{
188
+ incidentInformation?.complaintReceivedTo?.briefDescription || "-"
189
+ }}
190
+ </p>
191
+ </td>
192
+ </tr>
193
+ </tbody>
194
+ </table>
195
+ </div>
155
196
  </template>
156
197
 
157
198
  <script lang="ts" setup>
@@ -162,8 +203,22 @@ const props = defineProps({
162
203
  type: Object as PropType<Record<string, any> | null>,
163
204
  required: true,
164
205
  },
206
+ // Optional report status (pending/approved/rejected), printed inside the header.
207
+ status: {
208
+ type: String,
209
+ default: "",
210
+ },
211
+ // The report's `organization` id: the company that filed it.
212
+ organizationId: {
213
+ type: String,
214
+ default: "",
215
+ },
165
216
  });
166
217
 
218
+ const companyName = useIncidentCompany(() => props.organizationId);
219
+
220
+ const statusKey = computed(() => String(props.status || "").toLowerCase());
221
+
167
222
  // utilities
168
223
  const { getSiteById } = useSiteSettings();
169
224
  const route = useRoute();
@@ -204,11 +259,16 @@ watch(
204
259
  { immediate: true }
205
260
  );
206
261
 
262
+ // DD/MM/YYYY in Singapore time. The PDF is rendered on a server whose clock is
263
+ // UTC, so without the zone an 8 Oct (SGT) date prints as 07/10.
207
264
  function toLocalDate(utcString: string) {
208
- return new Date(utcString).toLocaleString("en-US", {
265
+ const d = new Date(utcString);
266
+ if (!utcString || isNaN(d.getTime())) return "";
267
+ return d.toLocaleDateString("en-GB", {
209
268
  year: "numeric",
210
269
  month: "2-digit",
211
270
  day: "2-digit",
271
+ timeZone: "Asia/Singapore",
212
272
  });
213
273
  }
214
274
 
@@ -218,3 +278,70 @@ const maskNRIC = (value: any) => {
218
278
  return value.replace(/.(?=.{3})/g, "*");
219
279
  };
220
280
  </script>
281
+
282
+ <style scoped>
283
+ /* One consistent 1px grey rule for every cell edge; rows never split across pages. */
284
+ .ir-title {
285
+ text-align: center;
286
+ padding: 10px;
287
+ }
288
+ .ir-status {
289
+ display: inline-block;
290
+ background: #fff;
291
+ color: #b26a00;
292
+ border: 1px solid currentColor;
293
+ border-radius: 4px;
294
+ padding: 2px 14px;
295
+ font-size: 0.95rem;
296
+ font-weight: 700;
297
+ letter-spacing: 0.03em;
298
+ }
299
+ .ir-company {
300
+ font-size: 1rem;
301
+ font-weight: 600;
302
+ }
303
+ .ir-status--approved { color: #2e7d32; }
304
+ .ir-status--rejected { color: #c62828; }
305
+ /* One table. Each cell paints its own right/bottom rule (the first cell also the
306
+ left one) and the heading cell all four, so borders are never painted outside
307
+ the cell that owns them: collapsed borders left a ghost of the repeated
308
+ heading in the page margin. The heading row is the table header, so it repeats
309
+ at the top of every page; rows never split. */
310
+ .ir-table {
311
+ width: 100%;
312
+ table-layout: fixed;
313
+ border-collapse: separate;
314
+ border-spacing: 0;
315
+ }
316
+ .ir-table thead {
317
+ display: table-header-group;
318
+ }
319
+ .ir-table tr {
320
+ break-inside: avoid;
321
+ page-break-inside: avoid;
322
+ }
323
+ .ir-cell {
324
+ border-right: 1px solid #8a8a8a;
325
+ border-bottom: 1px solid #8a8a8a;
326
+ vertical-align: top;
327
+ }
328
+ .ir-cell:first-child {
329
+ border-left: 1px solid #8a8a8a;
330
+ }
331
+ /* A label always travels with its value. */
332
+ .ir-cell p:first-child {
333
+ break-after: avoid;
334
+ page-break-after: avoid;
335
+ }
336
+ /* The heading is a solid bar with no stroke: when the repeated heading is laid
337
+ out at the foot of the previous page Chrome paints a clipped ghost of it
338
+ there, and a stroke on that ghost showed as a thin line. */
339
+ .ir-section {
340
+ /* A white top border with the colour clipped to the padding box: the ghost then
341
+ starts 2px lower than the page foot, so not even a 0.2pt sliver is painted. */
342
+ border: 0;
343
+ border-top: 2px solid #fff;
344
+ background-clip: padding-box;
345
+ font-weight: 400;
346
+ }
347
+ </style>
@@ -138,7 +138,7 @@
138
138
  <div v-if="commands.length" class="hero-detail__commands">
139
139
  <RobotCommandBar
140
140
  :capabilities="caps"
141
- :can-command="canCommand"
141
+ :can-command="cmdOk"
142
142
  :online="live?.ok === true && live.online === true"
143
143
  :mode="statusMode"
144
144
  :type="robotType"
@@ -151,7 +151,7 @@
151
151
  {{ commandResult.text }}
152
152
  </div>
153
153
  </div>
154
- <RobotViewOnlyNotice v-if="!canCommand" />
154
+ <RobotViewOnlyNotice v-if="!cmdOk" />
155
155
  </section>
156
156
  </div>
157
157
 
@@ -369,11 +369,13 @@ const props = withDefaults(
369
369
  canEdit?: boolean;
370
370
  canCommand?: boolean;
371
371
  canDelete?: boolean;
372
+ /** Seven365 Super Admin: the only one who may command a HERO Fleet Core robot (owner, 12 Oct 2026). */
373
+ superAdmin?: boolean;
372
374
  /** The robot types this app presents - the edit dialog shows Type only with both. */
373
375
  types?: Array<"cleaning" | "security">;
374
376
  tickMs?: number;
375
377
  }>(),
376
- { backLabel: "", canEdit: false, canCommand: false, canDelete: false, types: () => [], tickMs: 1200 },
378
+ { backLabel: "", canEdit: false, canCommand: false, canDelete: false, superAdmin: false, types: () => [], tickMs: 1200 },
377
379
  );
378
380
  const emit = defineEmits<{
379
381
  back: [];
@@ -398,6 +400,7 @@ const {
398
400
  } = useRobots();
399
401
 
400
402
  const record = ref<Record<string, any> | null>(null);
403
+ const cmdOk = computed(() => props.canCommand && (props.superAdmin || record.value?.brand !== "fleet-core"));
401
404
  const topEl = ref<HTMLElement | null>(null);
402
405
  const brands = ref<Array<Record<string, any>>>([]);
403
406
  const error = ref("");
@@ -478,7 +481,7 @@ const makerApp = computed(() => (live.value?.ok ? live.value.profile?.makerApp :
478
481
 
479
482
  const online = computed(() => live.value?.ok === true && live.value.online === true);
480
483
  const commands = computed(() =>
481
- visibleCommands({ capabilities: caps.value, canCommand: props.canCommand, online: online.value, mode: statusMode.value, type: robotType.value, resumable: resumable.value }),
484
+ visibleCommands({ capabilities: caps.value, canCommand: cmdOk.value, online: online.value, mode: statusMode.value, type: robotType.value, resumable: resumable.value }),
482
485
  );
483
486
 
484
487
  /* ---- the plan ---- */
@@ -506,7 +509,7 @@ watch(
506
509
  const readout = computed(() => `${positionText(live.value, caps.value, now.value)} · ${speedText(prevPose.value, nextPose.value, statusMode.value)}`);
507
510
 
508
511
  const spot = ref<Array<{ x: number; y: number }>>([]);
509
- const spotOn = computed(() => showSpotClean({ canCommand: props.canCommand, capabilities: caps.value, online: online.value, type: robotType.value }));
512
+ const spotOn = computed(() => showSpotClean({ canCommand: cmdOk.value, capabilities: caps.value, online: online.value, type: robotType.value }));
510
513
 
511
514
  // The route drawn on the plan: the shown map's first route, else the first with placed checkpoints (the rest are listed by name).
512
515
  const route = computed<TPatrolRouteView | null>(() =>
@@ -839,9 +842,9 @@ function onPick(p: TSavedPoint) {
839
842
  const livePanel = ref<{ show(): void } | null>(null);
840
843
  const hasCamera = computed(() => caps.value?.liveVideo === true || canDrive.value);
841
844
  const driveOpen = ref(false);
842
- const canDrive = computed(() => props.canCommand && caps.value?.manualDrive === true && online.value);
845
+ const canDrive = computed(() => cmdOk.value && caps.value?.manualDrive === true && online.value);
843
846
  const canResolve = computed(
844
- () => props.canCommand && caps.value?.resolveAlerts === true && faultBadge(fault.value) === "ALARM" && typeof fault.value?.code === "string",
847
+ () => cmdOk.value && caps.value?.resolveAlerts === true && faultBadge(fault.value) === "ALARM" && typeof fault.value?.code === "string",
845
848
  );
846
849
  const resolving = ref(false);
847
850
  async function resolveFault() {
@@ -26,9 +26,10 @@
26
26
  :key="robotId"
27
27
  :robot-id="robotId"
28
28
  :back-label="siteName || names.siteName ? `${siteName || names.siteName} fleet` : ''"
29
- :can-edit="canEdit"
29
+ :can-edit="canEdit && superAdmin"
30
30
  :can-command="canCommand"
31
- :can-delete="canDelete"
31
+ :super-admin="superAdmin"
32
+ :can-delete="canDelete && superAdmin"
32
33
  :types="types"
33
34
  @back="emit('back')"
34
35
  @removed="onRemoved"
@@ -42,7 +43,7 @@
42
43
  :site-name="siteName"
43
44
  :client-name="clientName"
44
45
  :type="type"
45
- :can-edit-map="canSetup && canEdit"
46
+ :can-edit-map="canSetup && canEdit && superAdmin"
46
47
  :back-to-network="backToNetwork"
47
48
  @open="(id) => emit('open', id)"
48
49
  @network="emit('network')"
@@ -57,7 +58,7 @@
57
58
  :client-name="clientName"
58
59
  :type="type"
59
60
  :can-command="canCommand"
60
- :can-edit-map="canSetup && canEdit"
61
+ :can-edit-map="canSetup && canEdit && superAdmin"
61
62
  :back-to-network="backToNetwork"
62
63
  @open="(id) => emit('open', id)"
63
64
  @network="emit('network')"
@@ -90,7 +91,7 @@
90
91
  :site-name="siteName"
91
92
  :client-name="clientName"
92
93
  :type="type"
93
- :can-setup="canSetup"
94
+ :can-setup="canSetup && superAdmin"
94
95
  :back-to-network="backToNetwork"
95
96
  :reload-key="reloadKey"
96
97
  @open="(r) => emit('open', String(r._id))"
@@ -0,0 +1,20 @@
1
+ // "Reported by" company for an incident report: the report's `organization`
2
+ // id looked up through the existing org endpoint. Blank when unreadable.
3
+ export function useIncidentCompany(getId: () => string | undefined) {
4
+ const { getById: getOrgById } = useOrg();
5
+ const companyName = ref("");
6
+ watch(
7
+ getId,
8
+ async (id) => {
9
+ companyName.value = "";
10
+ if (!id) return;
11
+ try {
12
+ companyName.value = incidentCompanyName(await getOrgById(id));
13
+ } catch {
14
+ // Not readable by this viewer: show nothing rather than a wrong name.
15
+ }
16
+ },
17
+ { immediate: true }
18
+ );
19
+ return companyName;
20
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.97.1-staging.540",
5
+ "version": "4.97.1-staging.541",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
@@ -0,0 +1,7 @@
1
+ // The company that filed an incident report = the organisation stored on the
2
+ // report (the filer's own membership org: security agency, or the client's own
3
+ // staff org). Returns "" when it cannot be resolved so nothing wrong is printed.
4
+ export function incidentCompanyName(org: unknown): string {
5
+ const name = (org as { name?: unknown } | null | undefined)?.name;
6
+ return typeof name === "string" ? name.trim() : "";
7
+ }