forked from verdnatura/salix-front
perf: TransferSale and implementations
This commit is contained in:
parent
a53f4bd957
commit
437d70d415
|
@ -507,6 +507,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('ticketSale.transferLines') }}</QTooltip>
|
<QTooltip>{{ t('ticketSale.transferLines') }}</QTooltip>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
|
class="full-width"
|
||||||
:transfer="transfer"
|
:transfer="transfer"
|
||||||
:ticket="store.data"
|
:ticket="store.data"
|
||||||
@refresh-data="resetChanges()"
|
@refresh-data="resetChanges()"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import TicketTransferForm from './TicketTransferForm.vue';
|
||||||
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -26,15 +27,15 @@ const $props = defineProps({
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const _transfer = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => (_transfer.value = $props.transfer));
|
||||||
const emit = defineEmits(['refreshData']);
|
const emit = defineEmits(['refreshData']);
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const QPopupProxyRef = ref(null);
|
const QPopupProxyRef = ref(null);
|
||||||
|
|
||||||
const _transfer = ref(null);
|
|
||||||
|
|
||||||
const transferLinesColumns = computed(() => [
|
const transferLinesColumns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('ticketSale.id'),
|
label: t('ticketSale.id'),
|
||||||
|
@ -98,13 +99,11 @@ const transferSales = async (ticketId) => {
|
||||||
if (data && data.id === $props.ticket.id) emit('refreshData');
|
if (data && data.id === $props.ticket.id) emit('refreshData');
|
||||||
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (_transfer.value = $props.transfer));
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy :breakpoint="600" ref="QPopupProxyRef">
|
||||||
<QCard class="q-px-md" style="display: flex">
|
<QCard class="full-width q-px-md" style="display: flex; width: 100vw">
|
||||||
<QTable
|
<QTable
|
||||||
v-if="transfer.sales"
|
v-if="transfer.sales"
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
|
@ -135,9 +134,10 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
:columns="destinationTicketColumns"
|
:columns="destinationTicketColumns"
|
||||||
:title="t('Destination ticket')"
|
:title="t('Destination ticket')"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
|
@row-click="(_, row) => transferSales(row.id)"
|
||||||
>
|
>
|
||||||
<template #body-cell-address="{ row }">
|
<template #body-cell-address="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
|
@ -158,35 +158,21 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #no-data>
|
||||||
|
<TicketTransferForm @refresh-data="transferSales" />
|
||||||
|
</template>
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
<QForm class="q-mt-lg full-width">
|
<TicketTransferForm @refresh-data="transferSales" />
|
||||||
<VnInput
|
|
||||||
v-model.number="_transfer.ticketId"
|
|
||||||
:label="t('Transfer to ticket')"
|
|
||||||
:clearable="false"
|
|
||||||
>
|
|
||||||
<template #append>
|
|
||||||
<QBtn
|
|
||||||
icon="keyboard_arrow_right"
|
|
||||||
color="primary"
|
|
||||||
@click="transferSales(_transfer.ticketId)"
|
|
||||||
style="width: 30px"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnInput>
|
|
||||||
<QBtn
|
|
||||||
:label="t('New ticket')"
|
|
||||||
color="primary"
|
|
||||||
class="full-width q-my-lg"
|
|
||||||
@click="transferSales()"
|
|
||||||
/>
|
|
||||||
</QForm>
|
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss">
|
||||||
|
.q-table__bottom.row.items-center.q-table__bottom--nodata {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Sales to transfer: Líneas a transferir
|
Sales to transfer: Líneas a transferir
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['refreshData']);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const newTicket = ref(null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QForm class="q-mt-lg full-width">
|
||||||
|
<VnInput
|
||||||
|
v-model.number="newTicket"
|
||||||
|
:label="t('Transfer to ticket')"
|
||||||
|
:clearable="false"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<QBtn
|
||||||
|
icon="keyboard_arrow_right"
|
||||||
|
color="primary"
|
||||||
|
@click="emit('refreshData', newTicket)"
|
||||||
|
style="width: 30px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
<QBtn
|
||||||
|
:label="t('New ticket')"
|
||||||
|
color="primary"
|
||||||
|
class="full-width q-my-lg"
|
||||||
|
@click="emit('refreshData')"
|
||||||
|
/>
|
||||||
|
</QForm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Sales to transfer: Líneas a transferir
|
||||||
|
Destination ticket: Ticket destinatario
|
||||||
|
Transfer to ticket: Transferir a ticket
|
||||||
|
New ticket: Nuevo ticket
|
||||||
|
</i18n>
|
|
@ -247,8 +247,10 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) {
|
||||||
}
|
}
|
||||||
const { store } = useArrayData(URL_KEY);
|
const { store } = useArrayData(URL_KEY);
|
||||||
const handleRows = (rows) => {
|
const handleRows = (rows) => {
|
||||||
|
rows.forEach((row) => (row.concept = item.value.name));
|
||||||
|
rows = rows.sort(freeFirst);
|
||||||
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
||||||
return rows.sort(freeFirst);
|
return rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
const itemProposalEvt = ({ itemProposal }) => {
|
const itemProposalEvt = ({ itemProposal }) => {
|
||||||
|
@ -364,9 +366,15 @@ const replaceItem = () => {
|
||||||
{{ t('globals.split') }}
|
{{ t('globals.split') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn> -->
|
</QBtn> -->
|
||||||
<QBtn color="primary" icon="vn:splitline" @click="setTransferParams()">
|
<QBtn color="primary" icon="vn:splitline">
|
||||||
<QTooltip>{{ t('ticketSale.transferLines') }}</QTooltip>
|
<QTooltip>{{ t('ticketSale.transferLines') }}</QTooltip>
|
||||||
<TicketTransfer></TicketTransfer
|
<TicketTransfer
|
||||||
|
class="full-width"
|
||||||
|
:transfer="{
|
||||||
|
sales: selectedRows,
|
||||||
|
lastActiveTickets: selectedRows.map((row) => row.ticketFk),
|
||||||
|
}"
|
||||||
|
></TicketTransfer
|
||||||
></QBtn>
|
></QBtn>
|
||||||
<QBtn color="primary" @click="showProposalDialog = true">
|
<QBtn color="primary" @click="showProposalDialog = true">
|
||||||
<QIcon name="import_export" class="rotate-90"></QIcon>
|
<QIcon name="import_export" class="rotate-90"></QIcon>
|
||||||
|
|
Loading…
Reference in New Issue