perf: sendEmail customerConsumption
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
0d99c5f609
commit
56f687ce36
|
@ -2,6 +2,7 @@ globals:
|
|||
lang:
|
||||
es: Spanish
|
||||
en: English
|
||||
quantity: Quantity
|
||||
language: Language
|
||||
entity: Entity
|
||||
user: User
|
||||
|
|
|
@ -3,6 +3,7 @@ globals:
|
|||
es: Español
|
||||
en: Inglés
|
||||
language: Idioma
|
||||
quantity: Cantidad
|
||||
entity: Entidad
|
||||
user: Usuario
|
||||
details: Detalles
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
|
@ -13,12 +12,12 @@ import FetchedTags from 'components/ui/FetchedTags.vue';
|
|||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
import SendEmailDialog from 'src/components/common/SendEmailDialog.vue';
|
||||
import { useVnConfirm } from 'src/composables/useVnConfirm';
|
||||
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { openReport, sendEmail } = usePrintService();
|
||||
const arrayData = useArrayData('Client');
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const route = useRoute();
|
||||
const tableRef = ref();
|
||||
|
@ -61,7 +60,7 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'shipped',
|
||||
label: t('Creation date'),
|
||||
label: t('shipped'),
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
|
@ -72,7 +71,7 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'description',
|
||||
label: t('Description'),
|
||||
label: t('globals.description'),
|
||||
class: 'extend',
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
|
@ -81,7 +80,7 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'quantity',
|
||||
label: t('Quantity'),
|
||||
label: t('globals.quantity'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
|
@ -102,20 +101,16 @@ const openReportPdf = () => {
|
|||
};
|
||||
|
||||
const openSendEmailDialog = async () => {
|
||||
quasar.dialog({
|
||||
component: SendEmailDialog,
|
||||
componentProps: {
|
||||
data: {
|
||||
address: arrayData.store.data.email,
|
||||
},
|
||||
promise: sendCampaignMetricsEmail,
|
||||
},
|
||||
});
|
||||
openConfirmationModal(
|
||||
t('The consumption report will be sent'),
|
||||
t('Please, confirm'),
|
||||
() => sendCampaignMetricsEmail({ address: arrayData.store.data.email })
|
||||
);
|
||||
};
|
||||
const sendCampaignMetricsEmail = ({ address }) => {
|
||||
sendEmail(`Suppliers/${route.params.id}/campaign-metrics-email`, {
|
||||
sendEmail(`Clients/${route.params.id}/campaign-metrics-email`, {
|
||||
recipient: address,
|
||||
...getParams().value,
|
||||
...getParams(),
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -140,7 +135,7 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
|||
@click="openSendEmailDialog()"
|
||||
:disabled="!showActionBtns"
|
||||
>
|
||||
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
||||
<QTooltip>{{ t('Send to email') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
@ -160,7 +155,6 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
|||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
<!-- <FetchedTags :item="row" :max-length="6" /> -->
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
<FetchedTags :item="row" :max-length="6" />
|
||||
|
@ -175,7 +169,9 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
|||
|
||||
<i18n>
|
||||
es:
|
||||
Group by item: Agrupar por artículo
|
||||
|
||||
Send to email: Enviar por email
|
||||
Search by item id or name: Buscar por id de artículo o nombre
|
||||
The consumption report will be sent: Se enviará el informe de consumo
|
||||
Please, confirm: Por favor, confirma
|
||||
Enter a new search: Introduce una nueva búsqueda
|
||||
</i18n>
|
||||
|
|
|
@ -24,7 +24,7 @@ defineProps({ dataKey: { type: String, required: true } });
|
|||
<QItemSection
|
||||
><QCheckbox
|
||||
v-model="params.grouped"
|
||||
:label="t('Group by item')"
|
||||
:label="t('params.grouped')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
/></QItemSection>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRouter } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import TicketTransferForm from './TicketTransferForm.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import axios from 'axios';
|
||||
|
@ -135,9 +136,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
|||
:columns="destinationTicketColumns"
|
||||
:title="t('Destination ticket')"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-address="{ row }">
|
||||
<QTd @click.stop>
|
||||
|
@ -158,29 +157,11 @@ onMounted(() => (_transfer.value = $props.transfer));
|
|||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #no-data>
|
||||
<TicketTransferForm v-bind="$props" />
|
||||
</template>
|
||||
<template #bottom>
|
||||
<QForm class="q-mt-lg full-width">
|
||||
<VnInput
|
||||
v-model.number="_transfer.ticketId"
|
||||
:label="t('Transfer to ticket')"
|
||||
:clearable="false"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="keyboard_arrow_right"
|
||||
color="primary"
|
||||
@click="transferSales(_transfer.ticketId)"
|
||||
style="width: 30px"
|
||||
/>
|
||||
</template>
|
||||
</VnInput>
|
||||
<QBtn
|
||||
:label="t('New ticket')"
|
||||
color="primary"
|
||||
class="full-width q-my-lg"
|
||||
@click="transferSales()"
|
||||
/>
|
||||
</QForm>
|
||||
<TicketTransferForm v-bind="$props" />
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
transfer: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
ticket: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['refreshData']);
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const _transfer = ref(null);
|
||||
|
||||
const transferSales = async (ticketId) => {
|
||||
const params = {
|
||||
ticketId: ticketId,
|
||||
sales: $props.transfer.sales,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
`tickets/${$props.ticket.id}/transferSales`,
|
||||
params
|
||||
);
|
||||
|
||||
if (data && data.id === $props.ticket.id) emit('refreshData');
|
||||
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
||||
};
|
||||
|
||||
onMounted(() => (_transfer.value = $props.transfer));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
{{ _transfer }}
|
||||
<QForm class="q-mt-lg full-width">
|
||||
<VnInput
|
||||
v-model.number="_transfer.ticketId"
|
||||
:label="t('Transfer to ticket')"
|
||||
:clearable="false"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="keyboard_arrow_right"
|
||||
color="primary"
|
||||
@click="transferSales(_transfer.ticketId)"
|
||||
style="width: 30px"
|
||||
/>
|
||||
</template>
|
||||
</VnInput>
|
||||
<QBtn
|
||||
:label="t('New ticket')"
|
||||
color="primary"
|
||||
class="full-width q-my-lg"
|
||||
@click="transferSales()"
|
||||
/>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Sales to transfer: Líneas a transferir
|
||||
Destination ticket: Ticket destinatario
|
||||
Transfer to ticket: Transferir a ticket
|
||||
New ticket: Nuevo ticket
|
||||
</i18n>
|
Loading…
Reference in New Issue