#6321 - Negative ticket #158
|
@ -273,7 +273,6 @@ input::-webkit-inner-spin-button {
|
|||
}
|
||||
td {
|
||||
font-size: 11pt;
|
||||
border-top: 1px solid var(--vn-page-color);
|
||||
border-collapse: collapse;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ const gradientStyle = (value) => {
|
|||
}
|
||||
return color;
|
||||
};
|
||||
|
||||
const tagColor = (match) => `color: ${!match ? 'red' : 'var(--vn-label-color)'}`;
|
||||
const $props = defineProps({
|
||||
itemLack: {
|
||||
type: Object,
|
||||
|
@ -102,6 +102,42 @@ const columns = computed(() => [
|
|||
field: 'longName',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('proposal.tag5'),
|
||||
name: 'tag5',
|
||||
field: 'value5',
|
||||
// format: (val) => val,
|
||||
style: "color: 'red'",
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('proposal.tag6'),
|
||||
name: 'tag6',
|
||||
field: 'value6',
|
||||
// format: (val) => val,
|
||||
attrs: ({ model }) => {
|
||||
return {
|
||||
style: `color: var(--vn-label-color)`,
|
||||
};
|
||||
},
|
||||
style: (row) => `color: var(--vn-label-color)`,
|
||||
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('proposal.tag7'),
|
||||
name: 'tag7',
|
||||
field: 'value7',
|
||||
// format: (val) => val,
|
||||
style: "color: 'red'",
|
||||
columnClass: 'expand',
|
||||
},
|
||||
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
|
@ -243,42 +279,36 @@ const isDisabled = (row) => !isSelectionAvailable(row);
|
|||
{{ compatibilityItem(statusConditionalValue(row)) }}
|
||||
</QTooltip>
|
||||
</div>
|
||||
<div style="flex: 2 0 100%">
|
||||
<div style="flex: 2 0 100%; align-content: center">
|
||||
<div>
|
||||
<span style="font-size: x-small">({{ row.id }})</span
|
||||
><span class="link">{{ row.longName }}</span>
|
||||
<span class="link">{{ row.longName }}</span>
|
||||
<ItemDescriptorProxy :id="row.id" />
|
||||
</div>
|
||||
<div class="inline-tag">
|
||||
{{ tag }}
|
||||
<span
|
||||
:key="key"
|
||||
v-for="(tag, key) in [5, 6, 7]"
|
||||
class="text"
|
||||
:style="{
|
||||
color: row[`match${tag}`]
|
||||
? 'green'
|
||||
: 'var(--vn-label-color)',
|
||||
}"
|
||||
>
|
||||
{{ row[`value${tag}`] }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-available="{ row }">
|
||||
{{ row.available }}
|
||||
<template #column-tag5="{ row }">
|
||||
<span :style="tagColor(row.match5)">{{ row.value5 }}</span>
|
||||
</template>
|
||||
<template #column-tag6="{ row }">
|
||||
<span :style="tagColor(row.match6)">{{ row.value6 }}</span>
|
||||
</template>
|
||||
<template #column-tag7="{ row }">
|
||||
<span :style="tagColor(row.match7)">{{ row.value7 }}</span>
|
||||
</template>
|
||||
<template #column-counter="{ row }">
|
||||
{{ row.counter }}
|
||||
<span
|
||||
:style="{
|
||||
color: row[`match${tag}`] ? 'green' : 'var(--vn-label-color)',
|
||||
}"
|
||||
>{{ row.counter }}</span
|
||||
>
|
||||
</template>
|
||||
<template #column-minQuantity="{ row }">
|
||||
{{ row.minQuantity }}
|
||||
</template>
|
||||
<template #column-price2="{ row }">
|
||||
<div class="flex column items-center content-center">
|
||||
* {{ sales[0] }} **{{ row.price2 }}*
|
||||
<VnStockValueDisplay :value="sales[0].price - row.price2" />
|
||||
<span :class="[conditionalValuePrice(row.price2)]">{{
|
||||
toCurrency(row.price2)
|
||||
|
|
|
@ -7,7 +7,7 @@ import TicketTransferForm from './TicketTransferForm.vue';
|
|||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import transferSales from './components/transferSales';
|
||||
import split from './components/split';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
|
@ -93,16 +93,21 @@ const handleRowClick = (row) => {
|
|||
transferFormRef.value.transferSales(ticketId);
|
||||
}
|
||||
};
|
||||
const split = () => {
|
||||
const splitSelectedRows = async () => {
|
||||
const tickets = Array.isArray($props.ticket) ? $props.ticket : [$props.ticket];
|
||||
tickets.forEach(transferSales);
|
||||
await split(tickets);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="popupProxyRef" data-cy="ticketTransferPopup">
|
||||
<div class="flex row items-center q-ma-lg" v-if="$props.split">
|
||||
<QBtn class="q-mr-sm" color="primary" label="Split" @click="split"></QBtn>
|
||||
<QBtn
|
||||
class="q-mr-sm"
|
||||
color="primary"
|
||||
label="Split"
|
||||
@click="splitSelectedRows"
|
||||
></QBtn>
|
||||
<VnInputDate :label="$t('New date')" v-model="splitDate"></VnInputDate>
|
||||
</div>
|
||||
<QSeparator class="q-my-lg" color="primary" />
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export default async function (data) {
|
||||
const reducedData = data.reduce((acc, item) => {
|
||||
const existing = acc.find((obj) => obj.ticketFk === item.id);
|
||||
if (existing) {
|
||||
existing.sales.push(item.saleFk);
|
||||
} else {
|
||||
acc.push({ ticketFk: item.id, sales: [item.saleFk] });
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
console.log(reducedData);
|
||||
|
||||
const promises = reducedData.map((params) => axios.post(`Tickets/split`, params));
|
||||
|
||||
const results = await Promise.allSettled(promises);
|
||||
|
||||
// results.forEach((result, index) => {
|
||||
// if (result.status === 'fulfilled') {
|
||||
// console.log(`Promise ${index + 1} fulfilled:`, result.value.data);
|
||||
// // Mostrar notificación de éxito
|
||||
// Notify.create({
|
||||
// type: 'positive',
|
||||
// message: `Operación ${index + 1} completada con éxito.`,
|
||||
// });
|
||||
// } else {
|
||||
// console.error(`Promise ${index + 1} rejected:`, result.reason);
|
||||
// // Mostrar notificación de error
|
||||
// Notify.create({
|
||||
// type: 'negative',
|
||||
// message: `Operación ${index + 1} fallida: ${result.reason.message}`,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
return results;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
export default async function ({ ticketId, sales }) {
|
||||
const params = {
|
||||
ticketId,
|
||||
sales,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`tickets/${ticketId}/transferSales`, params);
|
||||
|
||||
return data;
|
||||
}
|
|
@ -175,11 +175,7 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
|
|||
}"
|
||||
></TicketTransfer>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
@click="showProposalDialog = true"
|
||||
:disable="selectedRows.length < 1"
|
||||
>
|
||||
<QBtn color="primary" @click="showProposalDialog = true">
|
||||
<QIcon
|
||||
name="import_export"
|
||||
class="rotate-90"
|
||||
|
|
Loading…
Reference in New Issue