#6321 - Negative ticket #158
|
@ -372,9 +372,7 @@ function handleOnDataSaved(_) {
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:disable-infinite-scroll="
|
:disable-infinite-scroll="$attrs['disableInfiniteScroll']"
|
||||||
$attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll
|
|
||||||
"
|
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||||
:auto-load="hasParams || $attrs['auto-load']"
|
:auto-load="hasParams || $attrs['auto-load']"
|
||||||
|
@ -394,7 +392,7 @@ function handleOnDataSaved(_) {
|
||||||
card-container-class="grid-three"
|
card-container-class="grid-three"
|
||||||
flat
|
flat
|
||||||
:style="isTableMode && `max-height: ${tableHeight}`"
|
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||||
:virtual-scroll="!isTableMode"
|
virtual-scroll
|
||||||
@virtual-scroll="
|
@virtual-scroll="
|
||||||
(event) =>
|
(event) =>
|
||||||
event.index > rows.length - 2 &&
|
event.index > rows.length - 2 &&
|
||||||
|
|
|
@ -84,8 +84,12 @@ const styleAttrs = computed(() => {
|
||||||
outlined: true,
|
outlined: true,
|
||||||
rounded: true,
|
rounded: true,
|
||||||
}
|
}
|
||||||
: {};
|
: { eventColor: handleEventColor };
|
||||||
});
|
});
|
||||||
|
const handleEventColor = (date) => {
|
||||||
|
console.error(date);
|
||||||
|
return date === Date.now() ? null : 'orange';
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -139,6 +143,10 @@ const styleAttrs = computed(() => {
|
||||||
:landscape="true"
|
:landscape="true"
|
||||||
:today-btn="true"
|
:today-btn="true"
|
||||||
:options="$attrs.options"
|
:options="$attrs.options"
|
||||||
|
color="orange"
|
||||||
|
text-color="black"
|
||||||
|
dark
|
||||||
|
bordered
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
(date) => {
|
(date) => {
|
||||||
formattedDate = date;
|
formattedDate = date;
|
||||||
|
@ -158,6 +166,12 @@ const styleAttrs = computed(() => {
|
||||||
.vn-input-date.q-field--outlined.q-field--readonly .q-field__control:before {
|
.vn-input-date.q-field--outlined.q-field--readonly .q-field__control:before {
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
.calendar-event {
|
||||||
|
background-color: red;
|
||||||
|
&.--today {
|
||||||
|
border: 2px solid $info;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
|
|
|
@ -63,22 +63,18 @@ const columns = computed(() => [
|
||||||
label: t('proposal.available'),
|
label: t('proposal.available'),
|
||||||
name: 'available',
|
name: 'available',
|
||||||
field: 'available',
|
field: 'available',
|
||||||
columnClass: 'shrink',
|
|
||||||
columnFilter: {
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
columnClass: 'shrink',
|
class: 'shrink',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
label: t('proposal.difference'),
|
label: t('proposal.difference'),
|
||||||
name: 'difference',
|
name: 'difference',
|
||||||
columnFilter: {
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
columnClass: 'shrink',
|
class: 'shrink',
|
||||||
},
|
style: 'background-color:red;max-width: 75px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
|
@ -92,6 +88,9 @@ const columns = computed(() => [
|
||||||
label: t('proposal.counter'),
|
label: t('proposal.counter'),
|
||||||
name: 'counter',
|
name: 'counter',
|
||||||
field: 'counter',
|
field: 'counter',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
|
class: 'shrink',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -109,22 +108,18 @@ const columns = computed(() => [
|
||||||
label: t('proposal.price2'),
|
label: t('proposal.price2'),
|
||||||
name: 'price2',
|
name: 'price2',
|
||||||
field: 'price2',
|
field: 'price2',
|
||||||
columnFilter: {
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
class: 'expand',
|
class: 'shrink',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
label: t('proposal.minQuantity'),
|
label: t('proposal.minQuantity'),
|
||||||
name: 'minQuantity',
|
name: 'minQuantity',
|
||||||
field: 'minQuantity',
|
field: 'minQuantity',
|
||||||
columnFilter: {
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
class: 'expand',
|
class: 'shrink',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
|
@ -141,11 +136,11 @@ async function confirm() {
|
||||||
newItemFK: proposalSelected.value[0].id,
|
newItemFK: proposalSelected.value[0].id,
|
||||||
quantity: quantity.value,
|
quantity: quantity.value,
|
||||||
};
|
};
|
||||||
const { data } = await axios.post('Sales/replaceItem', params);
|
// const { data } = await axios.post('Sales/replaceItem', params);
|
||||||
emit('refreshData', {
|
emit('itemReplaced', {
|
||||||
type: 'refresh',
|
type: 'refresh',
|
||||||
itemProposal: proposalSelected.value[0],
|
itemProposal: proposalSelected.value[0],
|
||||||
...data,
|
...params,
|
||||||
});
|
});
|
||||||
proposalSelected.value = [];
|
proposalSelected.value = [];
|
||||||
popupProxyRef.value.hide();
|
popupProxyRef.value.hide();
|
||||||
|
@ -155,7 +150,7 @@ async function confirm() {
|
||||||
}
|
}
|
||||||
// const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
// const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();
|
||||||
const popupProxyRef = ref(null);
|
const popupProxyRef = ref(null);
|
||||||
const emit = defineEmits(['onDialogClosed', 'refreshData']);
|
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
||||||
|
|
||||||
// function onDialogClose() {
|
// function onDialogClose() {
|
||||||
// console.log('Dialog has been closed');
|
// console.log('Dialog has been closed');
|
||||||
|
@ -270,7 +265,9 @@ const isSelectionAvailable = (data) => {
|
||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-difference="{ row }">
|
<template #column-difference="{ row }">
|
||||||
<VnStockValueDisplay :value="row.id % 2 === 0 ? 10 : -10" />
|
<QTd style="width: 75px; background-color: red"
|
||||||
|
><VnStockValueDisplay :value="row.id % 2 === 0 ? 10 : -10"
|
||||||
|
/></QTd>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import ItemProposal from './ItemProposal.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
item: {
|
item: {
|
||||||
|
@ -46,7 +47,10 @@ const $props = defineProps({
|
||||||
<!-- {{ tickets[0].saleFk }} -->
|
<!-- {{ tickets[0].saleFk }} -->
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-pt-none">
|
<QCardSection class="q-pt-none">
|
||||||
<ItemProposal v-bind="$props"></ItemProposal
|
<ItemProposal
|
||||||
|
v-bind="$props"
|
||||||
|
@item-replaced="(data) => emit('itemReplaced', data)"
|
||||||
|
></ItemProposal
|
||||||
></QCardSection>
|
></QCardSection>
|
||||||
</QCard>
|
</QCard>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import CrudModel from 'components/CrudModel.vue';
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
import RoadmapAddStopForm from 'pages/Route/Roadmap/RoadmapAddStopForm.vue';
|
import RoadmapAddStopForm from 'pages/Route/Roadmap/RoadmapAddStopForm.vue';
|
||||||
|
import { QBtn } from 'quasar';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -65,9 +66,10 @@ const updateDefaultStop = (data) => {
|
||||||
</div>
|
</div>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<QIcon
|
<QBtn
|
||||||
name="add"
|
flat
|
||||||
size="sm"
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="roadmapStopsCrudRef.insert()"
|
@click="roadmapStopsCrudRef.insert()"
|
||||||
|
@ -75,7 +77,7 @@ const updateDefaultStop = (data) => {
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('Add stop') }}
|
{{ t('Add stop') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QBtn>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -19,8 +19,8 @@ const sageTransactionTypesOptions = ref([]);
|
||||||
const supplierActivitiesOptions = ref([]);
|
const supplierActivitiesOptions = ref([]);
|
||||||
|
|
||||||
function handleLocation(data, location) {
|
function handleLocation(data, location) {
|
||||||
const { town, label, provinceFk, countryFk } = location ?? {};
|
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||||
data.postCode = label;
|
data.postCode = code;
|
||||||
data.city = town;
|
data.city = town;
|
||||||
data.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
// import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
import TicketLackTable from './TicketLackTable.vue';
|
import TicketLackTable from './TicketLackTable.vue';
|
||||||
import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
|
import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
|
||||||
|
@ -23,6 +23,7 @@ const URL_KEY = 'Tickets/ItemLack';
|
||||||
const editableStates = ref([]);
|
const editableStates = ref([]);
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const proposalDialogRef = ref();
|
const proposalDialogRef = ref();
|
||||||
|
const tableRef = ref();
|
||||||
const changeStateDialogRef = ref();
|
const changeStateDialogRef = ref();
|
||||||
const changeQuantityDialogRef = ref();
|
const changeQuantityDialogRef = ref();
|
||||||
const showProposalDialog = ref(false);
|
const showProposalDialog = ref(false);
|
||||||
|
@ -54,48 +55,49 @@ const reload = async () => {
|
||||||
defineExpose({ reload });
|
defineExpose({ reload });
|
||||||
|
|
||||||
// Función de comparación
|
// Función de comparación
|
||||||
function freeFirst({ alertLevel: a }, { alertLevel: b }) {
|
// function freeFirst({ alertLevel: a }, { alertLevel: b }) {
|
||||||
const DEFAULT = 0;
|
// const DEFAULT = 0;
|
||||||
// Si el estado de 'a' es 'free' y el de 'b' no lo es, 'a' viene primero
|
// // Si el estado de 'a' es 'free' y el de 'b' no lo es, 'a' viene primero
|
||||||
if (a === DEFAULT && b !== DEFAULT) {
|
// if (a === DEFAULT && b !== DEFAULT) {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
// Si el estado de 'b' es 'free' y el de 'a' no lo es, 'b' viene primero
|
// // Si el estado de 'b' es 'free' y el de 'a' no lo es, 'b' viene primero
|
||||||
if (b === DEFAULT && a !== DEFAULT) {
|
// if (b === DEFAULT && a !== DEFAULT) {
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
// En cualquier otro caso, no se cambia el orden
|
// // En cualquier otro caso, no se cambia el orden
|
||||||
return 0;
|
// return 0;
|
||||||
jsegarra marked this conversation as resolved
Outdated
|
|||||||
}
|
// }
|
||||||
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.forEach((row) => (row.concept = item.value.name));
|
||||||
rows = rows.sort(freeFirst);
|
// rows = rows.sort(freeFirst);
|
||||||
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
// if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
||||||
return rows;
|
// return rows;
|
||||||
};
|
// };
|
||||||
|
|
||||||
const itemProposalEvt = ({ itemProposal }) => {
|
const itemProposalEvt = ({ itemProposal }) => {
|
||||||
itemProposalSelected.value = itemProposal;
|
itemProposalSelected.value = itemProposal;
|
||||||
replaceItem();
|
tableRef.value.reload();
|
||||||
|
// replaceItem();
|
||||||
};
|
};
|
||||||
const itemProposalSelected = ref(null);
|
const itemProposalSelected = ref(null);
|
||||||
const replaceItem = () => {
|
// const replaceItem = () => {
|
||||||
const rows = handleRows(originalRowDataCopy.value).sort((row) => row.quantity);
|
// const rows = handleRows(originalRowDataCopy.value).sort((row) => row.quantity);
|
||||||
for (const ticket of rows) {
|
// for (const ticket of rows) {
|
||||||
if (ticket.quantity > itemProposalSelected.value.available) continue;
|
// if (ticket.quantity > itemProposalSelected.value.available) continue;
|
||||||
originalRowDataCopy.value.splice(originalRowDataCopy.value.indexOf(ticket));
|
// originalRowDataCopy.value.splice(originalRowDataCopy.value.indexOf(ticket));
|
||||||
ticket.itemFk = itemProposalSelected.value.id;
|
// ticket.itemFk = itemProposalSelected.value.id;
|
||||||
selectedRows.value.push({ ticketFk: ticket.ticketFk });
|
// selectedRows.value.push({ ticketFk: ticket.ticketFk });
|
||||||
itemProposalSelected.value.available -= ticket.quantity;
|
// itemProposalSelected.value.available -= ticket.quantity;
|
||||||
jsegarra marked this conversation as resolved
jgallego
commented
2 ? 2 ?
jsegarra
commented
Esto ya lo habia cambiado, pero a lo mejor al hacer otros cambios se ha machacado Esto ya lo habia cambiado, pero a lo mejor al hacer otros cambios se ha machacado
|
|||||||
itemLack.value.lack += ticket.quantity;
|
// itemLack.value.lack += ticket.quantity;
|
||||||
const index = store.data.findIndex((t) => t.ticketFk === ticket.ticketFk);
|
// const index = store.data.findIndex((t) => t.ticketFk === ticket.ticketFk);
|
||||||
store.data.splice(index, 1);
|
// store.data.splice(index, 1);
|
||||||
console.log(ticket);
|
// console.log(ticket);
|
||||||
useArrayData('ItemsGetSimilar').store.data[1].available =
|
// useArrayData('ItemsGetSimilar').store.data[1].available =
|
||||||
itemProposalSelected.value.available;
|
// itemProposalSelected.value.available;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -178,7 +180,7 @@ const replaceItem = () => {
|
||||||
:item-lack="itemLack"
|
:item-lack="itemLack"
|
||||||
:replace-action="true"
|
:replace-action="true"
|
||||||
:tickets="selectedRows"
|
:tickets="selectedRows"
|
||||||
@refresh-data="itemProposalEvt"
|
@item-replaced="itemProposalEvt"
|
||||||
></ItemProposalProxy>
|
></ItemProposalProxy>
|
||||||
<QTooltip bottom anchor="bottom right">
|
<QTooltip bottom anchor="bottom right">
|
||||||
{{ t('itemProposal') }}
|
{{ t('itemProposal') }}
|
||||||
|
@ -216,6 +218,7 @@ const replaceItem = () => {
|
||||||
:label="itemLack.lack"
|
:label="itemLack.lack"
|
||||||
/>
|
/>
|
||||||
<QBadge
|
<QBadge
|
||||||
|
color="secondary"
|
||||||
class="q-ml-xs q-mt-xs"
|
class="q-ml-xs q-mt-xs"
|
||||||
v-if="itemLack"
|
v-if="itemLack"
|
||||||
:label="toCurrency(itemLack.lack)"
|
:label="toCurrency(itemLack.lack)"
|
||||||
|
@ -233,6 +236,7 @@ const replaceItem = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TicketLackTable
|
<TicketLackTable
|
||||||
|
ref="tableRef"
|
||||||
:filter="{ alertLevel: showFree }"
|
:filter="{ alertLevel: showFree }"
|
||||||
@update:selection="({ value }, _) => (selectedRows = value)"
|
@update:selection="({ value }, _) => (selectedRows = value)"
|
||||||
></TicketLackTable>
|
></TicketLackTable>
|
||||||
|
|
|
@ -34,6 +34,7 @@ const filterLack = ref({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
where: { alertLevel: 'FREE' },
|
where: { alertLevel: 'FREE' },
|
||||||
|
order: 'ts.alertLevelCODE ASC',
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const URL_KEY = 'Tickets/ItemLack';
|
const URL_KEY = 'Tickets/ItemLack';
|
||||||
|
@ -225,6 +226,7 @@ watch(selectedRows, () => emit('update:selection', selectedRows));
|
||||||
:create-as-dialog="false"
|
:create-as-dialog="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:filter="filterLack"
|
:filter="filterLack"
|
||||||
|
:order="['ts.alertLevelCode ASC']"
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
|
|
Loading…
Reference in New Issue
este lo tenias en la tabla
No, no lo tenia
He hecho, que si vienes desde el listado, pases el valor por parámetro al detalle, así evitamos un 2 a pelo