@7365admin1/layer-common 3.0.31-staging.18 → 3.0.31-staging.19

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.
@@ -137,15 +137,11 @@
137
137
  <InputLabel class="text-capitalize" title="Company Name" />
138
138
  <v-combobox v-model="visitor.company" v-model:search="companyNameInput" ref="companyCombo"
139
139
  autocomplete="off" :hide-no-data="false" :items="companyNames" item-value="value"
140
- :loading="fetchCompanyListPending" @update:model-value="handleSelectCompanyName" variant="outlined"
140
+ @update:model-value="handleSelectCompanyName" variant="outlined"
141
141
  density="comfortable" persistent-hint small-chips>
142
- <template v-slot:no-data>
142
+ <!-- <template v-slot:no-data>
143
143
  <v-list-item>
144
- <v-list-item-title v-if="fetchCompanyListPending">
145
- <v-progress-circular indeterminate size="20" class="mr-3" />
146
- Searching companies…
147
- </v-list-item-title>
148
- <v-list-item-title v-else-if="companyNameInput" @click.stop="handleAddNewCompany"
144
+ <v-list-item-title v-if="companyNameInput" @click.stop="handleAddNewCompany"
149
145
  class="d-flex align-center ga-1">
150
146
  <span><v-icon icon="mdi-plus" /></span>Add "<strong>{{
151
147
  companyNameInput
@@ -158,7 +154,7 @@
158
154
  No companies available. Start typing to add a new one.
159
155
  </v-list-item-title>
160
156
  </v-list-item>
161
- </template>
157
+ </template> -->
162
158
  </v-combobox>
163
159
  </v-col>
164
160
  </template>
@@ -171,7 +167,7 @@
171
167
  :loading="siteDataPending" variant="outlined" density="comfortable" persistent-hint small-chips>
172
168
  <template v-slot:no-data>
173
169
  <v-list-item>
174
- <v-list-item-title v-if="fetchCompanyListPending">
170
+ <v-list-item-title v-if="siteDataPending">
175
171
  <v-progress-circular indeterminate size="20" class="mr-3" />
176
172
  Searching companies…
177
173
  </v-list-item-title>
@@ -970,10 +966,18 @@ function applyNricSearchResult(
970
966
  visitor.name = item.name || visitor.name;
971
967
  visitor.contact = options.contacts || getPersonContactOptions(item)[0] || visitor.contact;
972
968
  visitor.plateNumber = options.plateNumber || getPersonPlateOptions(item)[0] || visitor.plateNumber;
973
- companyNames.value = item.companyName ?? [];
974
- if (!visitor.company) {
975
- visitor.company = companyNames.value?.[0] || visitor.company;
969
+
970
+ companyNames.value = Array.isArray(item.companyName) ? item.companyName : [];
971
+
972
+ if(item.companyName && item.companyName.length === 1) {
973
+ visitor.company = item.companyName?.[0] || visitor.company;
974
+ }
975
+
976
+ if(item.companyName && item.companyName.length > 1){
977
+ visitor.company = ""
976
978
  }
979
+
980
+
977
981
  // visitor.block = (item.block as any) ?? (visitor.block as any) ?? "";
978
982
  // visitor.level = (item.level as any) ?? (visitor.level as any) ?? "";
979
983
  // visitor.unit = item.unit ?? visitor.unit ?? "";
@@ -1040,21 +1044,9 @@ function confirmNricAutofillOptions() {
1040
1044
  closeNricAutofillOptions();
1041
1045
  }
1042
1046
 
1043
- const {
1044
- data: fetchCompanyListReq,
1045
- refresh: fetchCompanyListRefresh,
1046
- pending: fetchCompanyListPending,
1047
- } = useLazyAsyncData(`fetch-company-list`, () => {
1048
- if (!companyNameInput.value) return Promise.resolve(null);
1049
- return searchCompanyList(companyNameInput.value);
1050
- });
1051
1047
 
1052
- watch(fetchCompanyListReq, (arr) => {
1053
- if (Array.isArray(arr)) {
1054
- companyAutofillDataArray.value = arr;
1055
- companyNames.value = arr?.flatMap((x) => x?.companyName);
1056
- }
1057
- });
1048
+
1049
+
1058
1050
  function getVisitorSearchItems(res: any): TVisitor[] {
1059
1051
  const items =
1060
1052
  res?.items ||
@@ -1165,18 +1157,6 @@ async function handleCheckout(visitorId: string) {
1165
1157
  }
1166
1158
  }
1167
1159
 
1168
- const debounceFetchCompany = debounce(
1169
- async () => fetchCompanyListRefresh(),
1170
- 200
1171
- );
1172
-
1173
- watch(companyNameInput, async (val) => {
1174
- if (!val) {
1175
- companyNames.value = [];
1176
- return;
1177
- }
1178
- await debounceFetchCompany();
1179
- });
1180
1160
 
1181
1161
  function handleAutofillDataViaVehicleNumber(item: TPeople) {
1182
1162
  currentAutofillSource.value = "vehicleNumber";
@@ -1185,9 +1165,7 @@ function handleAutofillDataViaVehicleNumber(item: TPeople) {
1185
1165
  visitor.nric = item.nric;
1186
1166
  visitor.contact = item.contact;
1187
1167
  companyNames.value = item.companyName ?? [];
1188
- if (!visitor.company) {
1189
- visitor.company = companyNames.value?.[0];
1190
- }
1168
+
1191
1169
  visitor.block = item.block ?? "";
1192
1170
  visitor.level = item.level ?? "";
1193
1171
  visitor.unit = item.unit ?? "";
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.0.31-staging.18",
5
+ "version": "3.0.31-staging.19",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {