2023-01-16 19:37:39 +00:00
|
|
|
<template>
|
|
|
|
<StandardLayout>
|
2023-02-03 17:39:38 +00:00
|
|
|
<PageHead bordered><h1 class="text-2xl font-bold">Dashboard</h1></PageHead>
|
2023-01-28 07:30:11 +00:00
|
|
|
|
2023-01-16 19:37:39 +00:00
|
|
|
<p>Hello, {{ user.name }}</p>
|
2023-01-27 16:27:14 +00:00
|
|
|
|
2023-01-28 07:30:11 +00:00
|
|
|
<template v-if="expiringItems?.length">
|
|
|
|
<PageHead class="mt-4"
|
|
|
|
><h2 class="text-xl font-bold">Expiring soon</h2></PageHead
|
|
|
|
>
|
|
|
|
|
|
|
|
<div
|
|
|
|
class="flex flex-nowrap gap-1 overflow-x-scroll px-1 py-1 md:overflow-hidden"
|
|
|
|
>
|
|
|
|
<StoredItemCard
|
|
|
|
v-for="item of expiringItems"
|
|
|
|
:stored-item="item"
|
|
|
|
class="whitespace-nowrap rounded-md bg-white px-2 py-2 shadow-md ring-1 ring-black ring-opacity-5"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-02-03 17:39:38 +00:00
|
|
|
<PageHead class="mt-4">
|
|
|
|
<h2 class="text-xl font-bold">Buildings</h2>
|
|
|
|
</PageHead>
|
2023-01-28 07:30:11 +00:00
|
|
|
|
|
|
|
<div
|
|
|
|
class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"
|
|
|
|
v-if="buildings?.length"
|
|
|
|
>
|
|
|
|
<BuildingListItem v-for="building of buildings" :building="building" />
|
|
|
|
</div>
|
2023-01-16 19:37:39 +00:00
|
|
|
</StandardLayout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2023-01-28 07:30:11 +00:00
|
|
|
import { onMounted, ref } from 'vue';
|
2023-01-16 19:37:39 +00:00
|
|
|
import { useUserStore } from '../store/user.store';
|
|
|
|
import StandardLayout from '../components/StandardLayout.vue';
|
2023-01-28 07:30:11 +00:00
|
|
|
import PageHead from '../components/PageHead.vue';
|
|
|
|
import { useBuildingStore } from '../store/building.store';
|
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
|
import BuildingListItem from './building/BuildingListItem.vue';
|
|
|
|
import { useStorageStore } from '../store/storage.store';
|
|
|
|
import StoredItemCard from '../components/item/StoredItemCard.vue';
|
2023-01-16 19:37:39 +00:00
|
|
|
|
|
|
|
const userStore = useUserStore();
|
2023-01-28 07:30:11 +00:00
|
|
|
const storageStore = useStorageStore();
|
|
|
|
const buildingStore = useBuildingStore();
|
|
|
|
const { buildings, loadingBuildings } = storeToRefs(buildingStore);
|
|
|
|
const { expiringItems, loadingExpiringItems } = storeToRefs(storageStore);
|
2023-01-16 19:37:39 +00:00
|
|
|
const user = ref(userStore.user);
|
2023-01-27 16:27:14 +00:00
|
|
|
|
2023-01-28 07:30:11 +00:00
|
|
|
onMounted(() => {
|
|
|
|
storageStore.getExpiringItems();
|
|
|
|
});
|
2023-01-16 19:37:39 +00:00
|
|
|
</script>
|