0
0
Fork 0

Merge pull request 'Create order volume' (#42) from feature/order into dev

Reviewed-on: hyervoni/salix-front-mindshore#42
This commit is contained in:
Carlos Fonseca 2023-12-26 13:55:47 +00:00
commit a10b773b29
6 changed files with 178 additions and 15 deletions

View File

@ -557,6 +557,7 @@ export default {
summary: 'Summary', summary: 'Summary',
basicData: 'Basic Data', basicData: 'Basic Data',
catalog: 'Catalog', catalog: 'Catalog',
volume: 'Volume'
}, },
field: { field: {
salesPersonFk: 'Sales Person', salesPersonFk: 'Sales Person',

View File

@ -466,6 +466,7 @@ export default {
summary: 'Resumen', summary: 'Resumen',
basicData: 'Datos básicos', basicData: 'Datos básicos',
catalog: 'Catálogo', catalog: 'Catálogo',
volume: 'Volumen',
}, },
field: { field: {
salesPersonFk: 'Comercial', salesPersonFk: 'Comercial',

View File

@ -98,7 +98,7 @@ const setData = (entity) => {
<VnLv :label="t('order.summary.landed')" :value="toDate(entity?.landed)" /> <VnLv :label="t('order.summary.landed')" :value="toDate(entity?.landed)" />
<VnLv :label="t('order.field.agency')" :value="entity?.agencyMode?.name" /> <VnLv :label="t('order.field.agency')" :value="entity?.agencyMode?.name" />
<VnLv :label="t('order.summary.alias')" :value="entity?.address?.nickname" /> <VnLv :label="t('order.summary.alias')" :value="entity?.address?.nickname" />
<VnLv :label="t('order.summary.items')" :value="entity?.rows?.length || 0" /> <VnLv :label="t('order.summary.items')" :value="(entity?.rows?.length || 0).toString()" />
<VnLv :label="t('order.summary.total')" :value="toCurrency(entity?.total)" /> <VnLv :label="t('order.summary.total')" :value="toCurrency(entity?.total)" />
</template> </template>
<template #actions="{ entity }"> <template #actions="{ entity }">

View File

@ -110,15 +110,11 @@ const detailsColumns = ref([
:label="t('order.summary.createdFrom')" :label="t('order.summary.createdFrom')"
:value="entity?.sourceApp" :value="entity?.sourceApp"
/> />
<VnLv :label="t('order.summary.address')"> <VnLv
<template #value> :label="t('order.summary.address')"
<span class="address"> :value="`${entity?.address?.street} - ${entity?.address?.city} (${entity?.address?.province?.name})`"
{{ class="order-summary-address"
`${entity?.address?.street} - ${entity?.address?.city} (${entity?.address?.province?.name})` />
}}
</span>
</template>
</VnLv>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<p class="header"> <p class="header">
@ -203,11 +199,18 @@ const detailsColumns = ref([
</template> </template>
</CardSummary> </CardSummary>
</template> </template>
<style lang="scss" scoped> <style lang="scss">
.address { .cardSummary .summaryBody .vn-label-value.order-summary-address {
white-space: normal; .label {
} flex-shrink: 0;
}
.value {
white-space: normal;
}
}
</style>
<style lang="scss" scoped>
.item { .item {
text-align: center; text-align: center;
} }

View File

@ -0,0 +1,149 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue';
import VnLv from 'components/ui/VnLv.vue';
import { ref } from 'vue';
import { dashIfEmpty } from 'src/filters';
import CardList from 'components/ui/CardList.vue';
import axios from 'axios';
import FetchedTags from 'components/ui/FetchedTags.vue';
const route = useRoute();
const { t } = useI18n();
const volumeSummary = ref(null);
const loadVolumes = async (rows) => {
const { data } = await axios.get(`Orders/${route.params.id}/getVolumes`);
(rows || []).forEach((order) => {
(data.volumes || []).forEach((volume) => {
if (order.itemFk === volume.itemFk) {
order.volume = volume.volume;
}
});
});
};
</script>
<template>
<FetchData
:url="`Orders/${route.params.id}/getTotalVolume`"
@on-fetch="(data) => (volumeSummary = data)"
auto-load
/>
<QPage class="column items-center q-pa-md">
<div class="card-list">
<QCard class="order-volume-summary q-pa-lg">
<p class="header text-right block">
{{ t('summary') }}
</p>
<VnLv
:label="t('total')"
:value="`${volumeSummary?.totalVolume} m³`"
/>
<VnLv
:label="t('boxes')"
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
/>
</QCard>
<VnPaginate
data-key="OrderCatalogVolume"
url="OrderRows"
:limit="20"
auto-load
:filter="{
include: {
relation: 'item',
},
where: { orderFk: route.params.id },
}"
order="itemFk"
@on-fetch="(data) => loadVolumes(data)"
>
<template #body="{ rows }">
<div class="catalog-list q-mt-xl">
<CardList
v-for="row in rows"
:key="row.id"
:id="row.id"
:title="row?.item?.name"
class="cursor-inherit"
>
<template #list-items>
<div class="q-mb-sm">
<fetched-tags :item="row.item" :max-length="5" />
</div>
<VnLv :label="t('item')" :value="row.item.id" />
<VnLv :label="t('subName')">
<template #value>
<span class="text-uppercase">
{{ row.item.subName }}
</span>
</template>
</VnLv>
<VnLv :label="t('quantity')" :value="row.quantity" />
<VnLv :label="t('volume')" :value="row.volume" />
</template>
</CardList>
</div>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<style lang="scss">
.order-volume-summary {
.vn-label-value {
display: flex;
justify-content: flex-end;
gap: 2%;
.label {
color: var(--vn-label);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
<style lang="scss" scoped>
.card-list {
width: 100%;
max-width: 60em;
}
.header {
color: $primary;
font-weight: bold;
margin-bottom: 25px;
font-size: 20px;
display: inline-block;
}
</style>
<i18n>
en:
summary: Summary
total: Total
boxes: Boxes
item: Item
subName: Subname
quantity: Quantity
volume: per quantity
es:
summary: Resumen
total: Total
boxes: Cajas
item: Artículo
subName: Subname
quantity: Cantidad
volume: por cantidad
</i18n>

View File

@ -11,7 +11,7 @@ export default {
redirect: { name: 'OrderMain' }, redirect: { name: 'OrderMain' },
menus: { menus: {
main: ['OrderList'], main: ['OrderList'],
card: ['OrderBasicData', 'OrderCatalog'], card: ['OrderBasicData', 'OrderCatalog', 'OrderVolume'],
}, },
children: [ children: [
{ {
@ -72,6 +72,15 @@ export default {
}, },
component: () => import('src/pages/Order/OrderCatalog.vue'), component: () => import('src/pages/Order/OrderCatalog.vue'),
}, },
{
name: 'OrderVolume',
path: 'volume',
meta: {
title: 'volume',
icon: 'vn:volume',
},
component: () => import('src/pages/Order/OrderVolume.vue'),
},
], ],
}, },
], ],