forked from verdnatura/salix-front
Merge branch 'PR-CUSTOMER' of https://gitea.verdnatura.es/hyervoni/salix-front-mindshore into PR-CUSTOMER
This commit is contained in:
commit
f69b25716d
|
@ -66,6 +66,10 @@ body.body--dark {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.card-width {
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
.vn-card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
|
|
|
@ -3,6 +3,8 @@ import { ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
|
||||
|
@ -10,6 +12,7 @@ const { t } = useI18n();
|
|||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const addresses = ref([]);
|
||||
const client = ref(null);
|
||||
const provincesLocation = ref([]);
|
||||
|
||||
|
@ -45,6 +48,11 @@ const addressFilter = {
|
|||
],
|
||||
};
|
||||
|
||||
const setRows = (data) => {
|
||||
addresses.value = data;
|
||||
sortAddresses();
|
||||
};
|
||||
|
||||
const setProvince = (provinceFk) => {
|
||||
const result = provincesLocation.value.filter(
|
||||
(province) => province.id === provinceFk
|
||||
|
@ -56,6 +64,24 @@ const isDefaultAddress = (address) => {
|
|||
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||
};
|
||||
|
||||
const setDefault = (address) => {
|
||||
const url = `Clients/${route.params.id}`;
|
||||
const payload = { defaultAddressFk: address.id };
|
||||
axios.patch(url, payload).then((res) => {
|
||||
if (res.data) {
|
||||
client.value.defaultAddressFk = res.data.defaultAddressFk;
|
||||
sortAddresses();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const sortAddresses = () => {
|
||||
if (!client.value || !addresses.value) return;
|
||||
addresses.value = addresses.value.sort((a, b) => {
|
||||
return isDefaultAddress(b) - isDefaultAddress(a);
|
||||
});
|
||||
};
|
||||
|
||||
const toCustomerAddressCreate = () => {
|
||||
router.push({ name: 'CustomerAddressCreate' });
|
||||
};
|
||||
|
@ -72,6 +98,12 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="setRows"
|
||||
auto-load
|
||||
:filter="addressFilter"
|
||||
:url="`Clients/${route.params.id}/addresses`"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (client = data)"
|
||||
auto-load
|
||||
|
@ -83,21 +115,15 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
url="Provinces/location"
|
||||
/>
|
||||
|
||||
<QCard class="q-pa-lg">
|
||||
<VnPaginate
|
||||
data-key="CustomerAddress"
|
||||
:url="`Clients/${route.params.id}/addresses`"
|
||||
order="id"
|
||||
auto-load
|
||||
:filter="addressFilter"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QCard
|
||||
v-for="(item, index) in rows"
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg" v-if="addresses.length">
|
||||
<QCardSection>
|
||||
<div
|
||||
v-for="(item, index) in addresses"
|
||||
:key="index"
|
||||
:class="{
|
||||
'address-card': true,
|
||||
'q-mb-md': index < rows.length - 1,
|
||||
'q-mb-md': index < addresses.length - 1,
|
||||
'item-disabled': !item.isActive,
|
||||
}"
|
||||
@click="toCustomerAddressEdit(item.id)"
|
||||
|
@ -112,7 +138,18 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
color="primary"
|
||||
name="star"
|
||||
size="md"
|
||||
/>
|
||||
@click.stop="!isDefaultAddress(item) && setDefault(item)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{
|
||||
t(
|
||||
isDefaultAddress(item)
|
||||
? 'Default address'
|
||||
: 'Set as default'
|
||||
)
|
||||
}}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-weight-bold q-mb-sm">
|
||||
|
@ -156,10 +193,10 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
<div>{{ observation.description }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</QCard>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="toCustomerAddressCreate()" color="primary" fab icon="add" />
|
||||
|
@ -192,4 +229,6 @@ es:
|
|||
Is equalizated: Recargo de equivalencia
|
||||
Is logiflora allowed: Compra directa en Holanda
|
||||
New consignee: Nuevo consignatario
|
||||
Default address: Consignatario predeterminado
|
||||
Set as default: Establecer como predeterminado
|
||||
</i18n>
|
||||
|
|
|
@ -129,7 +129,7 @@ const updateData = () => {
|
|||
<QSeparator class="q-mx-lg" vertical />
|
||||
|
||||
<div class="flex">
|
||||
<div class="flex items-center">
|
||||
<div class="flex items-center" v-if="item?.insurances.length">
|
||||
<div class="flex q-mr-xl">
|
||||
<div class="q-mr-sm color-vn-label">
|
||||
{{ t('Credit') }}:
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { QBtn } from 'quasar';
|
||||
|
||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||
|
||||
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';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const informationOptions = ref([]);
|
||||
const rows = ref([]);
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -32,12 +37,64 @@ const initialData = reactive({
|
|||
rating: null,
|
||||
recommendedCredit: null,
|
||||
});
|
||||
|
||||
const tableColumnComponents = {
|
||||
since: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
employee: {
|
||||
component: QBtn,
|
||||
props: () => ({ flat: true, color: 'blue' }),
|
||||
event: () => {},
|
||||
},
|
||||
rating: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
recommendedCredit: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: 'created',
|
||||
format: (value) => toDateHourMin(value),
|
||||
label: t('Since'),
|
||||
name: 'since',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: (row) => row.worker.user.nickname,
|
||||
label: t('Employee'),
|
||||
name: 'employee',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'rating',
|
||||
label: t('Rating'),
|
||||
name: 'rating',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'recommendedCredit',
|
||||
format: (value) => toCurrency(value),
|
||||
label: t('Recommended credit'),
|
||||
name: 'recommendedCredit',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (informationOptions = data)"
|
||||
@on-fetch="(data) => (rows = data)"
|
||||
auto-load
|
||||
url="ClientInformas"
|
||||
/>
|
||||
|
@ -68,10 +125,41 @@ const initialData = reactive({
|
|||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:rows="rows"
|
||||
hide-bottom
|
||||
row-key="id"
|
||||
v-model:selected="selected"
|
||||
class="q-pa-lg"
|
||||
>
|
||||
<template #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<QTr :props="props" class="cursor-pointer">
|
||||
<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)"
|
||||
>
|
||||
{{ props.value }}
|
||||
<WorkerDescriptorProxy
|
||||
:id="props.row.workerFk"
|
||||
v-if="props.col.name === 'employee'"
|
||||
/>
|
||||
</component>
|
||||
</QTr>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Rating: Clasificación
|
||||
Recommended credit: Crédito recomendado
|
||||
Since: Desde
|
||||
Employee: Empleado
|
||||
</i18n>
|
||||
|
|
|
@ -85,7 +85,8 @@ const toCustomerCreditCreate = () => {
|
|||
url="ClientCredits"
|
||||
/>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 12 }"
|
||||
|
@ -99,9 +100,13 @@ const toCustomerCreditCreate = () => {
|
|||
<QTr :props="props" class="cursor-pointer">
|
||||
<component
|
||||
:is="tableColumnComponents[props.col.name].component"
|
||||
@click="tableColumnComponents[props.col.name].event(props)"
|
||||
@click="
|
||||
tableColumnComponents[props.col.name].event(props)
|
||||
"
|
||||
class="rounded-borders q-pa-sm"
|
||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||
v-bind="
|
||||
tableColumnComponents[props.col.name].props(props)
|
||||
"
|
||||
>
|
||||
{{ props.value }}
|
||||
<WorkerDescriptorProxy
|
||||
|
@ -117,7 +122,8 @@ const toCustomerCreditCreate = () => {
|
|||
<h5 class="flex justify-center color-vn-label" v-else>
|
||||
{{ t('globals.noResults') }}
|
||||
</h5>
|
||||
</QPage>
|
||||
</QCard>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="toCustomerCreditCreate()" color="primary" fab icon="add" />
|
||||
|
|
|
@ -83,7 +83,7 @@ function handleLocation(data, location) {
|
|||
:label="t('Sage transaction type')"
|
||||
:options="typesTransactions"
|
||||
hide-selected
|
||||
option-label="vat"
|
||||
option-label="transaction"
|
||||
option-value="id"
|
||||
v-model="data.sageTransactionTypeFk"
|
||||
>
|
||||
|
|
|
@ -23,7 +23,8 @@ const toCustomerNoteCreate = () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QCard class="q-pa-lg">
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg">
|
||||
<VnPaginate
|
||||
data-key="CustomerNotes"
|
||||
:url="'clientObservations'"
|
||||
|
@ -43,10 +44,15 @@ const toCustomerNoteCreate = () => {
|
|||
}"
|
||||
>
|
||||
<div class="flex justify-between">
|
||||
<p class="color-vn-label">{{ item.worker.user.nickname }}</p>
|
||||
<p class="color-vn-label">
|
||||
{{ item.worker.user.nickname }}
|
||||
</p>
|
||||
<p class="color-vn-label">
|
||||
{{
|
||||
date.formatDate(item?.created, 'DD-MM-YYYY HH:mm:ss')
|
||||
date.formatDate(
|
||||
item?.created,
|
||||
'DD-MM-YYYY HH:mm:ss'
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -62,6 +68,7 @@ const toCustomerNoteCreate = () => {
|
|||
</template>
|
||||
</VnPaginate>
|
||||
</QCard>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="toCustomerNoteCreate()" color="primary" fab icon="add" />
|
||||
|
|
|
@ -287,3 +287,8 @@ const creditWarning = computed(() => {
|
|||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Latest tickets: Últimos tickets
|
||||
</i18n>
|
||||
|
|
|
@ -135,7 +135,8 @@ const onSubmit = async () => {
|
|||
</QBtnGroup>
|
||||
</Teleport>
|
||||
|
||||
<QCard class="q-pa-lg">
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg">
|
||||
<QCardSection>
|
||||
<QForm>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
@ -148,6 +149,9 @@ const onSubmit = async () => {
|
|||
<div class="col">
|
||||
<VnInput :label="t('User')" clearable v-model="name" />
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Recovery email')"
|
||||
|
@ -171,6 +175,7 @@ const onSubmit = async () => {
|
|||
</QForm>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -69,7 +69,7 @@ const columns = computed(() => [
|
|||
url="CreditInsurances"
|
||||
/>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QPage class="column items-center q-pa-md" v-if="rows.length">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 12 }"
|
||||
|
@ -93,6 +93,10 @@ const columns = computed(() => [
|
|||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
|
||||
<h5 class="flex justify-center color-vn-label" v-else>
|
||||
{{ t('globals.noResults') }}
|
||||
</h5>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -366,17 +366,6 @@ export default {
|
|||
],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'credit-contracts',
|
||||
name: 'CustomerCreditContracts',
|
||||
meta: {
|
||||
title: 'creditContracts',
|
||||
},
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/Card/CustomerCreditContracts.vue'
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'credit-contracts',
|
||||
name: 'CreditContractsCard',
|
||||
|
@ -439,7 +428,7 @@ export default {
|
|||
{
|
||||
name: 'CustomerConsumption',
|
||||
title: 'consumption',
|
||||
icon: 'vn:lines',
|
||||
icon: 'show_chart',
|
||||
},
|
||||
{
|
||||
name: 'CustomerMandates',
|
||||
|
|
Loading…
Reference in New Issue