@7365admin1/layer-common 4.97.1-staging.528 → 4.97.1-staging.529
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/components/EntryPassMain.vue +78 -0
- package/package.json +1 -1
- package/utils/entrypass-apps.ts +76 -0
|
@@ -392,6 +392,60 @@
|
|
|
392
392
|
</v-row>
|
|
393
393
|
</v-window-item>
|
|
394
394
|
|
|
395
|
+
<!-- ─── Tab 6: Apps ───────────────────────────────────── -->
|
|
396
|
+
<!--
|
|
397
|
+
Which apps offer the entry pass at this site. `accessDoor` above says
|
|
398
|
+
whether the site offers QR and Bluetooth at all; these say which apps
|
|
399
|
+
may show them, so the two compose - turning QR off up there hides it
|
|
400
|
+
everywhere regardless of what is switched on here.
|
|
401
|
+
-->
|
|
402
|
+
<v-window-item value="apps">
|
|
403
|
+
<v-row no-gutters class="px-6 pt-4">
|
|
404
|
+
<v-col cols="12">
|
|
405
|
+
<div class="mt-3 pb-5">
|
|
406
|
+
<p class="font-weight-medium mb-1">Entry Pass Apps</p>
|
|
407
|
+
<p class="text-caption text-medium-emphasis mb-4">
|
|
408
|
+
Turn an app off to hide Entry Pass QR Code and Entry Pass
|
|
409
|
+
Bluetooth from it. Everything else in that app is unaffected.
|
|
410
|
+
</p>
|
|
411
|
+
|
|
412
|
+
<template v-for="group in entrypassAppGroups" :key="group.name">
|
|
413
|
+
<p class="text-caption text-uppercase text-medium-emphasis mt-4 mb-1">
|
|
414
|
+
{{ group.name }}
|
|
415
|
+
</p>
|
|
416
|
+
<div
|
|
417
|
+
v-for="app in group.apps"
|
|
418
|
+
:key="app.value"
|
|
419
|
+
class="d-flex align-center py-3 pr-5 entrypass-app-row"
|
|
420
|
+
>
|
|
421
|
+
<span class="flex-grow-1 font-weight-medium">{{ app.label }}</span>
|
|
422
|
+
<v-switch
|
|
423
|
+
:data-testid="`entrypass-app-${app.value}`"
|
|
424
|
+
color="success"
|
|
425
|
+
hide-details
|
|
426
|
+
v-model="currentEntryPassSettings.accessApps[app.value]"
|
|
427
|
+
/>
|
|
428
|
+
</div>
|
|
429
|
+
</template>
|
|
430
|
+
|
|
431
|
+
<v-row class="mt-4">
|
|
432
|
+
<v-col cols="12" md="3">
|
|
433
|
+
<v-btn
|
|
434
|
+
color="primary"
|
|
435
|
+
variant="flat"
|
|
436
|
+
prepend-icon="mdi-content-save"
|
|
437
|
+
block
|
|
438
|
+
@click="saveAccessAppsSettings()"
|
|
439
|
+
>
|
|
440
|
+
Save
|
|
441
|
+
</v-btn>
|
|
442
|
+
</v-col>
|
|
443
|
+
</v-row>
|
|
444
|
+
</div>
|
|
445
|
+
</v-col>
|
|
446
|
+
</v-row>
|
|
447
|
+
</v-window-item>
|
|
448
|
+
|
|
395
449
|
<!-- ─── Tab 5: Self-Service ───────────────────────────── -->
|
|
396
450
|
<v-window-item value="onboarding">
|
|
397
451
|
<v-row no-gutters class="px-6 pt-4">
|
|
@@ -615,6 +669,7 @@ const entryPassTabs = [
|
|
|
615
669
|
{ value: "printer", label: "Printer", icon: "mdi-printer" },
|
|
616
670
|
{ value: "entrypass", label: "Entrypass", icon: "mdi-link-variant" },
|
|
617
671
|
{ value: "onboarding", label: "Self-Service", icon: "mdi-account-multiple-check-outline" },
|
|
672
|
+
{ value: "apps", label: "Apps", icon: "mdi-cellphone-cog" },
|
|
618
673
|
];
|
|
619
674
|
|
|
620
675
|
const currentEntryPassSettings = ref<Record<string, any>>({
|
|
@@ -631,6 +686,8 @@ const currentEntryPassSettings = ref<Record<string, any>>({
|
|
|
631
686
|
keyPass: false,
|
|
632
687
|
accessDoorQrCode: false,
|
|
633
688
|
accessDoorBluetooth: false,
|
|
689
|
+
// Every app explicit, so a save can never switch one off by omitting it.
|
|
690
|
+
accessApps: entrypassAppsPayload(null),
|
|
634
691
|
printerVendorId: "",
|
|
635
692
|
printerProductId: "",
|
|
636
693
|
qrCodeTemplateHeader: "",
|
|
@@ -819,6 +876,9 @@ watchEffect(() => {
|
|
|
819
876
|
keyPass: data.settings?.keyPass ?? false,
|
|
820
877
|
accessDoorQrCode: data.settings?.accessDoor?.qrCode ?? false,
|
|
821
878
|
accessDoorBluetooth: data.settings?.accessDoor?.bluetooth ?? false,
|
|
879
|
+
// Absent means on, so a site that has never opened this tab shows every
|
|
880
|
+
// app enabled rather than every app off.
|
|
881
|
+
accessApps: entrypassAppsPayload(data.settings?.accessApps),
|
|
822
882
|
printerVendorId: data.settings?.printer?.vendorId ? String(data.settings.printer.vendorId) : "",
|
|
823
883
|
printerProductId: data.settings?.printer?.productId ? String(data.settings.printer.productId) : "",
|
|
824
884
|
qrCodeTemplateHeader: data.settings?.qrTemplate?.header ?? "",
|
|
@@ -863,6 +923,7 @@ function buildPayload() {
|
|
|
863
923
|
qrCode: currentEntryPassSettings.value.accessDoorQrCode,
|
|
864
924
|
bluetooth: currentEntryPassSettings.value.accessDoorBluetooth,
|
|
865
925
|
},
|
|
926
|
+
accessApps: entrypassAppsPayload(currentEntryPassSettings.value.accessApps),
|
|
866
927
|
printer: {
|
|
867
928
|
vendorId: Number(currentEntryPassSettings.value.printerVendorId) || null,
|
|
868
929
|
productId: Number(currentEntryPassSettings.value.printerProductId) || null,
|
|
@@ -913,6 +974,23 @@ async function saveAccessDoorSettings() {
|
|
|
913
974
|
getSiteEntryPassSettings();
|
|
914
975
|
}
|
|
915
976
|
|
|
977
|
+
/** The switches, in the two groups the tab shows them under. */
|
|
978
|
+
const entrypassAppGroups = computed(() => {
|
|
979
|
+
const groups: { name: string; apps: typeof ENTRYPASS_APPS[number][] }[] = [];
|
|
980
|
+
for (const app of ENTRYPASS_APPS) {
|
|
981
|
+
const existing = groups.find((g) => g.name === app.group);
|
|
982
|
+
if (existing) existing.apps.push(app);
|
|
983
|
+
else groups.push({ name: app.group, apps: [app] });
|
|
984
|
+
}
|
|
985
|
+
return groups;
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
async function saveAccessAppsSettings() {
|
|
989
|
+
await _save(buildPayload());
|
|
990
|
+
showMessage("App settings saved successfully!", "success");
|
|
991
|
+
getSiteEntryPassSettings();
|
|
992
|
+
}
|
|
993
|
+
|
|
916
994
|
async function savePrinterSettings() {
|
|
917
995
|
await _save(buildPayload());
|
|
918
996
|
showMessage("Printer settings saved successfully!", "success");
|
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.
|
|
5
|
+
"version": "4.97.1-staging.529",
|
|
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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHICH APPS OFFER THE ENTRY PASS, PER SITE.
|
|
3
|
+
*
|
|
4
|
+
* `settings.accessDoor.{qrCode,bluetooth}` already says whether a site offers
|
|
5
|
+
* QR or Bluetooth at all, but it says it for every app at once. A site that
|
|
6
|
+
* wants its M&E crew on the entry pass and its landscapers not had no way to
|
|
7
|
+
* say so — the two methods were all-or-nothing across the estate.
|
|
8
|
+
*
|
|
9
|
+
* `settings.accessApps` is that second axis: one switch per app, read by the
|
|
10
|
+
* app itself to decide whether to offer Entry Pass QR Code and Entry Pass
|
|
11
|
+
* Bluetooth at all. The two compose — a method still has to be on for the site
|
|
12
|
+
* before any app can show it.
|
|
13
|
+
*
|
|
14
|
+
* ## Keyed by SERVICE CODE, not app name
|
|
15
|
+
*
|
|
16
|
+
* `cleaning_services`, not `hygiene`. The codes are what `/api/service-providers`
|
|
17
|
+
* and `members` already speak, so a site's providers line up with the switches
|
|
18
|
+
* without a translation table in between. The label is where "Hygiene" lives,
|
|
19
|
+
* because that is what the app is called — `serviceTypeLabel` deliberately says
|
|
20
|
+
* "Cleaning" for the same code elsewhere, and both names are correct in their
|
|
21
|
+
* own screen.
|
|
22
|
+
*
|
|
23
|
+
* `ma` is the odd one out: the MA app is the management app, not a service
|
|
24
|
+
* provider, so it has no service code of its own.
|
|
25
|
+
*
|
|
26
|
+
* ## MISSING MEANS ON
|
|
27
|
+
*
|
|
28
|
+
* No site has this field, so a closed default would switch the entry pass off
|
|
29
|
+
* for every app in every estate the moment it shipped. Absent, `null`, a
|
|
30
|
+
* non-object, an unknown key and every value that is not exactly `false` mean
|
|
31
|
+
* the app offers it — the same rule `accessDoor` and the resident app's module
|
|
32
|
+
* switches already follow. Only a switch somebody deliberately turned off
|
|
33
|
+
* hides anything.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/** The app each switch governs. `value` is stored; `label` is only shown. */
|
|
37
|
+
export const ENTRYPASS_APPS: readonly {
|
|
38
|
+
value: string;
|
|
39
|
+
label: string;
|
|
40
|
+
group: "Management" | "Service Providers";
|
|
41
|
+
}[] = Object.freeze([
|
|
42
|
+
{ value: "ma", label: "MA App", group: "Management" },
|
|
43
|
+
{ value: "mechanical_electrical_services", label: "M&E", group: "Service Providers" },
|
|
44
|
+
{ value: "cleaning_services", label: "Hygiene", group: "Service Providers" },
|
|
45
|
+
{ value: "pool_maintenance_services", label: "Pool Maintenance", group: "Service Providers" },
|
|
46
|
+
{ value: "pest_control_services", label: "Pest Control", group: "Service Providers" },
|
|
47
|
+
{ value: "landscaping_services", label: "Landscape", group: "Service Providers" },
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
export type EntrypassApps = Partial<Record<string, boolean>>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Does this app offer the entry pass at this site?
|
|
54
|
+
*
|
|
55
|
+
* Fails open on every uncertainty, so a site that has never been configured —
|
|
56
|
+
* which is all of them until somebody opens the tab — behaves exactly as it
|
|
57
|
+
* does today.
|
|
58
|
+
*/
|
|
59
|
+
export function isEntrypassAppEnabled(
|
|
60
|
+
accessApps: EntrypassApps | null | undefined,
|
|
61
|
+
app: string,
|
|
62
|
+
): boolean {
|
|
63
|
+
if (!accessApps || typeof accessApps !== "object" || Array.isArray(accessApps)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return (accessApps as Record<string, unknown>)[app] !== false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Every switch written out explicitly, so a save can never turn one off by omission. */
|
|
70
|
+
export function entrypassAppsPayload(
|
|
71
|
+
current: EntrypassApps | null | undefined,
|
|
72
|
+
): Record<string, boolean> {
|
|
73
|
+
return Object.fromEntries(
|
|
74
|
+
ENTRYPASS_APPS.map(({ value }) => [value, isEntrypassAppEnabled(current, value)]),
|
|
75
|
+
);
|
|
76
|
+
}
|