2022-09-03 09:17:57 +00:00
|
|
|
<template>
|
2023-01-01 21:50:48 +00:00
|
|
|
<NuxtLink class="group card rounded-md" :to="`/item/${item.id}`">
|
2023-01-19 05:44:06 +00:00
|
|
|
<div class="rounded-t flex flex-col justify-center bg-neutral text-neutral-content p-5">
|
2023-01-22 06:15:23 +00:00
|
|
|
<h2 class="text-lg mb-1 last:mb-0 font-bold two-line">{{ item.name }}</h2>
|
|
|
|
<div>
|
|
|
|
<NuxtLink v-if="item.location" class="text-sm hover:link" :to="`/location/${item.location.id}`">
|
2023-01-01 21:50:48 +00:00
|
|
|
{{ item.location.name }}
|
2023-01-22 06:15:23 +00:00
|
|
|
</NuxtLink>
|
|
|
|
<span class="flex-1"></span>
|
|
|
|
</div>
|
2023-01-01 21:50:48 +00:00
|
|
|
</div>
|
|
|
|
<div class="rounded-b p-4 pt-2 flex-grow col-span-4 flex flex-col gap-y-2 bg-base-100">
|
|
|
|
<div class="flex justify-between gap-2">
|
|
|
|
<div class="mr-auto tooltip tooltip-tip" data-tip="Purchase Price">
|
2023-01-22 06:15:23 +00:00
|
|
|
<span v-if="item.purchasePrice != '0'" class="badge badge-sm badge-ghost h-5">
|
2023-01-01 21:50:48 +00:00
|
|
|
<Currency :amount="item.purchasePrice" />
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div v-if="item.insured" class="tooltip z-10" data-tip="Insured">
|
|
|
|
<Icon class="h-5 w-5 text-primary" name="mdi-shield-check" />
|
|
|
|
</div>
|
|
|
|
<div v-if="item.quantity > 1" class="tooltip" data-tip="Quantity">
|
|
|
|
<span class="badge h-5 w-5 badge-primary badge-sm text-xs">
|
|
|
|
{{ item.quantity }}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<Markdown class="mb-2 text-clip three-line" :source="item.description" />
|
|
|
|
|
|
|
|
<div class="flex gap-2 flex-wrap -mr-1 mt-auto justify-end">
|
|
|
|
<LabelChip v-for="label in top3" :key="label.id" :label="label" size="sm" />
|
2022-09-03 09:17:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</NuxtLink>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-09-12 22:47:27 +00:00
|
|
|
import { ItemOut, ItemSummary } from "~~/lib/api/types/data-contracts";
|
2023-01-01 21:50:48 +00:00
|
|
|
|
|
|
|
const top3 = computed(() => {
|
|
|
|
return props.item.labels.slice(0, 3) || [];
|
|
|
|
});
|
2022-09-03 09:17:57 +00:00
|
|
|
|
2022-09-06 18:32:13 +00:00
|
|
|
const props = defineProps({
|
2022-09-03 09:17:57 +00:00
|
|
|
item: {
|
2022-09-12 22:47:27 +00:00
|
|
|
type: Object as () => ItemOut | ItemSummary,
|
2022-09-03 09:17:57 +00:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2023-01-01 21:50:48 +00:00
|
|
|
|
|
|
|
<style lang="css">
|
|
|
|
.three-line {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 3;
|
|
|
|
line-clamp: 3;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
}
|
|
|
|
|
|
|
|
.two-line {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
}
|
|
|
|
</style>
|