#6321 - Negative ticket #158
|
@ -189,6 +189,8 @@ const isSelectionAvailable = (itemProposal) => {
|
||||||
(100 * itemProposal.available) / Math.abs($props.itemLack.lack) < 30;
|
(100 * itemProposal.available) / Math.abs($props.itemLack.lack) < 30;
|
||||||
return byQuantity;
|
return byQuantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
jsegarra marked this conversation as resolved
|
|||||||
|
const isDisabled = (row) => !isSelectionAvailable(row.value);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnTable
|
<VnTable
|
||||||
|
@ -214,22 +216,6 @@ const isSelectionAvailable = (itemProposal) => {
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #body-selection="props">
|
|
||||||
<QCheckbox
|
|
||||||
class="q-ma-xs"
|
|
||||||
flat
|
|
||||||
:disable="isSelectionAvailable(props.row)"
|
|
||||||
v-model="props.selected"
|
|
||||||
@update:model-value="(evt, _) => handleSelection(props.row, null)"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
<span v-if="isSelectionAvailable(props.row)">{{
|
|
||||||
t('proposal.available')
|
|
||||||
}}</span>
|
|
||||||
<span v-else>{{ t('proposal.available') }}</span>
|
|
||||||
</QTooltip>
|
|
||||||
</QCheckbox>
|
|
||||||
</template>
|
|
||||||
<template #column-longName="{ row }">
|
<template #column-longName="{ row }">
|
||||||
<QTd
|
<QTd
|
||||||
class="flex"
|
class="flex"
|
||||||
|
@ -244,13 +230,13 @@ const isSelectionAvailable = (itemProposal) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
:disable="isDisabled(row)"
|
||||||
|
@click="change(row)"
|
||||||
:class="{
|
:class="{
|
||||||
'fill-icon': isSelected(row),
|
'fill-icon': isSelected(row),
|
||||||
}"
|
}"
|
||||||
@click="change(row)"
|
|
||||||
:disable="!isSelectionAvailable(row)"
|
|
||||||
>
|
>
|
||||||
<QTooltip> {{ t('Open_details') }}</QTooltip>
|
<QTooltip> {{ isDisabled ? t('Disabled') : t('Enabled') }} </QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<div
|
<div
|
||||||
class="middle compatibility"
|
class="middle compatibility"
|
||||||
|
|
|
@ -134,6 +134,43 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
|
||||||
/>
|
/>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
|
<QBtn
|
||||||
|
data-cy="transferLines"
|
||||||
|
color="primary"
|
||||||
|
icon="vn:splitline"
|
||||||
|
:disable="selectedRows.length < 1"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('ticketSale.transferLines') }} </QTooltip>
|
||||||
|
<TicketTransfer
|
||||||
|
ref="transferFormRef"
|
||||||
|
split="true"
|
||||||
|
class="full-width"
|
||||||
|
:transfer="{
|
||||||
|
sales: selectedRows,
|
||||||
|
lastActiveTickets: selectedRows.map((row) => row.ticketFk),
|
||||||
|
}"
|
||||||
|
></TicketTransfer>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
data-cy="itemProposal"
|
||||||
|
color="primary"
|
||||||
|
@click="showProposalDialog = true"
|
||||||
|
:disable="selectedRows.length < 1"
|
||||||
|
>
|
||||||
|
<QIcon name="import_export" class="rotate-90"></QIcon>
|
||||||
|
<ItemProposalProxy
|
||||||
|
ref="proposalDialogRef"
|
||||||
|
:item-lack="itemLack"
|
||||||
|
:replace-action="true"
|
||||||
|
:sales="selectedRows"
|
||||||
|
@item-replaced="itemProposalEvt"
|
||||||
|
></ItemProposalProxy>
|
||||||
|
<QTooltip bottom anchor="bottom right">
|
||||||
|
{{ t('itemProposal') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</template>
|
||||||
|
<template #st-actions>
|
||||||
<QBtnGroup push style="column-gap: 1px">
|
<QBtnGroup push style="column-gap: 1px">
|
||||||
<VnPopupProxy
|
<VnPopupProxy
|
||||||
data-cy="changeItem"
|
data-cy="changeItem"
|
||||||
|
@ -178,41 +215,6 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
|
||||||
:selected-rows="selectedRows"
|
:selected-rows="selectedRows"
|
||||||
/></template>
|
/></template>
|
||||||
</VnPopupProxy>
|
</VnPopupProxy>
|
||||||
<QBtn
|
|
||||||
data-cy="transferLines"
|
|
||||||
color="primary"
|
|
||||||
icon="vn:splitline"
|
|
||||||
:disable="selectedRows.length < 1"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('ticketSale.transferLines') }} </QTooltip>
|
|
||||||
<TicketTransfer
|
|
||||||
ref="transferFormRef"
|
|
||||||
split="true"
|
|
||||||
class="full-width"
|
|
||||||
:transfer="{
|
|
||||||
sales: selectedRows,
|
|
||||||
lastActiveTickets: selectedRows.map((row) => row.ticketFk),
|
|
||||||
}"
|
|
||||||
></TicketTransfer>
|
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
|
||||||
data-cy="itemProposal"
|
|
||||||
color="primary"
|
|
||||||
@click="showProposalDialog = true"
|
|
||||||
:disable="selectedRows.length < 1"
|
|
||||||
>
|
|
||||||
<QIcon name="import_export" class="rotate-90"></QIcon>
|
|
||||||
<ItemProposalProxy
|
|
||||||
ref="proposalDialogRef"
|
|
||||||
:item-lack="itemLack"
|
|
||||||
:replace-action="true"
|
|
||||||
:sales="selectedRows"
|
|
||||||
@item-replaced="itemProposalEvt"
|
|
||||||
></ItemProposalProxy>
|
|
||||||
<QTooltip bottom anchor="bottom right">
|
|
||||||
{{ t('itemProposal') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import handlePromiseResults from './notifyResults';
|
||||||
const emit = defineEmits(['update-item']);
|
const emit = defineEmits(['update-item']);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -18,13 +19,15 @@ const $props = defineProps({
|
||||||
const updateItem = async () => {
|
const updateItem = async () => {
|
||||||
try {
|
try {
|
||||||
showChangeItemDialog.value = true;
|
showChangeItemDialog.value = true;
|
||||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk }) =>
|
const rowsToUpdate = $props.selectedRows.map(({ saleFk, quantity }) =>
|
||||||
axios.post(`Sales/${saleFk}/updateConcept`, {
|
axios.post(`Sales/replaceItem`, {
|
||||||
newConcept: newItem.value,
|
saleFk,
|
||||||
|
substitutionFk: newItem.value,
|
||||||
|
quantity,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await Promise.allSettled(rowsToUpdate);
|
const result = await Promise.allSettled(rowsToUpdate);
|
||||||
|
handlePromiseResults(result, 'saleFk');
|
||||||
emit('update-item', newItem.value);
|
emit('update-item', newItem.value);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error updating item:', err);
|
console.error('Error updating item:', err);
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { ref, defineEmits } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import handlePromiseResults from './notifyResults';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const showChangeQuantityDialog = ref(false);
|
const showChangeQuantityDialog = ref(false);
|
||||||
|
@ -19,11 +20,14 @@ const updateQuantity = async () => {
|
||||||
showChangeQuantityDialog.value = true;
|
showChangeQuantityDialog.value = true;
|
||||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk }) =>
|
const rowsToUpdate = $props.selectedRows.map(({ saleFk }) =>
|
||||||
axios.post(`Sales/${saleFk}/updateQuantity`, {
|
axios.post(`Sales/${saleFk}/updateQuantity`, {
|
||||||
|
saleFk,
|
||||||
quantity: +newQuantity.value,
|
quantity: +newQuantity.value,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
await Promise.allSettled(rowsToUpdate);
|
const result = await Promise.allSettled(rowsToUpdate);
|
||||||
|
handlePromiseResults(result, 'saleFk');
|
||||||
|
|
||||||
emit('update-quantity', newQuantity.value);
|
emit('update-quantity', newQuantity.value);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -4,8 +4,9 @@ import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
const emit = defineEmits(['update-state']);
|
import handlePromiseResults from './notifyResults';
|
||||||
|
|
||||||
|
const emit = defineEmits(['update-state']);
|
||||||
const editableStates = ref([]);
|
const editableStates = ref([]);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const showChangeStateDialog = ref(false);
|
const showChangeStateDialog = ref(false);
|
||||||
|
@ -19,13 +20,14 @@ const $props = defineProps({
|
||||||
const updateState = async () => {
|
const updateState = async () => {
|
||||||
try {
|
try {
|
||||||
showChangeStateDialog.value = true;
|
showChangeStateDialog.value = true;
|
||||||
const rowsToUpdate = $props.selectedRows.map(({ ticketFk }) =>
|
const rowsToUpdate = $props.selectedRows.map(({ id }) =>
|
||||||
axios.post(`Tickets/state`, {
|
axios.post(`Tickets/state`, {
|
||||||
ticketFk,
|
ticketFk: id,
|
||||||
code: newState.value,
|
code: newState.value,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await Promise.allSettled(rowsToUpdate);
|
const result = await Promise.allSettled(rowsToUpdate);
|
||||||
|
handlePromiseResults(result, 'ticketFk');
|
||||||
|
|
||||||
emit('update-state', newState.value);
|
emit('update-state', newState.value);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { Notify } from 'quasar';
|
||||||
|
|
||||||
|
export default function (results, key) {
|
||||||
|
results.forEach((result, index) => {
|
||||||
|
if (result.status === 'fulfilled') {
|
||||||
|
const data = JSON.parse(result.value.config.data);
|
||||||
|
console.log(`Promise ${index + 1} fulfilled:`, result.value);
|
||||||
|
// Mostrar notificación de éxito
|
||||||
|
Notify.create({
|
||||||
|
type: 'positive',
|
||||||
|
message: `Operación (${index + 1}) ${data[key]} completada con éxito.`,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const data = JSON.parse(result.reason.config.data);
|
||||||
|
console.error(`Promise ${index + 1} rejected:`, result.reason);
|
||||||
|
// Mostrar notificación de error
|
||||||
|
Notify.create({
|
||||||
|
type: 'negative',
|
||||||
|
message: `Operación (${index + 1}) ${data[key]} fallida: ${result.reason.message}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
30 ?
Lo habia reemplazado arroba y faltaba esta