diff --git a/src/pages/Item/components/ItemProposal.vue b/src/pages/Item/components/ItemProposal.vue index 1f5c1114e..814dd561d 100644 --- a/src/pages/Item/components/ItemProposal.vue +++ b/src/pages/Item/components/ItemProposal.vue @@ -14,7 +14,7 @@ const MATCH_VALUES = [5, 6, 7, 8]; const { t } = useI18n(); const session = useSession(); -const primaryColor = 'red'; +const primaryColor = '#f5b351'; const colorSpacer = '#ecf0f1'; const compatibilityItem = (value) => `${100 * (value / MATCH_VALUES.length)}%`; const gradientStyle = (value) => @@ -156,6 +156,7 @@ const columns = computed(() => [ field: 'located', }, ]); + async function confirm() { // console.log(''); // const response = { address: address.value }; @@ -171,12 +172,12 @@ async function confirm() { // } // } // onDialogOK({ data: true }); - dialogRef.value.hide({ type: 'refresh', itemProposal: proposalSelected.value[0] }); + emit('refreshData', { type: 'refresh', itemProposal: proposalSelected.value[0] }); } const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent(); // Definir el emisor de eventos -const emit = defineEmits(['dialogClosed']); +const emit = defineEmits(['dialogClosed', 'refreshData']); function onDialogClose() { console.log('Dialog has been closed'); diff --git a/src/pages/Ticket/Negative/TicketLackDetail.vue b/src/pages/Ticket/Negative/TicketLackDetail.vue index 5161a9953..53d968ba9 100644 --- a/src/pages/Ticket/Negative/TicketLackDetail.vue +++ b/src/pages/Ticket/Negative/TicketLackDetail.vue @@ -47,6 +47,7 @@ const session = useSession(); import { useRoute } from 'vue-router'; import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import VnRow from 'src/components/ui/VnRow.vue'; +import { useArrayData } from 'src/composables/useArrayData'; const route = useRoute(); const token = session.getTokenMultimedia(); const itemLack = ref(null); @@ -308,6 +309,7 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) { // En cualquier otro caso, no se cambia el orden return 0; } +const { store } = useArrayData(URL_KEY); const handleRows = (rows) => { if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0); return rows.sort(freeFirst); @@ -335,16 +337,23 @@ const itemProposalEvt = ({ itemProposal }) => { itemProposalSelected.value = itemProposal; replaceItem(); }; +const tableRef = ref(null); const itemProposalSelected = ref(null); const replaceItem = () => { const rows = handleRows(originalRowDataCopy.value).sort((row) => row.quantity); for (const ticket of rows) { if (ticket.quantity > itemProposalSelected.value.available) continue; + originalRowDataCopy.value.splice(originalRowDataCopy.value.indexOf(ticket)); ticket.itemFk = itemProposalSelected.value.id; ticket.quantity *= 2; selectedRows.value.push({ ticketFk: ticket.ticketFk }); itemProposalSelected.value.available -= ticket.quantity; itemLack.value.lack += ticket.quantity; + // tableRef.value.rows.pop(); + console.log(store.data); + const index = store.data.findIndex((t) => t.ticketFk === ticket.ticketFk); + store.data.splice(index, 1); + console.log(ticket); } }; @@ -442,6 +451,7 @@ const replaceItem = () => { ref="proposalDialogRef" :item="item" :tickets="selectedRows" + @refresh-data="itemProposalEvt" > {{ t('itemProposal') }} @@ -459,7 +469,7 @@ const replaceItem = () => { :data-key="URL_KEY" :url="`${URL_KEY}/${entityId}`" ref="itemLackForm" - @on-fetch="copyOriginalRowsData($event)" + @on-fetch="copyOriginalRowsData" auto-load > @@ -501,21 +511,22 @@ const replaceItem = () => { --> - - + + + + + @@ -611,3 +630,14 @@ const replaceItem = () => { :tickets="resultSplit" >--> +