0
0
Fork 0

Merge pull request '#7274 fixCustomer' (!374) from 7274-fixCustomer into dev

Reviewed-on: verdnatura/salix-front#374
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-05-16 07:05:01 +00:00
commit 03553dd9bc
19 changed files with 563 additions and 219 deletions

View File

@ -83,7 +83,7 @@ const inputRules = [
<slot name="prepend" /> <slot name="prepend" />
</template> </template>
<template #append> <template #append v-if="!!$attrs.disabled">
<slot name="append" v-if="$slots.append" /> <slot name="append" v-if="$slots.append" />
<QIcon <QIcon
name="close" name="close"

View File

@ -142,6 +142,9 @@ const showRedirectToSummaryIcon = computed(() => {
box-shadow: none; box-shadow: none;
.vn-label-value { .vn-label-value {
&.negative > .value span {
color: $alert;
}
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-top: 2px; margin-top: 2px;

View File

@ -32,6 +32,7 @@ globals:
confirm: Confirm confirm: Confirm
assign: Assign assign: Assign
back: Back back: Back
downloadPdf: Download PDF
yes: 'Yes' yes: 'Yes'
no: 'No' no: 'No'
noChanges: No changes to save noChanges: No changes to save
@ -271,6 +272,7 @@ customer:
tableVisibleColumns: tableVisibleColumns:
id: Identifier id: Identifier
name: Name name: Name
socialName: Social name
fi: Tax number fi: Tax number
salesPersonFk: Salesperson salesPersonFk: Salesperson
credit: Credit credit: Credit

View File

@ -59,6 +59,7 @@ globals:
amount: Importe amount: Importe
packages: Bultos packages: Bultos
download: Descargar download: Descargar
downloadPdf: Descargar PDF
selectRows: 'Seleccionar las { numberRows } filas(s)' selectRows: 'Seleccionar las { numberRows } filas(s)'
allRows: 'Todo { numberRows } filas(s)' allRows: 'Todo { numberRows } filas(s)'
markAll: Marcar todo markAll: Marcar todo
@ -269,6 +270,7 @@ customer:
tableVisibleColumns: tableVisibleColumns:
id: Identificador id: Identificador
name: Nombre name: Nombre
socialName: Razón social
fi: NIF / CIF fi: NIF / CIF
salesPersonFk: Comercial salesPersonFk: Comercial
credit: Crédito credit: Crédito

View File

@ -12,7 +12,6 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import ClaimSummary from './Card/ClaimSummary.vue'; import ClaimSummary from './Card/ClaimSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { getUrl } from 'src/composables/getUrl';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();

View File

@ -11,6 +11,7 @@ import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
import { usePrintService } from 'src/composables/usePrintService'; import { usePrintService } from 'src/composables/usePrintService';
import { useSession } from 'src/composables/useSession';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -19,6 +20,9 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue'; import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const { sendEmail } = usePrintService(); const { sendEmail } = usePrintService();
const { t } = useI18n(); const { t } = useI18n();
@ -188,6 +192,11 @@ const saveFieldValue = async (row) => {
const sendEmailAction = () => { const sendEmailAction = () => {
sendEmail(`Suppliers/${route.params.id}/campaign-metrics-email`); sendEmail(`Suppliers/${route.params.id}/campaign-metrics-email`);
}; };
const showBalancePdf = (balance) => {
const url = `api/InvoiceOuts/${balance.id}/download?access_token=${tokenMultimedia}`;
window.open(url, '_blank');
};
</script> </script>
<template> <template>
@ -257,17 +266,28 @@ const sendEmailAction = () => {
<QTd align="center"> <QTd align="center">
<QIcon <QIcon
@click.stop="showDialog = true" @click.stop="showDialog = true"
class="q-ml-md" class="q-ml-md fill-icon"
color="primary" color="primary"
name="outgoing_mail" name="outgoing_mail"
size="sm" size="sm"
style="font-variation-settings: 'FILL' 1"
v-if="row.isCompensation" v-if="row.isCompensation"
> >
<QTooltip> <QTooltip>
{{ t('Send compensation') }} {{ t('Send compensation') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
<QIcon
@click="showBalancePdf(row)"
class="q-ml-md fill-icon"
color="primary"
name="cloud_download"
size="sm"
v-if="row.hasPdf"
>
<QTooltip>
{{ t('globals.downloadPdf') }}
</QTooltip>
</QIcon>
<QDialog v-model="showDialog"> <QDialog v-model="showDialog">
<QCard class="q-pa-sm"> <QCard class="q-pa-sm">

View File

@ -105,7 +105,7 @@ const updateData = () => {
color="primary" color="primary"
name="lock" name="lock"
size="md" size="md"
style="font-variation-settings: 'FILL' 1" class="fill-icon"
> >
<QTooltip>{{ t('Close contract') }}</QTooltip> <QTooltip>{{ t('Close contract') }}</QTooltip>
</QIcon> </QIcon>

View File

@ -1,20 +1,17 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import { useStateStore } from 'src/stores/useStateStore';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const stateStore = computed(() => useStateStore());
const rows = ref([]); const rows = ref([]);
const totalAmount = ref(0); const totalAmount = ref(0);
@ -105,28 +102,40 @@ const columns = computed(() => [
const setRows = (data) => { const setRows = (data) => {
rows.value = data; rows.value = data;
totalAmount.value = data.reduce((accumulator, currentValue) => { totalAmount.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
return accumulator + currentValue.amount;
}, 0);
};
const toCustomerGreugeCreate = () => {
router.push({ name: 'CustomerGreugeCreate' });
}; };
</script> </script>
<template> <template>
<FetchData :filter="filter" @on-fetch="setRows" auto-load url="greuges" /> <FetchData :filter="filter" @on-fetch="setRows" auto-load url="greuges" />
<template v-if="stateStore.isHeaderMounted()">
<div class="full-width flex justify-center"> <Teleport to="#actions-append">
<QPage class="card-width q-pa-lg"> <div class="row q-gutter-x-sm">
<QCard class="full-width q-pa-sm" v-if="totalAmount"> <QBtn
<h6 class="flex justify-end q-my-lg q-pr-lg"> flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="300" show-if-above>
<QCard class="full-width q-pa-sm">
<h6 class="flex justify-end q-my-lg q-pr-lg" v-if="totalAmount">
<span class="color-vn-label q-mr-md">{{ t('Total') }}:</span> <span class="color-vn-label q-mr-md">{{ t('Total') }}:</span>
{{ toCurrency(totalAmount) }} {{ toCurrency(totalAmount) }}
</h6> </h6>
<QSkeleton v-else type="QInput" square />
</QCard> </QCard>
</QDrawer>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<QCard class="q-pa-sm q-mt-md"> <QCard class="q-pa-sm q-mt-md">
<QTable <QTable
:columns="columns" :columns="columns"
@ -164,7 +173,7 @@ const toCustomerGreugeCreate = () => {
</div> </div>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerGreugeCreate()" color="primary" fab icon="add" /> <QBtn color="primary" fab icon="add" :to="{ name: 'CustomerGreugeCreate' }" />
<QTooltip> <QTooltip>
{{ t('New greuge') }} {{ t('New greuge') }}
</QTooltip> </QTooltip>

View File

@ -3,10 +3,10 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox, useQuasar } from 'quasar'; import { QBtn, QCheckbox, useQuasar } from 'quasar';
import { useStateStore } from 'stores/useStateStore';
import { toCurrency, toDate } from 'filters/index'; import { toCurrency, toDate, dateRange } from 'filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue';
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue'; import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue'; import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -14,13 +14,14 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue'; import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t, locale } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
const dataRef = ref(null);
const balanceDueTotal = ref(0); const balanceDueTotal = ref(0);
const selected = ref([]); const selected = ref([]);
const rows = ref([]);
const tableColumnComponents = { const tableColumnComponents = {
client: { client: {
@ -167,39 +168,61 @@ const columns = computed(() => [
}, },
]); ]);
const setRows = (data) => {
rows.value = data;
balanceDueTotal.value = data.reduce((accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
}, 0);
};
const viewAddObservation = (rowsSelected) => { const viewAddObservation = (rowsSelected) => {
quasar.dialog({ quasar.dialog({
component: CustomerDefaulterAddObservation, component: CustomerDefaulterAddObservation,
componentProps: { componentProps: {
clients: rowsSelected, clients: rowsSelected,
promise: refreshData, promise: async () => await dataRef.value.fetch(),
}, },
}); });
}; };
const refreshData = () => { const onFetch = (data) => {
setRows(); for (const element of data) element.isWorker = element.businessTypeFk === 'worker';
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
}; };
const onFetch = (data) => { function exprBuilder(param, value) {
for (const element of data) { switch (param) {
element.isWorker = element.businessTypeFk === 'worker'; case 'clientFk':
return { [`d.${param}`]: value?.id };
case 'creditInsurance':
case 'amount':
case 'workerFk':
case 'countryFk':
case 'payMethod':
case 'salesPersonFk':
return { [`d.${param}`]: value };
case 'date':
return { 'd.created': { between: dateRange(value) } };
case 'defaulterSinced':
return { 'd.defaulterSinced': { between: dateRange(value) } };
} }
rows.value = data; }
};
</script> </script>
<template> <template>
<FetchData :filter="filter" @on-fetch="onFetch" auto-load url="Defaulters/filter" /> <template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<CustomerNotificationsFilter data-key="CustomerDefaulter" /> <CustomerNotificationsFilter data-key="CustomerDefaulter" />
</QScrollArea> </QScrollArea>
@ -214,12 +237,25 @@ const onFetch = (data) => {
icon="vn:notes" icon="vn:notes"
:disabled="!selected.length" :disabled="!selected.length"
@click.stop="viewAddObservation(selected)" @click.stop="viewAddObservation(selected)"
/> >
<QTooltip>{{ t('Add observation') }}</QTooltip>
</QBtn>
</div> </div>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<VnPaginate
ref="dataRef"
@on-fetch="onFetch"
data-key="CustomerDefaulter"
:filter="filter"
:expr-builder="exprBuilder"
auto-load
url="Defaulters/filter"
>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable <QTable
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
@ -233,9 +269,15 @@ const onFetch = (data) => {
<QTh> <QTh>
<QCheckbox v-model="props.selected" /> <QCheckbox v-model="props.selected" />
</QTh> </QTh>
<QTh v-for="col in props.cols" :key="col.name" :props="props"> <QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{ t(col.label) }} {{ t(col.label) }}
<QTooltip v-if="col.tooltip">{{ col.tooltip }}</QTooltip> <QTooltip v-if="col.tooltip">{{
col.tooltip
}}</QTooltip>
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
@ -244,17 +286,33 @@ const onFetch = (data) => {
<QTd :props="props"> <QTd :props="props">
<QTr :props="props" class="cursor-pointer"> <QTr :props="props" class="cursor-pointer">
<component <component
:is="tableColumnComponents[props.col.name].component" :is="
tableColumnComponents[props.col.name]
.component
"
class="col-content" class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="
@click="tableColumnComponents[props.col.name].event(props)" tableColumnComponents[props.col.name].props(
props
)
"
@click="
tableColumnComponents[props.col.name].event(
props
)
"
> >
<template v-if="props.col.name !== 'isWorker'"> <template v-if="props.col.name !== 'isWorker'">
<div v-if="props.col.name === 'lastObservation'"> <div
v-if="
props.col.name === 'lastObservation'
"
>
<VnInput <VnInput
type="textarea" type="textarea"
v-model="props.value" v-model="props.value"
autogrow autogrow
:disable="true"
/> />
</div> </div>
<div v-else>{{ props.value }}</div> <div v-else>{{ props.value }}</div>
@ -277,6 +335,9 @@ const onFetch = (data) => {
</QTd> </QTd>
</template> </template>
</QTable> </QTable>
</div>
</template>
</VnPaginate>
</QPage> </QPage>
</template> </template>
@ -289,6 +350,7 @@ const onFetch = (data) => {
<i18n> <i18n>
es: es:
Add observation: Añadir observación
Client: Cliente Client: Cliente
Is worker: Es trabajador Is worker: Es trabajador
Salesperson: Comercial Salesperson: Comercial

View File

@ -57,7 +57,7 @@ const authors = ref();
hide-selected hide-selected
map-options map-options
option-label="name" option-label="name"
option-value="clientTypeFk" option-value="id"
outlined outlined
rounded rounded
use-input use-input
@ -162,7 +162,7 @@ const authors = ref();
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnInput <VnInputDate
:label="t('L. O. Date')" :label="t('L. O. Date')"
clearable clearable
is-outlined is-outlined

View File

@ -10,7 +10,7 @@ import CustomerExtendedListActions from './CustomerExtendedListActions.vue';
import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue'; import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue'; import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
@ -37,8 +37,6 @@ onMounted(() => {
allColumnNames.value = filteredColumns.map((col) => col.name); allColumnNames.value = filteredColumns.map((col) => col.name);
}); });
const rows = computed(() => arrayData.value.store.data);
const selectedCustomerId = ref(0); const selectedCustomerId = ref(0);
const selectedSalesPersonId = ref(0); const selectedSalesPersonId = ref(0);
const allColumnNames = ref([]); const allColumnNames = ref([]);
@ -70,6 +68,11 @@ const tableColumnComponents = {
props: () => {}, props: () => {},
event: () => {}, event: () => {},
}, },
socialName: {
component: 'span',
props: () => {},
event: () => {},
},
fi: { fi: {
component: 'span', component: 'span',
props: () => {}, props: () => {},
@ -283,6 +286,12 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.name'), label: t('customer.extendedList.tableVisibleColumns.name'),
name: 'name', name: 'name',
}, },
{
align: 'left',
field: 'socialName',
label: t('customer.extendedList.tableVisibleColumns.socialName'),
name: 'socialName',
},
{ {
align: 'left', align: 'left',
field: 'fi', field: 'fi',
@ -485,6 +494,23 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport></template
>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<CustomerExtendedListFilter <CustomerExtendedListFilter
@ -495,7 +521,7 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<VnSubToolbar> <VnSubToolbar>
<template #st-actions> <template #st-data>
<TableVisibleColumns <TableVisibleColumns
:all-columns="allColumnNames" :all-columns="allColumnNames"
table-code="clientsDetail" table-code="clientsDetail"
@ -508,6 +534,13 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
</VnSubToolbar> </VnSubToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<VnPaginate
data-key="CustomerExtendedList"
url="Clients/extendedListFilter"
auto-load
>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable <QTable
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
@ -521,13 +554,32 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
{{ value }} {{ value }}
</QTd> </QTd>
</template> </template>
<template #body-cell-customerStatus="props">
<QTd @click="stopEventPropagation($event, props.col)">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="
tableColumnComponents[props.col.name].props(props)
"
@click="
tableColumnComponents[props.col.name].event(props)
"
>
</component>
</QTd>
</template>
<template #body-cell-id="props"> <template #body-cell-id="props">
<QTd @click="stopEventPropagation($event, props.col)"> <QTd @click="stopEventPropagation($event, props.col)">
<component <component
:is="tableColumnComponents[props.col.name].component" :is="tableColumnComponents[props.col.name].component"
class="col-content" class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="
@click="tableColumnComponents[props.col.name].event(props)" tableColumnComponents[props.col.name].props(props)
"
@click="
tableColumnComponents[props.col.name].event(props)
"
> >
<CustomerDescriptorProxy :id="props.row.id" /> <CustomerDescriptorProxy :id="props.row.id" />
{{ props.row.id }} {{ props.row.id }}
@ -540,10 +592,16 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
v-if="props.row.salesPerson" v-if="props.row.salesPerson"
class="col-content" class="col-content"
:is="tableColumnComponents[props.col.name].component" :is="tableColumnComponents[props.col.name].component"
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="
@click="tableColumnComponents[props.col.name].event(props)" tableColumnComponents[props.col.name].props(props)
"
@click="
tableColumnComponents[props.col.name].event(props)
"
> >
<WorkerDescriptorProxy :id="props.row.salesPersonFk" /> <WorkerDescriptorProxy
:id="props.row.salesPersonFk"
/>
{{ props.row.salesPerson }} {{ props.row.salesPerson }}
</component> </component>
<span class="col-content" v-else>-</span> <span class="col-content" v-else>-</span>
@ -554,12 +612,19 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
<component <component
:is="tableColumnComponents[props.col.name].component" :is="tableColumnComponents[props.col.name].component"
class="col-content" class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="
@click="tableColumnComponents[props.col.name].event(props)" tableColumnComponents[props.col.name].props(props)
"
@click="
tableColumnComponents[props.col.name].event(props)
"
/> />
</QTd> </QTd>
</template> </template>
</QTable> </QTable>
</div>
</template>
</VnPaginate>
</QPage> </QPage>
</template> </template>

View File

@ -1,17 +1,16 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import FetchData from 'components/FetchData.vue';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue'; import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsCampaignConsumption from './CustomerNotificationsCampaignConsumption.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const rows = ref([]);
const selected = ref([]); const selected = ref([]);
const selectedCustomerId = ref(0); const selectedCustomerId = ref(0);
@ -82,22 +81,42 @@ const selectCustomerId = (id) => {
</script> </script>
<template> <template>
<FetchData <template v-if="stateStore.isHeaderMounted()">
:filter="filter" <Teleport to="#actions-append">
@on-fetch="(data) => (rows = data)" <div class="row q-gutter-x-sm">
auto-load <QBtn
url="Clients" flat
/> @click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<CustomerNotificationsFilter data-key="CustomerNotifications" /> <CustomerNotificationsFilter data-key="CustomerNotifications" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<VnSubToolbar class="justify-end">
<VnSubToolbar /> <template #st-data>
<CustomerNotificationsCampaignConsumption
:selected-rows="selected.length > 0"
:clients="selected"
:promise="refreshData"
/>
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<VnPaginate data-key="CustomerNotifications" url="Clients" auto-load>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable <QTable
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
@ -110,18 +129,34 @@ const selectCustomerId = (id) => {
<QTd :props="props"> <QTd :props="props">
<QTr :props="props" class="cursor-pointer"> <QTr :props="props" class="cursor-pointer">
<component <component
:is="tableColumnComponents[props.col.name].component" :is="
tableColumnComponents[props.col.name]
.component
"
class="col-content" class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="
@click="tableColumnComponents[props.col.name].event(props)" tableColumnComponents[props.col.name].props(
props
)
"
@click="
tableColumnComponents[props.col.name].event(
props
)
"
> >
{{ props.value }} {{ props.value }}
<CustomerDescriptorProxy :id="selectedCustomerId" /> <CustomerDescriptorProxy
:id="selectedCustomerId"
/>
</component> </component>
</QTr> </QTr>
</QTd> </QTd>
</template> </template>
</QTable> </QTable>
</div>
</template>
</VnPaginate>
</QPage> </QPage>
</template> </template>
@ -140,4 +175,5 @@ es:
Phone: Teléfono Phone: Teléfono
City: Población City: Población
Email: Email Email: Email
Campaign consumption: Consumo campaña
</i18n> </i18n>

View File

@ -0,0 +1,152 @@
<script setup>
import { ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import useNotify from 'src/composables/useNotify';
import { useValidator } from 'src/composables/useValidator';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import FetchData from 'src/components/FetchData.vue';
import { watch } from 'vue';
import { onMounted } from 'vue';
const $props = defineProps({
clients: {
type: Array,
required: true,
},
promise: {
type: Function,
required: true,
},
selectedRows: {
type: Boolean,
},
});
const { selectedRows } = toRefs($props);
const { notify } = useNotify();
const { t } = useI18n();
const validationsStore = useValidator();
const campaignParams = ref(null);
const campaignsOptions = ref(null);
const moreFields = ref([]);
const popupProxyRef = ref(null);
const upcomingOptions = ref(null);
const campaignChange = ({ name }) => {
const campaign = campaignsOptions.value.find((c) => c.code === name);
handleDates(campaign);
};
const handleDates = (campaign) => {
const from = new Date(campaign.dated);
from.setDate(from.getDate() - campaign.scopeDays);
campaignParams.value = {
code: campaign.code,
from: from,
to: campaign.dated,
};
};
watch(selectedRows, () => {
handleDates(upcomingOptions.value);
});
const onSubmit = async () => {
try {
const data = {
clients: $props.clients.map((item) => item.id),
from: campaignParams.value.from,
to: campaignParams.value.to,
};
const params = JSON.stringify(data);
await axios.post('ClientConsumptionQueues', { params });
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide();
} catch (error) {
notify(error.message, 'negative');
}
};
onMounted(async () => {
const { models } = validationsStore;
const properties = models.Item?.properties || {};
const _moreFields = ['valentinesDay', 'mothersDay', 'allSaints'];
_moreFields.forEach((field) => {
let prop = properties[field];
const label = t(`params.${field}`);
moreFields.value.push({
name: field,
label,
type: prop ? prop.type : null,
});
});
});
</script>
<template>
<FetchData
url="Campaigns/latest"
@on-fetch="(data) => (campaignsOptions = data)"
:filter="{ fields: ['id', 'code', 'dated'], order: 'code ASC', limit: 30 }"
auto-load
/>
<FetchData
url="Campaigns/upcoming"
@on-fetch="(data) => (upcomingOptions = data)"
auto-load
/>
<QBtn color="primary" icon="show_chart" :disable="!selectedRows">
<QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md">
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
:options="moreFields"
option-value="code"
option-label="label"
v-model="campaignParams.code"
:label="t('Campaign')"
@update:model-value="campaignChange"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInputDate v-model="campaignParams.from" :label="t('From')" />
<VnInputDate v-model="campaignParams.to" :label="t('To')" />
</VnRow>
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
class="q-mr-md"
v-close-popup
/>
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
@click="onSubmit()"
/>
</div>
</QCard>
</QPopupProxy>
<QTooltip>{{ t('Campaign consumption') }}</QTooltip>
</QBtn>
</template>
<i18n>
en:
params:
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
es:
params:
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
Campaign consumption: Consumo campaña
Campaign: Campaña
From: Desde
To: Hasta
</i18n>

View File

@ -110,13 +110,7 @@ function stateColor(row) {
</div> </div>
</Teleport> </Teleport>
</template> </template>
<QDrawer <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
v-model="stateStore.rightDrawer"
side="right"
:width="256"
show-if-above
:breakpoint="1600"
>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<CustomerPaymentsFilter data-key="CustomerTransactions" /> <CustomerPaymentsFilter data-key="CustomerTransactions" />
</QScrollArea> </QScrollArea>

View File

@ -12,6 +12,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue'; import EntryLatestBuysFilter from './EntryLatestBuysFilter.vue';
import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
@ -636,18 +637,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
auto-load auto-load
@on-fetch="(data) => (intrastatOptions = data)" @on-fetch="(data) => (intrastatOptions = data)"
/> />
<QToolbar class="justify-end"> <VnSubToolbar>
<div id="st-data"> <template #st-data>
<TableVisibleColumns <TableVisibleColumns
:all-columns="allColumnNames" :all-columns="allColumnNames"
table-code="latestBuys" table-code="latestBuys"
labels-traductions-path="entry.latestBuys" labels-traductions-path="entry.latestBuys"
@on-config-saved="visibleColumns = ['picture', ...$event]" @on-config-saved="visibleColumns = ['picture', ...$event]"
/> />
</div> </template>
<QSpace /> <QSpace />
<div id="st-actions"></div> <div id="st-actions"></div>
</QToolbar> </VnSubToolbar>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<EntryLatestBuysFilter data-key="EntryLatestBuys" /> <EntryLatestBuysFilter data-key="EntryLatestBuys" />

View File

@ -139,7 +139,7 @@ const openCreateInvoiceModal = () => {
icon="cloud_download" icon="cloud_download"
:disable="selectedCards.size === 0" :disable="selectedCards.size === 0"
> >
<QTooltip>{{ t('downloadPdf') }}</QTooltip> <QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
</QBtn> </QBtn>
<QCheckbox <QCheckbox
left-label left-label
@ -234,13 +234,11 @@ en:
fileDenied: Browser denied file download... fileDenied: Browser denied file download...
fileAllowed: Successful download of CSV file fileAllowed: Successful download of CSV file
youCanSearchByInvoiceReference: You can search by invoice reference youCanSearchByInvoiceReference: You can search by invoice reference
downloadPdf: Download PDF
createInvoice: Make invoice createInvoice: Make invoice
es: es:
searchInvoice: Buscar factura emitida searchInvoice: Buscar factura emitida
fileDenied: El navegador denegó la descarga de archivos... fileDenied: El navegador denegó la descarga de archivos...
fileAllowed: Descarga exitosa de archivo CSV fileAllowed: Descarga exitosa de archivo CSV
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
downloadPdf: Descargar PDF
createInvoice: Crear factura createInvoice: Crear factura
</i18n> </i18n>

View File

@ -72,7 +72,12 @@ const openAddStopDialog = () => {
<template> <template>
<div class="q-pa-md full-width"> <div class="q-pa-md full-width">
<CardSummary ref="summary" :url="`Roadmaps/${entityId}`" :filter="filter"> <CardSummary
data-key="RoadmapSummary"
ref="summary"
:url="`Roadmaps/${entityId}`"
:filter="filter"
>
<template #header-left> <template #header-left>
<RouterLink :to="{ name: `RoadmapSummary`, params: { id: entityId } }"> <RouterLink :to="{ name: `RoadmapSummary`, params: { id: entityId } }">
<QIcon name="open_in_new" color="white" size="sm" /> <QIcon name="open_in_new" color="white" size="sm" />

View File

@ -274,7 +274,7 @@ const openSmsDialog = async () => {
<QBtn <QBtn
icon="filter_alt" icon="filter_alt"
color="primary" color="primary"
class="q-mr-sm filled-icon" class="q-mr-sm fill-icon"
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="deletePriorities" @click="deletePriorities"
> >
@ -295,7 +295,7 @@ const openSmsDialog = async () => {
<QBtn <QBtn
icon="sms" icon="sms"
color="primary" color="primary"
class="q-mr-sm filled-icon" class="q-mr-sm fill-icon"
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="openSmsDialog" @click="openSmsDialog"
> >
@ -425,10 +425,6 @@ const openSmsDialog = async () => {
.table-actions { .table-actions {
gap: 12px; gap: 12px;
} }
.filled-icon {
font-variation-settings: 'FILL' 1;
}
</style> </style>
<i18n> <i18n>
es: es:

View File

@ -87,7 +87,7 @@ export default {
name: 'CustomerNotifications', name: 'CustomerNotifications',
meta: { meta: {
title: 'notifications', title: 'notifications',
icon: 'notifications', icon: 'campaign',
}, },
component: () => component: () =>
import( import(
@ -99,7 +99,7 @@ export default {
name: 'CustomerDefaulter', name: 'CustomerDefaulter',
meta: { meta: {
title: 'defaulter', title: 'defaulter',
icon: 'vn:risk', icon: 'vn:defaulter',
}, },
component: () => component: () =>
import('src/pages/Customer/Defaulter/CustomerDefaulter.vue'), import('src/pages/Customer/Defaulter/CustomerDefaulter.vue'),