forked from verdnatura/salix-front
refs #6976 total Stems
This commit is contained in:
parent
ee80b1d617
commit
d2ec47fe1c
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { computed, onMounted } from 'vue';
|
import { computed, onMounted, watch, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import axios from 'axios';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { onUnmounted } from 'vue';
|
|
||||||
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -35,6 +34,9 @@ const arrayData = useArrayData('SupplierConsumption', {
|
||||||
|
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
|
console.log('route del principio', route.query.from);
|
||||||
|
watch(() => route.query);
|
||||||
|
|
||||||
onUnmounted(() => state.unset('SupplierConsumption'));
|
onUnmounted(() => state.unset('SupplierConsumption'));
|
||||||
const dateRanges = computed(() => {
|
const dateRanges = computed(() => {
|
||||||
const ranges = {
|
const ranges = {
|
||||||
|
@ -42,6 +44,7 @@ const dateRanges = computed(() => {
|
||||||
to: null,
|
to: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('route del if', route.query.from);
|
||||||
if (route.query && route.query.params) {
|
if (route.query && route.query.params) {
|
||||||
const params = JSON.parse(route.query.params);
|
const params = JSON.parse(route.query.params);
|
||||||
if (params.from && params.to) {
|
if (params.from && params.to) {
|
||||||
|
@ -52,7 +55,7 @@ const dateRanges = computed(() => {
|
||||||
|
|
||||||
return ranges;
|
return ranges;
|
||||||
});
|
});
|
||||||
|
console.log('dataRanges', dateRanges);
|
||||||
const reportParams = computed(() => ({
|
const reportParams = computed(() => ({
|
||||||
recipientId: Number(route.params.id),
|
recipientId: Number(route.params.id),
|
||||||
...dateRanges.value,
|
...dateRanges.value,
|
||||||
|
@ -112,12 +115,16 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
const calculateTotal = (buysArray = []) =>
|
const calculateTotal = (buysArray = []) =>
|
||||||
buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
|
buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
|
||||||
|
|
||||||
|
const calculateTotalStems = (buysArray = []) =>
|
||||||
|
buysArray.reduce((accumulator, { quantity }) => accumulator + quantity, 0);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
await getSupplierConsumptionData();
|
await getSupplierConsumptionData();
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('dateRange From', dateRanges.value.from);
|
console.log('dateRange From', dateRanges.value.from);
|
||||||
|
console.log('dateRange value', dateRanges.value);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -192,10 +199,14 @@ console.log('dateRange From', dateRanges.value.from);
|
||||||
<QTd colspan="2" no-hover> {{ dashIfEmpty(buy.total) }}</QTd>
|
<QTd colspan="2" no-hover> {{ dashIfEmpty(buy.total) }}</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
<QTr>
|
<QTr>
|
||||||
<QTd colspan="6" no-hover>
|
<QTd colspan="5" no-hover>
|
||||||
<span class="label">{{ t('Total entry') }}: </span>
|
<span class="label">{{ t('Total entry') }}: </span>
|
||||||
<span>{{ calculateTotal(row.buys) }}</span>
|
<span>{{ calculateTotal(row.buys) }}</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
|
<QTd no-hover>
|
||||||
|
<span class="label">{{ t('Total stems') }}: </span>
|
||||||
|
<span>{{ calculateTotalStems(row.buys) }}</span>
|
||||||
|
</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
@ -211,6 +222,7 @@ console.log('dateRange From', dateRanges.value.from);
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Total entry: Total entrada
|
Total entry: Total entrada
|
||||||
|
Total stems: Total tallos
|
||||||
Open as PDF: Abrir como PDF
|
Open as PDF: Abrir como PDF
|
||||||
Send to email: Enviar por email
|
Send to email: Enviar por email
|
||||||
This supplier does not have a contact with an email address: Este proveedor no tiene un email de contacto
|
This supplier does not have a contact with an email address: Este proveedor no tiene un email de contacto
|
||||||
|
|
Loading…
Reference in New Issue