@7365admin1/layer-common 3.1.2-staging.34 → 3.1.2-staging.36

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.
@@ -36,10 +36,17 @@
36
36
  </template>
37
37
 
38
38
  <v-list v-if="nricSearchResults.length" class="pa-1 phone-search-results">
39
- <v-list-item v-for="(item, index) in nricSearchResults" :key="item._id || index"
40
- @click="selectNricSearchResult(item)" class="cursor-pointer nric-search-item">
41
- <VisitorSearchResultSummary :item="item" />
42
- </v-list-item>
39
+ <div class="search-results-scroll">
40
+ <v-list-item v-for="(item, index) in nricSearchResults" :key="item._id || index"
41
+ @click="selectNricSearchResult(item)" class="cursor-pointer nric-search-item">
42
+ <VisitorSearchResultSummary :item="item" />
43
+ </v-list-item>
44
+ </div>
45
+ <div class="search-results-close pa-1">
46
+ <v-btn block variant="flat" color="red" @click.stop="closeAutofillSearchResults('nric')">
47
+ Close
48
+ </v-btn>
49
+ </div>
43
50
  </v-list>
44
51
  </v-menu>
45
52
  </v-col>
@@ -58,10 +65,17 @@
58
65
  </template>
59
66
 
60
67
  <v-list v-if="phoneSearchResults.length" class="pa-1 phone-search-results">
61
- <v-list-item v-for="(item, index) in phoneSearchResults" :key="item._id || index"
62
- @click="selectPhoneNumberSearchResult(item)" class="cursor-pointer nric-search-item">
63
- <VisitorSearchResultSummary :item="item" />
64
- </v-list-item>
68
+ <div class="search-results-scroll">
69
+ <v-list-item v-for="(item, index) in phoneSearchResults" :key="item._id || index"
70
+ @click="selectPhoneNumberSearchResult(item)" class="cursor-pointer nric-search-item">
71
+ <VisitorSearchResultSummary :item="item" />
72
+ </v-list-item>
73
+ </div>
74
+ <div class="search-results-close pa-1">
75
+ <v-btn block variant="flat" color="red" @click.stop="closeAutofillSearchResults('contact')">
76
+ Close
77
+ </v-btn>
78
+ </div>
65
79
  </v-list>
66
80
  </v-menu>
67
81
  </v-col>
@@ -77,15 +91,23 @@
77
91
  <v-menu v-model="vehicleSearchMenu" location="bottom" offset-y :close-on-content-click="false">
78
92
  <template #activator="{ props }">
79
93
  <InputVehicleNumber v-bind="props" v-model="visitor.plateNumber" density="comfortable"
80
- @update:model-value="handleUpdateVehicleNumber" @focus="isPlateNumberFieldFocused = true"
94
+ @update:model-value="handleUpdateVehicleNumber" @focus="handleFocusPlateNumber"
81
95
  @blur="isPlateNumberFieldFocused = false" />
82
96
  </template>
83
97
 
84
98
  <v-list v-if="vehicleSearchResults.length" class="pa-1 phone-search-results">
85
- <v-list-item v-for="(item, index) in vehicleSearchResults" :key="item._id || index"
86
- @click="selectPlateNumberSearchResult(item)" class="cursor-pointer nric-search-item">
87
- <VisitorSearchResultSummary :item="item" />
88
- </v-list-item>
99
+ <div class="search-results-scroll">
100
+ <v-list-item v-for="(item, index) in vehicleSearchResults" :key="item._id || index"
101
+ @click="selectPlateNumberSearchResult(item)" class="cursor-pointer nric-search-item">
102
+ <VisitorSearchResultSummary :item="item" />
103
+ </v-list-item>
104
+ </div>
105
+ <div class="search-results-close pa-1">
106
+ <v-btn block variant="flat" color="red"
107
+ @click.stop="closeAutofillSearchResults('vehicleNumber')">
108
+ Close
109
+ </v-btn>
110
+ </div>
89
111
  </v-list>
90
112
  </v-menu>
91
113
  </v-col>
@@ -1066,6 +1088,23 @@ function selectAutofillSearchResult(item: Partial<TPeople>, source: Exclude<Auto
1066
1088
  });
1067
1089
  }
1068
1090
 
1091
+ function closeAutofillSearchResults(source: Exclude<AutofillSource, null>) {
1092
+ if (source === "nric") {
1093
+ nricSearchMenu.value = false;
1094
+ nricSearchResults.value = [];
1095
+ }
1096
+
1097
+ if (source === "contact") {
1098
+ phoneSearchMenu.value = false;
1099
+ phoneSearchResults.value = [];
1100
+ }
1101
+
1102
+ if (source === "vehicleNumber") {
1103
+ vehicleSearchMenu.value = false;
1104
+ vehicleSearchResults.value = [];
1105
+ }
1106
+ }
1107
+
1069
1108
  function closeNricAutofillOptions() {
1070
1109
  dialog.nricAutofillOptions = false;
1071
1110
  selectedNricSearchResult.value = null;
@@ -1503,6 +1542,15 @@ function handleUpdateVehicleNumber() {
1503
1542
  debounceFetchPlateNumber();
1504
1543
  }
1505
1544
 
1545
+ const handleFocusPlateNumber = () => {
1546
+ isPlateNumberFieldFocused.value = true;
1547
+ if (prop.mode === 'register') {
1548
+
1549
+ handleUpdateVehicleNumber();
1550
+ }
1551
+ };
1552
+
1553
+
1506
1554
  function backToSelection() {
1507
1555
  emit("back");
1508
1556
  message.value = "";
@@ -2108,10 +2156,22 @@ onMounted(() => {
2108
2156
  }
2109
2157
 
2110
2158
  .phone-search-results {
2159
+ display: flex;
2160
+ flex-direction: column;
2111
2161
  max-height: 400px;
2162
+ overflow: hidden;
2163
+ }
2164
+
2165
+ .search-results-scroll {
2166
+ flex: 1 1 auto;
2167
+ min-height: 0;
2112
2168
  overflow-y: auto;
2113
2169
  }
2114
2170
 
2171
+ .search-results-close {
2172
+ flex: 0 0 auto;
2173
+ }
2174
+
2115
2175
  .nric-options-card {
2116
2176
  border-radius: 16px !important;
2117
2177
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "3.1.2-staging.34",
5
+ "version": "3.1.2-staging.36",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {