forked from verdnatura/salix-front
Merge remote-tracking branch 'origin/7830-customerDesplegables' into 6943_fix_customerSummaryTable
This commit is contained in:
commit
cadd6a2b62
|
@ -44,7 +44,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
async function fetch(fetchFilter = {}) {
|
async function fetch(fetchFilter = {}) {
|
||||||
try {
|
try {
|
||||||
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
|
const filter = { ...fetchFilter, ...$props.filter }; // eslint-disable-line vue/no-dupe-keys
|
||||||
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
||||||
if ($props.sortBy) filter.order = $props.sortBy;
|
if ($props.sortBy) filter.order = $props.sortBy;
|
||||||
if ($props.limit) filter.limit = $props.limit;
|
if ($props.limit) filter.limit = $props.limit;
|
||||||
|
|
|
@ -71,7 +71,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hasSubToolbar: {
|
hasSubToolbar: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: null,
|
||||||
},
|
},
|
||||||
disableOption: {
|
disableOption: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -347,7 +347,7 @@ defineExpose({
|
||||||
$attrs['disableInfiniteScroll'] ? isTableMode : disableInfiniteScroll
|
$attrs['disableInfiniteScroll'] ? isTableMode : disableInfiniteScroll
|
||||||
"
|
"
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
|
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||||
:auto-load="hasParams || $attrs['auto-load']"
|
:auto-load="hasParams || $attrs['auto-load']"
|
||||||
>
|
>
|
||||||
<template
|
<template
|
||||||
|
|
|
@ -127,11 +127,6 @@ const dialog = ref(null);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
.subName {
|
|
||||||
color: var(--vn-label-color);
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { date } from 'quasar';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
|
@ -194,6 +195,7 @@ async function remove(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(value) {
|
function formatValue(value) {
|
||||||
|
if (value instanceof Date) return date.formatDate(value, 'DD/MM/YYYY');
|
||||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||||
|
|
||||||
|
|
|
@ -86,12 +86,26 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
|
|
||||||
Object.assign(filter, store.userFilter, exprFilter);
|
Object.assign(filter, store.userFilter, exprFilter);
|
||||||
let where;
|
let where;
|
||||||
if (filter?.where || store.filter?.where)
|
// ARRAY DATA FALLA AL JUNTAR WHERE'S
|
||||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
console.log(
|
||||||
|
'userParams?.filter?.where: ',
|
||||||
|
userParams?.filter?.where,
|
||||||
|
filter?.where,
|
||||||
|
store.filter?.where
|
||||||
|
);
|
||||||
|
if ((userParams?.filter?.where, filter?.where || store.filter?.where))
|
||||||
|
where = Object.assign(
|
||||||
|
userParams?.filter?.where ?? {},
|
||||||
|
filter?.where ?? {},
|
||||||
|
store.filter?.where ?? {}
|
||||||
|
);
|
||||||
Object.assign(filter, store.filter);
|
Object.assign(filter, store.filter);
|
||||||
filter.where = where;
|
filter.where = where;
|
||||||
|
console.log('where: ', where);
|
||||||
const params = { filter };
|
const params = { filter };
|
||||||
|
console.log('params: ', params);
|
||||||
|
|
||||||
|
delete userParams?.filter;
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
params.filter.skip = store.skip;
|
params.filter.skip = store.skip;
|
||||||
if (store.order && store.order.length) params.filter.order = store.order;
|
if (store.order && store.order.length) params.filter.order = store.order;
|
||||||
|
|
|
@ -271,3 +271,8 @@ input::-webkit-inner-spin-button {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subName {
|
||||||
|
color: var(--vn-label-color);
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
|
@ -95,6 +95,10 @@ globals:
|
||||||
from: From
|
from: From
|
||||||
to: To
|
to: To
|
||||||
notes: Notes
|
notes: Notes
|
||||||
|
quantity: Quantity
|
||||||
|
item: Item
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaign
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
|
|
@ -95,6 +95,10 @@ globals:
|
||||||
from: Desde
|
from: Desde
|
||||||
to: Hasta
|
to: Hasta
|
||||||
notes: Notas
|
notes: Notas
|
||||||
|
quantity: Cantidad
|
||||||
|
item: Artículo
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaña
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||||
import CustomerFilter from '../CustomerFilter.vue';
|
import CustomerFilter from '../CustomerFilter.vue';
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const routeName = computed(() => route.name);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Client"
|
data-key="Client"
|
||||||
base-url="Clients"
|
base-url="Clients"
|
||||||
:descriptor="CustomerDescriptor"
|
:descriptor="CustomerDescriptor"
|
||||||
:filter-panel="CustomerFilter"
|
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
||||||
search-data-key="CustomerList"
|
search-data-key="CustomerList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'Clients/extendedListFilter',
|
url: 'Clients/extendedListFilter',
|
||||||
|
|
|
@ -174,4 +174,5 @@ es:
|
||||||
The consumption report will be sent: Se enviará el informe de consumo
|
The consumption report will be sent: Se enviará el informe de consumo
|
||||||
Please, confirm: Por favor, confirma
|
Please, confirm: Por favor, confirma
|
||||||
Enter a new search: Introduce una nueva búsqueda
|
Enter a new search: Introduce una nueva búsqueda
|
||||||
|
Group by items: Agrupar por artículos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -12,7 +12,7 @@ const { t } = useI18n();
|
||||||
defineProps({ dataKey: { type: String, required: true } });
|
defineProps({ dataKey: { type: String, required: true } });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true" :redirect="false">
|
<VnFilterPanel :data-key="dataKey" search-url="consumption" :redirect="false">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -53,6 +53,8 @@ const openDialog = (item) => {
|
||||||
promise: updateData,
|
promise: updateData,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
updateData();
|
||||||
|
showQPageSticky.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const openViewCredit = (credit) => {
|
const openViewCredit = (credit) => {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const clientInformasRef = ref(null);
|
const clientInformasRef = ref();
|
||||||
const rows = ref([]);
|
const rows = ref([]);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -75,36 +75,31 @@ watch(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
ref="clientInformasRef"
|
||||||
|
url="ClientInformas"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (rows = data)"
|
@on-fetch="(data) => (rows = data)"
|
||||||
auto-load
|
auto-load
|
||||||
ref="clientInformasRef"
|
|
||||||
url="ClientInformas"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:form-initial-data="{}"
|
:form-initial-data="{}"
|
||||||
:observe-form-changes="false"
|
|
||||||
:url-create="`Clients/${route.params.id}/setRating`"
|
:url-create="`Clients/${route.params.id}/setRating`"
|
||||||
|
@on-data-saved="clientInformasRef.fetch()"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Rating')"
|
:label="t('Rating')"
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="data.rating"
|
v-model.number="data.rating"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Recommended credit')"
|
:label="t('Recommended credit')"
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="data.recommendedCredit"
|
v-model.number="data.recommendedCredit"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
@ -120,17 +115,13 @@ watch(
|
||||||
class="card-width q-px-lg"
|
class="card-width q-px-lg"
|
||||||
>
|
>
|
||||||
<template #body-cell-employee="{ row }">
|
<template #body-cell-employee="{ row }">
|
||||||
<QTd auto-width @click.stop>
|
<QTd @click.stop>
|
||||||
<QBtn color="blue" flat no-caps>{{ row.worker.user.nickname }}</QBtn>
|
<span class="link">{{ row.worker.user.nickname }}</span>
|
||||||
<WorkerDescriptorProxy :id="row.clientFk" />
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5 class="flex justify-center color-vn-label" v-else>
|
|
||||||
{{ t('globals.noResults') }}
|
|
||||||
</h5>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -26,27 +26,20 @@ const filter = {
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const basicSpan = {
|
||||||
|
component: 'span',
|
||||||
|
props: () => {},
|
||||||
|
event: () => {},
|
||||||
|
};
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
sent: {
|
sent: basicSpan,
|
||||||
component: 'span',
|
description: basicSpan,
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
worker: {
|
worker: {
|
||||||
component: QBtn,
|
|
||||||
props: () => ({ flat: true, color: 'blue', noCaps: true }),
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
company: {
|
|
||||||
component: 'span',
|
component: 'span',
|
||||||
props: () => {},
|
props: () => ({ class: 'link' }),
|
||||||
event: () => {},
|
event: () => {},
|
||||||
},
|
},
|
||||||
|
company: basicSpan,
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -90,8 +83,6 @@ const toCustomerSamplesCreate = () => {
|
||||||
url="ClientSamples"
|
url="ClientSamples"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="full-width flex justify-center">
|
|
||||||
<QPage class="card-width q-pa-lg">
|
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
:pagination="{ rowsPerPage: 12 }"
|
||||||
|
@ -101,17 +92,14 @@ const toCustomerSamplesCreate = () => {
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
>
|
>
|
||||||
<template #body-cell="props">
|
<template #body-cell="props">
|
||||||
<QTd :props="props">
|
<QTd auto-width :props="props">
|
||||||
<QTr :props="props" class="cursor-pointer">
|
<span :props="props" class="cursor-pointer">
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
:is="tableColumnComponents[props.col.name].component"
|
||||||
class="col-content"
|
class="col-content"
|
||||||
v-bind="
|
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||||
tableColumnComponents[props.col.name].props(props)
|
@click="tableColumnComponents[props.col.name].event(props)"
|
||||||
"
|
:title="props.value"
|
||||||
@click="
|
|
||||||
tableColumnComponents[props.col.name].event(props)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
<WorkerDescriptorProxy
|
<WorkerDescriptorProxy
|
||||||
|
@ -119,12 +107,10 @@ const toCustomerSamplesCreate = () => {
|
||||||
v-if="props.col.name === 'worker'"
|
v-if="props.col.name === 'worker'"
|
||||||
/>
|
/>
|
||||||
</component>
|
</component>
|
||||||
</QTr>
|
</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QPage>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<QPageSticky :offset="[18, 18]">
|
<QPageSticky :offset="[18, 18]">
|
||||||
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />
|
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { reactive, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -10,10 +10,12 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const routeId = computed(() => route.params.id);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const initialData = reactive({
|
const initialData = reactive({
|
||||||
clientFK: Number(route.params.id),
|
started: Date.vnNew(),
|
||||||
|
clientFk: routeId.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const toCustomerCreditContracts = () => {
|
const toCustomerCreditContracts = () => {
|
||||||
|
|
|
@ -33,7 +33,6 @@ async function onSubmit() {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('newPassword: ', newPassword);
|
|
||||||
await axios.post(
|
await axios.post(
|
||||||
'VnUsers/reset-password',
|
'VnUsers/reset-password',
|
||||||
{ newPassword: newPassword.value },
|
{ newPassword: newPassword.value },
|
||||||
|
|
Loading…
Reference in New Issue