@7365admin1/layer-common 4.139.0 → 4.141.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,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.141.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a8e8548: Site Settings: "Manpower" panel (Seven365 Super Admin only) to switch Manpower on or off for a site (site feature setting `manpower`). Drawn only when the host passes `show-manpower-switch` (Security app). Not set = as before (on only at the legacy Aigle Security Command Centre site).
8
+
9
+ ## 4.140.0
10
+
11
+ ### Minor Changes
12
+
13
+ - e99d972: QR Tagging: explain what the screen does and add a `canGenerate` prop (default true) so an app can hide Generate QR Code from roles without the right. Blocks screen: delete dialog and messages say "Block" (the screen's own name) instead of "Building" / "region".
14
+
3
15
  ## 4.139.0
4
16
 
5
17
  ### Minor Changes
@@ -3389,11 +3401,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3389
3401
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3390
3402
  own rule from two endpoints the console already calls, unprojected:
3391
3403
 
3392
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3393
- GET /api/roles/id/:role that membership's role document
3404
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3405
+ GET /api/roles/id/:role that membership's role document
3394
3406
 
3395
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3396
- staff = member.type === "admin" && role.type === "admin"
3407
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3408
+ staff = member.type === "admin" && role.type === "admin"
3397
3409
 
3398
3410
  `role.default` is the marker because it is the only property of a platform
3399
3411
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -9,7 +9,10 @@
9
9
  tokens. Same three clicks, same `disabled` rules; the primary action
10
10
  sits rightmost, where the design puts it.
11
11
  -->
12
- <PageHeader title="QR Tagging">
12
+ <PageHeader
13
+ title="QR Tagging"
14
+ subtitle="Make a printable QR sticker for each access card, so a card can be identified by scanning its QR. Tick the cards, then Generate QR Code; Print QR Code prints the ones that already have a QR."
15
+ >
13
16
  <template #actions>
14
17
  <AppButton
15
18
  variant="ghost"
@@ -26,6 +29,7 @@
26
29
  Print QR Code
27
30
  </AppButton>
28
31
  <AppButton
32
+ v-if="canGenerate"
29
33
  :disabled="!qrCodeAccessCards.length"
30
34
  @click="generateQrCodes"
31
35
  >
@@ -186,6 +190,12 @@ const props = defineProps({
186
190
  type: Boolean,
187
191
  default: false,
188
192
  },
193
+ // Generate writes a QR tag onto each selected card. Default true keeps
194
+ // every consumer that does not pass it unchanged.
195
+ canGenerate: {
196
+ type: Boolean,
197
+ default: true,
198
+ },
189
199
  });
190
200
 
191
201
  const tableHeaders = [
@@ -117,12 +117,12 @@
117
117
  <v-dialog v-model="confirmDialog" :loading="deleteLoading" width="450" persistent>
118
118
  <v-card width="100%">
119
119
  <v-toolbar density="compact" class="pl-4">
120
- <span class="font-weight-medium text-h5">Delete Building</span>
120
+ <span class="font-weight-medium text-h5">Delete Block</span>
121
121
  </v-toolbar>
122
122
 
123
123
  <v-card-text>
124
124
  <p class="text-subtitle-2 text-center">
125
- Are you sure you want to delete this building? This action cannot be
125
+ Are you sure you want to delete this block? This action cannot be
126
126
  undone.
127
127
  </p>
128
128
 
@@ -288,14 +288,14 @@ function tableRowClickHandler(_: any, data: any) {
288
288
  function successCreate() {
289
289
  createDialog.value = false;
290
290
  getBuildings();
291
- showMessage("Building created successfully!", "success");
291
+ showMessage("Block created successfully!", "success");
292
292
  }
293
293
 
294
294
  function successUpdate() {
295
295
  editDialog.value = false;
296
296
  previewDialog.value = false;
297
297
  getBuildings();
298
- showMessage("Building updated successfully!", "success");
298
+ showMessage("Block updated successfully!", "success");
299
299
  }
300
300
 
301
301
  function openEditDialog() {
@@ -327,7 +327,7 @@ async function handleDeleteBuilding() {
327
327
  previewDialog.value = false
328
328
  } catch (error: any) {
329
329
  message.value =
330
- error?.response?._data?.message || "Failed to delete region";
330
+ error?.response?._data?.message || "Failed to delete block";
331
331
  } finally {
332
332
  deleteLoading.value = false;
333
333
  }
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <!-- Seven365 Super Admin only: everyone else never sees Manpower set-up. -->
3
+ <v-expansion-panel v-if="isStaff" data-test="manpower-site-switch">
4
+ <v-expansion-panel-title>
5
+ <v-icon class="mr-2">mdi-chart-bar</v-icon>
6
+ Manpower
7
+ </v-expansion-panel-title>
8
+ <v-expansion-panel-text>
9
+ <v-switch v-model="enabled" label="Show Manpower at this site" color="primary" hide-details
10
+ data-test="manpower-site-switch-toggle" />
11
+ <p class="text-caption text-medium-emphasis mt-1 mb-3">
12
+ Manpower (HRMLabs staff attendance) is for security agencies only. When on, the agency's managers see
13
+ Manpower in the menu and the guard app at this site. Only Seven365 can switch this on or off.
14
+ Now: <strong>{{ savedOn ? "On" : "Off" }}</strong>{{ saved ? "" : " (not set - default)" }}.
15
+ </p>
16
+ <v-btn class="screen-btn-primary" color="primary-button" variant="flat" text="Save"
17
+ :loading="saving" :disabled="!loaded" data-test="manpower-site-switch-save" @click="save" />
18
+ <Snackbar v-model="toast.show" :text="toast.message" :color="toast.color" />
19
+ </v-expansion-panel-text>
20
+ </v-expansion-panel>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import useSiteFeatureSettings from "../composables/useSiteFeatureSettings";
25
+ import useConsoleTier from "../composables/useConsoleTier";
26
+
27
+ /**
28
+ * Site setting `metadata.manpower` (core site-feature-settings, owner
29
+ * 2026-10-21). Not set = as before: on only at the one site Manpower was
30
+ * pinned to (core `MANPOWER_LEGACY_SITE_ID`), off everywhere else. The server
31
+ * refuses a change by anyone but the Seven365 Super Admin (403) and enforces
32
+ * the switch on every Manpower route; this only draws the switch.
33
+ */
34
+ const LEGACY_SITE_ID = "6a4496f47521150c58977c68";
35
+
36
+ const props = defineProps({
37
+ siteId: { type: String, required: true },
38
+ saved: { type: Object as PropType<{ enabled?: boolean } | null>, default: null },
39
+ /** The site has been read; Save stays off until then. */
40
+ loaded: { type: Boolean, default: false },
41
+ });
42
+ const emit = defineEmits(["saved"]);
43
+
44
+ const { isStaff, load: loadTier } = useConsoleTier();
45
+ onMounted(() => loadTier());
46
+
47
+ const savedOn = computed(() =>
48
+ typeof props.saved?.enabled === "boolean" ? props.saved.enabled : props.siteId === LEGACY_SITE_ID,
49
+ );
50
+ const enabled = ref(false);
51
+ watch(savedOn, (v) => (enabled.value = v), { immediate: true });
52
+
53
+ const { saveSiteFeature } = useSiteFeatureSettings();
54
+ const saving = ref(false);
55
+ const toast = reactive({ show: false, message: "", color: "" });
56
+
57
+ async function save() {
58
+ if (!props.loaded || !isStaff.value) return;
59
+ saving.value = true;
60
+ try {
61
+ await saveSiteFeature(props.siteId, "manpower", { enabled: enabled.value });
62
+ Object.assign(toast, { show: true, message: "Saved.", color: "success" });
63
+ emit("saved");
64
+ } catch (e: any) {
65
+ Object.assign(toast, { show: true, message: e?.data?.message || "Could not save.", color: "error" });
66
+ } finally {
67
+ saving.value = false;
68
+ }
69
+ }
70
+ </script>
@@ -267,6 +267,9 @@
267
267
  </v-expansion-panel-text>
268
268
  </v-expansion-panel>
269
269
 
270
+ <ManpowerSiteSwitch v-if="showManpowerSwitch" :site-id="siteId"
271
+ :saved="(siteData as any)?.metadata?.manpower" :loaded="!!siteData" @saved="refreshSiteData" />
272
+
270
273
  <slot
271
274
  name="panels"
272
275
  :can-manage="canManageSiteSettings"
@@ -296,6 +299,8 @@ const props = defineProps({
296
299
  showResidentVisitors: { type: Boolean, default: false },
297
300
  /** Visitor registration, Passes & keys and Incident report emails: PM and Security only. */
298
301
  showSiteSwitches: { type: Boolean, default: false },
302
+ /** Manpower per-site switch (Seven365 Super Admin only): the Security host only. */
303
+ showManpowerSwitch: { type: Boolean, default: false },
299
304
  });
300
305
 
301
306
  const openPanels = ref([]); // default open first
@@ -17,6 +17,7 @@ export const SITE_FEATURE_KEYS = [
17
17
  "maStaffRegistration",
18
18
  "visitorPassSms",
19
19
  "robotSharedSpace",
20
+ "manpower",
20
21
  ] as const;
21
22
 
22
23
  export type TSiteFeatureKey = (typeof SITE_FEATURE_KEYS)[number];
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.139.0",
5
+ "version": "4.141.0",
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.",