From 7e22a2924e4024d259f39ccaf735ee15d7e891ce Mon Sep 17 00:00:00 2001 From: wbuezas Date: Mon, 27 Nov 2023 12:49:19 -0300 Subject: [PATCH] create travel filters and integrate --- src/composables/inputSelectFilterFn.js | 9 +- src/pages/Travel/Card/TravelSummary.vue | 14 +- src/pages/Travel/TravelFilter.vue | 380 ++++++++++++++++++++++++ src/pages/Travel/TravelList.vue | 17 +- 4 files changed, 415 insertions(+), 5 deletions(-) create mode 100644 src/pages/Travel/TravelFilter.vue diff --git a/src/composables/inputSelectFilterFn.js b/src/composables/inputSelectFilterFn.js index f038e7a7d..778d78a2a 100644 --- a/src/composables/inputSelectFilterFn.js +++ b/src/composables/inputSelectFilterFn.js @@ -7,6 +7,13 @@ * @param {Object} optionsToFilter - Objeto que contiene las opciones originales y filtradas. */ +function normalizeString(text) { + return text + .toLowerCase() + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, ''); +} + export function inputSelectFilter(val, update, abort, optionsToFilter) { if (val === '') { update(() => { @@ -20,7 +27,7 @@ export function inputSelectFilter(val, update, abort, optionsToFilter) { update(() => { const searchQuery = val.toLowerCase(); optionsToFilter.filtered = optionsToFilter.original.filter((option) => - option.label.toLowerCase().includes(searchQuery) + normalizeString(option.label).includes(normalizeString(searchQuery)) ); }); } diff --git a/src/pages/Travel/Card/TravelSummary.vue b/src/pages/Travel/Card/TravelSummary.vue index 172b7a9dc..9fe4b8902 100644 --- a/src/pages/Travel/Card/TravelSummary.vue +++ b/src/pages/Travel/Card/TravelSummary.vue @@ -41,8 +41,8 @@ const cloneTravel = () => { const headerMenuOptions = [ { name: t('travel.summary.cloneShipping'), action: cloneTravel }, - { name: t('travel.summary.CloneTravelAndEntries'), action: cloneTravel }, - { name: t('travel.summary.AddEntry'), action: cloneTravel }, + { name: t('travel.summary.CloneTravelAndEntries'), action: null }, + { name: t('travel.summary.AddEntry'), action: null }, ]; const tableColumnComponents = { @@ -56,34 +56,42 @@ const tableColumnComponents = { id: { component: () => 'span', props: () => {}, + event: () => openEntryDescriptor(), }, supplierName: { component: () => 'span', props: () => {}, + event: () => {}, }, reference: { component: () => 'span', props: () => {}, + event: () => {}, }, freightValue: { component: () => 'span', props: () => {}, + event: () => {}, }, packageValue: { component: () => 'span', props: () => {}, + event: () => {}, }, cc: { component: () => 'span', props: () => {}, + event: () => {}, }, pallet: { component: () => 'span', props: () => {}, + event: () => {}, }, m3: { component: () => 'span', props: () => {}, + event: () => {}, }, observation: { component: (props) => (props.value ? QIcon : null), @@ -164,6 +172,8 @@ async function setTravelData(data) { const redirectToCreateView = (queryParams) => { router.push({ name: 'TravelCreate', query: { travelData: queryParams } }); }; + +const openEntryDescriptor = () => {};