From d0eb1d97ac3a4c974b02713a6cea97c189a50e94 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 18 Sep 2024 13:10:11 +0200 Subject: [PATCH] fet: updates --- src/components/VnTable/VnTable.vue | 6 +- src/components/common/VnInputDate.vue | 16 +++- src/pages/Item/components/ItemProposal.vue | 49 ++++++----- .../Item/components/ItemProposalProxy.vue | 6 +- src/pages/Route/Roadmap/RoadmapStops.vue | 10 ++- .../Supplier/Card/SupplierFiscalData.vue | 4 +- .../Ticket/Negative/TicketLackDetail.vue | 82 ++++++++++--------- src/pages/Ticket/Negative/TicketLackTable.vue | 2 + 8 files changed, 98 insertions(+), 77 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 16dfe5766..ca7043b75 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -372,9 +372,7 @@ function handleOnDataSaved(_) { ref="CrudModelRef" @on-fetch="(...args) => emit('onFetch', ...args)" :search-url="searchUrl" - :disable-infinite-scroll=" - $attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll - " + :disable-infinite-scroll="$attrs['disableInfiniteScroll']" @save-changes="reload" :has-sub-toolbar="$props.hasSubToolbar ?? isEditable" :auto-load="hasParams || $attrs['auto-load']" @@ -394,7 +392,7 @@ function handleOnDataSaved(_) { card-container-class="grid-three" flat :style="isTableMode && `max-height: ${tableHeight}`" - :virtual-scroll="!isTableMode" + virtual-scroll @virtual-scroll=" (event) => event.index > rows.length - 2 && diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index fd8993d6f..a76b8bda1 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -84,8 +84,12 @@ const styleAttrs = computed(() => { outlined: true, rounded: true, } - : {}; + : { eventColor: handleEventColor }; }); +const handleEventColor = (date) => { + console.error(date); + return date === Date.now() ? null : 'orange'; +}; diff --git a/src/pages/Item/components/ItemProposalProxy.vue b/src/pages/Item/components/ItemProposalProxy.vue index 02dee3d32..077e97208 100644 --- a/src/pages/Item/components/ItemProposalProxy.vue +++ b/src/pages/Item/components/ItemProposalProxy.vue @@ -3,6 +3,7 @@ import ItemProposal from './ItemProposal.vue'; import VnImg from 'src/components/ui/VnImg.vue'; import FetchedTags from 'components/ui/FetchedTags.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; +const emit = defineEmits(['onDialogClosed', 'itemReplaced']); const $props = defineProps({ item: { @@ -46,7 +47,10 @@ const $props = defineProps({ - diff --git a/src/pages/Route/Roadmap/RoadmapStops.vue b/src/pages/Route/Roadmap/RoadmapStops.vue index 8ff044d2d..f7bb6ff4e 100644 --- a/src/pages/Route/Roadmap/RoadmapStops.vue +++ b/src/pages/Route/Roadmap/RoadmapStops.vue @@ -5,6 +5,7 @@ import FetchData from 'components/FetchData.vue'; import { ref } from 'vue'; import CrudModel from 'components/CrudModel.vue'; import RoadmapAddStopForm from 'pages/Route/Roadmap/RoadmapAddStopForm.vue'; +import { QBtn } from 'quasar'; const { t } = useI18n(); const route = useRoute(); @@ -65,9 +66,10 @@ const updateDefaultStop = (data) => { - { {{ t('Add stop') }} - + diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue index 60cd6770b..553fc0f94 100644 --- a/src/pages/Supplier/Card/SupplierFiscalData.vue +++ b/src/pages/Supplier/Card/SupplierFiscalData.vue @@ -19,8 +19,8 @@ const sageTransactionTypesOptions = ref([]); const supplierActivitiesOptions = ref([]); function handleLocation(data, location) { - const { town, label, provinceFk, countryFk } = location ?? {}; - data.postCode = label; + const { town, code, provinceFk, countryFk } = location ?? {}; + data.postCode = code; data.city = town; data.provinceFk = provinceFk; data.countryFk = countryFk; diff --git a/src/pages/Ticket/Negative/TicketLackDetail.vue b/src/pages/Ticket/Negative/TicketLackDetail.vue index 8325e1686..a92dbc821 100644 --- a/src/pages/Ticket/Negative/TicketLackDetail.vue +++ b/src/pages/Ticket/Negative/TicketLackDetail.vue @@ -12,7 +12,7 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue'; import FetchData from 'src/components/FetchData.vue'; import { useStateStore } from 'stores/useStateStore'; 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 TicketLackTable from './TicketLackTable.vue'; import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue'; @@ -23,6 +23,7 @@ const URL_KEY = 'Tickets/ItemLack'; const editableStates = ref([]); const stateStore = useStateStore(); const proposalDialogRef = ref(); +const tableRef = ref(); const changeStateDialogRef = ref(); const changeQuantityDialogRef = ref(); const showProposalDialog = ref(false); @@ -54,48 +55,49 @@ const reload = async () => { defineExpose({ reload }); // FunciĆ³n de comparaciĆ³n -function freeFirst({ alertLevel: a }, { alertLevel: b }) { - const DEFAULT = 0; - // Si el estado de 'a' es 'free' y el de 'b' no lo es, 'a' viene primero - if (a === DEFAULT && b !== DEFAULT) { - return -1; - } - // Si el estado de 'b' es 'free' y el de 'a' no lo es, 'b' viene primero - if (b === DEFAULT && a !== DEFAULT) { - return 1; - } - // En cualquier otro caso, no se cambia el orden - return 0; -} -const { store } = useArrayData(URL_KEY); -const handleRows = (rows) => { - // rows.forEach((row) => (row.concept = item.value.name)); - rows = rows.sort(freeFirst); - if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0); - return rows; -}; +// function freeFirst({ alertLevel: a }, { alertLevel: b }) { +// const DEFAULT = 0; +// // Si el estado de 'a' es 'free' y el de 'b' no lo es, 'a' viene primero +// if (a === DEFAULT && b !== DEFAULT) { +// return -1; +// } +// // Si el estado de 'b' es 'free' y el de 'a' no lo es, 'b' viene primero +// if (b === DEFAULT && a !== DEFAULT) { +// return 1; +// } +// // En cualquier otro caso, no se cambia el orden +// return 0; +// } +// const { store } = useArrayData(URL_KEY); +// const handleRows = (rows) => { +// // rows.forEach((row) => (row.concept = item.value.name)); +// rows = rows.sort(freeFirst); +// if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0); +// return rows; +// }; const itemProposalEvt = ({ itemProposal }) => { itemProposalSelected.value = itemProposal; - replaceItem(); + tableRef.value.reload(); + // replaceItem(); }; 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; - selectedRows.value.push({ ticketFk: ticket.ticketFk }); - itemProposalSelected.value.available -= ticket.quantity; - itemLack.value.lack += ticket.quantity; - const index = store.data.findIndex((t) => t.ticketFk === ticket.ticketFk); - store.data.splice(index, 1); - console.log(ticket); - useArrayData('ItemsGetSimilar').store.data[1].available = - itemProposalSelected.value.available; - } -}; +// 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; +// selectedRows.value.push({ ticketFk: ticket.ticketFk }); +// itemProposalSelected.value.available -= ticket.quantity; +// itemLack.value.lack += ticket.quantity; +// const index = store.data.findIndex((t) => t.ticketFk === ticket.ticketFk); +// store.data.splice(index, 1); +// console.log(ticket); +// useArrayData('ItemsGetSimilar').store.data[1].available = +// itemProposalSelected.value.available; +// } +// };