@7365admin1/layer-common 4.180.2 → 4.182.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 +31 -4
- package/components/BuildingForm.vue +22 -53
- package/components/BuildingManagement/buildings.vue +3 -9
- package/components/BuildingManagement/units.vue +6 -9
- package/components/ChecklistReportButton.vue +367 -0
- package/components/CleaningScheduleMain.vue +13 -0
- package/components/HidUserEnrollment.vue +1 -1
- package/components/PeopleForm.vue +3 -2
- package/components/RolePermissionMain.vue +11 -2
- package/components/SiteSettings.vue +5 -1
- package/components/TaskCalendarMain.vue +18 -0
- package/composables/usePropertyPermission.ts +8 -0
- package/composables/useSecurityUtils.ts +1 -1
- package/composables/useSiteSettings.ts +2 -2
- package/package.json +1 -1
- package/types/building.d.ts +2 -2
- package/utils/building-block.ts +19 -0
- package/utils/checklist-report/checklist-report-files.ts +458 -0
- package/utils/checklist-report/checklist-report-load.ts +99 -0
- package/utils/checklist-report/checklist-report.ts +723 -0
- package/utils/inventory-presets.ts +2 -1
- package/utils/module-routes.ts +55 -8
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
|
|
120
120
|
<script setup lang="ts">
|
|
121
121
|
import { property } from 'zod/v4';
|
|
122
|
+
import { normaliseBlock } from '../utils/building-block';
|
|
122
123
|
|
|
123
124
|
const prop = defineProps({
|
|
124
125
|
org: {
|
|
@@ -205,14 +206,14 @@ const { data: levelsData, refresh: refreshLevelsData, status: levelsStatus } = u
|
|
|
205
206
|
`fetch-levels-data-${prop.site}-${form.block}`,
|
|
206
207
|
async () => {
|
|
207
208
|
if (!form.block) return Promise.resolve(null);
|
|
208
|
-
return await getSiteLevels(prop.site, { block:
|
|
209
|
+
return await getSiteLevels(prop.site, { block: normaliseBlock(form.block) ?? form.block })
|
|
209
210
|
}, { watch: [() => form.block],});
|
|
210
211
|
|
|
211
212
|
const { data: unitsData, refresh: refreshUnitsData, status: unitsStatus } = useLazyAsyncData(
|
|
212
213
|
`fetch-units-data-${prop.site}-${form.level}`,
|
|
213
214
|
async () => {
|
|
214
215
|
if (!form.level) return Promise.resolve(null);
|
|
215
|
-
return await getSiteUnits(prop.site,
|
|
216
|
+
return await getSiteUnits(prop.site, normaliseBlock(form.block) ?? form.block, form.level)
|
|
216
217
|
}, { watch: [()=> form.level]});
|
|
217
218
|
|
|
218
219
|
watch(
|
|
@@ -226,6 +226,7 @@ import {
|
|
|
226
226
|
ownerGrant,
|
|
227
227
|
siteModulesForOrg,
|
|
228
228
|
} from "../utils/org-modules";
|
|
229
|
+
import { withoutDeniedResources } from "../utils/module-routes";
|
|
229
230
|
|
|
230
231
|
const props = defineProps({
|
|
231
232
|
orgId: {
|
|
@@ -406,9 +407,17 @@ const { data: grantRole } = useLazyAsyncData(
|
|
|
406
407
|
{ watch: [grantRoleId] }
|
|
407
408
|
);
|
|
408
409
|
|
|
410
|
+
/*
|
|
411
|
+
* The deny list the server computed for this person (owner, 2026-11-16): a
|
|
412
|
+
* module the client's list removed - including a list saved with nothing
|
|
413
|
+
* ticked - is not offered either. Seven365 staff get an empty list, so the
|
|
414
|
+
* Super Admin still sees everything.
|
|
415
|
+
*/
|
|
416
|
+
const { userAppModulesDenied: deniedForEditor } = useLocalSetup();
|
|
417
|
+
|
|
409
418
|
/** `props.permissions`, narrowed to what this client - and this site - was given. */
|
|
410
419
|
const offeredPermissions = computed(() =>
|
|
411
|
-
catalogueForOwnerGrant(
|
|
420
|
+
withoutDeniedResources(catalogueForOwnerGrant(
|
|
412
421
|
catalogueForOrg(
|
|
413
422
|
props.permissions ?? {},
|
|
414
423
|
effectiveModules(
|
|
@@ -418,7 +427,7 @@ const offeredPermissions = computed(() =>
|
|
|
418
427
|
)
|
|
419
428
|
),
|
|
420
429
|
ownerGrant(orgForModules.value as any, grantRole.value as any, props.type)
|
|
421
|
-
)
|
|
430
|
+
), deniedForEditor?.value)
|
|
422
431
|
);
|
|
423
432
|
|
|
424
433
|
const { getRoles: _getRoles } = useRole();
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</v-expansion-panel>
|
|
110
110
|
|
|
111
111
|
<!-- ANPR CAMERA -->
|
|
112
|
-
<v-expansion-panel v-if="showAnprCamera && canManageANPRCamera">
|
|
112
|
+
<v-expansion-panel v-if="showAnprCamera && canManageANPRCamera && anprModuleOn">
|
|
113
113
|
<v-expansion-panel-title>
|
|
114
114
|
<v-icon class="mr-2">mdi-camera</v-icon>
|
|
115
115
|
ANPR Camera
|
|
@@ -319,6 +319,7 @@ import useSiteSettings from "../composables/useSiteSettings";
|
|
|
319
319
|
import useUtils from "../composables/useUtils";
|
|
320
320
|
import useANPRSettings from "../composables/useANPRSettings";
|
|
321
321
|
import useVehicle from "../composables/useVehicle";
|
|
322
|
+
import { permissionsDenied } from "../utils/module-routes";
|
|
322
323
|
import { SERIAL_DEFAULT_DIGITS, SERIAL_PREFIX_PATTERN, cleanSerialPrefix, formatStickerSerial } from "../utils/vehicle-qr-blank";
|
|
323
324
|
|
|
324
325
|
const props = defineProps({
|
|
@@ -347,6 +348,9 @@ const { canManageSiteInformation,
|
|
|
347
348
|
canManageSiteSettings: canManageAnySiteSetting,
|
|
348
349
|
} = useSettingsPermission();
|
|
349
350
|
const { canManageHidSettings } = useHidAccessPermission();
|
|
351
|
+
// ANPR serves vehicles and visitors: hide the panel when the client has neither module (denied list, same as the menu gate).
|
|
352
|
+
const { userAppModulesDenied } = useLocalSetup();
|
|
353
|
+
const anprModuleOn = computed(() => !permissionsDenied(["vehicle-mgmt:x", "visitor-mgmt:x"], userAppModulesDenied?.value));
|
|
350
354
|
|
|
351
355
|
const { getSiteById, updateSitebyId, updateSiteInformation } =
|
|
352
356
|
useSiteSettings();
|
|
@@ -74,6 +74,15 @@
|
|
|
74
74
|
</button>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
|
+
<div v-if="tab === 'extra' && canDownloadExtraReport" class="d-flex justify-end mb-2">
|
|
78
|
+
<ChecklistReportButton
|
|
79
|
+
:org-id="orgId"
|
|
80
|
+
:site="siteId"
|
|
81
|
+
:service-type="serviceType"
|
|
82
|
+
report="extra"
|
|
83
|
+
can-download
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
77
86
|
<TaskCalendarReadOnly
|
|
78
87
|
v-if="tab === 'agent'"
|
|
79
88
|
:site-id="siteId"
|
|
@@ -99,6 +108,7 @@
|
|
|
99
108
|
</template>
|
|
100
109
|
|
|
101
110
|
<script setup lang="ts">
|
|
111
|
+
import { useCleaningSchedulePermission } from "../composables/useCleaningSchedulePermission";
|
|
102
112
|
import {
|
|
103
113
|
pickTaskCalendarTab,
|
|
104
114
|
taskCalendarWords,
|
|
@@ -117,8 +127,16 @@ const props = defineProps({
|
|
|
117
127
|
canUpdateScheduleTask: { type: Boolean, default: false },
|
|
118
128
|
canDeleteScheduleTask: { type: Boolean, default: false },
|
|
119
129
|
canViewScheduleTaskDetails: { type: Boolean, default: false },
|
|
130
|
+
/**
|
|
131
|
+
* May download the Extra Checks report. Left out, it follows the role's
|
|
132
|
+
* "download-schedule" key, the one that gates the Daily Checklist downloads.
|
|
133
|
+
*/
|
|
134
|
+
canDownloadReport: { type: Boolean, default: undefined },
|
|
120
135
|
});
|
|
121
136
|
|
|
137
|
+
const { canDownloadSchedule } = useCleaningSchedulePermission();
|
|
138
|
+
const canDownloadExtraReport = computed(() => props.canDownloadReport ?? canDownloadSchedule.value);
|
|
139
|
+
|
|
122
140
|
const route = useRoute();
|
|
123
141
|
const router = useRouter();
|
|
124
142
|
|
|
@@ -438,6 +438,14 @@ export default function usePropertyPermission() {
|
|
|
438
438
|
check: true,
|
|
439
439
|
description: "Allows the user to approve or reject incident report.",
|
|
440
440
|
},
|
|
441
|
+
"add-incident-report": {
|
|
442
|
+
check: true,
|
|
443
|
+
description: "Allows the user to add a new incident report.",
|
|
444
|
+
},
|
|
445
|
+
"update-incident-report": {
|
|
446
|
+
check: true,
|
|
447
|
+
description: "Allows the user to update an incident report.",
|
|
448
|
+
},
|
|
441
449
|
},
|
|
442
450
|
|
|
443
451
|
"vehicle-mgmt": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default function(){
|
|
2
2
|
|
|
3
|
-
const formatLocation = ({block, level, unit}: {block: number, level: string, unit: string | TBuildingUnit}) => {
|
|
3
|
+
const formatLocation = ({block, level, unit}: {block: number | string, level: string, unit: string | TBuildingUnit}) => {
|
|
4
4
|
const parts = [];
|
|
5
5
|
|
|
6
6
|
if (block?.name) parts.push(`${block.name}`);
|
|
@@ -8,7 +8,7 @@ export default function () {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
async function getSiteLevels(siteId: string, query: { block: number }) {
|
|
11
|
+
async function getSiteLevels(siteId: string, query: { block: number | string }) {
|
|
12
12
|
return await useNuxtApp().$api<Record<string, any>>(
|
|
13
13
|
`/api/buildings/site/${siteId}`,
|
|
14
14
|
{
|
|
@@ -18,7 +18,7 @@ export default function () {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async function getSiteUnits(siteId: string, block: number, level: string) {
|
|
21
|
+
async function getSiteUnits(siteId: string, block: number | string, level: string) {
|
|
22
22
|
return await useNuxtApp().$api<Record<string, any>>(
|
|
23
23
|
`/api/building-units/site/${siteId}/block/${block}/level/${level}`,
|
|
24
24
|
{
|
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.
|
|
5
|
+
"version": "4.182.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.",
|
package/types/building.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ declare type TBuilding = {
|
|
|
2
2
|
_id?: string;
|
|
3
3
|
site: string;
|
|
4
4
|
name: string;
|
|
5
|
-
block: number | null;
|
|
5
|
+
block: number | string | null;
|
|
6
6
|
levels: { _id: string; name: string }[];
|
|
7
7
|
buildingFiles: { id: string, name: string }[] | string[];
|
|
8
8
|
};
|
|
@@ -15,7 +15,7 @@ declare type TBuildingUnit = {
|
|
|
15
15
|
ownerName?: string;
|
|
16
16
|
building: string;
|
|
17
17
|
buildingName?: string;
|
|
18
|
-
block: number | null;
|
|
18
|
+
block: number | string | null;
|
|
19
19
|
level: { _id: string; name: string } | null;
|
|
20
20
|
category: string;
|
|
21
21
|
status: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The one block label used everywhere: "Blk 3", "Blk 12A". Block names are no longer typed; they come from the number. */
|
|
2
|
+
export const blockLabel = (block: number | string | null | undefined): string => `Blk ${block}`;
|
|
3
|
+
|
|
4
|
+
export const BLOCK_NO_MESSAGE = "Block No must be a number from 1 to 9999, optionally followed by one letter (for example 12 or 12A).";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Block No: 1-4 digits and at most one capital letter. Same rule as the API (core): trim, capitals,
|
|
8
|
+
* drop "Blk"/"Block" and leading zeros. Digits only -> a number; with a letter -> a string ("12A").
|
|
9
|
+
*/
|
|
10
|
+
export function normaliseBlock(input: unknown): number | string | null {
|
|
11
|
+
if (typeof input === "number") return Number.isInteger(input) && input >= 1 && input <= 9999 ? input : null;
|
|
12
|
+
if (typeof input !== "string") return null;
|
|
13
|
+
const s = input.trim().toUpperCase().replace(/^(BLK|BLOCK)\.?\s*/, "").replace(/^0+(?=\d)/, "");
|
|
14
|
+
const m = /^(\d{1,4})([A-Z]?)$/.exec(s);
|
|
15
|
+
if (!m) return null;
|
|
16
|
+
const n = Number(m[1]);
|
|
17
|
+
if (n < 1) return null;
|
|
18
|
+
return m[2] ? `${n}${m[2]}` : n;
|
|
19
|
+
}
|