Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
a65b8432d8
|
@ -59,8 +59,8 @@ const $props = defineProps({
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
bottom: {
|
bottom: {
|
||||||
type: Object,
|
type: Boolean,
|
||||||
default: null,
|
default: false,
|
||||||
},
|
},
|
||||||
cardClass: {
|
cardClass: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -477,29 +477,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #bottom v-if="bottom">
|
|
||||||
<slot name="bottom-table">
|
|
||||||
<QBtn
|
|
||||||
@click="
|
|
||||||
() =>
|
|
||||||
createAsDialog
|
|
||||||
? (showForm = !showForm)
|
|
||||||
: handleOnDataSaved(create)
|
|
||||||
"
|
|
||||||
class="cursor-pointer fill-icon"
|
|
||||||
color="primary"
|
|
||||||
icon="add_circle"
|
|
||||||
size="md"
|
|
||||||
round
|
|
||||||
flat
|
|
||||||
shortcut="+"
|
|
||||||
:disabled="!disabledAttr"
|
|
||||||
/>
|
|
||||||
<QTooltip>
|
|
||||||
{{ createForm.title }}
|
|
||||||
</QTooltip>
|
|
||||||
</slot>
|
|
||||||
</template>
|
|
||||||
<template #item="{ row, colsMap }">
|
<template #item="{ row, colsMap }">
|
||||||
<component
|
<component
|
||||||
:is="$props.redirect ? 'router-link' : 'span'"
|
:is="$props.redirect ? 'router-link' : 'span'"
|
||||||
|
@ -630,6 +607,27 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
<div class="full-width bottomButton" v-if="bottom">
|
||||||
|
<QBtn
|
||||||
|
@click="
|
||||||
|
() =>
|
||||||
|
createAsDialog
|
||||||
|
? (showForm = !showForm)
|
||||||
|
: handleOnDataSaved(create)
|
||||||
|
"
|
||||||
|
class="cursor-pointer fill-icon"
|
||||||
|
color="primary"
|
||||||
|
icon="add_circle"
|
||||||
|
size="md"
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
shortcut="+"
|
||||||
|
:disabled="!disabledAttr"
|
||||||
|
/>
|
||||||
|
<QTooltip>
|
||||||
|
{{ createForm.title }}
|
||||||
|
</QTooltip>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
||||||
|
|
|
@ -166,7 +166,11 @@ onMounted(() => {
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
const arrayData = useArrayData(arrayDataKey, { url: $props.url, searchUrl: false });
|
const arrayData = useArrayData(arrayDataKey, {
|
||||||
|
url: $props.url,
|
||||||
|
searchUrl: false,
|
||||||
|
mapKey: $attrs['map-key'],
|
||||||
|
});
|
||||||
|
|
||||||
function findKeyInOptions() {
|
function findKeyInOptions() {
|
||||||
if (!$props.options) return;
|
if (!$props.options) return;
|
||||||
|
|
|
@ -54,6 +54,7 @@ function formatNumber(number) {
|
||||||
:offset="100"
|
:offset="100"
|
||||||
:limit="5"
|
:limit="5"
|
||||||
auto-load
|
auto-load
|
||||||
|
map-key="smsFk"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QCard
|
<QCard
|
||||||
|
|
|
@ -149,7 +149,8 @@ select:-webkit-autofill {
|
||||||
.q-card,
|
.q-card,
|
||||||
.q-table,
|
.q-table,
|
||||||
.q-table__bottom,
|
.q-table__bottom,
|
||||||
.q-drawer {
|
.q-drawer,
|
||||||
|
.bottomButton {
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, computed, onBeforeMount } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate } from 'src/filters/index';
|
import { dateRange, toDate } from 'src/filters/index';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
@ -104,18 +104,12 @@ function getParams() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const userParams = computed(() => {
|
const userParams = computed(() => {
|
||||||
const minDate = Date.vnNew();
|
const campaign = campaignList.value[0]?.id;
|
||||||
minDate.setHours(0, 0, 0, 0);
|
const userParams = {
|
||||||
minDate.setMonth(minDate.getMonth() - 2);
|
campaign,
|
||||||
|
...updateDateParams(campaign, { from: Date.vnNew(), to: Date.vnNew() }),
|
||||||
const maxDate = Date.vnNew();
|
|
||||||
maxDate.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return {
|
|
||||||
campaign: campaignList.value[0]?.id,
|
|
||||||
from: minDate,
|
|
||||||
to: maxDate,
|
|
||||||
};
|
};
|
||||||
|
return userParams;
|
||||||
});
|
});
|
||||||
const openReportPdf = () => {
|
const openReportPdf = () => {
|
||||||
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
|
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
|
||||||
|
@ -134,6 +128,23 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
...getParams(),
|
...getParams(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateDateParams = (value, params) => {
|
||||||
|
if (!value) {
|
||||||
|
params.from = null;
|
||||||
|
params.to = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const campaign = campaignList.value.find((c) => c.id === value);
|
||||||
|
if (!campaign) return;
|
||||||
|
|
||||||
|
const { dated, previousDays, scopeDays } = campaign;
|
||||||
|
const _date = new Date(dated);
|
||||||
|
const [from, to] = dateRange(_date);
|
||||||
|
params.from = new Date(from.setDate(from.getDate() - previousDays)).toISOString();
|
||||||
|
params.to = new Date(to.setDate(to.getDate() + scopeDays)).toISOString();
|
||||||
|
return params;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -144,7 +155,6 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
search-url="consumption"
|
search-url="consumption"
|
||||||
:filter="filter"
|
|
||||||
:user-params="userParams"
|
:user-params="userParams"
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
|
@ -201,6 +211,7 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
class="q-px-sm q-pt-none fit"
|
class="q-px-sm q-pt-none fit"
|
||||||
dense
|
dense
|
||||||
option-label="code"
|
option-label="code"
|
||||||
|
@update:model-value="(data) => updateDateParams(data, params)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -54,6 +54,7 @@ const transfer = ref({
|
||||||
});
|
});
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
const canProceed = ref();
|
const canProceed = ref();
|
||||||
|
const isLoading = ref(false);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
|
@ -213,6 +214,9 @@ const updateQuantity = async ({ quantity, id }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const addSale = async (sale) => {
|
const addSale = async (sale) => {
|
||||||
|
if (isLoading.value) return;
|
||||||
|
|
||||||
|
isLoading.value = true;
|
||||||
const params = {
|
const params = {
|
||||||
barcode: sale.itemFk,
|
barcode: sale.itemFk,
|
||||||
quantity: sale.quantity,
|
quantity: sale.quantity,
|
||||||
|
@ -233,7 +237,7 @@ const addSale = async (sale) => {
|
||||||
sale.item = newSale.item;
|
sale.item = newSale.item;
|
||||||
|
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
window.location.reload();
|
arrayData.fetch({});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateConcept = async (sale) => {
|
const updateConcept = async (sale) => {
|
||||||
|
@ -464,6 +468,7 @@ const addRow = (original = null) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const endNewRow = (row) => {
|
const endNewRow = (row) => {
|
||||||
|
if (!row) return;
|
||||||
if (row.itemFk && row.quantity) {
|
if (row.itemFk && row.quantity) {
|
||||||
row.isNew = false;
|
row.isNew = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ watch(
|
||||||
v-model="formData.geoFk"
|
v-model="formData.geoFk"
|
||||||
url="Postcodes/location"
|
url="Postcodes/location"
|
||||||
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
|
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
|
||||||
sort-by="code, townFk"
|
:sort-by="['code ASC']"
|
||||||
option-value="geoFk"
|
option-value="geoFk"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:filter-options="['code']"
|
:filter-options="['code']"
|
||||||
|
@ -97,6 +97,7 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
map-key="geoFk"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
|
Loading…
Reference in New Issue