@7365admin1/layer-common 4.0.4-staging.239 → 4.0.4-staging.241

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.
@@ -8,6 +8,18 @@
8
8
  :disabled="bulkUploadLoading" @click="openBulkUploadFilePicker()">
9
9
  Bulk Upload
10
10
  </AppButton>
11
+ <v-tooltip v-if="canCreate && canCreateUnit" text="Download Template" location="top">
12
+ <template #activator="{ props: tooltipProps }">
13
+ <AppButton
14
+ v-bind="tooltipProps"
15
+ variant="icon"
16
+ class="bg-primary"
17
+ icon="mdi-tray-arrow-down"
18
+ aria-label="Download Template"
19
+ @click="downloadBulkUploadTemplate"
20
+ />
21
+ </template>
22
+ </v-tooltip>
11
23
  <AppButton v-if="canCreate && canCreateUnit" icon="mdi-plus" @click="setBuilding()">
12
24
  Add Unit
13
25
  </AppButton>
@@ -342,6 +354,15 @@ function openBulkUploadFilePicker() {
342
354
  }
343
355
  }
344
356
 
357
+ function downloadBulkUploadTemplate() {
358
+ const link = document.createElement("a");
359
+ link.href = "/files/Bulk-Upload-Unit-Template.xlsx";
360
+ link.download = "Bulk-Upload-Unit-Template.xlsx";
361
+ document.body.appendChild(link);
362
+ link.click();
363
+ document.body.removeChild(link);
364
+ }
365
+
345
366
  function formatSkippedSummaryReason(item: Record<string, any>) {
346
367
  if (Array.isArray(item.errors) && item.errors.length) {
347
368
  return item.errors.join(", ");
@@ -175,22 +175,6 @@
175
175
  autocomplete="off" :hide-no-data="true" :items="companyNames" item-value="value"
176
176
  @update:model-value="handleSelectCompanyName" variant="outlined" density="comfortable" persistent-hint
177
177
  small-chips>
178
- <!-- <template v-slot:no-data>
179
- <v-list-item>
180
- <v-list-item-title v-if="companyNameInput" @click.stop="handleAddNewCompany"
181
- class="d-flex align-center ga-1">
182
- <span><v-icon icon="mdi-plus" /></span>Add "<strong>{{
183
- companyNameInput
184
- }}</strong>" as new company.
185
- </v-list-item-title>
186
- <v-list-item-title v-else-if="!companyNameInput && companyNames.length === 0">
187
- Start typing to search for companies.
188
- </v-list-item-title>
189
- <v-list-item-title v-else>
190
- No companies available. Start typing to add a new one.
191
- </v-list-item-title>
192
- </v-list-item>
193
- </template> -->
194
178
  </v-combobox>
195
179
  </v-col>
196
180
  </template>
@@ -204,21 +188,14 @@
204
188
  :loading="siteDataPending" variant="outlined" density="comfortable" persistent-hint small-chips>
205
189
  <template v-slot:no-data>
206
190
  <v-list-item>
207
- <v-list-item-title v-if="fetchCompanyListPending">
208
- <v-progress-circular indeterminate size="20" class="mr-3" />
209
- Searching companies…
210
- </v-list-item-title>
211
- <v-list-item-title v-else-if="companyNameInput" @click.stop="handleAddNewCompany"
191
+ <v-list-item-title v-if="deliveryCompanyInput" @click.stop="deliveryCompany = deliveryCompanyInput"
212
192
  class="d-flex align-center ga-1">
213
193
  <span><v-icon icon="mdi-plus" /></span>Add "<strong>{{
214
- companyNameInput
194
+ deliveryCompanyInput
215
195
  }}</strong>" as new company.
216
196
  </v-list-item-title>
217
- <v-list-item-title v-else-if="!companyNameInput && companyNames.length === 0">
218
- Start typing to search for companies.
219
- </v-list-item-title>
220
197
  <v-list-item-title v-else>
221
- No companies available. Start typing to add a new one.
198
+ No companies available.
222
199
  </v-list-item-title>
223
200
  </v-list-item>
224
201
  </template>
@@ -696,7 +673,6 @@ const {
696
673
  findPersonByNRICMultipleResult,
697
674
  findPersonByPhoneNumberMultipleResult,
698
675
  findPersonByPlateNumberMultipleResult,
699
- searchCompanyList,
700
676
  } = usePeople();
701
677
  const { getById: getUnitDataById } = useBuildingUnit();
702
678
 
@@ -949,15 +925,6 @@ const showEntryPassInformation = computed(() => {
949
925
  });
950
926
 
951
927
  const companyNames = ref<string[]>([]);
952
- const companyAutofillDataArray = ref<
953
- {
954
- companyName: string[];
955
- unit: string;
956
- block: number;
957
- level: string;
958
- unitName: string;
959
- }[]
960
- >([]);
961
928
  const nricSearchMenu = ref(false);
962
929
  const nricSearchResults = ref<Partial<TPeople>[]>([]);
963
930
  const skipNricFetch = ref(false);
@@ -1028,27 +995,10 @@ async function handleAddNewContractorType() {
1028
995
 
1029
996
  async function handleSelectCompanyName(company: string) {
1030
997
  visitor.company = company;
1031
- // const selected = companyAutofillDataArray.value.find(x => x.companyName?.includes(company))
1032
- // if (!selected) return
1033
-
1034
- // visitor.block = selected.block || ""
1035
- // visitor.level = selected.level || ""
1036
- // visitor.unit = selected.unit || ""
1037
- // visitor.unitName = selected.unitName || ""
1038
998
  }
1039
999
 
1040
1000
  const companyCombo = ref(null);
1041
1001
 
1042
- async function handleAddNewCompany() {
1043
- visitor.company = companyNameInput.value;
1044
-
1045
- const combo = companyCombo.value as any;
1046
- await nextTick();
1047
-
1048
- combo.isMenuActive = false;
1049
- combo.$el.querySelector("input")?.blur();
1050
- }
1051
-
1052
1002
  const {
1053
1003
  data: fetchPersonByNRICReq,
1054
1004
  refresh: fetchPersonByNRICRefresh,
@@ -1321,21 +1271,6 @@ function confirmNricAutofillOptions() {
1321
1271
  closeNricAutofillOptions();
1322
1272
  }
1323
1273
 
1324
- const {
1325
- data: fetchCompanyListReq,
1326
- refresh: fetchCompanyListRefresh,
1327
- pending: fetchCompanyListPending,
1328
- } = useLazyAsyncData(`fetch-company-list`, () => {
1329
- if (!companyNameInput.value) return Promise.resolve(null);
1330
- return searchCompanyList(companyNameInput.value);
1331
- });
1332
-
1333
- watch(fetchCompanyListReq, (arr) => {
1334
- if (Array.isArray(arr)) {
1335
- companyAutofillDataArray.value = arr;
1336
- companyNames.value = arr?.flatMap((x) => x?.companyName);
1337
- }
1338
- });
1339
1274
  function getVisitorSearchItems(res: any): TVisitor[] {
1340
1275
  const items =
1341
1276
  res?.items ||
@@ -1498,19 +1433,6 @@ async function handleNfcReturnCheckout() {
1498
1433
  }
1499
1434
  }
1500
1435
 
1501
- const debounceFetchCompany = debounce(
1502
- async () => fetchCompanyListRefresh(),
1503
- 200
1504
- );
1505
-
1506
- watch(companyNameInput, async (val) => {
1507
- if (!val) {
1508
- companyNames.value = [];
1509
- return;
1510
- }
1511
- await debounceFetchCompany();
1512
- });
1513
-
1514
1436
  function handleAutofillDataViaVehicleNumber(item: TPeople) {
1515
1437
  currentAutofillSource.value = "vehicleNumber";
1516
1438
 
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.0.4-staging.239",
5
+ "version": "4.0.4-staging.241",
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.",