diff --git a/cypress.config.js b/cypress.config.js index 84ffc68a8..368b92d8d 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,11 +1,6 @@ import { defineConfig } from 'cypress'; -// https://docs.cypress.io/app/tooling/reporters -// https://docs.cypress.io/app/references/configuration -// https://www.npmjs.com/package/cypress-mochawesome-reporter -let urlHost, - reporter, - reporterOptions; +let urlHost, reporter, reporterOptions; if (process.env.CI) { urlHost = 'front'; @@ -30,7 +25,7 @@ if (process.env.CI) { export default defineConfig({ e2e: { baseUrl: `http://${urlHost}:9000`, - experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios + experimentalStudio: false, defaultCommandTimeout: 10000, trashAssetsBeforeRuns: false, requestTimeout: 10000, @@ -43,31 +38,22 @@ export default defineConfig({ downloadsFolder: 'test/cypress/downloads', video: false, specPattern: 'test/cypress/integration/**/*.spec.js', - experimentalRunAllSpecs: true, - watchForFileChanges: true, - reporter, - reporterOptions, + experimentalRunAllSpecs: false, + watchForFileChanges: false, + reporter: 'cypress-mochawesome-reporter', + reporterOptions: { + charts: true, + reportPageTitle: 'Cypress Inline Reporter', + reportFilename: '[status]_[datetime]-report', + embeddedScreenshots: true, + reportDir: 'test/cypress/reports', + inlineAssets: true, + }, component: { componentFolder: 'src', testFiles: '**/*.spec.js', supportFile: 'test/cypress/support/unit.js', - },/* - setupNodeEvents: async (on, config) => { - const plugin = await import('cypress-mochawesome-reporter/plugin'); - plugin.default(on); - const fs = await import('fs'); - on('task', { - deleteFile(filePath) { - if (fs.existsSync(filePath)) { - fs.unlinkSync(filePath); - return true; - } - return false; - }, - }); - - return config; - },*/ + }, viewportWidth: 1280, viewportHeight: 720, }, diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 04ef13d45..182eeaafe 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -12,6 +12,7 @@ import SkeletonForm from 'components/ui/SkeletonForm.vue'; import VnConfirm from './ui/VnConfirm.vue'; import { tMobile } from 'src/composables/tMobile'; import { useArrayData } from 'src/composables/useArrayData'; +import { getDifferences, getUpdatedValues } from 'src/filters'; const { push } = useRouter(); const quasar = useQuasar(); @@ -284,7 +285,12 @@ function trimData(data) { } return data; } - +function onBeforeSave(formData, originalData) { + return getUpdatedValues( + Object.keys(getDifferences(formData, originalData)), + formData, + ); +} async function onKeyup(evt) { if (evt.key === 'Enter' && !('prevent-submit' in attrs)) { const input = evt.target; @@ -321,6 +327,7 @@ defineExpose({ class="q-pa-md" :style="maxWidth ? 'max-width: ' + maxWidth : ''" id="formModel" + :mapper="onBeforeSave" > -import { ref, computed } from 'vue'; +import { ref, computed, useAttrs, nextTick } from 'vue'; import { useI18n } from 'vue-i18n'; +import { useState } from 'src/composables/useState'; import FormModel from 'components/FormModel.vue'; const emit = defineEmits(['onDataSaved', 'onDataCanceled']); -defineProps({ +const props = defineProps({ title: { type: String, default: '', @@ -22,12 +23,21 @@ defineProps({ }); const { t } = useI18n(); - +const attrs = useAttrs(); +const state = useState(); const formModelRef = ref(null); const closeButton = ref(null); -const isSaveAndContinue = ref(false); -const onDataSaved = (formData, requestResponse) => { - if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click(); +const isSaveAndContinue = ref(props.showSaveAndContinueBtn); +const isLoading = computed(() => formModelRef.value?.isLoading); +const reset = computed(() => formModelRef.value?.reset); + +const onDataSaved = async (formData, requestResponse) => { + if (!isSaveAndContinue.value) closeButton.value?.click(); + if (isSaveAndContinue.value) { + await nextTick(); + state.set(attrs.model, attrs.formInitialData); + } + isSaveAndContinue.value = props.showSaveAndContinueBtn; emit('onDataSaved', formData, requestResponse); }; @@ -36,9 +46,6 @@ const onClick = async (saveAndContinue) => { await formModelRef.value.save(); }; -const isLoading = computed(() => formModelRef.value?.isLoading); -const reset = computed(() => formModelRef.value?.reset); - defineExpose({ isLoading, onDataSaved, @@ -74,10 +81,7 @@ defineExpose({ data-cy="FormModelPopup_cancel" v-close-popup z-max - @click=" - isSaveAndContinue = false; - emit('onDataCanceled'); - " + @click="emit('onDataCanceled')" /> mode.value == TABLE_MODE); +const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon); const selectRegex = /select/; const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const tableModes = [ @@ -953,14 +954,6 @@ function cardClick(_, row) { transition-show="scale" transition-hide="scale" :full-width="createComplement?.isFullWidth ?? false" - @before-hide=" - () => { - if (createRef.isSaveAndContinue) { - showForm = true; - createForm.formInitialData = { ...create.formInitialData }; - } - } - " data-cy="vn-table-create-dialog" > #{{ getValueFromPath(subtitle) ?? entity.id }} - {{ t('globals.copyId') }} -
diff --git a/src/pages/Claim/Card/ClaimAction.vue b/src/pages/Claim/Card/ClaimAction.vue index 8ac7c224f..baa36710c 100644 --- a/src/pages/Claim/Card/ClaimAction.vue +++ b/src/pages/Claim/Card/ClaimAction.vue @@ -27,6 +27,7 @@ const claimActionsForm = ref(); const rows = ref([]); const selectedRows = ref([]); const destinationTypes = ref([]); +const shelvings = ref([]); const totalClaimed = ref(null); const DEFAULT_MAX_RESPONSABILITY = 5; const DEFAULT_MIN_RESPONSABILITY = 1; @@ -56,6 +57,12 @@ const columns = computed(() => [ field: (row) => row.claimDestinationFk, align: 'left', }, + { + name: 'shelving', + label: t('shelvings.shelving'), + field: (row) => row.shelvingFk, + align: 'left', + }, { name: 'Landed', label: t('Landed'), @@ -125,6 +132,10 @@ async function updateDestination(claimDestinationFk, row, options = {}) { options.reload && claimActionsForm.value.reload(); } } +async function updateShelving(shelvingFk, row) { + await axios.patch(`ClaimEnds/${row.id}`, { shelvingFk }); + claimActionsForm.value.reload(); +} async function regularizeClaim() { await post(`Claims/${claimId}/regularizeClaim`); @@ -200,6 +211,7 @@ async function post(query, params) { auto-load @on-fetch="(data) => (destinationTypes = data)" /> + + + diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 67034da1a..43941d1dc 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -40,7 +40,7 @@ const workersOptions = ref([]);