@7365admin1/layer-common 1.11.21 → 1.11.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.11.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 00a8179: Update Layer-common changes
8
+
3
9
  ## 1.11.21
4
10
 
5
11
  ### Patch Changes
@@ -123,7 +123,7 @@ const emit = defineEmits<{
123
123
  }>()
124
124
 
125
125
  const { getPassKeysByPageSearch } = usePassKey()
126
- const { updateVisitor } = useVisitor()
126
+ const { updateVisitorPassKey } = useVisitor()
127
127
 
128
128
  const processing = ref(false)
129
129
  const errorMessage = ref('')
@@ -232,28 +232,28 @@ async function handleSubmit() {
232
232
  processing.value = true
233
233
 
234
234
  try {
235
- const payload: Partial<TVisitorPayload> = {}
235
+ const payload: any = {}
236
236
 
237
237
  // Build final pass list: kept existing + newly selected
238
- const finalPasses: { keyId: string; status: string }[] = []
238
+ const finalPasses: { keyId: string }[] = []
239
239
  if (existingPass.value) {
240
- finalPasses.push({ keyId: existingPass.value.keyId, status: 'In Use' })
240
+ finalPasses.push({ keyId: existingPass.value.keyId })
241
241
  }
242
242
  if (selectedPass.value) {
243
- finalPasses.push({ keyId: selectedPass.value, status: 'In Use' })
243
+ finalPasses.push({ keyId: selectedPass.value})
244
244
  }
245
245
  payload.visitorPass = finalPasses
246
246
 
247
247
  // Build final keys list: kept existing + newly selected
248
248
  if (showKeys.value) {
249
- const finalKeys: { keyId: string; status: string }[] = [
250
- ...existingKeys.value.map(k => ({ keyId: k.keyId, status: 'In Use' })),
251
- ...selectedKeys.value.map(keyId => ({ keyId, status: 'In Use' })),
249
+ const finalKeys: { keyId: string}[] = [
250
+ ...existingKeys.value.map(k => ({ keyId: k.keyId })),
251
+ ...selectedKeys.value.map(keyId => ({ keyId })),
252
252
  ]
253
253
  payload.passKeys = finalKeys
254
254
  }
255
255
 
256
- await updateVisitor(prop.visitor._id, payload)
256
+ await updateVisitorPassKey(prop.visitor._id, payload)
257
257
  emit('done')
258
258
  emit('close')
259
259
  } catch (error: any) {
@@ -357,7 +357,6 @@
357
357
  import QrcodeVue from "qrcode.vue";
358
358
  import useAreas from "../composables/useAreas";
359
359
  import useUnits from "../composables/useUnits";
360
- import { useAreaPermission } from "../composables/useAreaPermission";
361
360
  import useSiteSettings from "../composables/useSiteSettings";
362
361
  import useUtils from "../composables/useUtils";
363
362
 
@@ -367,6 +366,11 @@ const props = defineProps({
367
366
  type: { type: String, default: "" },
368
367
  serviceType: { type: String, default: "" },
369
368
  scheduleRoute: { type: String, default: "cleaning-schedule" },
369
+ canViewAreas: { type: Boolean, default: true },
370
+ canCreateArea: { type: Boolean, default: false },
371
+ canUpdateArea: { type: Boolean, default: false },
372
+ canDeleteArea: { type: Boolean, default: false },
373
+ canImportArea: { type: Boolean, default: false },
370
374
  });
371
375
 
372
376
  const isCleanerArea = computed(() => {
@@ -553,13 +557,11 @@ function showMessage(msg: string, color: string = "error") {
553
557
  messageSnackbar.value = true;
554
558
  }
555
559
 
556
- const {
557
- canCreateArea,
558
- canUpdateArea,
559
- canDeleteArea,
560
- canImportArea,
561
- canViewAreas,
562
- } = useAreaPermission();
560
+ const canCreateArea = computed(() => props.canCreateArea);
561
+ const canUpdateArea = computed(() => props.canUpdateArea);
562
+ const canDeleteArea = computed(() => props.canDeleteArea);
563
+ const canImportArea = computed(() => props.canImportArea);
564
+ const canViewAreas = computed(() => props.canViewAreas);
563
565
 
564
566
  async function handleDownloadExcel() {
565
567
  try {
@@ -209,7 +209,6 @@
209
209
  </template>
210
210
 
211
211
  <script setup lang="ts">
212
- import { useUnitPermission } from "../composables/useUnitPermission";
213
212
  import useUnits from "../composables/useUnits";
214
213
  import useUtils from "../composables/useUtils";
215
214
 
@@ -217,6 +216,11 @@ const props = defineProps({
217
216
  orgId: { type: String, default: "" },
218
217
  site: { type: String, default: "" },
219
218
  serviceType: { type: String, default: "", required: true },
219
+ canViewUnits: { type: Boolean, default: true },
220
+ canCreateUnit: { type: Boolean, default: false },
221
+ canUpdateUnit: { type: Boolean, default: false },
222
+ canDeleteUnit: { type: Boolean, default: false },
223
+ canImportUnit: { type: Boolean, default: false },
220
224
  });
221
225
 
222
226
  const items = ref<Array<Record<string, any>>>([]);
@@ -299,13 +303,11 @@ function showMessage(msg: string, color: string = "error") {
299
303
  messageSnackbar.value = true;
300
304
  }
301
305
 
302
- const {
303
- canCreateUnit,
304
- canUpdateUnit,
305
- canDeleteUnit,
306
- canViewUnits,
307
- canImportUnit,
308
- } = useUnitPermission();
306
+ const canViewUnits = computed(() => props.canViewUnits);
307
+ const canCreateUnit = computed(() => props.canCreateUnit);
308
+ const canUpdateUnit = computed(() => props.canUpdateUnit);
309
+ const canDeleteUnit = computed(() => props.canDeleteUnit);
310
+ const canImportUnit = computed(() => props.canImportUnit);
309
311
 
310
312
  async function handleDownloadExcel() {
311
313
  try {
@@ -1012,7 +1012,7 @@ const membersFieldIncomplete = computed(() => {
1012
1012
  });
1013
1013
 
1014
1014
  onMounted(() => {
1015
- contractorStep.value = 2;
1015
+ contractorStep.value = 1;
1016
1016
  currentAutofillSource.value = null;
1017
1017
 
1018
1018
  if (prop.mode === 'register' && prop.visitorData) {
@@ -169,32 +169,11 @@
169
169
  </span>
170
170
 
171
171
  <span
172
- v-if="
173
- !item.checkOut &&
174
- (item?.status === 'registered' ||
175
- item?.status === 'unregistered') &&
176
- canCheckoutVisitor
177
- "
178
- >
179
- <span
180
- class="d-flex align-center ga-2"
181
- v-bind="menuProps"
182
- style="cursor: pointer"
183
- >
184
- <v-icon
185
- icon="mdi-clock-time-eight-outline"
186
- color="red"
187
- size="20"
188
- />
189
- <v-btn
190
- size="x-small"
191
- class="text-capitalize"
192
- color="red"
193
- text="Checkout"
194
- :loading="
195
- loading.checkingOut && item?._id === selectedVisitorId
196
- "
197
- />
172
+ v-if="!item.checkOut && (item?.status === 'registered' || item?.status === 'unregistered') && canCheckoutVisitor">
173
+ <span class="d-flex align-center ga-2" v-bind="menuProps" style="cursor:pointer">
174
+ <v-icon icon="mdi-clock-time-eight-outline" color="red" size="20" />
175
+ <v-btn size="x-small" class="text-capitalize" color="red" text="Checkout"
176
+ :loading="loading.checkingOut && item?._id === selectedVisitorId" @click.stop="handleCheckout(item._id)" />
198
177
  </span>
199
178
  </span>
200
179
  <span v-else class="d-flex align-center ga-2">
@@ -270,26 +249,12 @@
270
249
  </div>
271
250
  </template>
272
251
  <v-list density="compact">
273
- <v-list-item
274
- prepend-icon="mdi-logout"
275
- title="Checkout"
276
- @click.stop="handleCheckout(item._id)"
277
- />
278
- <v-list-item
279
- v-if="
280
- (item.visitorPass?.length ?? 0) > 0 ||
281
- (item.passKeys?.length ?? 0) > 0
282
- "
283
- prepend-icon="mdi-card-bulleted-outline"
284
- :title="item.checkOut ? 'View Pass/Key' : 'Edit Pass/Key'"
285
- @click.stop="handleOpenEditPassKey(item)"
286
- />
287
- <v-list-item
288
- v-if="showAddPassKeyButton(item)"
289
- prepend-icon="mdi-plus"
290
- title="Add Pass/Key"
291
- @click.stop="handleOpenAddPassKey(item)"
292
- />
252
+ <v-list-item v-if="!item?.checkOut" prepend-icon="mdi-logout" title="Checkout" @click.stop="handleCheckout(item._id)" />
253
+ <v-list-item v-if="(item.visitorPass?.length ?? 0) > 0 || (item.passKeys?.length ?? 0) > 0"
254
+ prepend-icon="mdi-card-bulleted-outline" :title="item.checkOut ? 'View Pass/Key' :'Edit Pass/Key'"
255
+ @click.stop="handleOpenEditPassKey(item)" />
256
+ <v-list-item v-if="showAddPassKeyButton(item)" prepend-icon="mdi-plus" title="Add Pass/Key"
257
+ @click.stop="handleOpenAddPassKey(item)" />
293
258
  </v-list>
294
259
  </v-menu>
295
260
  </v-row>
@@ -111,6 +111,17 @@ export default function () {
111
111
  );
112
112
  }
113
113
 
114
+ async function updateVisitorPassKey(_id: string, payload: TPassKeyPayload[]){
115
+ return await useNuxtApp().$api<Record<string, any>>(
116
+ `/api/visitor-transactions/replace-keys/id/${_id}`,
117
+ {
118
+ method: "PUT",
119
+ body: payload,
120
+ }
121
+ );
122
+ }
123
+
124
+
114
125
  return {
115
126
  typeFieldMap,
116
127
  visitorSelection,
@@ -119,5 +130,6 @@ export default function () {
119
130
  getVisitors,
120
131
  updateVisitor,
121
132
  deleteVisitor,
133
+ updateVisitorPassKey
122
134
  };
123
135
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.21",
5
+ "version": "1.11.22",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {