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