@7365admin1/layer-common 4.2.20 → 4.2.21-staging.282
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/assets/css/screens.css +132 -0
- package/assets/css/shell.css +4 -0
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/InvitationClientForm.vue +34 -2
- package/components/NotificationSettings.vue +15 -26
- package/components/RolePermissionFormCreate.vue +2 -44
- package/components/RolePermissionFormPreviewUpdate.vue +13 -40
- package/components/RolePermissionMain.vue +51 -7
- package/components/VisitorManagement.vue +267 -5
- package/components/VisitorSocketPopUp.vue +84 -39
- package/composables/useFacility.ts +11 -0
- package/composables/useNotificationPreference.ts +6 -3
- package/composables/usePlateToastWindow.ts +56 -0
- package/composables/useRole.ts +55 -0
- package/composables/useVisitorSocket.ts +31 -0
- package/package.json +2 -2
- package/types/facility.d.ts +4 -0
package/assets/css/screens.css
CHANGED
|
@@ -896,6 +896,138 @@
|
|
|
896
896
|
text-transform: none;
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
+
/* ------------------------------------------------------------------ */
|
|
900
|
+
/* The ANPR plate toast (`components/VisitorSocketPopUp.vue`). */
|
|
901
|
+
/* */
|
|
902
|
+
/* The generic toast above is a coloured slab with a sentence on it, */
|
|
903
|
+
/* which is the wrong shape for this one: it carries a PAYLOAD - the */
|
|
904
|
+
/* plate the camera read - and the operator reads the number, not the */
|
|
905
|
+
/* sentence. So it is the design's own CARD instead: `--card` on a */
|
|
906
|
+
/* `--border` rule at `--r-card`, the menu shadow, and the plate set */
|
|
907
|
+
/* two steps above the label. */
|
|
908
|
+
/* */
|
|
909
|
+
/* No colour is written down here. The tint is `--info` over */
|
|
910
|
+
/* `--info-bg`, the same pair `.tone-info` paints a chip with, so the */
|
|
911
|
+
/* toast follows the theme instead of Vuetify's flat `color="info"` */
|
|
912
|
+
/* fill - which is what the owner was shown and what this replaces. */
|
|
913
|
+
/* ------------------------------------------------------------------ */
|
|
914
|
+
.anpr-toast .v-snackbar__wrapper {
|
|
915
|
+
background: var(--card);
|
|
916
|
+
color: var(--text);
|
|
917
|
+
border: 1px solid var(--border);
|
|
918
|
+
border-radius: var(--r-card);
|
|
919
|
+
box-shadow: var(--shadow-menu);
|
|
920
|
+
/* One width for every read, so the toast does not resize between plates.
|
|
921
|
+
Vuetify's own 344px minimum is left behind deliberately: a plate set at
|
|
922
|
+
21px needs the room, and a long read wraps inside this box. Vuetify's own
|
|
923
|
+
344px minimum is zeroed first, or a narrow phone gets a toast wider than
|
|
924
|
+
the screen. */
|
|
925
|
+
min-width: 0;
|
|
926
|
+
width: min(92vw, 400px);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.anpr-toast .v-snackbar__content {
|
|
930
|
+
width: 100%;
|
|
931
|
+
padding: 14px 14px 16px 16px;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.anpr-toast__row {
|
|
935
|
+
display: flex;
|
|
936
|
+
align-items: flex-start;
|
|
937
|
+
gap: 12px;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/* The leading glyph says WHAT was detected - a vehicle, not "information".
|
|
941
|
+
`mdi-car` resolves to `directions_car` through `utils/materialSymbols.ts`. */
|
|
942
|
+
.anpr-toast__icon {
|
|
943
|
+
flex: 0 0 auto;
|
|
944
|
+
display: inline-flex;
|
|
945
|
+
align-items: center;
|
|
946
|
+
justify-content: center;
|
|
947
|
+
width: 34px;
|
|
948
|
+
height: 34px;
|
|
949
|
+
border-radius: var(--r-pill);
|
|
950
|
+
background: var(--info-bg);
|
|
951
|
+
color: var(--info);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.anpr-toast__text {
|
|
955
|
+
flex: 1 1 auto;
|
|
956
|
+
/* Without this a long read stretches the flex item instead of wrapping. */
|
|
957
|
+
min-width: 0;
|
|
958
|
+
display: flex;
|
|
959
|
+
flex-direction: column;
|
|
960
|
+
gap: 2px;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/* The label is the SMALL half. `--fs-btn` is the size the generic toast
|
|
964
|
+
already uses, so nothing here is set smaller than the product's own toast
|
|
965
|
+
text - the plate is what got bigger. */
|
|
966
|
+
/* `--text2`, not `--muted`. `utils/theme.ts` measures `--muted` at 3.24:1 on a
|
|
967
|
+
card - below AA - and this is real text, not a graphical mark. */
|
|
968
|
+
.anpr-toast__label {
|
|
969
|
+
font-size: var(--fs-btn);
|
|
970
|
+
font-weight: var(--fw-btn);
|
|
971
|
+
line-height: 1.3;
|
|
972
|
+
color: var(--text2);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/* The payload. Tabular figures so `0`/`8` and `1`/`7` cannot be mistaken for
|
|
976
|
+
one another at a barrier, and `anywhere` so a malformed read wraps inside
|
|
977
|
+
the card rather than widening it. */
|
|
978
|
+
.anpr-toast__plate {
|
|
979
|
+
font-size: 21px;
|
|
980
|
+
font-weight: var(--fw-h1);
|
|
981
|
+
letter-spacing: 0.05em;
|
|
982
|
+
line-height: 1.25;
|
|
983
|
+
color: var(--text);
|
|
984
|
+
font-variant-numeric: tabular-nums;
|
|
985
|
+
overflow-wrap: anywhere;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/* 44px, the touch minimum - the bare 24px Vuetify cross this replaces was
|
|
989
|
+
under half that. Pulled out by its own padding so the glyph still sits on
|
|
990
|
+
the card's optical edge. */
|
|
991
|
+
.anpr-toast__close {
|
|
992
|
+
flex: 0 0 auto;
|
|
993
|
+
display: inline-flex;
|
|
994
|
+
align-items: center;
|
|
995
|
+
justify-content: center;
|
|
996
|
+
width: 44px;
|
|
997
|
+
height: 44px;
|
|
998
|
+
margin: -10px -10px 0 0;
|
|
999
|
+
padding: 0;
|
|
1000
|
+
border: 0;
|
|
1001
|
+
border-radius: var(--r-inner-sm);
|
|
1002
|
+
background: transparent;
|
|
1003
|
+
color: var(--muted);
|
|
1004
|
+
cursor: pointer;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.anpr-toast__close:hover {
|
|
1008
|
+
background: var(--hover);
|
|
1009
|
+
color: var(--text);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.anpr-toast__close:focus-visible {
|
|
1013
|
+
outline: 2px solid var(--accent);
|
|
1014
|
+
outline-offset: 2px;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/* Indented to the text column, so the button reads as belonging to the plate
|
|
1018
|
+
above it rather than to the card's edge. */
|
|
1019
|
+
.anpr-toast__actions {
|
|
1020
|
+
display: flex;
|
|
1021
|
+
margin: 12px 0 0 46px;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/* `AppButton`'s ghost is 40px everywhere else in the product; in a toast the
|
|
1025
|
+
operator is often on a tablet at a gate, so it is raised to the touch
|
|
1026
|
+
minimum here rather than changed for every screen. */
|
|
1027
|
+
.anpr-toast__actions .app-btn {
|
|
1028
|
+
min-height: 44px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
899
1031
|
/* ------------------------------------------------------------------ */
|
|
900
1032
|
/* The "Back" link that sits above a page title. */
|
|
901
1033
|
/* `SpecificAttr.vue` (17 caller files) and `Container/Standard.vue`. */
|
package/assets/css/shell.css
CHANGED
|
@@ -284,8 +284,12 @@
|
|
|
284
284
|
pointer-events: none;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/* `button` is on the list because the design's own controls - `AppButton` and
|
|
288
|
+
the plate toast's close - are plain `<button>` elements, not `v-btn`. Left
|
|
289
|
+
off, a redesigned toast draws a button that cannot be clicked. */
|
|
287
290
|
.v-snackbar .v-snackbar__wrapper .v-btn,
|
|
288
291
|
.v-snackbar .v-snackbar__wrapper a,
|
|
292
|
+
.v-snackbar .v-snackbar__wrapper button,
|
|
289
293
|
.v-snackbar .v-snackbar__wrapper [role="button"] {
|
|
290
294
|
pointer-events: auto;
|
|
291
295
|
}
|
|
@@ -482,6 +482,55 @@
|
|
|
482
482
|
</draggable>
|
|
483
483
|
</section>
|
|
484
484
|
|
|
485
|
+
<!-- RESIDENT CHECKLISTS -->
|
|
486
|
+
<v-col cols="12" class="mt-4 border-t">
|
|
487
|
+
<v-row align="center" no-gutters class="pt-5">
|
|
488
|
+
<v-col cols="9" class="d-flex align-center text-body-2">
|
|
489
|
+
<v-row no-gutters>
|
|
490
|
+
<v-col cols="12" class="header-style">
|
|
491
|
+
Resident Checklists
|
|
492
|
+
</v-col>
|
|
493
|
+
<v-col cols="12" class="text-body-2 text-medium-emphasis">
|
|
494
|
+
Allow residents to view and complete assigned checklists. Each
|
|
495
|
+
checklist requires a photo upload before submission.
|
|
496
|
+
</v-col>
|
|
497
|
+
</v-row>
|
|
498
|
+
</v-col>
|
|
499
|
+
<v-col cols="3" class="d-flex align-center justify-end">
|
|
500
|
+
<v-switch
|
|
501
|
+
v-model="facility.isResidentChecklistEnabled"
|
|
502
|
+
class="d-flex align-center"
|
|
503
|
+
color="accent"
|
|
504
|
+
hide-details
|
|
505
|
+
@update:model-value="onToggleResidentChecklist"
|
|
506
|
+
/>
|
|
507
|
+
</v-col>
|
|
508
|
+
</v-row>
|
|
509
|
+
|
|
510
|
+
<!-- SECURITY CHECKLISTS -->
|
|
511
|
+
<v-row align="center" no-gutters class="border-t pt-5 mt-5">
|
|
512
|
+
<v-col cols="9" class="d-flex align-center text-body-2">
|
|
513
|
+
<v-row no-gutters>
|
|
514
|
+
<v-col cols="12" class="header-style">
|
|
515
|
+
Security Checklists
|
|
516
|
+
</v-col>
|
|
517
|
+
<v-col cols="12" class="text-body-2 text-medium-emphasis">
|
|
518
|
+
Allow Security to view and complete assigned checklists
|
|
519
|
+
</v-col>
|
|
520
|
+
</v-row>
|
|
521
|
+
</v-col>
|
|
522
|
+
<v-col cols="3" class="d-flex align-center justify-end">
|
|
523
|
+
<v-switch
|
|
524
|
+
v-model="facility.isSecurityChecklistEnabled"
|
|
525
|
+
class="d-flex align-center"
|
|
526
|
+
color="accent"
|
|
527
|
+
hide-details
|
|
528
|
+
@update:model-value="onToggleSecurityChecklist"
|
|
529
|
+
/>
|
|
530
|
+
</v-col>
|
|
531
|
+
</v-row>
|
|
532
|
+
</v-col>
|
|
533
|
+
|
|
485
534
|
<v-col cols="12" class="mt-10">
|
|
486
535
|
<p class="header-style font-weight-bold mb-5 mt-md-0 ml-md-4">
|
|
487
536
|
Other Settings
|
|
@@ -1020,6 +1069,20 @@ watchEffect(() => {
|
|
|
1020
1069
|
}
|
|
1021
1070
|
});
|
|
1022
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* One checklist, one owner, and always one. A facility is completed either by
|
|
1074
|
+
* its residents or by Security, so the two switches are each other's inverse:
|
|
1075
|
+
* turning either off turns the other on. There is no state where a facility
|
|
1076
|
+
* has no checklist owner.
|
|
1077
|
+
*/
|
|
1078
|
+
function onToggleResidentChecklist(enabled: boolean | null) {
|
|
1079
|
+
facility.value.isSecurityChecklistEnabled = !enabled;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function onToggleSecurityChecklist(enabled: boolean | null) {
|
|
1083
|
+
facility.value.isResidentChecklistEnabled = !enabled;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1023
1086
|
function onToggleBookingUnitLimit(val: any) {
|
|
1024
1087
|
if (val) {
|
|
1025
1088
|
isBookingUnitLimitEnabled.value = true;
|
|
@@ -251,14 +251,46 @@ watch(
|
|
|
251
251
|
const roles = ref<any[]>([])
|
|
252
252
|
const { getRoles } = useRole()
|
|
253
253
|
|
|
254
|
+
/*
|
|
255
|
+
* `type` is the ROLE type, not the service the client subscribes to, and the
|
|
256
|
+
* only caller (`ClientMain.vue` "Invite Client") passes no `app` prop -- so
|
|
257
|
+
* this sent `type: ""` and the endpoint applied no type filter at all. The
|
|
258
|
+
* dropdown therefore listed every org-less role of every type, which includes
|
|
259
|
+
* the platform's OWN staff roles (`type: "admin"` -- the two rows the console's
|
|
260
|
+
* `/super-admin/role-permissions` screen edits). Offering a Seven365 console
|
|
261
|
+
* staff role on a CLIENT invitation is the defect.
|
|
262
|
+
*
|
|
263
|
+
* A client admin's role is `type: "organization"`, which is what the client
|
|
264
|
+
* roles screen (`org/[organization]/roles-permissions.vue`) already lists. This
|
|
265
|
+
* narrows to exactly that. It is a narrowing of this one picker only: no role
|
|
266
|
+
* changes, no permission changes, and the org-less `organization` roles that
|
|
267
|
+
* were already being picked are all still offered.
|
|
268
|
+
*
|
|
269
|
+
* Keying off the selected service instead would empty the dropdown -- no
|
|
270
|
+
* org-less role carries a service type -- so `props.app` is not the filter.
|
|
271
|
+
*/
|
|
254
272
|
const { data: roleData, refresh: refreshRoles } = await useLazyAsyncData(
|
|
255
273
|
"roles",
|
|
256
|
-
() => getRoles({ org: org.value?._id, type:
|
|
274
|
+
() => getRoles({ org: org.value?._id, type: "organization", limit: 50 }),
|
|
257
275
|
{ watch: [() => props.app] }
|
|
258
276
|
)
|
|
259
277
|
|
|
260
278
|
watchEffect(() => {
|
|
261
|
-
|
|
279
|
+
/*
|
|
280
|
+
* The App field above offers the seven service types and never the Seven365
|
|
281
|
+
* staff type (`APP_LIST`), so every invitation this screen can send is a
|
|
282
|
+
* non-staff one -- and `core invite-role-scope.util roleInvitable` refuses a
|
|
283
|
+
* `type: "admin"` role on any of those, without exception. The request that
|
|
284
|
+
* fills this list goes out as `org: "", type: ""`, which is the ORG-LESS set:
|
|
285
|
+
* on staging that is 12 roles, 2 of them `type: "admin"`. So 2 of the 12
|
|
286
|
+
* options could only ever be picked and then refused.
|
|
287
|
+
*
|
|
288
|
+
* Display only. The server's decision is unchanged, and nothing this form can
|
|
289
|
+
* successfully send is removed -- the 10 `type: "organization"` templates,
|
|
290
|
+
* including "Org Owner" (117 live members, 321 invitations), all stay.
|
|
291
|
+
*/
|
|
292
|
+
if (roleData.value)
|
|
293
|
+
roles.value = roleData.value.items.filter((r: any) => r?.type !== 'admin')
|
|
262
294
|
})
|
|
263
295
|
|
|
264
296
|
watch(
|
|
@@ -109,28 +109,24 @@
|
|
|
109
109
|
</AppButton>
|
|
110
110
|
|
|
111
111
|
<!-- one channel per row: a switch must never sit beside the
|
|
112
|
-
NEXT channel's label, which is what a three-up grid does
|
|
112
|
+
NEXT channel's label, which is what a three-up grid does.
|
|
113
|
+
Only channels this category can really deliver on are
|
|
114
|
+
drawn — a switch that will not move is not a setting. -->
|
|
113
115
|
<v-row no-gutters>
|
|
114
116
|
<v-col
|
|
115
|
-
v-for="(channel, index) in category
|
|
117
|
+
v-for="(channel, index) in switchableIn(category)"
|
|
116
118
|
:key="channel.key"
|
|
117
119
|
cols="12"
|
|
118
|
-
:class="index < category.
|
|
120
|
+
:class="index < switchableIn(category).length - 1 ? 'border-b-thin' : ''"
|
|
119
121
|
>
|
|
120
|
-
<div
|
|
121
|
-
class="d-flex align-center justify-space-between py-2"
|
|
122
|
-
:class="{ 'channel-unavailable': !channel.supported }"
|
|
123
|
-
>
|
|
122
|
+
<div class="d-flex align-center justify-space-between py-2">
|
|
124
123
|
<div class="pr-4">
|
|
125
124
|
<div class="channel-label">{{ channel.label }}</div>
|
|
126
|
-
<div v-if="!channel.supported" class="channel-note mt-1">
|
|
127
|
-
{{ channel.note }}
|
|
128
|
-
</div>
|
|
129
125
|
</div>
|
|
130
126
|
|
|
131
127
|
<v-switch
|
|
132
128
|
:model-value="channel.enabled"
|
|
133
|
-
:disabled="
|
|
129
|
+
:disabled="saving"
|
|
134
130
|
color="primary"
|
|
135
131
|
hide-details
|
|
136
132
|
density="compact"
|
|
@@ -206,11 +202,17 @@ const allOn = computed(
|
|
|
206
202
|
categories.value.every((category) => categoryAllOn(category)),
|
|
207
203
|
);
|
|
208
204
|
|
|
209
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* What is on, in words — so a collapsed panel still says what it is doing.
|
|
207
|
+
*
|
|
208
|
+
* The channels are NAMED rather than summarised as "on everywhere". Not every
|
|
209
|
+
* category can reach a person every way, so "everywhere" was a claim about
|
|
210
|
+
* three channels for a category that only ever had two — the screen said the
|
|
211
|
+
* email nobody sends was on.
|
|
212
|
+
*/
|
|
210
213
|
function summaryFor(category: TNotificationCategorySetting) {
|
|
211
214
|
const on = switchableIn(category).filter((c) => c.enabled);
|
|
212
215
|
if (!on.length) return "Off";
|
|
213
|
-
if (on.length === switchableIn(category).length) return "On everywhere";
|
|
214
216
|
return `On: ${on.map((c) => c.label).join(", ")}`;
|
|
215
217
|
}
|
|
216
218
|
|
|
@@ -357,17 +359,4 @@ onMounted(load);
|
|
|
357
359
|
font-size: var(--fs-breadcrumb);
|
|
358
360
|
color: var(--text2);
|
|
359
361
|
}
|
|
360
|
-
|
|
361
|
-
/* Unavailable channels are shown and explained, never hidden.
|
|
362
|
-
*
|
|
363
|
-
* They are NOT faded. The disabled switch already says the control cannot be
|
|
364
|
-
* moved, and the sentence beside it is the only place a person is told why —
|
|
365
|
-
* dimming that sentence is dimming the explanation. A blanket opacity here
|
|
366
|
-
* measured 2.3:1 against the card, which is unreadable; the row is now marked
|
|
367
|
-
* by a rule down its edge instead, and every word stays at full strength. */
|
|
368
|
-
.channel-unavailable {
|
|
369
|
-
border-left: 2px solid rgb(var(--v-border-color));
|
|
370
|
-
padding-left: 12px;
|
|
371
|
-
opacity: 1;
|
|
372
|
-
}
|
|
373
362
|
</style>
|
|
@@ -36,19 +36,6 @@
|
|
|
36
36
|
</v-row>
|
|
37
37
|
</v-col>
|
|
38
38
|
|
|
39
|
-
<v-col cols="12" class="mt-3">
|
|
40
|
-
<div class="role-create__legend">
|
|
41
|
-
<span class="d-flex align-center ga-2">
|
|
42
|
-
<v-icon class="role-create__dot--both" size="14">mdi-circle</v-icon>
|
|
43
|
-
Web and Mobile
|
|
44
|
-
</span>
|
|
45
|
-
<span class="d-flex align-center ga-2">
|
|
46
|
-
<v-icon class="role-create__dot--web" size="14">mdi-circle</v-icon>
|
|
47
|
-
Web only
|
|
48
|
-
</span>
|
|
49
|
-
</div>
|
|
50
|
-
</v-col>
|
|
51
|
-
|
|
52
39
|
<v-col cols="12" class="mt-2">
|
|
53
40
|
<AppButton
|
|
54
41
|
variant="ghost"
|
|
@@ -73,7 +60,7 @@
|
|
|
73
60
|
<StatusChip
|
|
74
61
|
class="mr-3"
|
|
75
62
|
:dot="false"
|
|
76
|
-
|
|
63
|
+
tone="info"
|
|
77
64
|
:label="String(selectedActionCount(String(resourceKey)))"
|
|
78
65
|
/>
|
|
79
66
|
</template>
|
|
@@ -181,10 +168,6 @@ const props = defineProps({
|
|
|
181
168
|
type: Boolean,
|
|
182
169
|
default: true,
|
|
183
170
|
},
|
|
184
|
-
webOnlyResources: {
|
|
185
|
-
type: Array as PropType<string[]>,
|
|
186
|
-
default: () => [],
|
|
187
|
-
},
|
|
188
171
|
cancelText: {
|
|
189
172
|
type: String,
|
|
190
173
|
default: "Cancel",
|
|
@@ -213,12 +196,7 @@ const resourceLabels: Record<string, string> = {
|
|
|
213
196
|
};
|
|
214
197
|
|
|
215
198
|
function formatResourceLabel(key: string): string {
|
|
216
|
-
|
|
217
|
-
return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function isWebOnly(resource: string) {
|
|
221
|
-
return props.webOnlyResources.includes(resource);
|
|
199
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
function isCategoryEnabled(resource: string) {
|
|
@@ -313,7 +291,6 @@ async function submit() {
|
|
|
313
291
|
type: props.type,
|
|
314
292
|
org: props.org,
|
|
315
293
|
site: props.siteId,
|
|
316
|
-
platform: "website",
|
|
317
294
|
});
|
|
318
295
|
emit("success");
|
|
319
296
|
} catch (error: any) {
|
|
@@ -381,25 +358,6 @@ const isAllSelected = computed(() => {
|
|
|
381
358
|
max-height: calc(100vh - 160px);
|
|
382
359
|
}
|
|
383
360
|
|
|
384
|
-
.role-create__legend {
|
|
385
|
-
display: flex;
|
|
386
|
-
align-items: center;
|
|
387
|
-
gap: 16px;
|
|
388
|
-
font-size: var(--fs-breadcrumb);
|
|
389
|
-
color: var(--text2);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/* Were `amber-darken-2` / `blue-darken-2` - fixed Vuetify hues that do not
|
|
393
|
-
follow the theme, and the same two the count chip used. Design tones now,
|
|
394
|
-
and the dot and the chip read the same `isWebOnly`, so they cannot drift. */
|
|
395
|
-
.role-create__dot--both {
|
|
396
|
-
color: var(--warn);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.role-create__dot--web {
|
|
400
|
-
color: var(--info);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
361
|
/* Was a `variant="outlined"` v-card inside the card - a card on a card. It is
|
|
404
362
|
the list frame, so it takes the design's border and radius and no second
|
|
405
363
|
surface. */
|
|
@@ -7,16 +7,6 @@
|
|
|
7
7
|
<v-form v-model="validForm" :disabled="disable">
|
|
8
8
|
<v-row no-gutters>
|
|
9
9
|
<v-col cols="12" class="mt-4">
|
|
10
|
-
<div class="role-perm__legend">
|
|
11
|
-
<span class="d-flex align-center ga-2">
|
|
12
|
-
<v-icon class="role-perm__dot--both" size="14">mdi-circle</v-icon>
|
|
13
|
-
Web and Mobile
|
|
14
|
-
</span>
|
|
15
|
-
<span class="d-flex align-center ga-2">
|
|
16
|
-
<v-icon class="role-perm__dot--web" size="14">mdi-circle</v-icon>
|
|
17
|
-
Web only
|
|
18
|
-
</span>
|
|
19
|
-
</div>
|
|
20
10
|
<AppButton
|
|
21
11
|
v-if="edit"
|
|
22
12
|
variant="ghost"
|
|
@@ -36,7 +26,7 @@
|
|
|
36
26
|
<StatusChip
|
|
37
27
|
class="mr-3"
|
|
38
28
|
:dot="false"
|
|
39
|
-
|
|
29
|
+
tone="info"
|
|
40
30
|
:label="String(selectedActionCount(String(resourceKey)))"
|
|
41
31
|
/>
|
|
42
32
|
</template>
|
|
@@ -157,10 +147,6 @@ const props = defineProps({
|
|
|
157
147
|
type: Object,
|
|
158
148
|
default: () => ({}),
|
|
159
149
|
},
|
|
160
|
-
webOnlyResources: {
|
|
161
|
-
type: Array as PropType<string[]>,
|
|
162
|
-
default: () => [],
|
|
163
|
-
},
|
|
164
150
|
// "Update role". This dialog had no permission prop at all, so it showed Edit
|
|
165
151
|
// to everyone -- including on the seeded platform-owner role -- and the
|
|
166
152
|
// `canUpdateRole` the apps have been passing to `RolePermissionMain` in good
|
|
@@ -182,12 +168,20 @@ const resourceLabels: Record<string, string> = {
|
|
|
182
168
|
};
|
|
183
169
|
|
|
184
170
|
function formatResourceLabel(key: string) {
|
|
185
|
-
|
|
186
|
-
return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
|
|
171
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
187
172
|
}
|
|
188
173
|
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Is this box ticked?
|
|
176
|
+
*
|
|
177
|
+
* The same grant is stored under more than one spelling. An exact `includes()`
|
|
178
|
+
* showed a role holding `work-orders:see-all-work-orders` as NOT having
|
|
179
|
+
* `workOrder:see-all-work-orders`, so the dialog reported a grant the role
|
|
180
|
+
* really holds as absent -- and unticking a box then cleared nothing. Ticks are
|
|
181
|
+
* alias-aware, and so is the untick below.
|
|
182
|
+
*/
|
|
183
|
+
function isActionSelected(resource: string, action: string) {
|
|
184
|
+
return holdsPermission(definedModel.value, `${resource}:${action}`);
|
|
191
185
|
}
|
|
192
186
|
|
|
193
187
|
/**
|
|
@@ -340,27 +334,6 @@ async function submit() {
|
|
|
340
334
|
max-height: calc(100vh - 160px);
|
|
341
335
|
}
|
|
342
336
|
|
|
343
|
-
.role-perm__legend {
|
|
344
|
-
display: flex;
|
|
345
|
-
align-items: center;
|
|
346
|
-
gap: 16px;
|
|
347
|
-
margin-bottom: 12px;
|
|
348
|
-
font-size: var(--fs-breadcrumb);
|
|
349
|
-
color: var(--text2);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/* The two legend dots carried `amber-darken-2` and `blue-darken-2` - fixed
|
|
353
|
-
Vuetify hues that do not follow the theme, and the same two hues the count
|
|
354
|
-
chip beside each row used. Both are the design's tones now, and the chip and
|
|
355
|
-
the dot stay in step because they read the same `isWebOnly`. */
|
|
356
|
-
.role-perm__dot--both {
|
|
357
|
-
color: var(--warn);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.role-perm__dot--web {
|
|
361
|
-
color: var(--info);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
337
|
/* Was a `variant="outlined"` v-card, i.e. a card inside a card. It is the list
|
|
365
338
|
frame, so it takes the design's card border and radius without laying a
|
|
366
339
|
second surface over the first. */
|
|
@@ -52,6 +52,20 @@
|
|
|
52
52
|
@click:row="tableRowClickHandler"
|
|
53
53
|
style="max-height: calc(100vh - (180px))"
|
|
54
54
|
>
|
|
55
|
+
<!--
|
|
56
|
+
SCOPE. Only rendered when a page puts `scope` in its `headers`,
|
|
57
|
+
which is the console's Roles and Permissions screen and nothing
|
|
58
|
+
else. Two kinds share that list and they are governed differently,
|
|
59
|
+
so the row has to say which it is.
|
|
60
|
+
-->
|
|
61
|
+
<template #item.scope="{ item }">
|
|
62
|
+
<StatusChip
|
|
63
|
+
:dot="false"
|
|
64
|
+
:tone="item.type === 'admin' ? 'info' : 'neutral'"
|
|
65
|
+
:label="scopeLabel(item)"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
55
69
|
<template #item.permissions="{ value }">
|
|
56
70
|
<span class="text-caption font-weight-bold text-capitalize">
|
|
57
71
|
permissions
|
|
@@ -86,7 +100,6 @@
|
|
|
86
100
|
:org="props.orgId"
|
|
87
101
|
:site-id="props.siteId"
|
|
88
102
|
:site-state="siteFieldShown"
|
|
89
|
-
:web-only-resources="props.webOnlyResources"
|
|
90
103
|
@success="success()"
|
|
91
104
|
:type="props.type"
|
|
92
105
|
@success:create-more="getRoles()"
|
|
@@ -104,7 +117,6 @@
|
|
|
104
117
|
:name="name"
|
|
105
118
|
:id="roleId"
|
|
106
119
|
:can-update-role="props.canUpdateRole"
|
|
107
|
-
:web-only-resources="props.webOnlyResources"
|
|
108
120
|
/>
|
|
109
121
|
</v-dialog>
|
|
110
122
|
|
|
@@ -221,15 +233,34 @@ const props = defineProps({
|
|
|
221
233
|
required: true,
|
|
222
234
|
default: "app",
|
|
223
235
|
},
|
|
236
|
+
/*
|
|
237
|
+
* The `type` the LIST is filtered by, when it differs from the `type` a
|
|
238
|
+
* newly created role is given.
|
|
239
|
+
*
|
|
240
|
+
* They were the same value, and on the Seven365 console that was the defect:
|
|
241
|
+
* the screen passed `type="admin"`, so it listed the 2 platform-staff roles
|
|
242
|
+
* and nothing else -- while the console's own "Invite Client" picker asks
|
|
243
|
+
* `GET /api/roles` with no `type` and is offered all 12 ORG-LESS roles
|
|
244
|
+
* (10 `type: "organization"` templates + those same 2). A super admin could
|
|
245
|
+
* therefore hand out ten roles the Roles and Permissions screen could not
|
|
246
|
+
* show, edit or delete.
|
|
247
|
+
*
|
|
248
|
+
* The server has always allowed it: an org-less role of ANY type goes to
|
|
249
|
+
* `requireConsolePermission("roles-and-permissions")`
|
|
250
|
+
* (`core role.controller requireRoleOrg`), so this only stops the UI hiding
|
|
251
|
+
* what the console may already manage. `null` keeps every other page exactly
|
|
252
|
+
* as it was; `""` means "do not filter by type", which for an org-less
|
|
253
|
+
* caller IS the administrative scope.
|
|
254
|
+
*/
|
|
255
|
+
listType: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: null,
|
|
258
|
+
},
|
|
224
259
|
permissions: {
|
|
225
260
|
type: Object,
|
|
226
261
|
required: true,
|
|
227
262
|
default: () => ({}),
|
|
228
263
|
},
|
|
229
|
-
webOnlyResources: {
|
|
230
|
-
type: Array as PropType<string[]>,
|
|
231
|
-
default: () => [],
|
|
232
|
-
},
|
|
233
264
|
headers: {
|
|
234
265
|
type: Array as PropType<Array<Record<string, any>>>,
|
|
235
266
|
default: () => [
|
|
@@ -296,7 +327,7 @@ const {
|
|
|
296
327
|
_getRoles({
|
|
297
328
|
page: page.value,
|
|
298
329
|
search: headerSearch.value,
|
|
299
|
-
type: props.type,
|
|
330
|
+
type: props.listType ?? props.type,
|
|
300
331
|
org: props.orgId,
|
|
301
332
|
site: props.siteId,
|
|
302
333
|
}),
|
|
@@ -338,6 +369,19 @@ const emptyText = computed(() => {
|
|
|
338
369
|
return "No roles have been created yet.";
|
|
339
370
|
});
|
|
340
371
|
|
|
372
|
+
/**
|
|
373
|
+
* What KIND of role a row is, in the words the console needs.
|
|
374
|
+
*
|
|
375
|
+
* A role with no `org` is not a client's -- it is either the Seven365 console's
|
|
376
|
+
* own staff role (`type: "admin"`) or an org-less TEMPLATE that any invitation
|
|
377
|
+
* may hand out. Both are managed here; only the second one leaves this system.
|
|
378
|
+
*/
|
|
379
|
+
function scopeLabel(item: Record<string, any>) {
|
|
380
|
+
if (item?.type === "admin") return "Platform staff";
|
|
381
|
+
if (props.orgId) return "Organisation";
|
|
382
|
+
return "Client template";
|
|
383
|
+
}
|
|
384
|
+
|
|
341
385
|
function tableRowClickHandler(_: any, data: any) {
|
|
342
386
|
// "See role details". Ungated until now, which is why granting or withholding
|
|
343
387
|
// it changed nothing.
|