@7365admin1/layer-common 3.0.31-staging.23 → 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 +41 -9
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -974,19 +974,44 @@ function applyNricSearchResult(
|
|
|
974
974
|
|
|
975
975
|
currentAutofillSource.value = options.source || "nric";
|
|
976
976
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
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
|
+
}
|
|
981
1006
|
|
|
982
1007
|
companyNames.value = Array.isArray(item.companyName) ? item.companyName : [];
|
|
983
1008
|
|
|
984
|
-
if (item.companyName && item.companyName.length === 1) {
|
|
1009
|
+
if (!visitor.company && item.companyName && item.companyName.length === 1) {
|
|
985
1010
|
visitor.company = item.companyName?.[0] || visitor.company;
|
|
986
1011
|
}
|
|
987
1012
|
|
|
988
|
-
if (item.companyName && item.companyName.length > 1) {
|
|
989
|
-
visitor.company = ""
|
|
1013
|
+
if (!visitor.company && item.companyName && item.companyName.length > 1) {
|
|
1014
|
+
visitor.company = "";
|
|
990
1015
|
}
|
|
991
1016
|
|
|
992
1017
|
|
|
@@ -1019,7 +1044,10 @@ function selectAutofillSearchResult(item: Partial<TPeople>, source: Exclude<Auto
|
|
|
1019
1044
|
const selectedPlate =
|
|
1020
1045
|
findMatchingPlateOption(plateOptions, visitor.plateNumber) || plateOptions[0] || "";
|
|
1021
1046
|
|
|
1022
|
-
|
|
1047
|
+
const needsContactChoice = !visitor.contact?.trim() && contactOptions.length > 1;
|
|
1048
|
+
const needsPlateChoice = !visitor.plateNumber?.trim() && plateOptions.length > 1;
|
|
1049
|
+
|
|
1050
|
+
if (needsContactChoice || needsPlateChoice) {
|
|
1023
1051
|
nricSearchMenu.value = false;
|
|
1024
1052
|
phoneSearchMenu.value = false;
|
|
1025
1053
|
vehicleSearchMenu.value = false;
|
|
@@ -1379,6 +1407,7 @@ function handleUpdateNRIC() {
|
|
|
1379
1407
|
if (skipNricFetch.value) return;
|
|
1380
1408
|
if (!isNricFieldFocused.value) return;
|
|
1381
1409
|
if (visitor.nric && visitor.nric?.length < 4) return;
|
|
1410
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1382
1411
|
debounceFetchNRIC();
|
|
1383
1412
|
}
|
|
1384
1413
|
|
|
@@ -1410,6 +1439,7 @@ function handleUpdatePhoneNumber() {
|
|
|
1410
1439
|
phoneSearchMenu.value = false;
|
|
1411
1440
|
return;
|
|
1412
1441
|
}
|
|
1442
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1413
1443
|
|
|
1414
1444
|
debounceFetchPhoneNumber();
|
|
1415
1445
|
}
|
|
@@ -1442,6 +1472,8 @@ function handleUpdateVehicleNumber() {
|
|
|
1442
1472
|
return;
|
|
1443
1473
|
}
|
|
1444
1474
|
|
|
1475
|
+
if(prop.type === 'walk-in' || prop.type === 'drop-off') return;
|
|
1476
|
+
|
|
1445
1477
|
debounceFetchPlateNumber();
|
|
1446
1478
|
}
|
|
1447
1479
|
|