Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6942-improveInvoceIn
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-05-28 13:14:11 +02:00
commit 0de575bb6b
18 changed files with 599 additions and 3240 deletions

View File

@ -20,6 +20,8 @@ const props = defineProps({
searchUrl: { type: String, default: undefined },
searchbarLabel: { type: String, default: '' },
searchbarInfo: { type: String, default: '' },
searchCustomRouteRedirect: { type: String, default: undefined },
searchRedirect: { type: Boolean, default: false },
});
const stateStore = useStateStore();
@ -62,6 +64,8 @@ watchEffect(() => {
:url="props.searchUrl"
:label="props.searchbarLabel"
:info="props.searchbarInfo"
:custom-route-redirect-name="searchCustomRouteRedirect"
:redirect="searchRedirect"
/>
</slot>
</Teleport>

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref } from 'vue';
import { onMounted, ref, watch } from 'vue';
import { useQuasar } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import VnInput from 'src/components/common/VnInput.vue';
@ -67,11 +67,19 @@ const props = defineProps({
},
});
const arrayData = useArrayData(props.dataKey, { ...props });
const { store } = arrayData;
let arrayData = useArrayData(props.dataKey, { ...props });
let store = arrayData.store;
const searchText = ref('');
const { navigate } = useRedirect();
watch(
() => props.dataKey,
(val) => {
arrayData = useArrayData(val, { ...props });
store = arrayData.store;
}
);
onMounted(() => {
const params = store.userParams;
if (params && params.search) {

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,418 +1,435 @@
@font-face {
font-family: 'icon';
src: url('fonts/icon.eot?2omjsr');
src: url('fonts/icon.eot?2omjsr#iefix') format('embedded-opentype'),
url('fonts/icon.ttf?2omjsr') format('truetype'),
url('fonts/icon.woff?2omjsr') format('woff'),
url('fonts/icon.svg?2omjsr#icon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
font-family: 'icon';
src: url('fonts/icon.eot?1om04h');
src: url('fonts/icon.eot?1om04h#iefix') format('embedded-opentype'),
url('fonts/icon.ttf?1om04h') format('truetype'),
url('fonts/icon.woff?1om04h') format('woff'),
url('fonts/icon.svg?1om04h#icon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^='icon-'],
[class*=' icon-'] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icon' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icon' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-100:before {
content: '\e926';
content: "\e901";
}
.icon-Client_unpaid:before {
content: '\e925';
}
.icon-Client_unpaid:before {
content: '\e925';
content: "\e98c";
}
.icon-History:before {
content: '\e964';
content: "\e902";
}
.icon-Person:before {
content: '\e984';
content: "\e903";
}
.icon-accessory:before {
content: '\e948';
content: "\e904";
}
.icon-account:before {
content: '\e927';
content: "\e905";
}
.icon-actions:before {
content: '\e928';
content: "\e907";
}
.icon-addperson:before {
content: '\e929';
content: "\e908";
}
.icon-agency:before {
content: '\e92a';
}
.icon-agency:before {
content: '\e92a';
content: "\e92a";
}
.icon-agency-term:before {
content: '\e92b';
content: "\e909";
}
.icon-albaran:before {
content: '\e92c';
}
.icon-albaran:before {
content: '\e92c';
content: "\e92c";
}
.icon-anonymous:before {
content: '\e92d';
content: "\e90b";
}
.icon-apps:before {
content: '\e92e';
content: "\e90c";
}
.icon-artificial:before {
content: '\e92f';
content: "\e90d";
}
.icon-attach:before {
content: '\e930';
content: "\e90e";
}
.icon-barcode:before {
content: '\e932';
content: "\e90f";
}
.icon-basket:before {
content: '\e933';
content: "\e910";
}
.icon-basketadd:before {
content: '\e934';
content: "\e911";
}
.icon-bin:before {
content: '\e935';
content: "\e913";
}
.icon-botanical:before {
content: '\e936';
content: "\e914";
}
.icon-bucket:before {
content: '\e937';
content: "\e915";
}
.icon-buscaman:before {
content: '\e938';
content: "\e916";
}
.icon-buyrequest:before {
content: '\e939';
content: "\e917";
}
.icon-calc_volum:before {
content: '\e93a';
.icon-calc_volum .path1:before {
content: "\e918";
color: rgb(0, 0, 0);
}
.icon-calc_volum .path2:before {
content: "\e919";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path3:before {
content: "\e91c";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path4:before {
content: "\e91d";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path5:before {
content: "\e91e";
margin-left: -1em;
color: rgb(0, 0, 0);
}
.icon-calc_volum .path6:before {
content: "\e91f";
margin-left: -1em;
color: rgb(255, 255, 255);
}
.icon-calendar:before {
content: '\e940';
content: "\e920";
}
.icon-catalog:before {
content: '\e941';
content: "\e921";
}
.icon-claims:before {
content: '\e942';
content: "\e922";
}
.icon-client:before {
content: '\e943';
content: "\e923";
}
.icon-clone:before {
content: '\e945';
content: "\e924";
}
.icon-columnadd:before {
content: '\e946';
content: "\e925";
}
.icon-columndelete:before {
content: '\e947';
content: "\e926";
}
.icon-components:before {
content: '\e949';
content: "\e927";
}
.icon-consignatarios:before {
content: '\e94b';
content: "\e928";
}
.icon-control:before {
content: '\e94c';
content: "\e929";
}
.icon-credit:before {
content: '\e94d';
content: "\e92b";
}
.icon-defaulter:before {
content: '\e94e';
.icon-deaulter:before {
content: "\e92d";
}
.icon-deletedTicket:before {
content: '\e94f';
content: "\e92e";
}
.icon-deleteline:before {
content: '\e950';
content: "\e92f";
}
.icon-delivery:before {
content: '\e951';
content: "\e930";
}
.icon-deliveryprices:before {
content: '\e952';
content: "\e932";
}
.icon-details:before {
content: '\e954';
content: "\e933";
}
.icon-dfiscales:before {
content: '\e955';
content: "\e934";
}
.icon-disabled:before {
content: '\e965';
content: "\e935";
}
.icon-doc:before {
content: '\e956';
content: "\e936";
}
.icon-entry:before {
content: '\e958';
content: "\e937";
}
.icon-exit:before {
content: '\e959';
content: "\e938";
}
.icon-eye:before {
content: '\e95a';
content: "\e939";
}
.icon-fixedPrice:before {
content: '\e95b';
content: "\e93a";
}
.icon-flower:before {
content: '\e95c';
content: "\e93b";
}
.icon-frozen:before {
content: '\e95d';
content: "\e93c";
}
.icon-fruit:before {
content: '\e95e';
content: "\e93d";
}
.icon-funeral:before {
content: '\e95f';
content: "\e93e";
}
.icon-grafana:before {
content: '\e931';
}
.icon-grafana:before {
content: '\e931';
content: "\e906";
}
.icon-greenery:before {
content: '\e91e';
content: "\e93f";
}
.icon-greuge:before {
content: '\e960';
content: "\e940";
}
.icon-grid:before {
content: '\e961';
content: "\e941";
}
.icon-handmade:before {
content: '\e94a';
content: "\e942";
}
.icon-handmadeArtificial:before {
content: '\e962';
content: "\e943";
}
.icon-headercol:before {
content: '\e963';
content: "\e945";
}
.icon-info:before {
content: '\e966';
content: "\e946";
}
.icon-inventory:before {
content: '\e967';
content: "\e947";
}
.icon-invoice:before {
content: '\e969';
content: "\e968";
color: #5f5f5f;
}
.icon-invoice-in:before {
content: '\e96a';
content: "\e949";
}
.icon-invoice-in-create:before {
content: '\e96b';
content: "\e94a";
}
.icon-invoice-out:before {
content: '\e96c';
content: "\e94b";
}
.icon-isTooLittle:before {
content: '\e96e';
content: "\e94c";
}
.icon-item:before {
content: '\e96f';
content: "\e94d";
}
.icon-languaje:before {
content: '\e912';
content: "\e970";
}
.icon-lines:before {
content: '\e971';
content: "\e94e";
}
.icon-linesprepaired:before {
content: '\e972';
content: "\e94f";
}
.icon-link-to-corrected:before {
content: '\e900';
content: "\e931";
}
.icon-link-to-correcting:before {
content: '\e906';
content: "\e944";
}
.icon-logout:before {
content: '\e90a';
content: "\e973";
}
.icon-mana:before {
content: '\e974';
content: "\e950";
}
.icon-mandatory:before {
content: '\e975';
content: "\e951";
}
.icon-net:before {
content: '\e976';
content: "\e952";
}
.icon-newalbaran:before {
content: '\e977';
content: "\e954";
}
.icon-niche:before {
content: '\e979';
content: "\e955";
}
.icon-no036:before {
content: '\e97a';
content: "\e956";
}
.icon-noPayMethod:before {
content: '\e97b';
content: "\e958";
}
.icon-notes:before {
content: '\e97c';
content: "\e959";
}
.icon-noweb:before {
content: '\e97e';
content: "\e95a";
}
.icon-onlinepayment:before {
content: '\e97f';
content: "\e95b";
}
.icon-package:before {
content: '\e980';
content: "\e95c";
}
.icon-payment:before {
content: '\e982';
content: "\e95d";
}
.icon-pbx:before {
content: '\e983';
content: "\e95e";
}
.icon-pets:before {
content: '\e985';
content: "\e95f";
}
.icon-photo:before {
content: '\e986';
content: "\e960";
}
.icon-plant:before {
content: '\e987';
content: "\e961";
}
.icon-polizon:before {
content: '\e989';
content: "\e962";
}
.icon-preserved:before {
content: '\e98a';
content: "\e963";
}
.icon-recovery:before {
content: '\e98b';
content: "\e964";
}
.icon-regentry:before {
content: '\e901';
content: "\e965";
}
.icon-reserva:before {
content: '\e902';
content: "\e966";
}
.icon-revision:before {
content: '\e903';
content: "\e967";
}
.icon-risk:before {
content: '\e904';
content: "\e969";
}
.icon-saysimple:before {
content: "\e912";
}
.icon-services:before {
content: '\e905';
content: "\e96a";
}
.icon-settings:before {
content: '\e907';
content: "\e96b";
}
.icon-shipment:before {
content: '\e908';
content: "\e96c";
}
.icon-sign:before {
content: '\e909';
content: "\e90a";
}
.icon-sms:before {
content: '\e90b';
content: "\e96e";
}
.icon-solclaim:before {
content: '\e90c';
content: "\e96f";
}
.icon-solunion:before {
content: '\e90d';
content: "\e971";
}
.icon-splitline:before {
content: '\e90e';
content: "\e972";
}
.icon-splur:before {
content: '\e90f';
content: "\e974";
}
.icon-stowaway:before {
content: '\e910';
content: "\e975";
}
.icon-supplier:before {
content: '\e911';
content: "\e976";
}
.icon-supplierfalse:before {
content: '\e913';
content: "\e977";
}
.icon-tags:before {
content: '\e914';
content: "\e979";
}
.icon-tax:before {
content: '\e915';
content: "\e97a";
}
.icon-thermometer:before {
content: '\e916';
content: "\e97b";
}
.icon-ticket:before {
content: '\e917';
content: "\e97c";
}
.icon-ticketAdd:before {
content: '\e918';
content: "\e97e";
}
.icon-traceability:before {
content: '\e919';
content: "\e97f";
}
.icon-transaction:before {
content: '\e93b';
}
.icon-transaction:before {
content: '\e93b';
content: "\e91b";
}
.icon-treatments:before {
content: '\e91c';
content: "\e980";
}
.icon-trolley:before {
content: '\e91a';
content: "\e900";
}
.icon-troncales:before {
content: '\e91b';
content: "\e982";
}
.icon-unavailable:before {
content: '\e91d';
content: "\e983";
}
.icon-visible_columns_Icono:before {
content: "\e984";
}
.icon-volume:before {
content: '\e91f';
content: "\e985";
}
.icon-wand:before {
content: '\e920';
content: "\e986";
}
.icon-web:before {
content: '\e921';
content: "\e987";
}
.icon-wiki:before {
content: '\e922';
content: "\e989";
}
.icon-worker:before {
content: '\e923';
content: "\e98a";
}
.icon-zone:before {
content: '\e924';
content: "\e98b";
}

View File

@ -1,10 +1,10 @@
<script setup>
import VnTree from 'components/ui/VnTree.vue';
import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
</script>
<template>
<QPage class="column items-center q-pa-md">
<VnTree />
<WorkerDepartmentTree />
</QPage>
</template>

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
import { useQuasar } from 'quasar';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import CreateDepartmentChild from '../CreateDepartmentChild.vue';
import CreateDepartmentChild from './CreateDepartmentChild.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { useRouter } from 'vue-router';

View File

@ -5,38 +5,29 @@ import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue';
import ZoneDescriptor from './ZoneDescriptor.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
const { t } = useI18n();
const stateStore = useStateStore();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
if (routeName.value === 'ZoneLocations') return null;
return routeName.value;
});
const searchBarDataKeys = {
ZoneWarehouses: 'ZoneWarehouses',
ZoneSummary: 'ZoneSummary',
ZoneLocations: 'ZoneLocations',
};
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
:data-key="searchBarDataKeys[routeName]"
:custom-route-redirect-name="routeName"
:label="t('list.searchZone')"
:info="t('list.searchInfo')"
/>
</Teleport>
</template>
<VnCard
data-key="Zone"
base-url="Zones"
:descriptor="ZoneDescriptor"
searchbar-data-key="ZoneList"
searchbar-url="Zones"
searchbar-label="Search zones"
searchbar-info="You can search by zone reference"
:search-data-key="searchBarDataKeys[routeName]"
:search-custom-route-redirect="customRouteRedirectName"
:search-redirect="!!customRouteRedirectName"
:searchbar-label="t('list.searchZone')"
:searchbar-info="t('list.searchInfo')"
/>
</template>

View File

@ -1 +1,80 @@
<template>Zone Locations</template>
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import ZoneLocationsTree from './ZoneLocationsTree.vue';
import axios from 'axios';
const { t } = useI18n();
const route = useRoute();
const onSelected = async (val, node) => {
try {
if (val === null) val = undefined;
const params = { geoId: node.id, isIncluded: val };
await axios.post(`Zones/${route.params.id}/toggleIsIncluded`, params);
} catch (err) {
console.error('Error updating included', err);
}
};
</script>
<template>
<QPage class="column items-center q-pa-md">
<QCard class="full-width q-pa-md" style="max-width: 800px">
<ZoneLocationsTree :root-label="t('zoneLocations.locations')">
<template #checkbox="{ node }">
<QCheckbox
v-if="node.id"
v-model="node.selected"
:label="node.name"
@update:model-value="($event) => onSelected($event, node)"
toggle-indeterminate
color="transparent"
:class="[
'checkbox',
node.selected
? '--checked'
: node.selected == false
? '--unchecked'
: '--indeterminate',
]"
/>
</template>
</ZoneLocationsTree>
</QCard>
</QPage>
</template>
<style lang="scss">
.checkbox {
&.--checked {
.q-checkbox__bg {
border: 1px solid $info !important;
}
.q-checkbox__svg {
color: white !important;
background-color: $info !important;
}
}
&.--unchecked {
.q-checkbox__bg {
border: 1px solid $negative !important;
}
.q-checkbox__svg {
background-color: $negative !important;
}
}
&.--indeterminate {
.q-checkbox__bg {
border: 1px solid $white !important;
}
.q-checkbox__svg {
color: transparent !important;
}
}
}
</style>

View File

@ -0,0 +1,172 @@
<script setup>
import { onMounted, ref, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import { useArrayData } from 'composables/useArrayData';
import { onUnmounted } from 'vue';
const { t } = useI18n();
const route = useRoute();
const state = useState();
const treeRef = ref();
const expanded = ref([]);
const arrayData = useArrayData('ZoneLocations', {
url: `Zones/${route.params.id}/getLeaves`,
});
const { store } = arrayData;
const storeData = computed(() => store.data);
const nodes = ref([
{ id: null, name: t('zoneLocations.locations'), sons: true, childs: [{}] },
]);
const previousExpandedNodes = ref(new Set());
const onNodeExpanded = async (nodeKeysArray) => {
let nodeKeysSet = new Set(nodeKeysArray);
const lastNodeKey = nodeKeysArray.at(-1);
if (!nodeKeysSet.has(null)) return;
const wasExpanded = !previousExpandedNodes.value.has(lastNodeKey);
if (wasExpanded) await fetchNodeLeaves(lastNodeKey);
else {
const difference = new Set(
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
);
const collapsedNode = Array.from(difference).pop();
const node = treeRef.value?.getNodeByKey(collapsedNode);
const allNodeIds = getNodeIds(node);
expanded.value = expanded.value.filter((id) => !allNodeIds.includes(id));
}
previousExpandedNodes.value = nodeKeysSet;
};
const formatNodeSelected = (node) => {
if (node.selected === 1) node.selected = true;
else if (node.selected === 0) node.selected = false;
if (node.childs && node.childs.length > 0) {
expanded.value.push(node.id);
node.childs.forEach((childNode) => {
formatNodeSelected(childNode);
});
}
if (node.sons > 0 && !node.childs) node.childs = [{}];
};
const fetchNodeLeaves = async (nodeKey) => {
try {
const node = treeRef.value?.getNodeByKey(nodeKey);
if (!node || node.sons === 0) return;
const params = { parentId: node.id };
const response = await axios.get(`Zones/${route.params.id}/getLeaves`, {
params,
});
if (response.data) {
node.childs = response.data.map((n) => {
formatNodeSelected(n);
return n;
});
}
state.set('Tree', node);
} catch (err) {
console.error('Error fetching department leaves', err);
throw new Error();
}
};
function getNodeIds(node) {
let ids = [];
if (node.id) ids.push(node.id);
if (node.childs)
node.childs.forEach((child) => {
ids = ids.concat(getNodeIds(child));
});
return ids;
}
watch(storeData, async (val) => {
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]);
if (store.userParams?.search === '') {
val.forEach((n) => {
formatNodeSelected(n);
});
} else {
for (let n of state.get('Tree')) {
await fetchNodeLeaves(n);
}
expanded.value = [null, ...fetchedNodeKeys];
}
previousExpandedNodes.value = new Set(expanded.value);
});
onMounted(async () => {
if (store.userParams?.search) {
await arrayData.fetch({ append: false });
return;
}
const stateTree = state.get('Tree');
const tree = stateTree ? [...state.get('Tree')] : [null];
const lastStateTree = state.get('TreeState');
if (tree) {
for (let n of tree) {
await fetchNodeLeaves(n);
}
if (lastStateTree) {
tree.push(lastStateTree);
await fetchNodeLeaves(lastStateTree);
}
}
setTimeout(() => {
if (lastStateTree) {
document.getElementById(lastStateTree).scrollIntoView();
}
}, 1000);
previousExpandedNodes.value = new Set(expanded.value);
});
onUnmounted(() => {
state.set('Tree', undefined);
});
</script>
<template>
<QTree
ref="treeRef"
:nodes="nodes"
node-key="id"
label-key="name"
children-key="childs"
v-model:expanded="expanded"
@update:expanded="onNodeExpanded($event)"
:default-expand-all="true"
>
<template #default-header="{ node }">
<div
:id="node.id"
class="qtr row justify-between full-width q-pr-md cursor-pointer"
>
<span v-if="!node.id">{{ node.name }}</span>
<slot name="checkbox" :node="node" />
</div>
</template>
</QTree>
</template>

View File

@ -42,6 +42,8 @@ summary:
filterPanel:
name: Name
agencyModeFk: Agency
zoneLocations:
locations: Locations
deliveryPanel:
pickup: Pick up
delivery: Delivery

View File

@ -42,6 +42,8 @@ summary:
filterPanel:
name: Nombre
agencyModeFk: Agencia
zoneLocations:
locations: Localizaciones
deliveryPanel:
pickup: Recogida
delivery: Entrega

View File

@ -106,7 +106,7 @@ export default {
path: 'location',
meta: {
title: 'locations',
icon: 'vn:greuge',
icon: 'my_location',
},
component: () => import('src/pages/Zone/Card/ZoneLocations.vue'),
},

View File

@ -1,6 +1,6 @@
describe('WorkerLocker', () => {
const workerId = 1109;
const lockerCode = '201A';
const lockerCode = '2F';
const input = '.q-card input';
const firstOpt = '[role="listbox"] .q-item:nth-child(1)';
beforeEach(() => {