forked from verdnatura/salix-front
refs #6897 vnTable, columns
This commit is contained in:
parent
01e44753e4
commit
f93929de6a
|
@ -1,15 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted } from 'vue';
|
import { onMounted, ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import { useRoute } from 'vue-router';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
|
||||||
import EntrySummary from './Card/EntrySummary.vue';
|
|
||||||
import EntryFilter from './EntryFilter.vue';
|
import EntryFilter from './EntryFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { toDate } from 'src/filters/index';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
|
||||||
|
@ -17,7 +14,8 @@ const stateStore = useStateStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const route = useRoute();
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/entry/${id}` });
|
router.push({ path: `/entry/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -26,6 +24,61 @@ const redirectToCreateView = () => {
|
||||||
router.push({ name: 'EntryCreate' });
|
router.push({ name: 'EntryCreate' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.id'),
|
||||||
|
name: 'id',
|
||||||
|
isTitle: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.reference'),
|
||||||
|
name: 'reference',
|
||||||
|
isTitle: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.created'),
|
||||||
|
name: 'created',
|
||||||
|
create: true,
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.supplierFk'),
|
||||||
|
name: 'supplierFk',
|
||||||
|
create: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'suppliers',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.isBooked'),
|
||||||
|
name: 'isBooked',
|
||||||
|
create: true,
|
||||||
|
component: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.isConfirmed'),
|
||||||
|
name: 'isConfirmed',
|
||||||
|
create: true,
|
||||||
|
component: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('entry.list.tableVisibleColumns.isOrdered'),
|
||||||
|
name: 'isOrdered',
|
||||||
|
create: true,
|
||||||
|
component: 'checkbox',
|
||||||
|
},
|
||||||
|
]);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
});
|
});
|
||||||
|
@ -42,83 +95,28 @@ onMounted(async () => {
|
||||||
<EntryFilter data-key="EntryList" />
|
<EntryFilter data-key="EntryList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<QPage class="column items-center q-pa-md">
|
<VnTable
|
||||||
<div class="vn-card-list">
|
ref="tableRef"
|
||||||
<VnPaginate
|
|
||||||
data-key="EntryList"
|
data-key="EntryList"
|
||||||
url="Entries/filter"
|
:url="`Entries`"
|
||||||
:order="['landed DESC', 'id DESC']"
|
:url-create="`Entries`"
|
||||||
|
save-url="Entries/crud"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'Entries',
|
||||||
|
title: 'Create entry',
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
formInitialData: {
|
||||||
|
workerFk: entityId,
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
order="id DESC"
|
||||||
|
:columns="columns"
|
||||||
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
:right-search="false"
|
||||||
<template #body="{ rows }">
|
:is-editable="true"
|
||||||
<CardList
|
:use-model="true"
|
||||||
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:net"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</template>
|
|
||||||
<template #list-items>
|
|
||||||
<VnLv :label="t('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, EntrySummary)"
|
|
||||||
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>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
Loading…
Reference in New Issue