From 271e33a999d54cf06788aa41dce6164658aaf6ab Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 20 Sep 2024 11:57:15 +0200 Subject: [PATCH 01/14] feat: formatLocation when field is null --- src/components/common/VnLocation.vue | 40 +++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index b6cbfbafd..c3b07c72c 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -12,14 +12,46 @@ const props = defineProps({ default: null, }, }); +const formatLocation = (obj, properties) => { + // Crear un array con las propiedades del objeto + const parts = properties.map((prop) => { + if (typeof prop === 'string') { + return obj[prop]; + } else if (typeof prop === 'function') { + return prop(obj); + } + return null; + }); + + // Filtrar los valores que no son null o undefined + const filteredParts = parts.filter( + (part) => part !== null && part !== undefined && part !== '' + ); + + // Unir los valores filtrados con el formato deseado + return filteredParts.join(', '); +}; + +const locationProperties = [ + 'postcode', + (obj) => + obj.city + ? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}` + : null, + (obj) => obj.country?.name, +]; const modelValue = ref( - props.location - ? `${props.location?.postcode} - ${props.location?.city}(${props.location?.province?.name}), ${props.location?.country?.name}` - : null + props.location ? formatLocation(props.location, locationProperties) : null ); function showLabel(data) { - return `${data.code} - ${data.town}(${data.province}), ${data.country}`; + const dataProperties = [ + 'code', + (obj) => (obj.town ? `${obj.town}(${obj.province})` : null), + 'country', + ]; + return formatLocation(data, dataProperties); } + const handleModelValue = (data) => { emit('update:model-value', data); }; From f06723a9192a158bbdff8fb160e664d994692f68 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 23 Sep 2024 11:39:10 +0200 Subject: [PATCH 02/14] test: VnLocation --- .../integration/vnComponent/vnLocation.spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/cypress/integration/vnComponent/vnLocation.spec.js b/test/cypress/integration/vnComponent/vnLocation.spec.js index 3533a3c1f..15ab53d17 100644 --- a/test/cypress/integration/vnComponent/vnLocation.spec.js +++ b/test/cypress/integration/vnComponent/vnLocation.spec.js @@ -36,20 +36,23 @@ describe('VnLocation', () => { }); it('Fin by postalCode', () => { const postCode = '46600'; + const postCodeLabel = '46600, Valencia(Province one), España'; const firstOption = '[role="listbox"] .q-item:nth-child(1)'; cy.get(inputLocation).click(); cy.get(inputLocation).clear(); cy.get(inputLocation).type(postCode); - cy.get(locationOptions).should('have.length.at.least', 2); + cy.get(locationOptions) + .get(':nth-child(1)') + .should('have.length.at.least', 2); + cy.get( + firstOption.concat(' > .q-item__section > .q-item__label--caption') + ).should('have.text', postCodeLabel); cy.get(firstOption).click(); cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click(); cy.reload(); cy.waitForElement('.q-form'); - cy.get(inputLocation).should( - 'have.value', - '46600 - Valencia(Province one), España' - ); + cy.get(inputLocation).should('have.value', postCodeLabel); }); it('Create postCode', () => { From 013a76cbce074ef727b371ce949bbf79b8f75f7e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 23 Sep 2024 11:48:00 +0200 Subject: [PATCH 03/14] test: VnLocation --- src/components/common/VnLocation.vue | 3 --- test/cypress/integration/vnComponent/vnLocation.spec.js | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index c3b07c72c..633d32b85 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -13,7 +13,6 @@ const props = defineProps({ }, }); const formatLocation = (obj, properties) => { - // Crear un array con las propiedades del objeto const parts = properties.map((prop) => { if (typeof prop === 'string') { return obj[prop]; @@ -23,12 +22,10 @@ const formatLocation = (obj, properties) => { return null; }); - // Filtrar los valores que no son null o undefined const filteredParts = parts.filter( (part) => part !== null && part !== undefined && part !== '' ); - // Unir los valores filtrados con el formato deseado return filteredParts.join(', '); }; diff --git a/test/cypress/integration/vnComponent/vnLocation.spec.js b/test/cypress/integration/vnComponent/vnLocation.spec.js index 15ab53d17..1872d3591 100644 --- a/test/cypress/integration/vnComponent/vnLocation.spec.js +++ b/test/cypress/integration/vnComponent/vnLocation.spec.js @@ -34,7 +34,7 @@ describe('VnLocation', () => { cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 }); cy.waitForElement('.q-form'); }); - it('Fin by postalCode', () => { + it('Find by postalCode', () => { const postCode = '46600'; const postCodeLabel = '46600, Valencia(Province one), España'; const firstOption = '[role="listbox"] .q-item:nth-child(1)'; From a5c6d628ca9eb4378cd548e4a4d9b79bc554592e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 23 Sep 2024 18:48:58 +0000 Subject: [PATCH 04/14] feat: enable notify positive when user update self data --- src/components/UserPanel.vue | 43 +++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 98334460a..5276f9e20 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -13,12 +13,14 @@ import FetchData from 'components/FetchData.vue'; import { useClipboard } from 'src/composables/useClipboard'; import { useRole } from 'src/composables/useRole'; import VnAvatar from './ui/VnAvatar.vue'; +import useNotify from 'src/composables/useNotify'; const state = useState(); const session = useSession(); const router = useRouter(); const { t, locale } = useI18n(); const { copyText } = useClipboard(); +const { notify } = useNotify(); const userLocale = computed({ get() { @@ -53,6 +55,7 @@ const user = state.getUser(); const warehousesData = ref(); const companiesData = ref(); const accountBankData = ref(); +const isEmployee = computed(() => useRole().isEmployee()); onMounted(async () => { updatePreferences(); @@ -70,18 +73,28 @@ function updatePreferences() { async function saveDarkMode(value) { const query = `/UserConfigs/${user.value.id}`; - await axios.patch(query, { - darkMode: value, - }); - user.value.darkMode = value; + try { + await axios.patch(query, { + darkMode: value, + }); + user.value.darkMode = value; + notify('globals.dataSaved', 'positive'); + } catch (error) { + console.error(error); + } } async function saveLanguage(value) { const query = `/VnUsers/${user.value.id}`; - await axios.patch(query, { - lang: value, - }); - user.value.lang = value; + try { + await axios.patch(query, { + lang: value, + }); + user.value.lang = value; + notify('globals.dataSaved', 'positive'); + } catch (error) { + console.error(error); + } } function logout() { @@ -98,10 +111,18 @@ function localUserData() { } function saveUserData(param, value) { - axios.post('UserConfigs/setUserConfig', { [param]: value }); - localUserData(); + try { + axios.post('UserConfigs/setUserConfig', { [param]: value }); + localUserData(); + notify('globals.dataSaved', 'positive'); + } catch (error) { + console.error(error); + } } -const isEmployee = computed(() => useRole().isEmployee()); + +const onDataSaved = () => { + notify('globals.dataSaved', 'positive'); +}; From 868e6a312f063e54f9cd567e1a6f3b2cc7c52dcc Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 30 Sep 2024 10:04:00 +0200 Subject: [PATCH 07/14] fix: refs #7404 class name --- src/components/VnTable/VnTable.vue | 3 +-- src/pages/Entry/EntryStockBought.vue | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6d27f7ced..861a79432 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -899,8 +899,7 @@ es: user-select: all; } -.q-table__container.q-table--horizontal-separator.column.no-wrap.q-table__card.q-table__card--dark.q-dark.q-table--flat.q-table--dark.q-table--no-wrap.vnTable, -.q-table__container.q-table--horizontal-separator.column.no-wrap.q-table__card.q-table--flat.q-table--no-wrap.vnTable { +.q-table__container { background-color: transparent; } diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index b41973243..9b6eca132 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -211,7 +211,6 @@ function round(value) { /> -
Date: Mon, 30 Sep 2024 10:13:39 +0200 Subject: [PATCH 08/14] fix: refs #7404 translate and width problem --- src/pages/Entry/EntryStockBought.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/Entry/EntryStockBought.vue b/src/pages/Entry/EntryStockBought.vue index 9b6eca132..0e8013586 100644 --- a/src/pages/Entry/EntryStockBought.vue +++ b/src/pages/Entry/EntryStockBought.vue @@ -76,7 +76,7 @@ const columns = [ name: 'tableActions', actions: [ { - title: t('More'), + title: t('View more details'), icon: 'search', isPrimary: true, action: (row) => { @@ -279,7 +279,7 @@ function round(value) { display: flex; flex-direction: column; align-items: center; - width: 45%; + width: 35%; } .text-negative { color: $negative !important; @@ -293,8 +293,8 @@ function round(value) { Buyer: Comprador Reserve: Reservado Bought: Comprado - More: Más Date: Fecha + View more details: Ver más detalles Reserve some space: Reservar espacio - This buyer has already made a reservation for this date: Este comprador ya ha hecho una reserva para esta fecha + This buyer has already made a reservation for this date: Este comprador ya ha hecho una reserva para esta fecha From 7fa0a5b28cbe5c2e7c177758158e8d610c88bd82 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 30 Sep 2024 10:47:02 +0200 Subject: [PATCH 09/14] fix: refs #7404 path name --- src/router/modules/entry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js index 4750a4301..76b4a6e23 100644 --- a/src/router/modules/entry.js +++ b/src/router/modules/entry.js @@ -59,7 +59,7 @@ export default { component: () => import('src/pages/Entry/EntryLatestBuys.vue'), }, { - path: 'stock-Bought', + path: 'stock-bought', name: 'EntryStockBought', meta: { title: 'reserves', From cf67865b0bf099570086314099b9a214a3e17ce5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 30 Sep 2024 11:53:54 +0200 Subject: [PATCH 10/14] feat: refs #7404 updates --- src/components/common/VnInput.vue | 39 +++++++++++++++++++++++++ src/components/common/VnSelect.vue | 17 +++++++++++ src/components/ui/VnFilterPanel.vue | 16 +++------- src/css/app.scss | 8 +++++ src/pages/InvoiceOut/InvoiceOutList.vue | 5 +++- src/pages/Item/ItemFixedPrice.vue | 7 ++++- 6 files changed, 78 insertions(+), 14 deletions(-) diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 1246eedcd..ce7918eda 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -130,4 +130,43 @@ const mixinRules = [ .q-field__append { padding-inline: 0; } +// .q-field--standard .q-field__control:after { +// padding: 0; +// } +// .q-field__control-container.col.relative-position.row.no-wrap.q-anchor--skip { +// display: flex; +// flex-direction: row; +// align-items: flex-end; +// } + +.q-field__append.q-field__marginal.row.no-wrap.items-center.row { + height: 20px; +} +.q-field--outlined .q-field__append.q-field__marginal.row.no-wrap.items-center.row { + height: auto; +} +.q-field__control, +.q-select--with-input { + /* color: var(--q-primary); */ + // margin-bottom: 10px; + height: 23px; + /* max-width: 100%; */ + /* outline: none; */ +} +// .q-field--labeled .q-field__native, +// .q-field--labeled .q-field__prefix, +// .q-field--labeled .q-field__suffix { +// padding-bottom: 0; +// } +.q-field__native, +.q-field__prefix, +.q-field__suffix, +.q-field__input { + padding: 0; +} +// .q-field__append.q-field__marginal.row.no-wrap.items-center.q-anchor--skip { +// display: flex; +// flex-direction: row; +// align-items: flex-end; +// } diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index aa629767d..bd505ed29 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -283,4 +283,21 @@ const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); .q-field--outlined { max-width: 100%; } +.q-field__inner { + .q-field__control { + min-height: auto !important; + .q-field__native.row { + min-height: auto !important; + } + } +} +// &.q-field__control { +// min-height: auto; +// &.q-field__controler-container { +// .q-field__native { +// min-height: revert; +// } +// } +// } +// } diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index ef07b7bef..43d634ad9 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -3,7 +3,6 @@ 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'; @@ -59,7 +58,6 @@ const $props = defineProps({ }); defineExpose({ search, sanitizer }); - const emit = defineEmits([ 'update:modelValue', 'refresh', @@ -114,9 +112,9 @@ watch( ); const isLoading = ref(false); -async function search() { +async function search(evt) { try { - if ($props.disableSubmitEvent) return; + if (evt && $props.disableSubmitEvent) return; store.filter.where = {}; isLoading.value = true; @@ -167,7 +165,7 @@ const tagsList = computed(() => { for (const key of Object.keys(userParams.value)) { const value = userParams.value[key]; if (value == null || ($props.hiddenTags || []).includes(key)) continue; - tagList.push({ label: aliasField(key), value }); + tagList.push({ label: key, value }); } return tagList; }); @@ -187,7 +185,6 @@ 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); @@ -203,11 +200,6 @@ function sanitizer(params) { } return params; } - -function aliasField(field) { - const split = field.split('.'); - return split[1] ?? split[0]; -}