HOTFIX: #6943 CustomerList form salesPersons options #790
|
@ -2,8 +2,6 @@
|
||||||
defineProps({ phoneNumber: { type: [String, Number], default: null } });
|
defineProps({ phoneNumber: { type: [String, Number], default: null } });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-btn round color="secondary" name="add" />
|
|
||||||
<QIcon round color="primary" name="add_circle" />
|
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="phoneNumber"
|
v-if="phoneNumber"
|
||||||
flat
|
flat
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
|
||||||
|
|
||||||
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
||||||
|
@ -26,6 +25,11 @@ const $props = defineProps({
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const customer = computed(() => summary.value.entity);
|
const customer = computed(() => summary.value.entity);
|
||||||
const summary = ref();
|
const summary = ref();
|
||||||
|
const clientUrl = ref();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
|
||||||
|
});
|
||||||
|
|
||||||
const balanceDue = computed(() => {
|
const balanceDue = computed(() => {
|
||||||
return (
|
return (
|
||||||
|
@ -38,11 +42,11 @@ const balanceDue = computed(() => {
|
||||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||||
|
|
||||||
const claimRate = computed(() => {
|
const claimRate = computed(() => {
|
||||||
return customer.value.claimsRatio?.claimingRate ?? 0;
|
return customer.value.claimsRatio.claimingRate;
|
||||||
});
|
});
|
||||||
|
|
||||||
const priceIncreasingRate = computed(() => {
|
const priceIncreasingRate = computed(() => {
|
||||||
return customer.value.claimsRatio?.priceIncreasing ?? 0 / 100;
|
return customer.value.claimsRatio.priceIncreasing / 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
|
@ -56,11 +60,6 @@ const creditWarning = computed(() => {
|
||||||
|
|
||||||
return tooMuchInsurance || noCreditInsurance ? 'negative' : '';
|
return tooMuchInsurance || noCreditInsurance ? 'negative' : '';
|
||||||
});
|
});
|
||||||
const sumRisk = ({ clientRisks }) => {
|
|
||||||
let total = clientRisks.reduce((acc, { amount }) => acc + amount, 0);
|
|
||||||
|
|
||||||
return total;
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -98,13 +97,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
:value="entity?.salesPersonUser?.name"
|
:value="entity?.salesPersonUser?.name"
|
||||||
>
|
/>
|
||||||
<template #value>
|
|
||||||
<VnUserLink
|
|
||||||
:name="entity.salesPersonUser?.name"
|
|
||||||
:worker-id="entity.salesPersonFk"
|
|
||||||
/> </template
|
|
||||||
></VnLv>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.contactChannel')"
|
:label="t('customer.summary.contactChannel')"
|
||||||
:value="entity?.contactChannel?.name"
|
:value="entity?.contactChannel?.name"
|
||||||
|
@ -144,7 +137,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:url="`#/customer/${entityId}/fiscal-data`"
|
:url="`#/customer/${entityId}/fiscal-data`"
|
||||||
:text="t('customer.summary.fiscalData')"
|
:text="t('customer.summary.fiscalData')"
|
||||||
/>
|
/>
|
||||||
<VnRow class="block">
|
<VnRow>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.isEqualizated')"
|
:label="t('customer.summary.isEqualizated')"
|
||||||
:value="entity.isEqualizated"
|
:value="entity.isEqualizated"
|
||||||
|
@ -153,6 +146,8 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:label="t('customer.summary.isActive')"
|
:label="t('customer.summary.isActive')"
|
||||||
:value="entity.isActive"
|
:value="entity.isActive"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.verifiedData')"
|
:label="t('customer.summary.verifiedData')"
|
||||||
:value="entity.isTaxDataChecked"
|
:value="entity.isTaxDataChecked"
|
||||||
|
@ -161,6 +156,8 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:label="t('customer.summary.hasToInvoice')"
|
:label="t('customer.summary.hasToInvoice')"
|
||||||
:value="entity.hasToInvoice"
|
:value="entity.hasToInvoice"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.notifyByEmail')"
|
:label="t('customer.summary.notifyByEmail')"
|
||||||
:value="entity.isToBeMailed"
|
:value="entity.isToBeMailed"
|
||||||
|
@ -171,7 +168,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`#/customer/${entityId}/billing-data`"
|
:url="`#/customer/${entityId}/billing-data`"
|
||||||
:text="t('customer.summary.payMethodFk')"
|
:text="t('customer.summary.billingData')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.payMethod')"
|
:label="t('customer.summary.payMethod')"
|
||||||
|
@ -179,7 +176,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
|
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
|
||||||
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
|
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
|
||||||
<VnRow class="q-mt-sm block">
|
<VnRow class="q-mt-sm" wrap>
|
||||||
<VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
|
<VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.hasCoreVnl')"
|
:label="t('customer.summary.hasCoreVnl')"
|
||||||
|
@ -194,7 +191,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="entity.defaultAddress">
|
<QCard class="vn-one" v-if="entity.defaultAddress">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`#/customer/${entityId}/address`"
|
:url="`#/customer/${entityId}/consignees`"
|
||||||
:text="t('customer.summary.consignee')"
|
:text="t('customer.summary.consignee')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
@ -241,6 +238,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="toCurrency(entity?.mana?.mana)"
|
:value="toCurrency(entity?.mana?.mana)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
v-if="entity.claimsRatio"
|
||||||
:label="t('customer.summary.priceIncreasingRate')"
|
:label="t('customer.summary.priceIncreasingRate')"
|
||||||
:value="toPercentage(priceIncreasingRate)"
|
:value="toPercentage(priceIncreasingRate)"
|
||||||
/>
|
/>
|
||||||
|
@ -249,6 +247,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="toCurrency(entity?.averageInvoiced?.invoiced)"
|
:value="toCurrency(entity?.averageInvoiced?.invoiced)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
v-if="entity.claimsRatio"
|
||||||
:label="t('customer.summary.claimRate')"
|
:label="t('customer.summary.claimRate')"
|
||||||
:value="toPercentage(claimRate)"
|
:value="toPercentage(claimRate)"
|
||||||
/>
|
/>
|
||||||
|
@ -275,13 +274,15 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnLv
|
<VnLv
|
||||||
|
v-if="entity.creditInsurance"
|
||||||
:label="t('customer.summary.securedCredit')"
|
:label="t('customer.summary.securedCredit')"
|
||||||
:value="toCurrency(entity.creditInsurance)"
|
:value="toCurrency(entity.creditInsurance)"
|
||||||
:info="t('customer.summary.securedCreditInfo')"
|
:info="t('customer.summary.securedCreditInfo')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.balance')"
|
:label="t('customer.summary.balance')"
|
||||||
:value="toCurrency(sumRisk(entity)) || toCurrency(0)"
|
:value="toCurrency(entity.sumRisk) || toCurrency(0)"
|
||||||
:info="t('customer.summary.balanceInfo')"
|
:info="t('customer.summary.balanceInfo')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -308,7 +309,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="entity.recommendedCredit"
|
:value="entity.recommendedCredit"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard>
|
<QCard class="vn-one">
|
||||||
<VnTitle :text="t('Latest tickets')" />
|
<VnTitle :text="t('Latest tickets')" />
|
||||||
<CustomerSummaryTable />
|
<CustomerSummaryTable />
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
@ -14,6 +14,7 @@ import OrderFilter from './Card/OrderFilter.vue';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -21,6 +22,7 @@ const tableRef = ref();
|
||||||
const agencyList = ref([]);
|
const agencyList = ref([]);
|
||||||
const addressesList = ref([]);
|
const addressesList = ref([]);
|
||||||
const clientId = ref();
|
const clientId = ref();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -141,7 +143,12 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
onMounted(() => {
|
||||||
|
if (!route.query.createForm) return;
|
||||||
|
const clientId = route.query.createForm;
|
||||||
|
const id = JSON.parse(clientId);
|
||||||
|
fetchClientAddress(id.clientFk, id);
|
||||||
|
});
|
||||||
async function fetchClientAddress(id, formData) {
|
async function fetchClientAddress(id, formData) {
|
||||||
const { data } = await axios.get(`Clients/${id}`, {
|
const { data } = await axios.get(`Clients/${id}`, {
|
||||||
params: { filter: { include: { relation: 'addresses' } } },
|
params: { filter: { include: { relation: 'addresses' } } },
|
||||||
|
|
|
@ -141,6 +141,16 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
onMounted(() => {
|
||||||
|
if (!route.query.createForm) return;
|
||||||
|
const clientId = route.query.createForm;
|
||||||
|
const id = JSON.parse(clientId);
|
||||||
|
console.error('id: ', id);
|
||||||
|
});
|
||||||
|
function redirectToLines(id) {
|
||||||
|
const url = `#/ticket/${id}/sale`;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
}
|
||||||
|
|
||||||
const onClientSelected = async (formData) => {
|
const onClientSelected = async (formData) => {
|
||||||
await fetchClient(formData);
|
await fetchClient(formData);
|
||||||
|
@ -238,7 +248,7 @@ onMounted(() => {
|
||||||
urlCreate: 'Tickets/new',
|
urlCreate: 'Tickets/new',
|
||||||
title: t('ticketList.createTicket'),
|
title: t('ticketList.createTicket'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {},
|
formInitialData: { clientFk: null },
|
||||||
}"
|
}"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
||||||
|
@ -250,10 +260,11 @@ onMounted(() => {
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
{{ clientId }}
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:label="t('ticketList.client')"
|
:label="t('ticketList.client')"
|
||||||
v-model="data.clientId"
|
v-model="data.clientFk"
|
||||||
:options="clientsOptions"
|
:options="clientsOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
|
Loading…
Reference in New Issue