@7365admin1/layer-common 4.97.1-staging.719 → 4.97.1-staging.720
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 +88 -1
- package/package.json +1 -1
|
@@ -190,6 +190,55 @@
|
|
|
190
190
|
</div>
|
|
191
191
|
</v-col>
|
|
192
192
|
|
|
193
|
+
<v-divider />
|
|
194
|
+
|
|
195
|
+
<!-- Resident QR Code Validity -->
|
|
196
|
+
<!--
|
|
197
|
+
How long a resident's access QR stays valid before the app renews
|
|
198
|
+
it. Stored as `settings.validityMinutes`, which this screen already
|
|
199
|
+
loaded and saved but never showed. Empty saves null.
|
|
200
|
+
-->
|
|
201
|
+
<v-col cols="12">
|
|
202
|
+
<div class="mt-5 pb-5">
|
|
203
|
+
<p class="font-weight-medium mb-1">
|
|
204
|
+
Resident QR Code Validity
|
|
205
|
+
<span class="d-block text-caption screen-hint mt-1">
|
|
206
|
+
How long a resident's access QR code stays valid, in minutes,
|
|
207
|
+
before the resident app renews it.
|
|
208
|
+
</span>
|
|
209
|
+
</p>
|
|
210
|
+
<v-row class="mt-2">
|
|
211
|
+
<v-col cols="12" md="3">
|
|
212
|
+
<v-text-field
|
|
213
|
+
data-testid="entrypass-resident-qr-validity"
|
|
214
|
+
label="Validity (minutes)"
|
|
215
|
+
placeholder="e.g. 20"
|
|
216
|
+
type="number"
|
|
217
|
+
min="1"
|
|
218
|
+
:max="QR_VALIDITY_MAX_MINUTES"
|
|
219
|
+
density="comfortable"
|
|
220
|
+
clearable
|
|
221
|
+
:error-messages="qrValidityError"
|
|
222
|
+
v-model="currentEntryPassSettings.qrCodeValidityMinutes"
|
|
223
|
+
@update:modelValue="qrValidityError = ''"
|
|
224
|
+
/>
|
|
225
|
+
</v-col>
|
|
226
|
+
</v-row>
|
|
227
|
+
<v-row>
|
|
228
|
+
<v-col cols="12" md="3">
|
|
229
|
+
<v-btn
|
|
230
|
+
color="primary"
|
|
231
|
+
variant="flat"
|
|
232
|
+
prepend-icon="mdi-content-save"
|
|
233
|
+
block
|
|
234
|
+
@click="saveQrValidity()"
|
|
235
|
+
>
|
|
236
|
+
Save
|
|
237
|
+
</v-btn>
|
|
238
|
+
</v-col>
|
|
239
|
+
</v-row>
|
|
240
|
+
</div>
|
|
241
|
+
</v-col>
|
|
193
242
|
|
|
194
243
|
</v-row>
|
|
195
244
|
</v-window-item>
|
|
@@ -933,7 +982,7 @@ function buildPayload() {
|
|
|
933
982
|
subText: currentEntryPassSettings.value.qrCodeTemplateHeaderSubText,
|
|
934
983
|
date: currentEntryPassSettings.value.qrCodeTemplateDate || null,
|
|
935
984
|
},
|
|
936
|
-
validityMinutes:
|
|
985
|
+
validityMinutes: validityMinutesForSave(),
|
|
937
986
|
disclaimerMessage: currentEntryPassSettings.value.disclaimerMessage || "",
|
|
938
987
|
url: currentEntryPassSettings.value.url,
|
|
939
988
|
template: currentEntryPassSettings.value.template?.id
|
|
@@ -1003,6 +1052,44 @@ async function saveQrCodeTemplate() {
|
|
|
1003
1052
|
getSiteEntryPassSettings();
|
|
1004
1053
|
}
|
|
1005
1054
|
|
|
1055
|
+
/** One day. The QR payload can carry up to 65535 minutes, but a resident
|
|
1056
|
+
access QR lasting longer than a day defeats the point of renewing it. */
|
|
1057
|
+
const QR_VALIDITY_MAX_MINUTES = 1440;
|
|
1058
|
+
const qrValidityError = ref("");
|
|
1059
|
+
|
|
1060
|
+
/** Every Save on this screen sends the whole payload, so an unsaved, invalid
|
|
1061
|
+
entry in the validity field must not ride along with another section's
|
|
1062
|
+
save: anything but whole minutes in range sends what is already saved. */
|
|
1063
|
+
function validityMinutesForSave(): number | null {
|
|
1064
|
+
const minutes = Number(currentEntryPassSettings.value.qrCodeValidityMinutes);
|
|
1065
|
+
if (Number.isInteger(minutes) && minutes >= 1 && minutes <= QR_VALIDITY_MAX_MINUTES) {
|
|
1066
|
+
return minutes;
|
|
1067
|
+
}
|
|
1068
|
+
const raw = currentEntryPassSettings.value.qrCodeValidityMinutes;
|
|
1069
|
+
if (raw === null || raw === undefined || String(raw).trim() === "") return null;
|
|
1070
|
+
return getSiteEntryPassSettingsReq.value?.data?.settings?.validityMinutes ?? null;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
async function saveQrValidity() {
|
|
1074
|
+
const raw = currentEntryPassSettings.value.qrCodeValidityMinutes;
|
|
1075
|
+
// Cleared (null, or "" from the number field) saves null: no site value.
|
|
1076
|
+
if (raw === null || raw === undefined || String(raw).trim() === "") {
|
|
1077
|
+
currentEntryPassSettings.value.qrCodeValidityMinutes = null;
|
|
1078
|
+
} else {
|
|
1079
|
+
const minutes = Number(raw);
|
|
1080
|
+
if (!Number.isInteger(minutes) || minutes < 1 || minutes > QR_VALIDITY_MAX_MINUTES) {
|
|
1081
|
+
qrValidityError.value = `Enter whole minutes from 1 to ${QR_VALIDITY_MAX_MINUTES}.`;
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
// The number field hands back a string; store a number.
|
|
1085
|
+
currentEntryPassSettings.value.qrCodeValidityMinutes = minutes;
|
|
1086
|
+
}
|
|
1087
|
+
qrValidityError.value = "";
|
|
1088
|
+
await _save(buildPayload());
|
|
1089
|
+
showMessage("Resident QR code validity saved successfully!", "success");
|
|
1090
|
+
getSiteEntryPassSettings();
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1006
1093
|
async function saveResidentAppDisclaimerMsg() {
|
|
1007
1094
|
await _save(buildPayload());
|
|
1008
1095
|
showMessage("Disclaimer message 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.720",
|
|
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.",
|