forked from verdnatura/salix-front
fix: refs #7553 fixed TicketTransfer
This commit is contained in:
parent
d18ca14b4e
commit
f35e33cf10
|
@ -283,7 +283,7 @@ const getMana = async () => {
|
||||||
|
|
||||||
const selectedValidSales = computed(() => {
|
const selectedValidSales = computed(() => {
|
||||||
if (!sales.value) return;
|
if (!sales.value) return;
|
||||||
return selectedSales.value.filter((sale) => sale.id != undefined);
|
return [...selectedRows.value];
|
||||||
});
|
});
|
||||||
|
|
||||||
const onOpenEditPricePopover = async (sale) => {
|
const onOpenEditPricePopover = async (sale) => {
|
||||||
|
@ -418,6 +418,7 @@ const removeSales = async () => {
|
||||||
|
|
||||||
const setTransferParams = async () => {
|
const setTransferParams = async () => {
|
||||||
try {
|
try {
|
||||||
|
selectedSales.value = selectedValidSales.value;
|
||||||
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
||||||
transfer.value = {
|
transfer.value = {
|
||||||
lastActiveTickets: [],
|
lastActiveTickets: [],
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
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 TicketTransferForm from './TicketTransferForm.vue';
|
||||||
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
mana: {
|
mana: {
|
||||||
|
@ -28,13 +26,10 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['refreshData']);
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const QPopupProxyRef = ref(null);
|
const QPopupProxyRef = ref(null);
|
||||||
|
|
||||||
const _transfer = ref(null);
|
const _transfer = ref();
|
||||||
|
|
||||||
const transferLinesColumns = computed(() => [
|
const transferLinesColumns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -85,29 +80,13 @@ const destinationTicketColumns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const transferSales = async (ticketId) => {
|
|
||||||
const params = {
|
|
||||||
ticketId: ticketId,
|
|
||||||
sales: $props.transfer.sales,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data } = await axios.post(
|
|
||||||
`tickets/${$props.ticket.id}/transferSales`,
|
|
||||||
params
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data && data.id === $props.ticket.id) emit('refreshData');
|
|
||||||
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => (_transfer.value = $props.transfer));
|
onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef">
|
||||||
<QCard class="q-px-md" style="display: flex">
|
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||||
<QTable
|
<QTable
|
||||||
v-if="transfer.sales"
|
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
:columns="transferLinesColumns"
|
:columns="transferLinesColumns"
|
||||||
:title="t('Sales to transfer')"
|
:title="t('Sales to transfer')"
|
||||||
|
@ -121,9 +100,6 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
@keyup.enter="changeQuantity(row)"
|
|
||||||
@blur="changeQuantity(row)"
|
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
|
||||||
style="max-width: 60px"
|
style="max-width: 60px"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
|
|
|
@ -50,7 +50,6 @@ const transferSales = async (ticketId) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{ _transfer }}
|
|
||||||
<QForm class="q-mt-lg full-width">
|
<QForm class="q-mt-lg full-width">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model.number="_transfer.ticketId"
|
v-model.number="_transfer.ticketId"
|
||||||
|
|
|
@ -490,9 +490,7 @@ function setReference(data) {
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.risk" color="primary" name="vn:risk" size="xs">
|
<QIcon v-if="row.risk" color="primary" name="vn:risk" size="xs">
|
||||||
<QTooltip>
|
<QTooltip> {{ t('Risk') }}: {{ row.risk }} </QTooltip>
|
||||||
{{ t('Risk') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="row.hasComponentLack"
|
v-if="row.hasComponentLack"
|
||||||
|
|
Loading…
Reference in New Issue