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`"
|
||||||
url="Entries/filter"
|
:url-create="`Entries`"
|
||||||
:order="['landed DESC', 'id DESC']"
|
save-url="Entries/crud"
|
||||||
auto-load
|
:create="{
|
||||||
>
|
urlCreate: 'Entries',
|
||||||
<template #body="{ rows }">
|
title: 'Create entry',
|
||||||
<CardList
|
onDataSaved: () => tableRef.reload(),
|
||||||
v-for="row of rows"
|
formInitialData: {
|
||||||
:key="row.id"
|
workerFk: entityId,
|
||||||
:title="row.reference"
|
},
|
||||||
@click="navigate(row.id)"
|
}"
|
||||||
:id="row.id"
|
order="id DESC"
|
||||||
:has-info-icons="!!row.isExcludedFromAvailable || !!row.isRaid"
|
:columns="columns"
|
||||||
>
|
default-mode="table"
|
||||||
<template #info-icons>
|
auto-load
|
||||||
<QIcon
|
:right-search="false"
|
||||||
v-if="row.isExcludedFromAvailable"
|
:is-editable="true"
|
||||||
name="vn:inventory"
|
:use-model="true"
|
||||||
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