0
0
Fork 0

Merge remote-tracking branch 'origin/7830-customerDesplegables' into 6943_fix_customerSummaryTable

This commit is contained in:
Javier Segarra 2024-08-27 15:52:38 +02:00
commit cadd6a2b62
16 changed files with 104 additions and 93 deletions

View File

@ -44,7 +44,7 @@ onMounted(async () => {
async function fetch(fetchFilter = {}) {
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.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit;

View File

@ -71,7 +71,7 @@ const $props = defineProps({
},
hasSubToolbar: {
type: Boolean,
default: true,
default: null,
},
disableOption: {
type: Object,
@ -347,7 +347,7 @@ defineExpose({
$attrs['disableInfiniteScroll'] ? isTableMode : disableInfiniteScroll
"
@save-changes="reload"
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
>
<template

View File

@ -127,11 +127,6 @@ const dialog = ref(null);
flex-direction: column;
gap: 4px;
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}
p {
margin-bottom: 0;
}

View File

@ -3,6 +3,7 @@ import { onMounted, ref, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router';
import { date } from 'quasar';
import toDate from 'filters/toDate';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
@ -194,6 +195,7 @@ async function remove(key) {
}
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 (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);

View File

@ -86,12 +86,26 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
Object.assign(filter, store.userFilter, exprFilter);
let where;
if (filter?.where || store.filter?.where)
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
// ARRAY DATA FALLA AL JUNTAR WHERE'S
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);
filter.where = where;
console.log('where: ', where);
const params = { filter };
console.log('params: ', params);
delete userParams?.filter;
Object.assign(params, userParams);
params.filter.skip = store.skip;
if (store.order && store.order.length) params.filter.order = store.order;

View File

@ -271,3 +271,8 @@ input::-webkit-inner-spin-button {
z-index: 1;
cursor: pointer;
}
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}

View File

@ -95,6 +95,10 @@ globals:
from: From
to: To
notes: Notes
quantity: Quantity
item: Item
ticket: Ticket
campaign: Campaign
pageTitles:
logIn: Login
summary: Summary

View File

@ -95,6 +95,10 @@ globals:
from: Desde
to: Hasta
notes: Notas
quantity: Cantidad
item: Artículo
ticket: Ticket
campaign: Campaña
pageTitles:
logIn: Inicio de sesión
summary: Resumen

View File

@ -1,14 +1,20 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue';
import CustomerDescriptor from './CustomerDescriptor.vue';
import CustomerFilter from '../CustomerFilter.vue';
const route = useRoute();
const routeName = computed(() => route.name);
</script>
<template>
<VnCard
data-key="Client"
base-url="Clients"
:descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter"
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
search-data-key="CustomerList"
:searchbar-props="{
url: 'Clients/extendedListFilter',

View File

@ -174,4 +174,5 @@ es:
The consumption report will be sent: Se enviará el informe de consumo
Please, confirm: Por favor, confirma
Enter a new search: Introduce una nueva búsqueda
Group by items: Agrupar por artículos
</i18n>

View File

@ -12,7 +12,7 @@ const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
</script>
<template>
<VnFilterPanel :data-key="dataKey" :search-button="true" :redirect="false">
<VnFilterPanel :data-key="dataKey" search-url="consumption" :redirect="false">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -53,6 +53,8 @@ const openDialog = (item) => {
promise: updateData,
},
});
updateData();
showQPageSticky.value = true;
};
const openViewCredit = (credit) => {

View File

@ -16,7 +16,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
const { t } = useI18n();
const route = useRoute();
const clientInformasRef = ref(null);
const clientInformasRef = ref();
const rows = ref([]);
const filter = {
@ -75,36 +75,31 @@ watch(
<template>
<FetchData
ref="clientInformasRef"
url="ClientInformas"
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
ref="clientInformasRef"
url="ClientInformas"
/>
<FormModel
:form-initial-data="{}"
:observe-form-changes="false"
:url-create="`Clients/${route.params.id}/setRating`"
@on-data-saved="clientInformasRef.fetch()"
>
<template #form="{ data }">
<VnRow>
<div class="col">
<VnInput
:label="t('Rating')"
clearable
type="number"
v-model.number="data.rating"
/>
</div>
<div class="col">
<VnInput
:label="t('Recommended credit')"
clearable
type="number"
v-model.number="data.recommendedCredit"
/>
</div>
<VnInput
:label="t('Rating')"
clearable
type="number"
v-model.number="data.rating"
/>
<VnInput
:label="t('Recommended credit')"
clearable
type="number"
v-model.number="data.recommendedCredit"
/>
</VnRow>
</template>
</FormModel>
@ -120,17 +115,13 @@ watch(
class="card-width q-px-lg"
>
<template #body-cell-employee="{ row }">
<QTd auto-width @click.stop>
<QBtn color="blue" flat no-caps>{{ row.worker.user.nickname }}</QBtn>
<QTd @click.stop>
<span class="link">{{ row.worker.user.nickname }}</span>
<WorkerDescriptorProxy :id="row.clientFk" />
</QTd>
</template>
</QTable>
</div>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</template>
<i18n>

View File

@ -26,27 +26,20 @@ const filter = {
limit: 20,
};
const basicSpan = {
component: 'span',
props: () => {},
event: () => {},
};
const tableColumnComponents = {
sent: {
component: 'span',
props: () => {},
event: () => {},
},
description: {
component: 'span',
props: () => {},
event: () => {},
},
sent: basicSpan,
description: basicSpan,
worker: {
component: QBtn,
props: () => ({ flat: true, color: 'blue', noCaps: true }),
event: () => {},
},
company: {
component: 'span',
props: () => {},
props: () => ({ class: 'link' }),
event: () => {},
},
company: basicSpan,
};
const columns = computed(() => [
@ -90,41 +83,34 @@ const toCustomerSamplesCreate = () => {
url="ClientSamples"
/>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
:no-data-label="t('globals.noResults')"
>
<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.userFk"
v-if="props.col.name === 'worker'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</QPage>
</div>
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
:no-data-label="t('globals.noResults')"
>
<template #body-cell="props">
<QTd auto-width :props="props">
<span :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)"
:title="props.value"
>
{{ props.value }}
<WorkerDescriptorProxy
:id="props.row.userFk"
v-if="props.col.name === 'worker'"
/>
</component>
</span>
</QTd>
</template>
</QTable>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />

View File

@ -1,5 +1,5 @@
<script setup>
import { reactive } from 'vue';
import { reactive, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
@ -10,10 +10,12 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = computed(() => route.params.id);
const router = useRouter();
const initialData = reactive({
clientFK: Number(route.params.id),
started: Date.vnNew(),
clientFk: routeId.value,
});
const toCustomerCreditContracts = () => {

View File

@ -33,7 +33,6 @@ async function onSubmit() {
};
try {
console.log('newPassword: ', newPassword);
await axios.post(
'VnUsers/reset-password',
{ newPassword: newPassword.value },