0
0
Fork 0

Merge branch 'dev' into 7500_ChangeEntryDms

This commit is contained in:
Jon Elias 2024-09-13 06:10:34 +00:00
commit eca4b02022
19 changed files with 127 additions and 201 deletions

View File

@ -507,11 +507,8 @@ function handleOnDataSaved(_) {
:key="index"
:title="btn.title"
:icon="btn.icon"
class="q-px-sm"
class="q-px-sm text-primary-light"
flat
:class="
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
"
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
}`"

View File

@ -231,20 +231,20 @@ defineExpose({ fetch, addFilter, paginate });
</template>
<style lang="scss" scoped>
.spinner {
z-index: 1;
align-content: end;
position: absolute;
bottom: 0;
left: 0;
}
.info-row {
width: 100%;
.spinner {
z-index: 1;
align-content: end;
position: absolute;
bottom: 0;
left: 0;
}
.info-row {
width: 100%;
h5 {
margin: 0;
}
h5 {
margin: 0;
}
}
</style>
<i18n>

View File

@ -16,7 +16,7 @@ export function usePrintService() {
);
}
function openReport(path, params) {
function openReport(path, params, isNewTab = '_self') {
if (typeof params === 'string') params = JSON.parse(params);
params = Object.assign(
{
@ -26,8 +26,7 @@ export function usePrintService() {
);
const query = new URLSearchParams(params).toString();
window.open(`api/${path}?${query}`);
window.open(`api/${path}?${query}`, isNewTab);
}
return {

View File

@ -133,6 +133,7 @@ globals:
fiscalData: Fiscal data
billingData: Billing data
consignees: Consignees
'address-create': New address
notes: Notes
credits: Credits
greuges: Greuges

View File

@ -136,6 +136,7 @@ globals:
fiscalData: Datos fiscales
billingData: Forma de pago
consignees: Consignatarios
'address-create': Nuevo consignatario
notes: Notas
credits: Créditos
greuges: Greuges

View File

@ -179,6 +179,13 @@ const toCustomerAddressEdit = (addressId) => {
{{ item.postalCode }} - {{ item.city }},
{{ setProvince(item.provinceFk) }}
</div>
<div>
{{ item.phone }}
<span v-if="item.mobile"
>,
{{ item.mobile }}
</span>
</div>
<div class="flex">
<QCheckbox
:label="t('Is equalizated')"

View File

@ -5,12 +5,12 @@ import { useRoute } from 'vue-router';
import { useAcl } from 'src/composables/useAcl';
import axios from 'axios';
import { useQuasar } from 'quasar';
import FetchData from 'components/FetchData.vue';
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
import { useState } from 'composables/useState';
import { useStateStore } from 'stores/useStateStore';
import { usePrintService } from 'composables/usePrintService';
import { useSession } from 'composables/useSession';
import { useVnConfirm } from 'composables/useVnConfirm';
import VnTable from 'components/VnTable/VnTable.vue';
@ -22,12 +22,10 @@ import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService();
const { sendEmail, openReport } = usePrintService();
const { t } = useI18n();
const { hasAny } = useAcl();
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const currentBalance = ref({});
const quasar = useQuasar();
const route = useRoute();
const state = useState();
@ -36,7 +34,7 @@ const user = state.getUser();
const clientRisk = ref([]);
const tableRef = ref();
const companyId = ref();
const companyId = ref(user.value.companyFk);
const companyLastId = ref(user.value.companyFk);
const balances = ref([]);
const vnFilterRef = ref({});
@ -76,14 +74,14 @@ const companyFilterColumn = {
const columns = computed(() => [
{
align: 'left',
align: 'right',
name: 'payed',
label: t('Date'),
format: ({ payed }) => toDate(payed),
cardVisible: true,
},
{
align: 'left',
align: 'right',
name: 'created',
label: t('Creation date'),
format: ({ created }) => toDateHourMin(created),
@ -91,11 +89,10 @@ const columns = computed(() => [
},
{
align: 'left',
name: 'workerFk',
label: t('Employee'),
columnField: {
component: 'userLink',
attrs: ({ row }) => ({ workerId: row.workerFk, tag: row.userName }),
attrs: ({ row }) => ({ workerId: row.workerFk, name: row.userName }),
},
cardVisible: true,
},
@ -120,14 +117,14 @@ const columns = computed(() => [
isId: true,
},
{
align: 'right',
align: 'left',
name: 'credit',
label: t('Havings'),
format: ({ credit }) => credit && toCurrency(credit),
cardVisible: true,
},
{
align: 'right',
align: 'left',
name: 'balance',
label: t('Balance'),
format: ({ balance }) => toCurrency(balance),
@ -166,41 +163,15 @@ const columns = computed(() => [
onBeforeMount(() => {
stateStore.rightDrawer = true;
companyId.value = user.value.companyFk;
});
async function getClientRisk() {
const { data } = await axios.get(`clientRisks`, {
params: {
filter: JSON.stringify({
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
}),
},
});
clientRisk.value = data;
return clientRisk.value;
}
async function getCurrentBalance() {
const currentBalance = (await getClientRisk()).find((balance) => {
return balance.companyFk === companyId.value;
});
return currentBalance && currentBalance.amount;
}
async function onFetch(data) {
balances.value = [];
for (const [index, balance] of data.entries()) {
if (index === 0) {
balance.balance = await getCurrentBalance();
continue;
}
const previousBalance = data[index - 1];
balance.balance =
previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
async function getCurrentBalance(data) {
for (const balance of data) {
currentBalance.value[balance.companyFk] = {
code: balance.company.code,
amount: balance.amount,
};
}
balances.value = data;
}
const showNewPaymentDialog = () => {
@ -215,19 +186,27 @@ const showNewPaymentDialog = () => {
};
const showBalancePdf = ({ id }) => {
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
window.open(url, '_blank');
openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
};
</script>
<template>
<FetchData
url="clientRisks"
:filter="{
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id, companyFk: companyId },
}"
auto-load
@on-fetch="getCurrentBalance"
></FetchData>
<VnSubToolbar class="q-mb-md">
<template #st-data>
<div class="column justify-center q-px-md q-py-sm">
<span class="text-bold">{{ t('Total by company') }}</span>
<div class="row justify-center" v-if="clientRisk?.length">
{{ clientRisk[0].company.code }}:
{{ toCurrency(clientRisk[0].amount) }}
<div class="row justify-center">
{{ currentBalance[companyId]?.code }}:
{{ toCurrency(currentBalance[companyId]?.amount) }}
</div>
</div>
</template>
@ -253,7 +232,6 @@ const showBalancePdf = ({ id }) => {
:right-search="false"
:is-editable="false"
:column-search="false"
@on-fetch="onFetch"
:disable-option="{ card: true }"
auto-load
>
@ -262,7 +240,7 @@ const showBalancePdf = ({ id }) => {
</template>
<template #column-description="{ row }">
<div class="link" v-if="row.isInvoice">
{{ row.description }}
{{ t('bill', { ref: row.description }) }}
<InvoiceOutDescriptorProxy :id="row.description" />
</div>
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">

View File

@ -137,7 +137,6 @@ const title = ref();
<VnRow>
<VnSelect
url="Clients"
:where="{ id: { neq: $route.params.id } }"
:input-debounce="0"
:label="t('customer.basicData.previousClient')"
:options="clients"

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
@ -14,8 +13,6 @@ import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
const { t } = useI18n();
const route = useRoute();
const payMethods = ref([]);
const bankEntitiesOptions = ref([]);
const bankEntitiesRef = ref(null);
const filter = {
@ -31,15 +28,6 @@ const getBankEntities = (data, formData) => {
</script>
<template>
<FetchData @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
<FetchData
ref="bankEntitiesRef"
@on-fetch="(data) => (bankEntitiesOptions = data)"
:filter="filter"
auto-load
url="BankEntities"
/>
<FormModel
:url-update="`Clients/${route.params.id}`"
:url="`Clients/${route.params.id}/getCard`"
@ -49,8 +37,9 @@ const getBankEntities = (data, formData) => {
<template #form="{ data, validate }">
<VnRow>
<VnSelect
auto-load
url="PayMethods"
:label="t('Billing data')"
:options="payMethods"
hide-selected
option-label="name"
option-value="id"
@ -69,7 +58,10 @@ const getBankEntities = (data, formData) => {
</VnInput>
<VnSelectDialog
:label="t('Swift / BIC')"
:options="bankEntitiesOptions"
ref="bankEntitiesRef"
:filter="filter"
auto-load
url="BankEntities"
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:rules="validate('Worker.bankEntity')"
hide-selected

View File

@ -44,7 +44,7 @@ const columns = computed(() => [
{
align: 'right',
field: 'rating',
label: t('Rating'),
label: t('customer.summary.rating'),
name: 'rating',
create: true,
columnCreate: {
@ -56,7 +56,7 @@ const columns = computed(() => [
align: 'right',
field: 'recommendedCredit',
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
label: t('Recommended credit'),
label: t('customer.summary.recommendCredit'),
name: 'recommendedCredit',
create: true,
columnCreate: {
@ -89,8 +89,8 @@ const columns = computed(() => [
}"
>
<template #column-employee="{ row }">
<span class="link" @click.stop>{{ row.worker.user.nickname }}</span>
<WorkerDescriptorProxy :id="row.clientFk" />
<span class="link">{{ row.worker.user.nickname }}</span>
<WorkerDescriptorProxy :id="row.worker.id" />
</template>
</VnTable>
<!-- <QTable
@ -113,7 +113,6 @@ const columns = computed(() => [
<i18n>
es:
Rating: Clasificación
Recommended credit: Crédito recomendado
Since: Desde
Employee: Empleado

View File

@ -5,10 +5,10 @@ import { useRoute } from 'vue-router';
import { toCurrency } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date';
import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue';
const entityId = computed(() => route.params.id);
const { t } = useI18n();
const route = useRoute();
const rows = ref([]);
const totalAmount = ref();
const tableRef = ref();
const filter = computed(() => {
@ -28,7 +28,7 @@ const filter = computed(() => {
},
],
where: {
clientFk: route.params.id,
clientFk: entityId,
},
};
});
@ -84,14 +84,14 @@ const columns = computed(() => [
create: true,
},
]);
const setRows = (data) => {
rows.value = data;
totalAmount.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
};
</script>
<template>
<FetchData
:url="`Greuges/${entityId}/sumAmount`"
auto-load
@on-fetch="({ sumAmount }) => (totalAmount = sumAmount)"
></FetchData>
<VnTable
ref="tableRef"
data-key="Greuges"
@ -104,7 +104,6 @@ const setRows = (data) => {
:is-editable="false"
:use-model="true"
:column-search="false"
@on-fetch="(data) => setRows(data)"
:disable-option="{ card: true }"
:create="{
urlCreate: `Greuges`,

View File

@ -1,20 +1,19 @@
<script setup>
import { computed, ref } from 'vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { toDateTimeFormat } from 'src/filters/date';
import FetchData from 'components/FetchData.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import { dashIfEmpty } from 'src/filters';
const { t } = useI18n();
const route = useRoute();
const rows = ref([]);
const filter = {
include: [
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } },
],
where: { clientFk: route.params.id },
@ -22,114 +21,61 @@ const filter = {
limit: 20,
};
const tableColumnComponents = {
id: {
component: 'span',
props: () => {},
event: () => {},
},
company: {
component: 'span',
props: () => {},
event: () => {},
},
type: {
component: 'span',
props: () => {},
event: () => {},
},
registerDate: {
component: 'span',
props: () => {},
event: () => {},
},
endDate: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'id',
label: t('Id'),
name: 'id',
label: t('globals.id'),
field: 'id',
isId: true,
},
{
align: 'left',
field: (row) => row.company.code,
label: t('Company'),
cardVisible: true,
format: ({ company }) => company.code,
label: t('globals.company'),
name: 'company',
},
{
align: 'left',
field: (row) => row.mandateType.name,
label: t('Type'),
cardVisible: true,
format: ({ mandateType }) => mandateType.code,
label: t('globals.type'),
name: 'type',
},
{
align: 'left',
field: 'created',
cardVisible: true,
label: t('Register date'),
name: 'registerDate',
format: (value) => toDateTimeFormat(value),
name: 'created',
format: ({ created }) => toDateTimeFormat(created),
},
{
align: 'left',
field: 'finished',
align: 'right',
cardVisible: true,
name: 'finished',
label: t('End date'),
name: 'endDate',
format: (value) => (value ? toDateTimeFormat(value) : '-'),
format: ({ finished }) => dashIfEmpty(toDateTimeFormat(finished)),
},
]);
</script>
<template>
<FetchData
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
url="Mandates"
/>
<QPage class="column items-center q-pa-md">
<QTable
<VnTable
:filter="filter"
auto-load
url="Mandates"
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
@click="tableColumnComponents[props.col.name].event(props)"
class="rounded-borders q-pa-sm"
v-bind="tableColumnComponents[props.col.name].props(props)"
>
{{ props.value }}
</component>
</QTr>
</QTd>
</template>
</QTable>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
:right-search="false"
:row-click="false"
/>
</QPage>
</template>
<i18n>
es:
Id: Id
Company: Empresa
Type: Tipo
Register date: Fecha alta
End date: Fecha baja
</i18n>

View File

@ -92,7 +92,7 @@ function setFinished(id) {
:disable-option="{ card: true }"
:create="{
urlCreate: 'Recoveries',
title: 'New recovery',
title: t('New recovery'),
onDataSaved: () => tableRef.reload(),
formInitialData: { clientFk: route.params.id, started: Date.vnNew() },
}"

View File

@ -1,7 +1,7 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import { QBtn, useQuasar } from 'quasar';
@ -13,7 +13,6 @@ import CustomerSamplesCreate from '../components/CustomerSamplesCreate.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const filter = {
include: [
@ -42,7 +41,16 @@ const columns = computed(() => [
{
align: 'left',
label: t('Worker'),
name: 'worker',
columnField: {
component: 'userLink',
attrs: ({ row }) => {
return {
defaultName: true,
workerId: row?.user?.id,
name: row?.user?.name,
};
},
},
},
{
align: 'left',
@ -73,7 +81,9 @@ const tableRef = ref();
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:disable-option="{ card: true }"
:right-search="false"
:rows="rows"
:order="['created DESC']"
class="full-width q-mt-md"
row-key="id"
:create="false"

View File

@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
import axios from 'axios';
import { toCurrency, toDateHourMinSec } from 'src/filters';
import { toCurrency, toDateHourMin } from 'src/filters';
import CustomerCloseIconTooltip from '../components/CustomerCloseIconTooltip.vue';
import CustomerCheckIconTooltip from '../components/CustomerCheckIconTooltip.vue';
@ -74,7 +74,7 @@ const columns = computed(() => [
field: 'created',
label: t('Date'),
name: 'date',
format: (value) => toDateHourMinSec(value),
format: (value) => toDateHourMin(value),
},
{
align: 'left',

View File

@ -41,8 +41,7 @@ const invoiceFormType = ref('pdf');
const defaultEmailAddress = ref($props.invoiceOutData.client?.email);
const showInvoicePdf = () => {
const url = `api/InvoiceOuts/${$props.invoiceOutData.id}/download?access_token=${token}`;
window.open(url, '_blank');
openReport(`InvoiceOuts/${$props.invoiceOutData.id}/download`, {}, '_blank');
};
const showInvoiceCsv = () => {

View File

@ -17,7 +17,9 @@ import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { usePrintService } from 'src/composables/usePrintService';
const { openReport } = usePrintService();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const quasar = useQuasar();
@ -235,18 +237,15 @@ const cloneRoutes = () => {
const showRouteReport = () => {
const ids = selectedRows.value.map((row) => row?.id);
const idString = ids.join(',');
let url;
if (selectedRows.value.length <= 1) {
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getTokenMultimedia()}`;
} else {
const params = new URLSearchParams({
access_token: session.getTokenMultimedia(),
let url = `Routes/${idString}/driver-route-pdf`;
let params = {};
if (selectedRows.value.length >= 1) {
params = {
id: idString,
});
url = `api/Routes/downloadZip?${params.toString()}`;
};
url = `Routes/downloadZip`;
}
window.open(url, '_blank');
openReport(url, params, '_blank');
};
function markAsServed() {

View File

@ -153,7 +153,7 @@ onMounted(async () => {
:label="t('params.state')"
v-model="params.state"
:options="stateOptions"
option-value="code"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
@ -169,7 +169,7 @@ onMounted(async () => {
:label="t('params.futureState')"
v-model="params.futureState"
:options="stateOptions"
option-value="code"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense

View File

@ -10,6 +10,6 @@ const route = useRoute();
delete-model="WorkerDms"
download-model="WorkerDms"
default-dms-code="hhrrData"
filter="worker"
filter="wd.workerFk"
/>
</template>