@7365admin1/layer-common 4.84.0 → 4.84.1-staging.482
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 +4 -4
- package/assets/css/primitives.css +107 -0
- package/assets/css/screens.css +8 -4
- package/components/AccessCardDetailsDialog.vue +57 -4
- package/components/AccessCardPreviewDialog.vue +291 -50
- package/components/AppSelect.vue +143 -4
- package/components/AttendanceDetailsDialog.vue +48 -1
- package/components/AttendanceMain.vue +104 -10
- package/components/AttendanceProxyDialog.vue +391 -0
- package/components/AttendanceSettingsDialog.vue +53 -1
- package/components/BuildingUnitFormEdit.vue +6 -0
- package/components/BuildingUnitManagement.vue +298 -0
- package/components/BulletinBoardView.vue +1 -1
- package/components/DashboardEmptyState.vue +8 -0
- package/components/DashboardMain.vue +14 -0
- package/components/DashboardPanel.vue +10 -0
- package/components/Dialog/UpdateMoreAction.vue +11 -1
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +74 -17
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +183 -14
- package/components/HidProfileQrCode.vue +332 -0
- package/components/HidQrCodeConfiguration.vue +17 -195
- package/components/HidReaderManagement.vue +398 -0
- package/components/HidReaderUserRoster.vue +44 -3
- package/components/HidUserEnrollment.vue +2239 -276
- package/components/InventoryMain.vue +11 -2
- package/components/InvitationClientForm.vue +19 -1
- package/components/MemberServiceProviders.vue +43 -45
- package/components/MyAttendanceMain.vue +60 -2
- package/components/NotificationBell.vue +14 -2
- package/components/TableMain.vue +22 -7
- package/components/VisitorForm.vue +12 -0
- package/components/VisitorManagement.vue +279 -7
- package/composables/useAttendance.ts +53 -0
- package/composables/useAttendancePermission.ts +25 -0
- package/composables/useCleaningPermission.ts +5 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +165 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useHidReaderSelection.ts +50 -0
- package/composables/useLandscapingPermission.ts +5 -0
- package/composables/useMember.ts +12 -0
- package/composables/useNFCPatrolReportFilters.ts +21 -3
- package/composables/useNFCPatrolRoute.ts +8 -1
- package/composables/usePeople.ts +19 -0
- package/composables/usePestControlPermission.ts +5 -0
- package/composables/usePoolMaintenancePermission.ts +5 -0
- package/composables/useSecurityPermission.ts +5 -0
- package/composables/useServiceProvider.ts +45 -2
- package/composables/useSiteActions.ts +29 -0
- package/composables/useSiteCategory.ts +45 -0
- package/constants/permissions.ts +1 -0
- package/nuxt.config.ts +18 -0
- package/package.json +4 -2
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/plugins/vuetify.ts +6 -0
- package/server/plugins/no-powered-by.ts +7 -0
- package/types/attendance.d.ts +13 -1
- package/types/document.d.ts +14 -0
- package/types/facility.d.ts +4 -0
- package/types/member.d.ts +4 -0
- package/types/people.d.ts +28 -1
- package/types/service-provider.d.ts +5 -0
- package/types/site.d.ts +7 -1
- package/utils/attendance-proxy.ts +110 -0
- package/utils/hid-enrolment-subject.ts +344 -0
- package/utils/hid-permission-assignments.ts +198 -0
- package/utils/hid-reader-selection.ts +52 -0
- package/utils/notification-target.ts +43 -4
- package/utils/occupancy-role.ts +109 -0
- package/utils/sanitize-html.ts +16 -0
- package/utils/security-headers.ts +52 -0
- package/utils/service-type.ts +30 -0
- package/utils/site-actions.ts +18 -0
- package/utils/site-provider-members.ts +37 -0
|
@@ -77,10 +77,11 @@
|
|
|
77
77
|
</v-tab>
|
|
78
78
|
</v-tabs>
|
|
79
79
|
|
|
80
|
+
<!-- Wraps on narrow screens (was a fixed 60px row: on a phone the
|
|
81
|
+
"Not Checked Out" label stacked one letter per line). -->
|
|
80
82
|
<v-card
|
|
81
|
-
class="w-100 px-3 d-flex align-center ga-
|
|
83
|
+
class="w-100 px-3 d-flex flex-wrap align-center ga-3 py-2 visitor-filters"
|
|
82
84
|
flat
|
|
83
|
-
:height="60"
|
|
84
85
|
>
|
|
85
86
|
<v-text-field
|
|
86
87
|
v-model="searchInput"
|
|
@@ -749,11 +750,35 @@
|
|
|
749
750
|
class="visitor-preview__row"
|
|
750
751
|
>
|
|
751
752
|
<div class="visitor-preview__label">{{ label }}</div>
|
|
752
|
-
<div
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
<div>
|
|
754
|
+
<!-- Was a hover tooltip on the value: the full NRIC only
|
|
755
|
+
reachable by hovering, which says nothing is there to
|
|
756
|
+
reach and cannot be reached at all on a touch screen.
|
|
757
|
+
The eye alone, at the 14px the Incident Report screens
|
|
758
|
+
draw it, is a 14px target - the floor is 24px. So the
|
|
759
|
+
NUMBER is the control and the eye is its affordance:
|
|
760
|
+
the whole masked value is pressable, which makes the
|
|
761
|
+
target the width of the digits rather than of a glyph,
|
|
762
|
+
and being a real `button` it also takes a tab stop,
|
|
763
|
+
which a `v-icon` with a click handler never did. -->
|
|
764
|
+
<button
|
|
765
|
+
type="button"
|
|
766
|
+
class="visitor-preview__reveal"
|
|
767
|
+
:aria-label="showVisitorNric ? 'Hide NRIC' : 'Show NRIC'"
|
|
768
|
+
:aria-pressed="showVisitorNric"
|
|
769
|
+
@click="showVisitorNric = !showVisitorNric"
|
|
770
|
+
>
|
|
771
|
+
<span class="visitor-preview__value">
|
|
772
|
+
{{
|
|
773
|
+
showVisitorNric
|
|
774
|
+
? selectedVisitorObject[key]
|
|
775
|
+
: maskNRIC(selectedVisitorObject[key])
|
|
776
|
+
}}
|
|
777
|
+
</span>
|
|
778
|
+
<v-icon size="16" class="visitor-preview__eye">
|
|
779
|
+
{{ showVisitorNric ? "mdi-eye-off-outline" : "mdi-eye-outline" }}
|
|
780
|
+
</v-icon>
|
|
781
|
+
</button>
|
|
757
782
|
</div>
|
|
758
783
|
</div>
|
|
759
784
|
|
|
@@ -803,6 +828,84 @@
|
|
|
803
828
|
</div>
|
|
804
829
|
</div>
|
|
805
830
|
|
|
831
|
+
<!--
|
|
832
|
+
THE CONTRACTOR'S PARTY.
|
|
833
|
+
|
|
834
|
+
The list row has always said `( +2 members)` beside the name
|
|
835
|
+
and then had nowhere to send you for the names themselves. The
|
|
836
|
+
block spans both columns rather than sitting in the 116px
|
|
837
|
+
value track: a member is a record, not a value, and several of
|
|
838
|
+
them in a 250px column is unreadable.
|
|
839
|
+
|
|
840
|
+
Read off `selectedVisitorDataObject` (the raw row) and not
|
|
841
|
+
`selectedVisitorObject`, which filters itself down to
|
|
842
|
+
`typeFieldMap` plus five fixed keys - `members` is on neither
|
|
843
|
+
list, and widening that computed would change what four other
|
|
844
|
+
dialogs on this screen see.
|
|
845
|
+
-->
|
|
846
|
+
<div
|
|
847
|
+
v-else-if="key === 'members' && selectedVisitorMembers.length"
|
|
848
|
+
class="visitor-preview__row visitor-preview__row--block"
|
|
849
|
+
>
|
|
850
|
+
<div class="visitor-preview__label">
|
|
851
|
+
{{ label }} ({{ selectedVisitorMembers.length }})
|
|
852
|
+
</div>
|
|
853
|
+
<div class="visitor-preview__members">
|
|
854
|
+
<div
|
|
855
|
+
v-for="(member, index) in selectedVisitorMembers"
|
|
856
|
+
:key="member?.nric || member?.name || index"
|
|
857
|
+
class="visitor-preview__member"
|
|
858
|
+
>
|
|
859
|
+
<div class="visitor-preview__value">
|
|
860
|
+
{{ member?.name || "N/A" }}
|
|
861
|
+
</div>
|
|
862
|
+
<template v-for="field in memberDetailFields" :key="field.key">
|
|
863
|
+
<div
|
|
864
|
+
v-if="member?.[field.key]"
|
|
865
|
+
class="visitor-preview__member-line"
|
|
866
|
+
>
|
|
867
|
+
<span class="visitor-preview__member-key">
|
|
868
|
+
{{ field.label }}
|
|
869
|
+
</span>
|
|
870
|
+
<!-- A member's NRIC is the same class of data as the
|
|
871
|
+
visitor's, so it gets the same control. Each
|
|
872
|
+
member reveals separately - one toggle for the
|
|
873
|
+
whole card would show three people's NRICs to
|
|
874
|
+
read one. -->
|
|
875
|
+
<button
|
|
876
|
+
v-if="field.key === 'nric'"
|
|
877
|
+
type="button"
|
|
878
|
+
class="visitor-preview__reveal"
|
|
879
|
+
:aria-label="
|
|
880
|
+
isMemberNricShown(index)
|
|
881
|
+
? `Hide NRIC for ${member?.name || 'this member'}`
|
|
882
|
+
: `Show NRIC for ${member?.name || 'this member'}`
|
|
883
|
+
"
|
|
884
|
+
:aria-pressed="isMemberNricShown(index)"
|
|
885
|
+
@click="toggleMemberNric(index)"
|
|
886
|
+
>
|
|
887
|
+
<span>
|
|
888
|
+
{{
|
|
889
|
+
isMemberNricShown(index)
|
|
890
|
+
? member.nric
|
|
891
|
+
: maskNRIC(member.nric)
|
|
892
|
+
}}
|
|
893
|
+
</span>
|
|
894
|
+
<v-icon size="16" class="visitor-preview__eye">
|
|
895
|
+
{{
|
|
896
|
+
isMemberNricShown(index)
|
|
897
|
+
? "mdi-eye-off-outline"
|
|
898
|
+
: "mdi-eye-outline"
|
|
899
|
+
}}
|
|
900
|
+
</v-icon>
|
|
901
|
+
</button>
|
|
902
|
+
<span v-else>{{ member[field.key] }}</span>
|
|
903
|
+
</div>
|
|
904
|
+
</template>
|
|
905
|
+
</div>
|
|
906
|
+
</div>
|
|
907
|
+
</div>
|
|
908
|
+
|
|
806
909
|
<!-- The vehicle number, with Block on its right: the Registered
|
|
807
910
|
tab only, for someone who may add vehicles. It opens the
|
|
808
911
|
Vehicle Mgmt Block Listed form with the category taken from
|
|
@@ -2123,6 +2226,71 @@ const isSelectedVisitorPendingApproval = computed(
|
|
|
2123
2226
|
() => selectedVisitorStatus.value === "pending"
|
|
2124
2227
|
);
|
|
2125
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* The members a contractor brought with them. Not gated on the Guests tab: the
|
|
2231
|
+
* list row's own `( +N members)` count is not either, and a contractor with a
|
|
2232
|
+
* party has one wherever the screen shows it.
|
|
2233
|
+
*
|
|
2234
|
+
* Blank entries are dropped rather than drawn as an empty card - the payload
|
|
2235
|
+
* carries `""` for every detail nobody filled in, so a member with no name and
|
|
2236
|
+
* no details would otherwise render as a bare inset box.
|
|
2237
|
+
*/
|
|
2238
|
+
const selectedVisitorMembers = computed<Record<string, any>[]>(() => {
|
|
2239
|
+
const members = selectedVisitorDataObject.value?.members;
|
|
2240
|
+
if (!Array.isArray(members)) return [];
|
|
2241
|
+
|
|
2242
|
+
return members.filter(
|
|
2243
|
+
(member: Record<string, any>) =>
|
|
2244
|
+
member?.name || member?.nric || member?.contact || member?.plateNumber
|
|
2245
|
+
);
|
|
2246
|
+
});
|
|
2247
|
+
|
|
2248
|
+
/**
|
|
2249
|
+
* WHICH NRICs ARE UNCOVERED RIGHT NOW.
|
|
2250
|
+
*
|
|
2251
|
+
* Per member and not per card, so revealing one person's number does not
|
|
2252
|
+
* uncover the rest of the party's. Both are cleared when the dialog closes -
|
|
2253
|
+
* a preview must not open on the next visitor with the last one's NRIC
|
|
2254
|
+
* already showing, and it is the same `selectedVisitorId` that would carry it
|
|
2255
|
+
* across if the same row were reopened.
|
|
2256
|
+
*/
|
|
2257
|
+
const showVisitorNric = ref(false);
|
|
2258
|
+
const shownMemberNrics = ref<number[]>([]);
|
|
2259
|
+
|
|
2260
|
+
function isMemberNricShown(index: number) {
|
|
2261
|
+
return shownMemberNrics.value.includes(index);
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
function toggleMemberNric(index: number) {
|
|
2265
|
+
shownMemberNrics.value = isMemberNricShown(index)
|
|
2266
|
+
? shownMemberNrics.value.filter((x) => x !== index)
|
|
2267
|
+
: [...shownMemberNrics.value, index];
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
watch(
|
|
2271
|
+
() => dialog.viewVisitor,
|
|
2272
|
+
(open) => {
|
|
2273
|
+
if (open) return;
|
|
2274
|
+
showVisitorNric.value = false;
|
|
2275
|
+
shownMemberNrics.value = [];
|
|
2276
|
+
}
|
|
2277
|
+
);
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* What a member row prints under the name, in order. `plateNumber` is in here
|
|
2281
|
+
* because the API returns it on `members[]` even though neither
|
|
2282
|
+
* `TMemberInfo` (this package) nor `TContractorMembers` (API-core's visitor
|
|
2283
|
+
* model, name and nric only) declares it - the two types have drifted from the
|
|
2284
|
+
* document and from each other. Reading the key defensively costs nothing and
|
|
2285
|
+
* shows the vehicle a member actually arrived in; the types are somebody's to
|
|
2286
|
+
* reconcile separately.
|
|
2287
|
+
*/
|
|
2288
|
+
const memberDetailFields = [
|
|
2289
|
+
{ key: "nric", label: "NRIC" },
|
|
2290
|
+
{ key: "contact", label: "Contact" },
|
|
2291
|
+
{ key: "plateNumber", label: "Vehicle" },
|
|
2292
|
+
] as const;
|
|
2293
|
+
|
|
2126
2294
|
const formatType = (item: any) =>
|
|
2127
2295
|
(item.deliveryType ? item.deliveryType + "-" : "") + item.type;
|
|
2128
2296
|
|
|
@@ -2136,6 +2304,7 @@ const formattedFields = {
|
|
|
2136
2304
|
level: "Level",
|
|
2137
2305
|
unit: "Unit",
|
|
2138
2306
|
purpose: "Purpose",
|
|
2307
|
+
members: "Members",
|
|
2139
2308
|
checkIn: "Check In",
|
|
2140
2309
|
snapshotEntryImage: "Entry Image",
|
|
2141
2310
|
checkOut: "Check Out",
|
|
@@ -3142,6 +3311,100 @@ watchEffect(async () => {
|
|
|
3142
3311
|
word-break: break-word;
|
|
3143
3312
|
}
|
|
3144
3313
|
|
|
3314
|
+
/* A row whose value is a set of records rather than a value - it drops the
|
|
3315
|
+
two-column grid and runs the full width of the card body. */
|
|
3316
|
+
.visitor-preview__row--block {
|
|
3317
|
+
display: block;
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
.visitor-preview__members {
|
|
3321
|
+
display: flex;
|
|
3322
|
+
flex-direction: column;
|
|
3323
|
+
gap: 8px;
|
|
3324
|
+
margin-top: 8px;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
/*
|
|
3328
|
+
* An added member reads as an inset on the card it sits in - `--hover` on
|
|
3329
|
+
* `--border` at the inner radius. Those are `Card/MemberInfoSummary`'s three
|
|
3330
|
+
* decisions, unchanged, so a member looks the same in the preview as it does
|
|
3331
|
+
* in the form that created it. Only the TYPE differs: that card still prints
|
|
3332
|
+
* `<strong>Label:</strong> value`, which is the pattern this dialog just moved
|
|
3333
|
+
* off, so the lines below are set on the scale rather than inherited.
|
|
3334
|
+
*/
|
|
3335
|
+
.visitor-preview__member {
|
|
3336
|
+
padding: 9px 12px;
|
|
3337
|
+
border: 1px solid var(--border);
|
|
3338
|
+
border-radius: var(--r-inner);
|
|
3339
|
+
background: var(--hover);
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
.visitor-preview__member-line {
|
|
3343
|
+
display: flex;
|
|
3344
|
+
gap: 8px;
|
|
3345
|
+
margin-top: 3px;
|
|
3346
|
+
font-size: var(--fs-breadcrumb);
|
|
3347
|
+
color: var(--text2);
|
|
3348
|
+
word-break: break-word;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
.visitor-preview__member-key {
|
|
3352
|
+
flex: 0 0 52px;
|
|
3353
|
+
color: var(--muted);
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
/*
|
|
3357
|
+
* THE NRIC REVEAL.
|
|
3358
|
+
*
|
|
3359
|
+
* The pressable thing is the masked number, not the glyph beside it: an eye on
|
|
3360
|
+
* its own is a 14-16px target where 24px is the floor, and on a 12.5px member
|
|
3361
|
+
* line an `AppButton variant="icon"` - the layer's 32px icon square - would
|
|
3362
|
+
* make the NRIC line half again the height of the Contact line under it.
|
|
3363
|
+
* Pressing the digits gives a target the width of the value at no cost to the
|
|
3364
|
+
* rhythm, and reads the right way round: the number is what changes.
|
|
3365
|
+
*
|
|
3366
|
+
* It inherits its type rather than setting any, so the visitor's NRIC stays on
|
|
3367
|
+
* `--fs-cell` and a member's on the `--fs-breadcrumb` of the line it sits in.
|
|
3368
|
+
* The negative margin pays back the padding, so a revealed value starts on the
|
|
3369
|
+
* same left edge as every other value in the card.
|
|
3370
|
+
*/
|
|
3371
|
+
.visitor-preview__reveal {
|
|
3372
|
+
display: inline-flex;
|
|
3373
|
+
align-items: center;
|
|
3374
|
+
gap: 6px;
|
|
3375
|
+
margin: -3px -7px;
|
|
3376
|
+
padding: 3px 7px;
|
|
3377
|
+
border: none;
|
|
3378
|
+
border-radius: var(--r-inner-sm);
|
|
3379
|
+
background: transparent;
|
|
3380
|
+
font: inherit;
|
|
3381
|
+
color: inherit;
|
|
3382
|
+
text-align: left;
|
|
3383
|
+
cursor: pointer;
|
|
3384
|
+
transition: background var(--motion) ease;
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
.visitor-preview__reveal:hover {
|
|
3388
|
+
background: var(--hover);
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
.visitor-preview__reveal:focus-visible {
|
|
3392
|
+
outline: 2px solid var(--accent);
|
|
3393
|
+
outline-offset: 1px;
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
/* The design's interactive ink - not Vuetify's fixed blue, which is one colour
|
|
3397
|
+
on both themes. `affectedEntities` gives its NRIC eye the same value. */
|
|
3398
|
+
.visitor-preview__eye {
|
|
3399
|
+
color: var(--accent-text);
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3403
|
+
.visitor-preview__reveal {
|
|
3404
|
+
transition: none;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3145
3408
|
/* The width the type filter carried as `max-width="200"` on the v-select. */
|
|
3146
3409
|
.visitor-type-filter {
|
|
3147
3410
|
max-width: 200px;
|
|
@@ -3159,4 +3422,13 @@ watchEffect(async () => {
|
|
|
3159
3422
|
opacity: 0.55;
|
|
3160
3423
|
cursor: not-allowed;
|
|
3161
3424
|
}
|
|
3425
|
+
|
|
3426
|
+
.visitor-filters > *:not(.v-checkbox) {
|
|
3427
|
+
flex: 1 1 160px;
|
|
3428
|
+
min-width: 150px;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
.visitor-filters > .v-checkbox {
|
|
3432
|
+
flex: 0 0 auto;
|
|
3433
|
+
}
|
|
3162
3434
|
</style>
|
|
@@ -81,7 +81,60 @@ export default function useAttendance() {
|
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
// ---- Site device mode (check in/out for someone on a shared site phone) ----
|
|
85
|
+
|
|
86
|
+
function setSiteDeviceMode(site: string, enabled: boolean, serviceType: string = "") {
|
|
87
|
+
return useNuxtApp().$api<{ message: string; siteDeviceMode: boolean }>(
|
|
88
|
+
`/api/attendance-settings/site/${site}/device-mode`,
|
|
89
|
+
{ method: "PUT", body: { serviceType, enabled } }
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The person's photo, stored PRIVATELY by the server (never a public URL). */
|
|
94
|
+
function uploadAttendancePhoto(site: string, file: File, serviceType: string = "") {
|
|
95
|
+
const form = new FormData();
|
|
96
|
+
form.append("file", file);
|
|
97
|
+
return useNuxtApp().$api<{ id: string }>(`/api/attendances/site/${site}/photo`, {
|
|
98
|
+
method: "POST",
|
|
99
|
+
query: { serviceType },
|
|
100
|
+
body: form,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function proxyCheckOut(site: string, body: Record<string, any>, serviceType: string = "") {
|
|
105
|
+
return useNuxtApp().$api<{ message: string; id: string }>(
|
|
106
|
+
`/api/attendances/site/${site}/proxy-check-out`,
|
|
107
|
+
{ method: "POST", body: { ...body, serviceType } }
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getOpenProxyCheckIns(site: string, serviceType: string = "") {
|
|
112
|
+
return useNuxtApp().$api<{ items: Array<Record<string, any>> }>(
|
|
113
|
+
`/api/attendances/site/${site}/proxy-open`,
|
|
114
|
+
{ method: "GET", query: { serviceType } }
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Path of the private photo; read through $api (session), never a public link. */
|
|
119
|
+
function attendancePhotoPath(id: string, which: "checkIn" | "checkOut") {
|
|
120
|
+
return `/api/attendances/id/${id}/photo/${which}`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function getAttendancePhotoUrl(id: string, which: "checkIn" | "checkOut") {
|
|
124
|
+
const blob = await useNuxtApp().$api<Blob>(attendancePhotoPath(id, which), {
|
|
125
|
+
method: "GET",
|
|
126
|
+
responseType: "blob",
|
|
127
|
+
});
|
|
128
|
+
return URL.createObjectURL(blob);
|
|
129
|
+
}
|
|
130
|
+
|
|
84
131
|
return {
|
|
132
|
+
setSiteDeviceMode,
|
|
133
|
+
uploadAttendancePhoto,
|
|
134
|
+
proxyCheckOut,
|
|
135
|
+
getOpenProxyCheckIns,
|
|
136
|
+
attendancePhotoPath,
|
|
137
|
+
getAttendancePhotoUrl,
|
|
85
138
|
getAttendances,
|
|
86
139
|
getMyAttendances,
|
|
87
140
|
getMyAttendanceById,
|
|
@@ -57,6 +57,30 @@ export function useAttendancePermission() {
|
|
|
57
57
|
);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
// Site device mode switch. Widened, never swapped: the new key OR the existing
|
|
61
|
+
// settings key OR `*` - the same three the server accepts (core
|
|
62
|
+
// `SITE_DEVICE_MODE_PERMISSIONS`), so an admin who manages attendance
|
|
63
|
+
// settings today can use it without a role change.
|
|
64
|
+
const canManageSiteDeviceMode = computed(() => {
|
|
65
|
+
if (!userAppRole.value) return false;
|
|
66
|
+
if (moduleDenied("attendance-mgmt")) return false;
|
|
67
|
+
if (userAppRole.value.permissions.includes("*")) return true;
|
|
68
|
+
return (
|
|
69
|
+
hasPermission(
|
|
70
|
+
userAppRole.value,
|
|
71
|
+
permissions,
|
|
72
|
+
"attendance-mgmt",
|
|
73
|
+
"manage-site-device-mode"
|
|
74
|
+
) ||
|
|
75
|
+
hasPermission(
|
|
76
|
+
userAppRole.value,
|
|
77
|
+
permissions,
|
|
78
|
+
"attendance-mgmt",
|
|
79
|
+
"manage-attendance-settings"
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
|
|
60
84
|
const canViewOwnAttendance = computed(() => {
|
|
61
85
|
if (!userAppRole.value) return false;
|
|
62
86
|
if (moduleDenied("my-attendance")) return false;
|
|
@@ -85,6 +109,7 @@ export function useAttendancePermission() {
|
|
|
85
109
|
canViewAllAttendance,
|
|
86
110
|
canViewAttendanceDetails,
|
|
87
111
|
canManageAttendanceSettings,
|
|
112
|
+
canManageSiteDeviceMode,
|
|
88
113
|
canViewOwnAttendance,
|
|
89
114
|
canCheckInOut,
|
|
90
115
|
};
|
|
@@ -221,6 +221,11 @@ export default function useCleaningPermission() {
|
|
|
221
221
|
description:
|
|
222
222
|
"Allows the user to configure and manage attendance settings.",
|
|
223
223
|
},
|
|
224
|
+
"manage-site-device-mode": {
|
|
225
|
+
check: true,
|
|
226
|
+
description:
|
|
227
|
+
"Allows the user to turn Site device mode on or off: one shared phone at the site checks staff in and out with a photo, their name and the last 4 characters of their NRIC.",
|
|
228
|
+
},
|
|
224
229
|
},
|
|
225
230
|
// my attendance permissions
|
|
226
231
|
"my-attendance": {
|
|
@@ -6,6 +6,7 @@ export default function useDocument() {
|
|
|
6
6
|
type = "all",
|
|
7
7
|
site = "",
|
|
8
8
|
parentId = "",
|
|
9
|
+
expiry = "all",
|
|
9
10
|
}: {
|
|
10
11
|
page?: number;
|
|
11
12
|
search?: string;
|
|
@@ -13,6 +14,11 @@ export default function useDocument() {
|
|
|
13
14
|
type?: string;
|
|
14
15
|
site?: string;
|
|
15
16
|
parentId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Which tab is asking: "active" for Documents, "expired" for
|
|
19
|
+
* Document (Expired). Defaults to "all" so existing callers are unaffected.
|
|
20
|
+
*/
|
|
21
|
+
expiry?: string;
|
|
16
22
|
} = {}) {
|
|
17
23
|
const query: Record<string, any> = {
|
|
18
24
|
page,
|
|
@@ -21,6 +27,7 @@ export default function useDocument() {
|
|
|
21
27
|
type,
|
|
22
28
|
site,
|
|
23
29
|
parentId,
|
|
30
|
+
expiry,
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
|
|
@@ -76,6 +76,8 @@ export default function usetFacility() {
|
|
|
76
76
|
hourInterval?: number;
|
|
77
77
|
isBookingFeeEnabled: boolean;
|
|
78
78
|
isGuestEnabled: boolean;
|
|
79
|
+
isResidentChecklistEnabled: boolean;
|
|
80
|
+
isSecurityChecklistEnabled: boolean;
|
|
79
81
|
bookingAmount: number | null;
|
|
80
82
|
peakBookingFeeAmount?: number | null;
|
|
81
83
|
bookingFeeGuestAmount?: number | null;
|
|
@@ -173,6 +175,8 @@ export default function usetFacility() {
|
|
|
173
175
|
hourInterval = 1,
|
|
174
176
|
isBookingFeeEnabled = false,
|
|
175
177
|
isGuestEnabled = false,
|
|
178
|
+
isResidentChecklistEnabled = false,
|
|
179
|
+
isSecurityChecklistEnabled = false,
|
|
176
180
|
bookingAmount = 0,
|
|
177
181
|
peakBookingFeeAmount = 0,
|
|
178
182
|
bookingFeeGuestAmount = 0,
|
|
@@ -236,6 +240,13 @@ export default function usetFacility() {
|
|
|
236
240
|
this.hourInterval = hourInterval;
|
|
237
241
|
this.isBookingFeeEnabled = isBookingFeeEnabled;
|
|
238
242
|
this.isGuestEnabled = isGuestEnabled;
|
|
243
|
+
// Exactly one owner, always. `isResidentChecklistEnabled` is the flag
|
|
244
|
+
// the apps gate on, so it decides, and security is its complement —
|
|
245
|
+
// stored rather than computed so each app can read its own flag without
|
|
246
|
+
// knowing the rule. A facility predating both fields lands on security,
|
|
247
|
+
// which is how every one of them already behaved.
|
|
248
|
+
this.isResidentChecklistEnabled = isResidentChecklistEnabled === true;
|
|
249
|
+
this.isSecurityChecklistEnabled = !this.isResidentChecklistEnabled;
|
|
239
250
|
this.bookingAmount = bookingAmount;
|
|
240
251
|
this.peakBookingFeeAmount = peakBookingFeeAmount;
|
|
241
252
|
this.bookingFeeGuestAmount = bookingFeeGuestAmount;
|