0
0
Fork 0
This commit is contained in:
William Buezas 2024-07-01 08:43:15 -03:00
parent 86a016e375
commit e951894ac3
3 changed files with 52 additions and 28 deletions

View File

@ -17,6 +17,7 @@ const { t } = useI18n();
const paginateRef = ref(null);
const workersActiveOptions = ref([]);
const clientsOptions = ref([]);
const showHeaderFilters = ref(true);
const from = ref(Date.vnNew());
const to = ref(Date.vnNew());
@ -37,9 +38,11 @@ const filter = reactive({
},
});
const refetch = async () => await paginateRef.value.fetch();
watch(dateRange, (val) => {
filter.where['v.stamp'].between = val;
paginateRef.value.fetch();
refetch();
});
function exprBuilder(param, value) {
@ -166,6 +169,8 @@ const columns = computed(() => [
:no-data-label="t('globals.noResults')"
>
<template #top>
<div class="full-width row justify-between">
<div class="row">
<VnInputDate
:label="t('salesClientsTable.from')"
dense
@ -181,8 +186,18 @@ const columns = computed(() => [
v-model="to"
style="width: 150px"
/>
</div>
<div class="row q-gutter-x-sm">
<QBtn
color="primary"
icon="search"
@click="showHeaderFilters = !showHeaderFilters"
/>
<QBtn color="primary" icon="replay" @click="refetch()" />
</div>
</div>
</template>
<template #top-row="{ cols }">
<template v-if="showHeaderFilters" #top-row="{ cols }">
<QTr>
<QTd
v-for="(col, index) in cols"

View File

@ -50,7 +50,7 @@ const columns = computed(() => [
name: 'date',
field: 'dated',
align: 'left',
columnFilter: null,
sortable: true,
},
{
label: t('salesOrdersTable.client'),
@ -162,8 +162,7 @@ const redirectToOrderSummary = (orderId) => {
<QBadge
:color="getBadgeColor(row.date_send)"
text-color="black"
class="q-ma-none q-mb-md"
dense
class="q-pa-sm q-mb-md"
style="font-size: 14px"
>
{{ toDateFormat(row.date_send) }}

View File

@ -315,7 +315,9 @@ const getBadgeAttrs = (date) => {
if (comparation < 0) return { color: 'success', 'text-color': 'black' };
return { color: 'transparent', 'text-color': 'white' };
};
let refreshTimer = null;
const autoRefreshHandler = (value) => {
if (value)
refreshTimer = setInterval(() => paginateRef.value.fetch(), DEFAULT_AUTO_REFRESH);
@ -324,8 +326,10 @@ const autoRefreshHandler = (value) => {
refreshTimer = null;
}
};
const redirectToTicketSummary = (id) => {
router.push({ name: 'TicketSummary', params: { id } });
const url = `#/ticket/${id}/summary`;
window.open(url, '_blank');
};
const stateColors = {
@ -348,6 +352,11 @@ const formatShippedDate = (date) => {
return toDateFormat(_date);
};
const redirectToSales = (id) => {
const url = `#/ticket/${id}/sale`;
window.open(url, '_blank');
};
onMounted(async () => {
const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions');
allColumnNames.value = filteredColumns.map((col) => col.name);
@ -517,8 +526,10 @@ onMounted(async () => {
</template>
<template #body-cell-identifier="{ row }">
<QTd>
<span class="link" @click.stop.prevent>{{ row.id }}</span>
<span class="link" @click.stop.prevent>
{{ row.id }}
<TicketDescriptorProxy :id="row.id" />
</span>
</QTd>
</template>
<template #body-cell-client="{ row }">
@ -537,8 +548,7 @@ onMounted(async () => {
<QTd>
<QBadge
v-bind="getBadgeAttrs(row.shippedDate)"
class="q-ma-none"
dense
class="q-pa-sm"
style="font-size: 14px"
>
{{ formatShippedDate(row.shippedDate) }}
@ -555,7 +565,7 @@ onMounted(async () => {
v-else
:color="stateColors[row.classColor] || 'transparent'"
:text-color="stateColors[row.classColor] ? 'black' : 'white'"
dense
class="q-pa-sm"
style="font-size: 14px"
>
{{ row.state }}
@ -585,7 +595,7 @@ onMounted(async () => {
<QBadge
:color="totalPriceColor(row) || 'transparent'"
:text-color="totalPriceColor(row) ? 'black' : 'white'"
dense
class="q-pa-sm"
style="font-size: 14px"
>
{{ toCurrency(row.totalWithVat) }}
@ -601,7 +611,7 @@ onMounted(async () => {
class="q-mr-sm"
flat
dense
:to="{ name: 'TicketSale', params: { id: row.id } }"
@click="redirectToSales(row.id)"
>
<QTooltip>{{ t('salesTicketsTable.goToLines') }}</QTooltip>
</QBtn>