diff --git a/src/pages/Order/Card/OrderVolume.vue b/src/pages/Order/Card/OrderVolume.vue index 8622a1fa5..b16022c2f 100644 --- a/src/pages/Order/Card/OrderVolume.vue +++ b/src/pages/Order/Card/OrderVolume.vue @@ -2,24 +2,20 @@ import axios from 'axios'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { ref, watch } from 'vue'; -import { useRouter } from 'vue-router'; - -import VnPaginate from 'components/ui/VnPaginate.vue'; -import FetchData from 'components/FetchData.vue'; -import VnLv from 'components/ui/VnLv.vue'; -import CardList from 'components/ui/CardList.vue'; -import FetchedTags from 'components/ui/FetchedTags.vue'; -import { useStateStore } from 'stores/useStateStore'; +import { ref } from 'vue'; import { dashIfEmpty } from 'src/filters'; -import { onMounted } from 'vue'; -const router = useRouter(); +import FetchData from 'components/FetchData.vue'; +import FetchedTags from 'components/ui/FetchedTags.vue'; +import ItemDescriptorProxy from 'pages/Item/Card/ItemDescriptorProxy.vue'; +import VnLv from 'components/ui/VnLv.vue'; +import VnTable from 'components/VnTable/VnTable.vue'; + const route = useRoute(); const { t } = useI18n(); const volumeSummary = ref(null); const volumeRef = ref(); -const stateStore = useStateStore(); +const volumes = ref([]); const volumeFilter = ref({ include: [ { @@ -29,26 +25,39 @@ const volumeFilter = ref({ where: { orderFk: route.params.id }, }); +const columns = [ + { + name: 'itemFk', + label: t('item'), + align: 'left', + }, + { + name: 'description', + label: t('globals.description'), + align: 'left', + }, + { + name: 'quantity', + label: t('quantity'), + align: 'left', + }, + { + name: 'volume', + label: t('volume'), + align: 'left', + }, +]; + const loadVolumes = async (rows) => { + if (!rows) return; const { data } = await axios.get(`Orders/${route.params.id}/getVolumes`); - (rows || []).forEach((order) => { + rows.forEach((order) => { (data.volumes || []).forEach((volume) => { - if (order.itemFk === volume.itemFk) { - order.volume = volume.volume; - } + if (order.itemFk === volume.itemFk) order.volume = volume.volume; }); }); + volumes.value = rows; }; - -watch( - () => router.currentRoute.value.params.id, - () => { - volumeFilter.value.where.orderFk = router.currentRoute.value.params.id; - - volumeRef.value.fetch(); - } -); -onMounted(() => (stateStore.rightDrawer = false)); @@ -57,61 +66,38 @@ onMounted(() => (stateStore.rightDrawer = false)); @on-fetch="(data) => (volumeSummary = data)" auto-load /> - - - - {{ t('globals.noResults') }} - - - - - - loadVolumes(data)" - > - - - - - - - - - - - - {{ row.item.subName }} - - - - - - - - - - - - + + + + + loadVolumes(data)" + :right-search="false" + :column-search="false" + > + + + {{ row.itemFk }} + + + + + + + + {{ volumes?.[rowIndex]?.volume }} + + - en: summary: Summary total: Total boxes: Boxes item: Item - subName: Subname quantity: Quantity volume: m³ per quantity es: @@ -166,7 +135,6 @@ es: total: Total boxes: Cajas item: Artículo - subName: Subnombre quantity: Cantidad volume: m³ por cantidad