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 742fbf276..139961155 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "24.24.1", + "version": "24.26.0", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", @@ -56,4 +56,4 @@ "vite": "^5.1.4", "vitest": "^0.31.1" } -} +} \ No newline at end of file diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 03f75477d..377708143 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -117,7 +117,7 @@ onMounted(async () => { state.set($props.model, $props.formInitialData); if ($props.autoLoad && !$props.formInitialData && $props.url) await fetch(); - else if (arrayData.store.data) updateAndEmit(arrayData.store.data, 'onFetch'); + else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data); if ($props.observeFormChanges) { watch( @@ -137,7 +137,7 @@ onMounted(async () => { if (!$props.url) watch( () => arrayData.store.data, - (val) => updateAndEmit(val, 'onFetch') + (val) => updateAndEmit('onFetch', val) ); watch(formUrl, async () => { @@ -172,8 +172,8 @@ async function fetch() { }); if (Array.isArray(data)) data = data[0] ?? {}; - updateAndEmit(data, 'onFetch'); - } catch (error) { + updateAndEmit('onFetch', data); + } catch (e) { state.set($props.model, {}); originalData.value = {}; } @@ -196,13 +196,13 @@ async function save() { if ($props.urlCreate) notify('globals.dataCreated', 'positive'); - hasChanges.value = false; - isLoading.value = false; - - updateAndEmit(response?.data, 'onDataSaved'); + updateAndEmit('onDataSaved', formData.value, response?.data); } catch (err) { console.error(err); notify('errors.writeRequest', 'negative'); + } finally { + hasChanges.value = false; + isLoading.value = false; } } @@ -212,7 +212,7 @@ async function saveAndGo() { } function reset() { - updateAndEmit(originalData.value, 'onFetch'); + updateAndEmit('onFetch', originalData.value); if ($props.observeFormChanges) { hasChanges.value = false; isResetting.value = true; @@ -234,12 +234,12 @@ function filter(value, update, filterOptions) { ); } -function updateAndEmit(val, evt) { +function updateAndEmit(evt, val, res) { state.set($props.model, val); originalData.value = val && JSON.parse(JSON.stringify(val)); if (!$props.url) arrayData.store.data = val; - emit(evt, state.get($props.model)); + emit(evt, state.get($props.model), res); } defineExpose({ save, isLoading, hasChanges }); diff --git a/src/components/LeftMenuItem.vue b/src/components/LeftMenuItem.vue index 5e0ee461f..d12fb8428 100644 --- a/src/components/LeftMenuItem.vue +++ b/src/components/LeftMenuItem.vue @@ -20,7 +20,13 @@ const itemComputed = computed(() => { }); + + diff --git a/src/components/common/RightMenu.vue b/src/components/common/RightMenu.vue index e288fbc87..f0a95b0df 100644 --- a/src/components/common/RightMenu.vue +++ b/src/components/common/RightMenu.vue @@ -9,19 +9,18 @@ const rightPanel = ref(null); onMounted(() => { rightPanel.value = document.querySelector('#right-panel'); - if (rightPanel.value.childNodes.length) hasContent.value = true; + if (!rightPanel.value) return; // Check if there's content to display const observer = new MutationObserver(() => { hasContent.value = rightPanel.value.childNodes.length; }); - if (rightPanel.value) - observer.observe(rightPanel.value, { - subtree: true, - childList: true, - attributes: true, - }); + observer.observe(rightPanel.value, { + subtree: true, + childList: true, + attributes: true, + }); if (!slots['right-panel'] && !hasContent.value) stateStore.rightDrawer = false; }); @@ -30,7 +29,7 @@ const { t } = useI18n(); const stateStore = useStateStore();