@7365admin1/layer-common 3.0.31-staging.22 → 3.0.31-staging.24
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/VisitorForm.vue +49 -15
- package/package.json +1 -1
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
<v-col cols="12">
|
|
137
137
|
<InputLabel class="text-capitalize" title="Company Name" />
|
|
138
138
|
<v-combobox v-model="visitor.company" v-model:search="companyNameInput" ref="companyCombo"
|
|
139
|
-
autocomplete="off" :hide-no-data="
|
|
139
|
+
autocomplete="off" :hide-no-data="true" :items="companyNames" item-value="value"
|
|
140
140
|
@update:model-value="handleSelectCompanyName" variant="outlined" density="comfortable" persistent-hint
|
|
141
141
|
small-chips>
|
|
142
142
|
<!-- <template v-slot:no-data>
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
</p>
|
|
347
347
|
|
|
348
348
|
<div class="text-subtitle-1 mb-8">
|
|
349
|
-
<div>NRIC: {{ visitor.nric || "N/A" }}</div>
|
|
349
|
+
<div v-if="!skipNonCheckedOutNric">NRIC: {{ visitor.nric || "N/A" }}</div>
|
|
350
350
|
<div>Phone Number: {{ visitor.contact || "N/A" }}</div>
|
|
351
351
|
</div>
|
|
352
352
|
|
|
@@ -754,6 +754,7 @@ type SearchPerson = Omit<Partial<TPeople>, "contact"> & {
|
|
|
754
754
|
contacts?: string | string[];
|
|
755
755
|
plateNumbers?: string | string[];
|
|
756
756
|
plateNumber?: string | string[];
|
|
757
|
+
plates?: { plateNumber?: string }[];
|
|
757
758
|
};
|
|
758
759
|
|
|
759
760
|
function getPeopleSearchItems(res: any): Partial<TPeople>[] {
|
|
@@ -803,7 +804,6 @@ async function handleAddNewContractorType() {
|
|
|
803
804
|
|
|
804
805
|
combo.isMenuActive = false;
|
|
805
806
|
combo.$el.querySelector("input")?.blur();
|
|
806
|
-
``;
|
|
807
807
|
}
|
|
808
808
|
|
|
809
809
|
async function handleSelectCompanyName(company: string) {
|
|
@@ -871,8 +871,10 @@ watch(fetchPersonByNRICReq, (obj) => {
|
|
|
871
871
|
|
|
872
872
|
watch(
|
|
873
873
|
() => visitor.nric,
|
|
874
|
-
(value) => {
|
|
875
|
-
skipNonCheckedOutNric.value
|
|
874
|
+
(value, oldValue) => {
|
|
875
|
+
if (skipNonCheckedOutNric.value && value !== oldValue) {
|
|
876
|
+
skipNonCheckedOutNric.value = false;
|
|
877
|
+
}
|
|
876
878
|
if (!value || value.length < 4) {
|
|
877
879
|
nricSearchMenu.value = false;
|
|
878
880
|
nricSearchResults.value = [];
|
|
@@ -883,7 +885,6 @@ watch(
|
|
|
883
885
|
watch(
|
|
884
886
|
() => visitor.contact,
|
|
885
887
|
(value) => {
|
|
886
|
-
skipNonCheckedOutNric.value = false;
|
|
887
888
|
if (!value || value.length < 4) {
|
|
888
889
|
phoneSearchMenu.value = false;
|
|
889
890
|
phoneSearchResults.value = [];
|
|
@@ -973,19 +974,44 @@ function applyNricSearchResult(
|
|
|
973
974
|
|
|
974
975
|
currentAutofillSource.value = options.source || "nric";
|
|
975
976
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
977
|
+
const shouldAutofillField = (fieldSource?: Exclude<AutofillSource, null>) => {
|
|
978
|
+
if (!fieldSource) return false;
|
|
979
|
+
return currentAutofillSource.value === fieldSource;
|
|
980
|
+
};
|
|
981
|
+
const getAutofillValue = (
|
|
982
|
+
currentValue: string | undefined,
|
|
983
|
+
nextValue: string | undefined,
|
|
984
|
+
fieldSource?: Exclude<AutofillSource, null>
|
|
985
|
+
) => {
|
|
986
|
+
if (!nextValue) return currentValue;
|
|
987
|
+
if (currentValue && !shouldAutofillField(fieldSource)) return currentValue;
|
|
988
|
+
return nextValue;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
visitor.nric = getAutofillValue(visitor.nric, item.nric, "nric");
|
|
992
|
+
visitor.name = getAutofillValue(visitor.name, item.name);
|
|
993
|
+
visitor.contact = getAutofillValue(
|
|
994
|
+
visitor.contact,
|
|
995
|
+
options.contacts || getPersonContactOptions(item)[0],
|
|
996
|
+
"contact"
|
|
997
|
+
);
|
|
998
|
+
|
|
999
|
+
if(prop.type !== 'walk-in'){
|
|
1000
|
+
visitor.plateNumber = getAutofillValue(
|
|
1001
|
+
visitor.plateNumber,
|
|
1002
|
+
options.plateNumber || getPersonPlateOptions(item)[0],
|
|
1003
|
+
"vehicleNumber"
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
980
1006
|
|
|
981
1007
|
companyNames.value = Array.isArray(item.companyName) ? item.companyName : [];
|
|
982
1008
|
|
|
983
|
-
if (item.companyName && item.companyName.length === 1) {
|
|
1009
|
+
if (!visitor.company && item.companyName && item.companyName.length === 1) {
|
|
984
1010
|
visitor.company = item.companyName?.[0] || visitor.company;
|
|
985
1011
|
}
|
|
986
1012
|
|
|
987
|
-
if (item.companyName && item.companyName.length > 1) {
|
|
988
|
-
visitor.company = ""
|
|
1013
|
+
if (!visitor.company && item.companyName && item.companyName.length > 1) {
|
|
1014
|
+
visitor.company = "";
|
|
989
1015
|
}
|
|
990
1016
|
|
|
991
1017
|
|
|
@@ -1018,7 +1044,10 @@ function selectAutofillSearchResult(item: Partial<TPeople>, source: Exclude<Auto
|
|
|
1018
1044
|
const selectedPlate =
|
|
1019
1045
|
findMatchingPlateOption(plateOptions, visitor.plateNumber) || plateOptions[0] || "";
|
|
1020
1046
|
|
|
1021
|
-
|
|
1047
|
+
const needsContactChoice = !visitor.contact?.trim() && contactOptions.length > 1;
|
|
1048
|
+
const needsPlateChoice = !visitor.plateNumber?.trim() && plateOptions.length > 1;
|
|
1049
|
+
|
|
1050
|
+
if (needsContactChoice || needsPlateChoice) {
|
|
1022
1051
|
nricSearchMenu.value = false;
|
|
1023
1052
|
phoneSearchMenu.value = false;
|
|
1024
1053
|
vehicleSearchMenu.value = false;
|
|
@@ -1134,11 +1163,12 @@ async function checkNonCheckedOutVisitorsBeforeSubmit(
|
|
|
1134
1163
|
}
|
|
1135
1164
|
|
|
1136
1165
|
async function handleSkipNricNonCheckedOut() {
|
|
1166
|
+
skipNonCheckedOutNric.value = true;
|
|
1167
|
+
|
|
1137
1168
|
const canSubmit = await checkNonCheckedOutVisitorsBeforeSubmit({
|
|
1138
1169
|
skipNric: true,
|
|
1139
1170
|
});
|
|
1140
1171
|
if (!canSubmit) return;
|
|
1141
|
-
skipNonCheckedOutNric.value = true;
|
|
1142
1172
|
dialog.showNonCheckedOutDialog = false;
|
|
1143
1173
|
}
|
|
1144
1174
|
|
|
@@ -1377,6 +1407,7 @@ function handleUpdateNRIC() {
|
|
|
1377
1407
|
if (skipNricFetch.value) return;
|
|
1378
1408
|
if (!isNricFieldFocused.value) return;
|
|
1379
1409
|
if (visitor.nric && visitor.nric?.length < 4) return;
|
|
1410
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1380
1411
|
debounceFetchNRIC();
|
|
1381
1412
|
}
|
|
1382
1413
|
|
|
@@ -1408,6 +1439,7 @@ function handleUpdatePhoneNumber() {
|
|
|
1408
1439
|
phoneSearchMenu.value = false;
|
|
1409
1440
|
return;
|
|
1410
1441
|
}
|
|
1442
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1411
1443
|
|
|
1412
1444
|
debounceFetchPhoneNumber();
|
|
1413
1445
|
}
|
|
@@ -1440,6 +1472,8 @@ function handleUpdateVehicleNumber() {
|
|
|
1440
1472
|
return;
|
|
1441
1473
|
}
|
|
1442
1474
|
|
|
1475
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1476
|
+
|
|
1443
1477
|
debounceFetchPlateNumber();
|
|
1444
1478
|
}
|
|
1445
1479
|
|