@7365admin1/layer-common 4.97.1-staging.622 → 4.97.1-staging.623

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.
@@ -376,10 +376,16 @@
376
376
  Replace Card
377
377
  </v-list-item-title>
378
378
  </v-list-item>
379
- <v-list-item :disabled="!isSelectedCardPhysical" @click="historyDialog = true">
379
+ <!-- Any card type: the details dialog fetches by card id alone.
380
+ It was gated to physical cards, and with nothing selected on
381
+ open it read as broken, so the hint says what is missing. -->
382
+ <v-list-item :disabled="!selectedCardInUnit" @click="historyDialog = true">
380
383
  <v-list-item-title class="text-subtitle-2 cursor-pointer">
381
384
  Card Details
382
385
  </v-list-item-title>
386
+ <v-list-item-subtitle v-if="!selectedCardInUnit" class="text-caption">
387
+ Select a card first
388
+ </v-list-item-subtitle>
383
389
  </v-list-item>
384
390
  <v-list-item
385
391
  @click="emit('delete')"
@@ -437,10 +443,6 @@ const props = defineProps({
437
443
  type: Boolean,
438
444
  default: false,
439
445
  },
440
- isSelectedCardPhysical: {
441
- type: Boolean,
442
- default: false,
443
- },
444
446
  siteId: {
445
447
  type: String,
446
448
  default: "",
@@ -849,6 +851,25 @@ function toggleCard(card: Record<string, any>) {
849
851
  props.selectedCardInUnit?._id === card._id ? null : card
850
852
  );
851
853
  }
854
+
855
+ // A unit with a single card opens with it selected, so More actions works
856
+ // without a click on a chip that is the only choice anyway.
857
+ const unitCards = computed(() =>
858
+ ["available", "assigned", "replaced", "deleted"].flatMap((state) => [
859
+ ...(props.unit?.[state]?.physical ?? []),
860
+ ...(props.unit?.[state]?.non_physical ?? []),
861
+ ])
862
+ );
863
+
864
+ watch(
865
+ () => [props.modelValue, props.unit?._id],
866
+ () => {
867
+ if (!props.modelValue || props.selectedCardInUnit) return;
868
+ if (unitCards.value.length === 1) {
869
+ emit("update:selectedCardInUnit", unitCards.value[0]);
870
+ }
871
+ }
872
+ );
852
873
  </script>
853
874
 
854
875
  <style scoped>
@@ -106,7 +106,6 @@
106
106
  :can-delete-access-card="canDeleteAccessCard"
107
107
  :can-assign-to-person="canUpdateAccessCard && canAssignAccessCard"
108
108
  :is-selected-card-assigned-physical="isSelectedCardAssignedPhysical"
109
- :is-selected-card-physical="isSelectedCardPhysical"
110
109
  :site-id="siteId"
111
110
  :org-id="orgId"
112
111
  @replace="openReplaceDialog()"
@@ -252,14 +251,6 @@ const isSelectedCardAssignedPhysical = computed(() =>
252
251
  ) ?? false
253
252
  );
254
253
 
255
- const isSelectedCardPhysical = computed(() =>
256
- ["available", "assigned", "replaced", "deleted"].some((state) =>
257
- selectedCard.value?.[state]?.physical?.some(
258
- (c: any) => c._id === selectedCardInUnit.value?._id
259
- )
260
- )
261
- );
262
-
263
254
  const { getUserTypeAccessCards, deleteCard: _deleteCard } = useAccessManagement();
264
255
 
265
256
  const statsRef = ref<{ refresh: () => void } | null>(null);
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.97.1-staging.622",
5
+ "version": "4.97.1-staging.623",
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.",