@7365admin1/layer-common 3.0.31-staging.26 → 3.0.31-staging.28

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.
@@ -34,3 +34,14 @@ jobs:
34
34
 
35
35
  - name: Publish to npm with staging tag
36
36
  run: npm publish --tag staging --registry https://registry.npmjs.org
37
+
38
+ - name: Notify Discord on failure
39
+ if: failure()
40
+ env:
41
+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
42
+ run: |
43
+ MESSAGE="@everyone :rotating_light: **Publish Staging** failed in \`${{ github.repository }}\` (\`${{ github.workflow }}\`)
44
+ ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
45
+ curl -s -X POST -H "Content-Type: application/json" \
46
+ -d "$(jq -n --arg content "$MESSAGE" '{content: $content}')" \
47
+ "$DISCORD_WEBHOOK_URL"
@@ -121,6 +121,10 @@
121
121
  </v-row>
122
122
  </v-col>
123
123
 
124
+
125
+
126
+
127
+
124
128
  <v-col v-if="shouldShowField('deliveryType')" cols="12">
125
129
  <v-row>
126
130
  <v-col cols="12">
@@ -159,6 +163,7 @@
159
163
  </v-col>
160
164
  </template>
161
165
 
166
+
162
167
  <template v-if="shouldShowField('delivery-company')">
163
168
  <v-col cols="12">
164
169
  <InputLabel class="text-capitalize" title="Delivery Company" />
@@ -167,7 +172,7 @@
167
172
  :loading="siteDataPending" variant="outlined" density="comfortable" persistent-hint small-chips>
168
173
  <template v-slot:no-data>
169
174
  <v-list-item>
170
- <v-list-item-title v-if="siteDataPending">
175
+ <v-list-item-title v-if="fetchCompanyListPending">
171
176
  <v-progress-circular indeterminate size="20" class="mr-3" />
172
177
  Searching companies…
173
178
  </v-list-item-title>
@@ -175,7 +180,7 @@
175
180
  class="d-flex align-center ga-1">
176
181
  <span><v-icon icon="mdi-plus" /></span>Add "<strong>{{
177
182
  companyNameInput
178
- }}</strong>" as new company.
183
+ }}</strong>" as new company.
179
184
  </v-list-item-title>
180
185
  <v-list-item-title v-else-if="!companyNameInput && companyNames.length === 0">
181
186
  Start typing to search for companies.
@@ -190,7 +195,6 @@
190
195
  </template>
191
196
 
192
197
 
193
-
194
198
  <v-col v-if="shouldShowField('block')" cols="12">
195
199
  <InputLabel class="text-capitalize" title="Block" required />
196
200
  <v-autocomplete v-model="visitor.block" :items="blocksArray" item-value="value" autocomplete="off"
@@ -307,7 +311,7 @@
307
311
  <span class="text-no-wrap">NRIC: {{ selectedNricSearchResult.nric || "N/A" }}</span>
308
312
  </div>
309
313
 
310
- <template v-if="selectedNricContactOptions.length >= 1">
314
+ <template v-if="!visitor.contact && selectedNricContactOptions.length >= 1">
311
315
  <h3 class="nric-options-section-title font-weight-bold mb-2">Contact</h3>
312
316
  <v-radio-group v-model="selectedNricContact" hide-details color="success" class="nric-option-group">
313
317
  <v-radio v-for="contact in selectedNricContactOptions" :key="contact" :label="contact" :value="contact"
@@ -315,7 +319,7 @@
315
319
  </v-radio-group>
316
320
  </template>
317
321
 
318
- <template v-if="selectedNricPlateOptions.length >= 1">
322
+ <template v-if="!visitor.plateNumber && selectedNricPlateOptions.length >= 1">
319
323
  <h3 class="nric-options-section-title font-weight-bold mb-2 mt-5">Vehicle</h3>
320
324
  <v-radio-group v-model="selectedNricPlate" hide-details color="success" class="nric-option-group">
321
325
  <v-radio v-for="plate in selectedNricPlateOptions" :key="plate" :label="plate" :value="plate"
@@ -683,10 +687,6 @@ const requireNRIC = computed(() => {
683
687
  return prop.type !== "walk-in" && prop.type !== "guest";
684
688
  });
685
689
 
686
- const isVehicleRequired = computed(() => {
687
- return ["guest", "drop-off", "pick-up"].includes(prop.type);
688
- });
689
-
690
690
  const hidQrCodePassConfig = computed(() => {
691
691
  return (siteData.value as any)?.metadata?.hidQrCodePass || {};
692
692
  });
@@ -1084,9 +1084,21 @@ function confirmNricAutofillOptions() {
1084
1084
  closeNricAutofillOptions();
1085
1085
  }
1086
1086
 
1087
+ const {
1088
+ data: fetchCompanyListReq,
1089
+ refresh: fetchCompanyListRefresh,
1090
+ pending: fetchCompanyListPending,
1091
+ } = useLazyAsyncData(`fetch-company-list`, () => {
1092
+ if (!companyNameInput.value) return Promise.resolve(null);
1093
+ return searchCompanyList(companyNameInput.value);
1094
+ });
1087
1095
 
1088
-
1089
-
1096
+ watch(fetchCompanyListReq, (arr) => {
1097
+ if (Array.isArray(arr)) {
1098
+ companyAutofillDataArray.value = arr;
1099
+ companyNames.value = arr?.flatMap((x) => x?.companyName);
1100
+ }
1101
+ });
1090
1102
  function getVisitorSearchItems(res: any): TVisitor[] {
1091
1103
  const items =
1092
1104
  res?.items ||
@@ -1198,6 +1210,18 @@ async function handleCheckout(visitorId: string) {
1198
1210
  }
1199
1211
  }
1200
1212
 
1213
+ const debounceFetchCompany = debounce(
1214
+ async () => fetchCompanyListRefresh(),
1215
+ 200
1216
+ );
1217
+
1218
+ watch(companyNameInput, async (val) => {
1219
+ if (!val) {
1220
+ companyNames.value = [];
1221
+ return;
1222
+ }
1223
+ await debounceFetchCompany();
1224
+ });
1201
1225
 
1202
1226
  function handleAutofillDataViaVehicleNumber(item: TPeople) {
1203
1227
  currentAutofillSource.value = "vehicleNumber";
@@ -1206,7 +1230,9 @@ function handleAutofillDataViaVehicleNumber(item: TPeople) {
1206
1230
  visitor.nric = item.nric;
1207
1231
  visitor.contact = item.contact;
1208
1232
  companyNames.value = item.companyName ?? [];
1209
-
1233
+ if (!visitor.company) {
1234
+ visitor.company = companyNames.value?.[0];
1235
+ }
1210
1236
  visitor.block = item.block ?? "";
1211
1237
  visitor.level = item.level ?? "";
1212
1238
  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.26",
5
+ "version": "3.0.31-staging.28",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {