diff --git a/CHANGELOG.md b/CHANGELOG.md index b72bc2c8a..250aa01a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2420.01] +### Added + +- (Item) => Se añade la opción de añadir un comentario del motivo de hacer una foto + ## [2418.01] ## [2416.01] - 2024-04-18 diff --git a/package.json b/package.json index fb77b3f0a..87546bb66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.24.3", + "version": "24.26.1", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index 8c89c9202..a809140b0 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -1,21 +1,48 @@ import { getCurrentInstance } from 'vue'; -const filterAvailableInput = element => element.classList.contains('q-field__native') && !element.disabled -const filterAvailableText = element => element.__vueParentComponent.type.name === 'QInput' && element.__vueParentComponent?.attrs?.class !== 'vn-input-date'; - +const filterAvailableInput = (element) => { + return element.classList.contains('q-field__native') && !element.disabled; +}; +const filterAvailableText = (element) => { + return ( + element.__vueParentComponent.type.name === 'QInput' && + element.__vueParentComponent?.attrs?.class !== 'vn-input-date' + ); +}; export default { mounted: function () { const vm = getCurrentInstance(); - if (vm.type.name === 'QForm') - if (!['searchbarForm','filterPanelForm'].includes(this.$el?.id)) { + if (vm.type.name === 'QForm') { + if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { // AUTOFOCUS const elementsArray = Array.from(this.$el.elements); - const firstInputElement = elementsArray.filter(filterAvailableInput).find(filterAvailableText); + const availableInputs = elementsArray.filter(filterAvailableInput); + const firstInputElement = availableInputs.find(filterAvailableText); if (firstInputElement) { firstInputElement.focus(); } + const that = this; + this.$el.addEventListener('keyup', function (evt) { + if (evt.key === 'Enter') { + const input = evt.target; + console.log('input', input); + if (input.type == 'textarea' && evt.shiftKey) { + evt.preventDefault(); + let { selectionStart, selectionEnd } = input; + input.value = + input.value.substring(0, selectionStart) + + '\n' + + input.value.substring(selectionEnd); + selectionStart = selectionEnd = selectionStart + 1; + return; + } + evt.preventDefault(); + that.onSubmit(); + } + }); } + } }, }; diff --git a/src/components/EditPictureForm.vue b/src/components/EditPictureForm.vue index a51ca11ad..8a22debda 100644 --- a/src/components/EditPictureForm.vue +++ b/src/components/EditPictureForm.vue @@ -155,7 +155,7 @@ const rotateRight = () => { editor.value.rotate(-90); }; -const onUploadAccept = () => { +const onSubmit = () => { try { if (!newPhoto.files && !newPhoto.url) { notify(t('Select an image'), 'negative'); @@ -206,7 +206,7 @@ const makeRequest = async () => { @on-fetch="(data) => (allowedContentTypes = data.join(', '))" auto-load /> - + diff --git a/src/components/EditTableCellValueForm.vue b/src/components/EditTableCellValueForm.vue index b1df9525b..9d56ba738 100644 --- a/src/components/EditTableCellValueForm.vue +++ b/src/components/EditTableCellValueForm.vue @@ -50,7 +50,7 @@ const onDataSaved = () => { closeForm(); }; -const submitData = async () => { +const onSubmit = async () => { try { isLoading.value = true; const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk })); @@ -74,7 +74,7 @@ const closeForm = () => {