0
0
Fork 0

feat: salesOrderTable

This commit is contained in:
Javier Segarra 2024-07-10 09:56:37 +02:00
parent f45b623f24
commit 44294bb46a
1 changed files with 66 additions and 62 deletions

View File

@ -5,7 +5,8 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js'; import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
@ -51,18 +52,21 @@ const columns = computed(() => [
field: 'dated', field: 'dated',
align: 'left', align: 'left',
sortable: true, sortable: true,
cardVisible: true,
}, },
{ {
label: t('salesOrdersTable.client'), label: t('salesOrdersTable.client'),
name: 'client', name: 'client',
align: 'left', align: 'left',
sortable: true, sortable: true,
cardVisible: true,
}, },
{ {
label: t('salesOrdersTable.salesPerson'), label: t('salesOrdersTable.salesPerson'),
name: 'salesPerson', name: 'salesPerson',
align: 'left', align: 'left',
sortable: true, sortable: true,
cardVisible: true,
}, },
]); ]);
@ -119,28 +123,29 @@ const redirectToOrderSummary = (orderId) => {
@on-fetch="(data) => (clientsOptions = data)" @on-fetch="(data) => (clientsOptions = data)"
/> />
<VnSubToolbar />
<QCard style="max-height: 380px; overflow-y: scroll"> <QCard style="max-height: 380px; overflow-y: scroll">
<VnPaginate <VnTable
ref="paginateRef" ref="paginateRef"
data-key="SalesMonitorOrders" data-key="SalesMonitorOrders"
url="SalesMonitors/ordersFilter" url="SalesMonitors/ordersFilter"
order="date_make DESC" order="date_make DESC"
:limit="6" :limit="6"
:right-search="false"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
auto-load auto-load
>
<template #body="{ rows }">
<QTable
:rows="rows"
:columns="columns" :columns="columns"
row-key="id" :table="{
selection="multiple" 'row-key': 'id',
v-model:selected="selectedRows" selection: 'multiple',
:pagination="{ rowsPerPage: 0 }" 'hide-bottom': true,
:no-data-label="t('globals.noResults')" }"
default-mode="table"
:without-header="false"
@row-click="(_, row) => redirectToOrderSummary(row.id)" @row-click="(_, row) => redirectToOrderSummary(row.id)"
v-model:selected="selectedRows"
> >
<template #top> <template #top-left>
<QBtn <QBtn
v-if="selectedRows.length > 0" v-if="selectedRows.length > 0"
icon="delete" icon="delete"
@ -157,7 +162,7 @@ const redirectToOrderSummary = (orderId) => {
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip> <QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
<template #body-cell-date="{ row }"> <template #column-date="{ row }">
<QTd> <QTd>
<QBadge <QBadge
:color="getBadgeColor(row.date_send)" :color="getBadgeColor(row.date_send)"
@ -170,7 +175,7 @@ const redirectToOrderSummary = (orderId) => {
<div>{{ toDateTimeFormat(row.date_make) }}</div> <div>{{ toDateTimeFormat(row.date_make) }}</div>
</QTd> </QTd>
</template> </template>
<template #body-cell-client="{ row }"> <template #column-client="{ row }">
<QTd> <QTd>
<div class="q-mb-md"> <div class="q-mb-md">
<span class="link">{{ row.clientName }}</span> <span class="link">{{ row.clientName }}</span>
@ -179,7 +184,8 @@ const redirectToOrderSummary = (orderId) => {
<span> {{ row.agencyName }}</span> <span> {{ row.agencyName }}</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-salesPerson="{ row }">
<template #column-salesPerson="{ row }">
<QTd> <QTd>
<div class="q-mb-md"> <div class="q-mb-md">
<span class="link">{{ row.salesPerson }}</span> <span class="link">{{ row.salesPerson }}</span>
@ -188,9 +194,7 @@ const redirectToOrderSummary = (orderId) => {
<span>{{ toCurrency(row.import) }}</span> <span>{{ toCurrency(row.import) }}</span>
</QTd> </QTd>
</template> </template>
</QTable> </VnTable>
</template>
</VnPaginate>
</QCard> </QCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>