@7365admin1/layer-common 4.97.1-staging.689 → 4.97.1-staging.691
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.
|
@@ -7,15 +7,6 @@
|
|
|
7
7
|
<v-card-text class="screen-modal__body pa-0">
|
|
8
8
|
<v-form v-model="validForm" :disabled="disable">
|
|
9
9
|
<v-row no-gutters class="px-6 pt-4">
|
|
10
|
-
<v-col cols="12" class="mt-2">
|
|
11
|
-
<v-row no-gutters>
|
|
12
|
-
<InputLabel class="text-capitalize font-weight-bold" title="Block Name" required />
|
|
13
|
-
<v-col cols="12">
|
|
14
|
-
<v-text-field v-model="building.name" class="filter-field" density="comfortable" :rules="[requiredRule]"></v-text-field>
|
|
15
|
-
</v-col>
|
|
16
|
-
</v-row>
|
|
17
|
-
</v-col>
|
|
18
|
-
|
|
19
10
|
<v-col v-if="prop.mode === 'add'" cols="12">
|
|
20
11
|
<v-row>
|
|
21
12
|
<v-col cols="6" class="mt-2">
|
|
@@ -206,6 +197,7 @@
|
|
|
206
197
|
|
|
207
198
|
<script setup lang="ts">
|
|
208
199
|
import InputLabel from './InputLabel.vue';
|
|
200
|
+
import { blockLabel } from "../utils/building-block";
|
|
209
201
|
|
|
210
202
|
const prop = defineProps({
|
|
211
203
|
site: {
|
|
@@ -400,10 +392,16 @@ async function submit() {
|
|
|
400
392
|
try {
|
|
401
393
|
if (prop.mode === "add") {
|
|
402
394
|
const buildingPayload = { ...building.value };
|
|
395
|
+
// One block field only: the stored name is derived from the number ("Blk 3").
|
|
396
|
+
const name = blockLabel(buildingPayload.block);
|
|
397
|
+
if (prop.blocks.some((b) => b.name?.trim().toLowerCase() === name.toLowerCase() && b.block !== buildingPayload.block)) {
|
|
398
|
+
message.value = `Another block is already named "${name}". Rename it first, or choose a different Block No.`;
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
403
401
|
|
|
404
402
|
let payload: TBuildingPayload = {
|
|
405
403
|
site: buildingPayload.site,
|
|
406
|
-
name
|
|
404
|
+
name,
|
|
407
405
|
block: buildingPayload.block,
|
|
408
406
|
levels: [...newLevelsArray.value],
|
|
409
407
|
buildingFiles: (building.value.buildingFiles as string[] || []).map((id) => ({ id, name: buildingFilesNames.value[id] ?? "" }))
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
<template #prepend-additional>
|
|
23
23
|
<AppField v-model="searchInput" search compact placeholder="Search" klass="app-toolbar__search" />
|
|
24
24
|
</template>
|
|
25
|
+
<template #item.block="{ value }">{{ value ? blockLabel(value) : "" }}</template>
|
|
25
26
|
<template #item.createdAt="{ value }">
|
|
26
27
|
{{ new Date(value).toLocaleDateString() }}
|
|
27
28
|
</template>
|
|
@@ -52,13 +53,9 @@
|
|
|
52
53
|
<v-card width="100%">
|
|
53
54
|
<v-card-text style="max-height: 100vh; overflow-y: auto" class="pb-0">
|
|
54
55
|
<v-row no-gutters class="mb-4">
|
|
55
|
-
<v-col cols="12">
|
|
56
|
-
<strong>Name:</strong> {{ selectedBuilding?.name ?? "N/A" }}
|
|
57
|
-
</v-col>
|
|
58
|
-
|
|
59
56
|
<v-col cols="12">
|
|
60
57
|
<strong>Block:</strong>
|
|
61
|
-
{{ selectedBuilding?.block
|
|
58
|
+
{{ selectedBuilding?.block ? blockLabel(selectedBuilding.block) : "N/A" }}
|
|
62
59
|
</v-col>
|
|
63
60
|
|
|
64
61
|
<v-col cols="12">
|
|
@@ -161,16 +158,13 @@
|
|
|
161
158
|
// Relative import, never Nuxt auto-import: this layer's `utils/` are auto-imported
|
|
162
159
|
// into the consuming apps but not reliably into the layer's own components.
|
|
163
160
|
import { levelCount } from "../../utils/data";
|
|
161
|
+
import { blockLabel } from "../../utils/building-block";
|
|
164
162
|
|
|
165
163
|
|
|
166
164
|
const props = defineProps({
|
|
167
165
|
headers: {
|
|
168
166
|
type: Array as PropType<Array<Record<string, any>>>,
|
|
169
167
|
default: () => [
|
|
170
|
-
{
|
|
171
|
-
title: "Name",
|
|
172
|
-
value: "name",
|
|
173
|
-
},
|
|
174
168
|
{
|
|
175
169
|
title: "Block",
|
|
176
170
|
value: "block",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
v-model="showImport"
|
|
31
31
|
title="Import Blocks, Levels and Units from Excel"
|
|
32
32
|
noun="rows"
|
|
33
|
-
name-label="
|
|
34
|
-
fill-hint="One row per unit:
|
|
33
|
+
name-label="Block / Level / Unit"
|
|
34
|
+
fill-hint="One row per unit: Block No, Level and Unit Number. Pick Level from the dropdown where it already exists. A new Block No creates a new block (Blk 1, Blk 2 ...); an existing block keeps its name."
|
|
35
35
|
duplicate-note="Units already on that level are skipped and left unchanged."
|
|
36
36
|
template-file-name="units-import-template.xlsx"
|
|
37
37
|
:download-template="() => downloadTemplate('building-units', { site })"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<AppField v-model="searchInput" search compact placeholder="Search" klass="app-toolbar__search" />
|
|
51
51
|
</template>
|
|
52
52
|
<template #item.block="{ value, item }">
|
|
53
|
-
{{ value ?
|
|
53
|
+
{{ value ? blockLabel(value) : "" }}
|
|
54
54
|
</template>
|
|
55
55
|
</TableMain>
|
|
56
56
|
|
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
|
|
175
175
|
<script setup lang="ts">
|
|
176
176
|
import useImportTemplates from "../../composables/useImportTemplates";
|
|
177
|
+
import { blockLabel } from "../../utils/building-block";
|
|
177
178
|
import { saveBlob } from "../../composables/useInventory";
|
|
178
179
|
import { useDisplay } from 'vuetify/lib/composables/display.mjs';
|
|
179
180
|
|
|
@@ -189,13 +190,9 @@ const props = defineProps({
|
|
|
189
190
|
title: "Level",
|
|
190
191
|
value: "level.name",
|
|
191
192
|
},
|
|
192
|
-
// {
|
|
193
|
-
// title: "Block",
|
|
194
|
-
// value: "block",
|
|
195
|
-
// },
|
|
196
193
|
{
|
|
197
|
-
title: "Block
|
|
198
|
-
value: "
|
|
194
|
+
title: "Block",
|
|
195
|
+
value: "block",
|
|
199
196
|
},
|
|
200
197
|
|
|
201
198
|
// {
|
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.691",
|
|
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/utils/module-routes.ts
CHANGED
|
@@ -153,6 +153,9 @@ export function permissionsDenied(
|
|
|
153
153
|
return permissions.every((p) => denied.includes(String(p).split(":")[0]));
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/** Carved-out pages: shown to anyone, but never the only thing left in a trimmed group. */
|
|
157
|
+
const ROUTES_THAT_DONT_KEEP_A_GROUP = ["org-site-facility-settings"];
|
|
158
|
+
|
|
156
159
|
type TRouted = { route?: { name?: unknown } | null; children?: TRouted[] };
|
|
157
160
|
|
|
158
161
|
/** A menu without the pages the client was not given; a group left empty goes too. */
|
|
@@ -165,7 +168,11 @@ export function withoutDeniedRoutes<T extends TRouted>(
|
|
|
165
168
|
if (routeDenied(item.route?.name, denied)) return [];
|
|
166
169
|
if (!item.children?.length) return [item];
|
|
167
170
|
const children = withoutDeniedRoutes(item.children as T[], denied);
|
|
168
|
-
|
|
171
|
+
// A page carved out of its module (Facility Settings) must not keep a group
|
|
172
|
+
// alive on its own once the group's module pages were taken away.
|
|
173
|
+
const lost = children.length < item.children.length;
|
|
174
|
+
const stray = children.every((c) => ROUTES_THAT_DONT_KEEP_A_GROUP.includes(String(c.route?.name)));
|
|
175
|
+
return children.length && !(lost && stray) ? [{ ...item, children }] : [];
|
|
169
176
|
});
|
|
170
177
|
}
|
|
171
178
|
|