136 lines
4.7 KiB
Vue
136 lines
4.7 KiB
Vue
<script setup>
|
|
import { onMounted } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRouter } from 'vue-router';
|
|
import { useQuasar } from 'quasar';
|
|
|
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
import VnLv from 'src/components/ui/VnLv.vue';
|
|
import CardList from 'src/components/ui/CardList.vue';
|
|
import EntrySummaryDialog from './Card/EntrySummaryDialog.vue';
|
|
import EntryFilter from './EntryFilter.vue';
|
|
|
|
import { useStateStore } from 'stores/useStateStore';
|
|
import { toDate } from 'src/filters/index';
|
|
|
|
const stateStore = useStateStore();
|
|
const router = useRouter();
|
|
const quasar = useQuasar();
|
|
const { t } = useI18n();
|
|
|
|
function navigate(id) {
|
|
router.push({ path: `/entry/${id}` });
|
|
}
|
|
|
|
const redirectToCreateView = () => {
|
|
router.push({ name: 'EntryCreate' });
|
|
};
|
|
|
|
function viewSummary(id) {
|
|
quasar.dialog({
|
|
component: EntrySummaryDialog,
|
|
componentProps: {
|
|
id,
|
|
},
|
|
});
|
|
}
|
|
|
|
onMounted(async () => {
|
|
stateStore.rightDrawer = true;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
<QScrollArea class="fit text-grey-8">
|
|
<EntryFilter data-key="EntryList" />
|
|
</QScrollArea>
|
|
</QDrawer>
|
|
<QPage class="column items-center q-pa-md">
|
|
<div class="vn-card-list">
|
|
<VnPaginate
|
|
data-key="EntryList"
|
|
url="Entries/filter"
|
|
order="landed DESC, id DESC"
|
|
auto-load
|
|
>
|
|
<template #body="{ rows }">
|
|
<CardList
|
|
v-for="row of rows"
|
|
:key="row.id"
|
|
:title="row.reference"
|
|
@click="navigate(row.id)"
|
|
:id="row.id"
|
|
:has-info-icons="!!row.isExcludedFromAvailable || !!row.isRaid"
|
|
>
|
|
<template #info-icons>
|
|
<QIcon
|
|
v-if="row.isExcludedFromAvailable"
|
|
name="vn:inventory"
|
|
color="primary"
|
|
size="xs"
|
|
>
|
|
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
|
|
</QIcon>
|
|
<QIcon
|
|
v-if="row.isRaid"
|
|
name="vn:web"
|
|
color="primary"
|
|
size="xs"
|
|
>
|
|
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
|
|
</QIcon>
|
|
</template>
|
|
<template #list-items>
|
|
<VnLv
|
|
:label="t('entry.list.landed')"
|
|
:value="toDate(row.landed)"
|
|
/>
|
|
<VnLv
|
|
:label="t('entry.list.booked')"
|
|
:value="!!row.isBooked"
|
|
/>
|
|
<VnLv
|
|
:label="t('entry.list.invoiceNumber')"
|
|
:value="row.invoiceNumber"
|
|
/>
|
|
<VnLv
|
|
:label="t('entry.list.confirmed')"
|
|
:value="!!row.isConfirmed"
|
|
/>
|
|
<VnLv
|
|
:label="t('entry.list.supplier')"
|
|
:value="row.supplierName"
|
|
/>
|
|
<VnLv
|
|
:label="t('entry.list.ordered')"
|
|
:value="!!row.isOrdered"
|
|
/>
|
|
</template>
|
|
<template #actions>
|
|
<QBtn
|
|
:label="t('components.smartCard.openSummary')"
|
|
@click.stop="viewSummary(row.id)"
|
|
color="primary"
|
|
type="submit"
|
|
/>
|
|
</template>
|
|
</CardList>
|
|
</template>
|
|
</VnPaginate>
|
|
</div>
|
|
</QPage>
|
|
<QPageSticky :offset="[20, 20]">
|
|
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
|
<QTooltip>
|
|
{{ t('entry.list.newEntry') }}
|
|
</QTooltip>
|
|
</QPageSticky>
|
|
</template>
|
|
|
|
<i18n>
|
|
es:
|
|
Inventory entry: Es inventario
|
|
Virtual entry: Es una redada
|
|
</i18n>
|