HOTFIX: #6943 CustomerList form salesPersons options #790

Closed
jsegarra wants to merge 84 commits from hotfix_newCustomer_SalesPerson into master
5 changed files with 55 additions and 19 deletions
Showing only changes of commit f06020bab5 - Show all commits

View File

@ -247,6 +247,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
} }
function updateStateParams() { function updateStateParams() {
if (!route?.path) return;
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };

Así evitamos ahora y a futuro que si usamos VnTable en *summary, tengamos los filtros de la tabla

Así evitamos ahora y a futuro que si usamos VnTable en *summary, tengamos los filtros de la tabla
Outdated
Review

Añadirle un searchUrl diferente a la tabla que se use, como ya hacemos en las otras secciones

Añadirle un searchUrl diferente a la tabla que se use, como ya hacemos en las otras secciones

Mi no entender.
No se elimina la linea

Mi no entender. No se elimina la linea
Outdated
Review

Ya pero que la solucion seria mas en la tabla que haya en ese summary ponerle searchUrl="sumarry"
Mas que poner aqui una condicion especifica no?

Ya pero que la solucion seria mas en la tabla que haya en ese summary ponerle searchUrl="sumarry" Mas que poner aqui una condicion especifica no?

Los usuarios nos dicen que para compartir el summary de un cliente ahora les sale esto en el portapapeles http://localhost:9000/#/customer/1109/summary?tickets={%22filter%22:%22{%5C%22limit%5C%22:30,%5C%22include%5C%22:[{%5C%22relation%5C%22:%5C%22ticketState%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22stateFk%5C%22,%5C%22code%5C%22,%5C%22alertLevel%5C%22],%5C%22include%5C%22:{%5C%22relation%5C%22:%5C%22state%5C%22}}},{%5C%22relation%5C%22:%5C%22invoiceOut%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22id%5C%22]}},{%5C%22relation%5C%22:%5C%22agencyMode%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22name%5C%22]}}],%5C%22where%5C%22:{%5C%22clientFk%5C%22:%5C%221109%5C%22},%5C%22order%5C%22:%5C%22shipped+DESC,+id%5C%22,%5C%22skip%5C%22:0}%22}

Lo que estan haciendo a mano es seleccionar este texto http://localhost:9000/#/customer/1109/summary

Por tanto, si me dices que hay alguna manera de montar el summary si que se añada la parte de la query, por favor, indicame como. Porque hasta ahora, he probado quitando o poniendo un valor a search-url y siempre me pone table o el valor, respectivamente.
Caso de existo, entras en un cliente y en la URL tienes esto http://localhost:9000/#/customer/1109/summary

Los usuarios nos dicen que para compartir el summary de un cliente ahora les sale esto en el portapapeles http://localhost:9000/#/customer/1109/summary?tickets={%22filter%22:%22{%5C%22limit%5C%22:30,%5C%22include%5C%22:[{%5C%22relation%5C%22:%5C%22ticketState%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22stateFk%5C%22,%5C%22code%5C%22,%5C%22alertLevel%5C%22],%5C%22include%5C%22:{%5C%22relation%5C%22:%5C%22state%5C%22}}},{%5C%22relation%5C%22:%5C%22invoiceOut%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22id%5C%22]}},{%5C%22relation%5C%22:%5C%22agencyMode%5C%22,%5C%22scope%5C%22:{%5C%22fields%5C%22:[%5C%22name%5C%22]}}],%5C%22where%5C%22:{%5C%22clientFk%5C%22:%5C%221109%5C%22},%5C%22order%5C%22:%5C%22shipped+DESC,+id%5C%22,%5C%22skip%5C%22:0}%22} Lo que estan haciendo a mano es seleccionar este texto http://localhost:9000/#/customer/1109/summary Por tanto, si me dices que hay alguna manera de montar el summary si que se añada la parte de la query, por favor, indicame como. Porque hasta ahora, he probado quitando o poniendo un valor a search-url y siempre me pone table o el valor, respectivamente. Caso de existo, entras en un cliente y en la URL tienes esto http://localhost:9000/#/customer/1109/summary
Outdated
Review

Y aqui sea if(store.searchUrl)

Y aqui sea if(store.searchUrl)

lo coge como String no como boolean

lo coge como String no como boolean
if (store?.searchUrl) if (store?.searchUrl)
newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter); newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter);

View File

@ -11,6 +11,20 @@ defineProps({
required: true, required: true,
}, },
}); });
const handleSalesModelValue = (val) => ({
or: [
{ id: val },
{ name: val },
{ nickname: { like: '%' + val + '%' } },
{ code: { like: `${val}%` } },
],
});
const exprBuilder = (param, value) => {
return {
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
};
};
</script> </script>
<template> <template>
@ -52,14 +66,18 @@ defineProps({
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
url="Workers/activeWithInheritedRole" url="Workers/search"
:filter="{ where: { role: 'salesPerson' } }" :params="{
departmentCodes: ['VT'],
}"
auto-load auto-load
:label="t('Salesperson')" :label="t('Salesperson')"
:expr-builder="exprBuilder"
v-model="params.salesPersonFk" v-model="params.salesPersonFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
option-value="id" option-value="id"
option-label="name" option-label="name"
sort-by="nickname ASC"
emit-value emit-value
map-options map-options
use-input use-input
@ -68,7 +86,18 @@ defineProps({
outlined outlined
rounded rounded
:input-debounce="0" :input-debounce="0"
/> >
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption>
{{ opt.nickname }},{{ opt.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template></VnSelect
>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">

View File

@ -205,6 +205,7 @@ const onThermographCreated = async (data) => {
}" }"
sort-by="thermographFk ASC" sort-by="thermographFk ASC"
option-label="thermographFk" option-label="thermographFk"
option-filter-value="thermographFk"
:disable="viewAction === 'edit'" :disable="viewAction === 'edit'"
:tooltip="t('New thermograph')" :tooltip="t('New thermograph')"
:roles-allowed-to-create="['logistic']" :roles-allowed-to-create="['logistic']"

View File

@ -20,12 +20,13 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
<template> <template>
<VnCard <VnCard
data-key="zone" data-key="zone"
base-url="Zones" :base-url="notIsLocations('Zones', undefined)"
:descriptor="ZoneDescriptor" :descriptor="ZoneDescriptor"
:filter-panel="ZoneFilterPanel" :filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
:search-data-key="notIsLocations('ZoneList', 'ZoneLocations')" :search-data-key="notIsLocations('ZoneList', undefined)"
:custom-url="`Zones/${route.params?.id}/getLeaves`"
:searchbar-props="{ :searchbar-props="{
url: 'Zones', url: notIsLocations('Zones', 'ZoneLocations'),
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')), label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
info: t('list.searchInfo'), info: t('list.searchInfo'),
whereFilter: notIsLocations((value) => { whereFilter: notIsLocations((value) => {

View File

@ -5,6 +5,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const props = defineProps({ const props = defineProps({
rootLabel: { rootLabel: {
@ -33,22 +34,23 @@ const state = useState();
const treeRef = ref(); const treeRef = ref();
const expanded = ref([]); const expanded = ref([]);
const arrayData = useArrayData('ZoneLocations', { const datakey = 'ZoneLocations';
url: `Zones/${route.params.id}/getLeaves`, const url = computed(() => `Zones/${route.params.id}/getLeaves`);
const arrayData = useArrayData(datakey, {
url: url.value,
}); });
const { store } = arrayData; const { store } = arrayData;
const storeData = computed(() => store.data); const storeData = computed(() => store.data);
const nodes = ref([ const defaultNode = {
{ id: null,
id: null, name: props.rootLabel,
name: props.rootLabel, sons: true,
sons: true, tickable: false,
tickable: false, noTick: true,
noTick: true, children: [{}],
children: [{}], };
}, const nodes = ref([defaultNode]);
]);
const _tickedNodes = computed({ const _tickedNodes = computed({
get: () => props.tickedNodes, get: () => props.tickedNodes,
@ -128,6 +130,7 @@ function getNodeIds(node) {
watch(storeData, async (val) => { watch(storeData, async (val) => {
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
if (!nodes.value[0]) nodes.value = [defaultNode];
nodes.value[0].childs = [...val]; nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds); const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]); state.set('Tree', [...fetchedNodeKeys]);
@ -193,6 +196,7 @@ onUnmounted(() => {
<QBtn color="primary" icon="search" dense flat @click="reFetch()" /> <QBtn color="primary" icon="search" dense flat @click="reFetch()" />
</template> </template>
</VnInput> </VnInput>
<VnSearchbar :data-key="datakey" :url="url" :redirect="false" />
<QTree <QTree
ref="treeRef" ref="treeRef"
:nodes="nodes" :nodes="nodes"