library/frontend/pages/medias/index.vue

63 lines
1.6 KiB
Vue
Raw Normal View History

2023-07-13 20:25:53 -07:00
<script setup lang="ts">
import medias from '@data/medias'
2023-07-14 20:36:30 -07:00
const category = ref('Books')
2023-07-13 20:25:53 -07:00
const mediaList = computed(() => {
2023-07-14 20:36:30 -07:00
return medias.filter((m) => {
return m.type === category.value.toLowerCase().slice(0, -1)
})
2023-07-13 20:25:53 -07:00
})
</script>
<template>
<section>
<Table>
<TableThead>
<tr>
<TableTh>Title</TableTh>
<TableTh>Copies</TableTh>
<TableTh>Checked Out</TableTh>
<TableTh actions>
2023-07-14 20:32:41 -07:00
<Dropdown :options="['Books', 'Films', 'Albums']"
2023-07-14 20:36:30 -07:00
@select="(i) => (category = (i as string))">
2023-07-14 20:32:41 -07:00
{{ category }}
</Dropdown>
2023-07-13 20:25:53 -07:00
<PrimaryButton>Add New</PrimaryButton>
</TableTh>
</tr>
</TableThead>
<TableTbody>
<tr v-for="(media, index) in mediaList" :key="index">
<TableTd>
<div>{{ media.title }}</div>
<SecondaryInfo>{{ media.name }}</SecondaryInfo>
</TableTd>
<TableTd>{{ media.copies }}</TableTd>
<TableTd>
<div>{{ media.checkedOut }}</div>
2023-07-13 21:44:04 -07:00
<SecondaryInfo v-if="media.holds.length > 0">
{{ media.holds.length }} on hold
</SecondaryInfo>
2023-07-13 20:25:53 -07:00
</TableTd>
<TableTd actions>
<NuxtLink :to="`/medias/${media.id}/checkout`">Check Out</NuxtLink>
<NuxtLink :to="`/medias/${media.id}`">View</NuxtLink>
<NuxtLink :to="`/medias/${media.id}/edit`">Edit</NuxtLink>
</TableTd>
</tr>
</TableTbody>
</Table>
</section>
</template>
<style scoped lang="postcss">
2023-07-13 21:44:04 -07:00
section {
2023-07-15 14:02:49 -07:00
@apply w-full;
2023-07-13 21:44:04 -07:00
}
2023-07-13 20:25:53 -07:00
</style>