diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb5912c3..119f702f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - (Item) => Se añade la opción de añadir un comentario del motivo de hacer una foto +- (Worker) => Se añade la opción de crear un trabajador ajeno a la empresa +- (Route) => Ahora se muestran todos los cmrs ## [2418.01] diff --git a/package.json b/package.json index 01b5c1582..cdb185ba1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.24.4", + "version": "24.26.2", "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/CrudModel.vue b/src/components/CrudModel.vue index fe15d2db1..406516d46 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -135,7 +135,7 @@ async function onSubmit() { await saveChanges($props.saveFn ? formData.value : null); } -async function onSumbitAndGo() { +async function onSubmitAndGo() { await onSubmit(); push({ path: $props.goTo }); } @@ -324,7 +324,7 @@ watch(formUrl, async () => { /> { 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 = () => {