From d7e3303d680fb8b0a54dc9fd5c16049585d1c46d Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 17 May 2024 13:19:59 +0200 Subject: [PATCH 1/7] refs #7396 add fiDueDate, machine --- src/pages/Worker/Card/WorkerBasicData.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue index d1c27beda..12ad7956b 100644 --- a/src/pages/Worker/Card/WorkerBasicData.vue +++ b/src/pages/Worker/Card/WorkerBasicData.vue @@ -2,7 +2,7 @@ import { ref } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; - +import VnInputDate from 'src/components/common/VnInputDate.vue'; import FetchData from 'components/FetchData.vue'; import FormModel from 'src/components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; @@ -78,7 +78,7 @@ const maritalStatus = [ - + {{ data }} + + + + @@ -165,4 +173,5 @@ es: Education level: Nivel educación SSN: NSS Locker: Taquilla + fiDueDate: Fecha de caducidad del DNI From cd21d7817dde0be4f28b60b61c1608c7d1ce8b30 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 17 May 2024 14:16:06 +0200 Subject: [PATCH 2/7] refs #7396 fix summary basicData --- src/i18n/locale/en.yml | 10 ++++++ src/pages/Worker/Card/WorkerBasicData.vue | 31 ++++++++++++++++++- src/pages/Worker/Card/WorkerSummary.vue | 37 ++++++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 7d680c681..0e6edeab2 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -830,6 +830,7 @@ worker: calendar: Calendar timeControl: Time control locker: Locker + list: name: Name email: Email @@ -861,6 +862,15 @@ worker: role: Role sipExtension: Extension locker: Locker + fiDueDate: Fecha de caducidad del DNI + sex: Sexo + seniority: Antigüedad + fi: DNI/NIE/NIF + birth: Cumpleaños + isFreelance: Autónomo + isSsDiscounted: Bonificación SS + hasMachineryAuthorized: Autorizado para llevar maquinaria + isDisable: Trabajador desactivado notificationsManager: activeNotifications: Active notifications availableNotifications: Available notifications diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue index 12ad7956b..2f69de318 100644 --- a/src/pages/Worker/Card/WorkerBasicData.vue +++ b/src/pages/Worker/Card/WorkerBasicData.vue @@ -78,7 +78,6 @@ const maritalStatus = [ - {{ data }} + + + + + + + + + + + + + + @@ -174,4 +195,12 @@ es: SSN: NSS Locker: Taquilla fiDueDate: Fecha de caducidad del DNI + seniority: Antigüedad + hasMachineryAuthorized: Autorizado para llevar maquinaria + isFreelance: Autónomo + isDisable: Trabajador desactivado + fi: DNI/NIE/NIF + sex: Sexo + birth: Cumpleaños + isSsDiscounted: Bonificación SS diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue index 5b25fe335..65375373a 100644 --- a/src/pages/Worker/Card/WorkerSummary.vue +++ b/src/pages/Worker/Card/WorkerSummary.vue @@ -2,7 +2,7 @@ import { ref, onMounted, computed } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { dashIfEmpty } from 'src/filters'; +import { dashIfEmpty, toDate } from 'src/filters'; import { getUrl } from 'src/composables/getUrl'; import VnLv from 'src/components/ui/VnLv.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; @@ -110,6 +110,41 @@ const filter = { + + + + + + + + + From ce444c7e5c3f76a0497e15899d86696a34b68702 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 17 May 2024 14:19:29 +0200 Subject: [PATCH 3/7] first approach --- quasar.config.js | 11 +++- src/boot/customQInput.js | 77 +++++++++++++++++++++++++++ src/boot/customQTh.js | 34 ++++++++++++ src/boot/defaults/qTable.js | 46 ++++++++++++++++ src/components/common/VnInput.vue | 1 - src/pages/Claim/Card/ClaimSummary.vue | 27 +--------- src/pages/Customer/CustomerFilter.vue | 2 +- src/pages/Ticket/TicketFilter.vue | 2 - 8 files changed, 169 insertions(+), 31 deletions(-) create mode 100644 src/boot/customQInput.js create mode 100644 src/boot/customQTh.js diff --git a/quasar.config.js b/quasar.config.js index b59c62eeb..ddfe41c82 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -29,7 +29,16 @@ module.exports = configure(function (/* ctx */) { // app boot file (/src/boot) // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files - boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'], + boot: [ + 'i18n', + 'axios', + 'vnDate', + 'validations', + 'quasar', + 'quasar.defaults', + 'customQTh', + 'customQInput', + ], // https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css css: ['app.scss'], diff --git a/src/boot/customQInput.js b/src/boot/customQInput.js new file mode 100644 index 000000000..51dcd9179 --- /dev/null +++ b/src/boot/customQInput.js @@ -0,0 +1,77 @@ +// src/boot/customQTh.js + +import { boot } from 'quasar/wrappers'; +import { QInput } from 'quasar'; +import i18n from 'src/i18n'; +const TR_HEADER = 'tr-header'; + +export default boot((b) => { + const { app } = b; + app.use(i18n); + app.mixin({ + // mounted() { + // this.applyMixinLogic(); + // }, + mounted() { + this.applyMixinLogic(); + // if (this.$options.name === QInput.name) { + // console.table([this.$options.name]); + // if (this.label) this.label = this.$t(this.label); + // // this.addClassToQTh(this); + // } + }, + methods: { + applyMixinLogic() { + if (this.$options.name === 'QInput') { + // Traducción de la etiqueta + if (this.label) { + const el = this.$el; + // Recorrer los elementos hijos + const children = el.children || []; + for (let i = 0; i < children.length; i++) { + const child = children[i]; + if ( + child.tagName === 'DIV' && + child.classList.contains('q-field__inner') + ) { + const input = child.querySelector('input'); + const filterAvailableText = (element) => + element.__vueParentComponent.type.name === 'QInput' && + element.__vueParentComponent?.attrs?.class !== + 'vn-input-date'; + + if ( + input && + input.__vueParentComponent.type.name === 'QInput' + ) { + // Añadir clase CSS + input.classList.add('input-default'); + + // Traducción de la etiqueta + const labelElement = + child.querySelector('.q-field__label'); + if (labelElement) { + const labelKey = labelElement.textContent.trim(); + labelElement.textContent = this.$t(labelKey); + } + } + } + } + // Traducción de la etiqueta + // const label = this.$el.getAttribute('label'); + // if (label) { + // this.$el = this.$el.setAttribute('label', 'sasd'); + // } + // this.$props.label = this.$t(`*${this.$props.label}`); + // this.label = this.$t(`*${this.$props.label}`); + // this.getNativeElement().ariaLabel = '++++'; + } + // // Añadir clase CSS + // if (!this.$el.classList.contains('input-default')) { + // this.$el.classList.add('input-default'); + // } + } + }, + }, + }); +}); diff --git a/src/boot/customQTh.js b/src/boot/customQTh.js new file mode 100644 index 000000000..ae3aa1011 --- /dev/null +++ b/src/boot/customQTh.js @@ -0,0 +1,34 @@ +// src/boot/customQTh.js + +import { QTable } from 'quasar'; +import { boot } from 'quasar/wrappers'; + +import i18n from 'src/i18n'; +const TR_HEADER = 'tr-header'; + +export default boot((b) => { + const { app } = b; + app.use(i18n); + app.mixin({ + mounted() { + if (this.$options.name === QTable.name) { + console.table([this.$options.name]); + this.addClassToQTh(this.columns ?? []); + } + }, + methods: { + addClassToQTh(columns) { + for (const column of columns) { + let { headerClasses, label, sortable } = column ?? []; + if (!headerClasses) headerClasses = TR_HEADER; + if (!Array.isArray(headerClasses)) headerClasses = [headerClasses]; + else headerClasses.push(TR_HEADER); + column.headerClasses = headerClasses; + if (sortable === undefined) column.sortable = true; + column.label = this.$t(label); + console.table([headerClasses, column.headerClasses]); + } + }, + }, + }); +}); diff --git a/src/boot/defaults/qTable.js b/src/boot/defaults/qTable.js index 8902d4266..23bc7d922 100644 --- a/src/boot/defaults/qTable.js +++ b/src/boot/defaults/qTable.js @@ -1,5 +1,51 @@ import { QTable } from 'quasar'; +import { QInput } from 'quasar'; import setDefault from './setDefault'; +import { QSelect } from 'quasar'; setDefault(QTable, 'pagination', { rowsPerPage: 0 }); setDefault(QTable, 'hidePagination', true); +QInput.props.outlined = { + type: QInput.props.outlined, + default: false, +}; +QInput.props.dense = { + type: QInput.props.dense, + default: false, +}; +QInput.props.stackLabel = { + type: QInput.props.stackLabel, + default: true, +}; +QSelect.props.optionLabel = { + type: QSelect.props.optionLabel, + default: 'name', +}; +QSelect.props.optionValue = { + type: QSelect.props.optionValue, + default: 'id', +}; +QInput.props.hideBottomSpace = { + type: QInput.props.hideBottomSpace, + default: true, +}; +QTable.props.columns = { + type: QTable.props.columns, + align: 'right', + format: (value) => `${value}*`, +}; +QTable.props.noDataLabel = { + default: 'asd', +}; + +setDefault(QInput, 'outlined', false); +// setDefault(QTable, "noDataLabel", t('globalfs.noResults')); +setDefault(QTable, 'gridHeader', true); +setDefault(QTable, 'color', 'red-8'); +setDefault(QTable, 'pagination', { rowsPerPage: 25 }); +setDefault(QTable, 'rowKey', 'id'); +// setDefault(QTable, 'columns', (data) => { +// console.log(this); +// }); +// setDefault(QSelect, 'optionValue', 'id'); +// setDefault(QSelect, 'optionLabel', 'name'); diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 8358cd6e6..67a4fd958 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -69,7 +69,6 @@ const inputRules = [ :clearable="false" :rules="inputRules" :lazy-rules="true" - hide-bottom-space >