#6943 - Customer module migration bugs #705
|
@ -369,7 +369,7 @@ function handleOnDataSaved(_) {
|
||||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:disable-infinite-scroll="
|
:disable-infinite-scroll="
|
||||||
$attrs['disableInfiniteScroll'] ? isTableMode : disableInfiniteScroll
|
$attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll
|
||||||
"
|
"
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||||
|
@ -507,11 +507,8 @@ function handleOnDataSaved(_) {
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="btn.title"
|
:title="btn.title"
|
||||||
:icon="btn.icon"
|
:icon="btn.icon"
|
||||||
class="q-px-sm"
|
class="q-px-sm text-primary-light"
|
||||||
flat
|
flat
|
||||||
:class="
|
|
||||||
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
|
|
||||||
"
|
|
||||||
:style="`visibility: ${
|
:style="`visibility: ${
|
||||||
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
||||||
}`"
|
}`"
|
||||||
|
|
|
@ -224,13 +224,20 @@ defineExpose({ fetch, addFilter, paginate });
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<slot name="body" :rows="store.data"></slot>
|
<slot name="body" :rows="store.data"></slot>
|
||||||
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
<div v-if="isLoading" class="spinner info-row q-pa-md text-center">
|
||||||
<QSpinner color="primary" size="md" />
|
<QSpinner color="primary" size="md" />
|
||||||
</div>
|
</div>
|
||||||
</QInfiniteScroll>
|
</QInfiniteScroll>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.spinner {
|
||||||
|
z-index: 1;
|
||||||
|
align-content: end;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
.info-row {
|
.info-row {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
if (typeof params === 'string') params = JSON.parse(params);
|
||||||
params = Object.assign(
|
params = Object.assign(
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,7 @@ export function usePrintService() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = new URLSearchParams(params).toString();
|
const query = new URLSearchParams(params).toString();
|
||||||
|
window.open(`api/${path}?${query}`, isNewTab);
|
||||||
window.open(`api/${path}?${query}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -5,12 +5,12 @@ import { useRoute } from 'vue-router';
|
||||||
import { useAcl } from 'src/composables/useAcl';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import { useSession } from 'composables/useSession';
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
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';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { sendEmail } = usePrintService();
|
const { sendEmail, openReport } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { hasAny } = useAcl();
|
const { hasAny } = useAcl();
|
||||||
|
const currentBalance = ref({});
|
||||||
const session = useSession();
|
|
||||||
const tokenMultimedia = session.getTokenMultimedia();
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -36,7 +34,7 @@ const user = state.getUser();
|
||||||
|
|
||||||
const clientRisk = ref([]);
|
const clientRisk = ref([]);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const companyId = ref();
|
const companyId = ref(user.value.companyFk);
|
||||||
const companyLastId = ref(user.value.companyFk);
|
const companyLastId = ref(user.value.companyFk);
|
||||||
const balances = ref([]);
|
const balances = ref([]);
|
||||||
const vnFilterRef = ref({});
|
const vnFilterRef = ref({});
|
||||||
|
@ -76,14 +74,14 @@ const companyFilterColumn = {
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
name: 'payed',
|
name: 'payed',
|
||||||
label: t('Date'),
|
label: t('Date'),
|
||||||
format: ({ payed }) => toDate(payed),
|
format: ({ payed }) => toDate(payed),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
name: 'created',
|
name: 'created',
|
||||||
label: t('Creation date'),
|
label: t('Creation date'),
|
||||||
format: ({ created }) => toDateHourMin(created),
|
format: ({ created }) => toDateHourMin(created),
|
||||||
|
@ -91,11 +89,10 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'workerFk',
|
|
||||||
label: t('Employee'),
|
label: t('Employee'),
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'userLink',
|
component: 'userLink',
|
||||||
attrs: ({ row }) => ({ workerId: row.workerFk, tag: row.userName }),
|
attrs: ({ row }) => ({ workerId: row.workerFk, name: row.userName }),
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
@ -120,14 +117,14 @@ const columns = computed(() => [
|
||||||
isId: true,
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'left',
|
||||||
name: 'credit',
|
name: 'credit',
|
||||||
label: t('Havings'),
|
label: t('Havings'),
|
||||||
format: ({ credit }) => credit && toCurrency(credit),
|
format: ({ credit }) => credit && toCurrency(credit),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'left',
|
||||||
name: 'balance',
|
name: 'balance',
|
||||||
label: t('Balance'),
|
label: t('Balance'),
|
||||||
format: ({ balance }) => toCurrency(balance),
|
format: ({ balance }) => toCurrency(balance),
|
||||||
|
@ -166,41 +163,15 @@ const columns = computed(() => [
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
companyId.value = user.value.companyFk;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getClientRisk() {
|
async function getCurrentBalance(data) {
|
||||||
const { data } = await axios.get(`clientRisks`, {
|
for (const balance of data) {
|
||||||
params: {
|
currentBalance.value[balance.companyFk] = {
|
||||||
filter: JSON.stringify({
|
code: balance.company.code,
|
||||||
include: { relation: 'company', scope: { fields: ['code'] } },
|
amount: balance.amount,
|
||||||
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);
|
|
||||||
}
|
|
||||||
balances.value = data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showNewPaymentDialog = () => {
|
const showNewPaymentDialog = () => {
|
||||||
|
@ -215,19 +186,27 @@ const showNewPaymentDialog = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const showBalancePdf = ({ id }) => {
|
const showBalancePdf = ({ id }) => {
|
||||||
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
|
openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
|
||||||
window.open(url, '_blank');
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<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">
|
<VnSubToolbar class="q-mb-md">
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
<div class="column justify-center q-px-md q-py-sm">
|
<div class="column justify-center q-px-md q-py-sm">
|
||||||
<span class="text-bold">{{ t('Total by company') }}</span>
|
<span class="text-bold">{{ t('Total by company') }}</span>
|
||||||
<div class="row justify-center" v-if="clientRisk?.length">
|
<div class="row justify-center">
|
||||||
{{ clientRisk[0].company.code }}:
|
{{ currentBalance[companyId]?.code }}:
|
||||||
{{ toCurrency(clientRisk[0].amount) }}
|
{{ toCurrency(currentBalance[companyId]?.amount) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -253,7 +232,6 @@ const showBalancePdf = ({ id }) => {
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
@on-fetch="onFetch"
|
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
|
@ -262,7 +240,7 @@ const showBalancePdf = ({ id }) => {
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<div class="link" v-if="row.isInvoice">
|
<div class="link" v-if="row.isInvoice">
|
||||||
{{ row.description }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||||
</div>
|
</div>
|
||||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
|
|
|
@ -151,6 +151,7 @@ const setShippedColor = (date) => {
|
||||||
:disable-option="{ card: true, table: true }"
|
:disable-option="{ card: true, table: true }"
|
||||||
limit="5"
|
limit="5"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
|
:disable-infinite-scroll="true"
|
||||||
>
|
>
|
||||||
<template #column-nickname="{ row }">
|
<template #column-nickname="{ row }">
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
|
|
@ -41,8 +41,7 @@ const invoiceFormType = ref('pdf');
|
||||||
const defaultEmailAddress = ref($props.invoiceOutData.client?.email);
|
const defaultEmailAddress = ref($props.invoiceOutData.client?.email);
|
||||||
|
|
||||||
const showInvoicePdf = () => {
|
const showInvoicePdf = () => {
|
||||||
const url = `api/InvoiceOuts/${$props.invoiceOutData.id}/download?access_token=${token}`;
|
openReport(`InvoiceOuts/${$props.invoiceOutData.id}/download`, {}, '_blank');
|
||||||
window.open(url, '_blank');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showInvoiceCsv = () => {
|
const showInvoiceCsv = () => {
|
||||||
|
|
|
@ -17,7 +17,9 @@ import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
|
|
||||||
|
const { openReport } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -235,18 +237,15 @@ const cloneRoutes = () => {
|
||||||
const showRouteReport = () => {
|
const showRouteReport = () => {
|
||||||
const ids = selectedRows.value.map((row) => row?.id);
|
const ids = selectedRows.value.map((row) => row?.id);
|
||||||
const idString = ids.join(',');
|
const idString = ids.join(',');
|
||||||
let url;
|
let url = `Routes/${idString}/driver-route-pdf`;
|
||||||
|
let params = {};
|
||||||
if (selectedRows.value.length <= 1) {
|
if (selectedRows.value.length >= 1) {
|
||||||
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getTokenMultimedia()}`;
|
params = {
|
||||||
} else {
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
access_token: session.getTokenMultimedia(),
|
|
||||||
id: idString,
|
id: idString,
|
||||||
});
|
};
|
||||||
url = `api/Routes/downloadZip?${params.toString()}`;
|
url = `Routes/downloadZip`;
|
||||||
}
|
}
|
||||||
window.open(url, '_blank');
|
openReport(url, params, '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
function markAsServed() {
|
function markAsServed() {
|
||||||
|
|
|
@ -153,7 +153,7 @@ onMounted(async () => {
|
||||||
:label="t('params.state')"
|
:label="t('params.state')"
|
||||||
v-model="params.state"
|
v-model="params.state"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
option-value="code"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
dense
|
dense
|
||||||
|
@ -169,7 +169,7 @@ onMounted(async () => {
|
||||||
:label="t('params.futureState')"
|
:label="t('params.futureState')"
|
||||||
v-model="params.futureState"
|
v-model="params.futureState"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
option-value="code"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
dense
|
dense
|
||||||
|
|
Loading…
Reference in New Issue