forked from mirrors/homebox
card option 1
This commit is contained in:
parent
58d6f9a28c
commit
149f16a600
1 changed files with 39 additions and 13 deletions
|
@ -3,20 +3,42 @@
|
||||||
class="group card bg-neutral text-neutral-content hover:bg-primary transition-colors duration-300"
|
class="group card bg-neutral text-neutral-content hover:bg-primary transition-colors duration-300"
|
||||||
:to="`/item/${item.id}`"
|
:to="`/item/${item.id}`"
|
||||||
>
|
>
|
||||||
<div class="card-body py-4 px-6">
|
<div class="card-body p-4 gap-3">
|
||||||
<h2 class="card-title">
|
<h2 class="card-title">
|
||||||
<Icon name="mdi-package-variant" />
|
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
<Icon v-if="item.archived" class="ml-auto" name="mdi-archive-outline" />
|
<Icon v-if="item.archived" class="ml-auto" name="mdi-archive-outline" />
|
||||||
|
<Icon v-else class="ml-auto" name="mdi-package-variant" />
|
||||||
</h2>
|
</h2>
|
||||||
<p>{{ description }}</p>
|
<div v-if="colOne" class="flex gap-x-2 items-center justify-between">
|
||||||
|
<NuxtLink
|
||||||
|
v-if="item.location"
|
||||||
|
class="badge badge-primary group-hover:badge-ghost"
|
||||||
|
:to="`/location/${item.location.id}`"
|
||||||
|
>
|
||||||
|
<Icon name="heroicons-map-pin" class="mr-2 swap-on"></Icon>
|
||||||
|
{{ item.location.name }}
|
||||||
|
</NuxtLink>
|
||||||
|
<div class="flex gap-2 ml-auto items-end">
|
||||||
|
<div v-if="item.purchasePrice" class="tooltip" data-tip="Purchase Price">
|
||||||
|
<span class="badge badge-ghost">
|
||||||
|
<Currency :amount="item.purchasePrice" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.insured" class="tooltip" data-tip="Insured">
|
||||||
|
<Icon class="h-5 w-5 text-base-200" name="mdi-shield-check" />
|
||||||
|
</div>
|
||||||
|
<div v-if="item.quantity > 1" class="tooltip" data-tip="Quantity">
|
||||||
|
<span class="badge badge-ghost">
|
||||||
|
{{ item.quantity }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="w-[100%] group-hover:bg-neutral-content h-[3px] transition-colors duration-300 rounded-box bg-primary"
|
||||||
|
></span>
|
||||||
<div class="flex gap-2 flex-wrap justify-end">
|
<div class="flex gap-2 flex-wrap justify-end">
|
||||||
<LabelChip
|
<LabelChip v-for="label in top3" :key="label.id" :label="label" size="sm" />
|
||||||
v-for="label in item.labels"
|
|
||||||
:key="label.id"
|
|
||||||
:label="label"
|
|
||||||
class="badge-primary group-hover:badge-secondary"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
@ -24,7 +46,14 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ItemOut, ItemSummary } from "~~/lib/api/types/data-contracts";
|
import { ItemOut, ItemSummary } from "~~/lib/api/types/data-contracts";
|
||||||
import { truncate } from "~~/lib/strings";
|
|
||||||
|
const colOne = computed(() => {
|
||||||
|
return props.item.location || props.item.purchasePrice;
|
||||||
|
});
|
||||||
|
|
||||||
|
const top3 = computed(() => {
|
||||||
|
return props.item.labels.slice(0, 3) || [];
|
||||||
|
});
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
|
@ -32,7 +61,4 @@
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const description = computed(() => {
|
|
||||||
return truncate(props.item.description, 80);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue