diff --git a/src/lang/en.js b/src/lang/en.js index ae221ba81ad..c0a29764929 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -163,7 +163,17 @@ export default { refresh: 'Refresh', close: 'Close', closeOthers: 'Close Others', - closeAll: 'Close All' + closeAll: 'Close All', + table: { + label: 'Close the window', + tab: 'Tab', + field: 'Field', + value: 'Value' + }, + buttonClose: { + discardChanges: 'Discard Changes', + returnToWindow: 'Return to Window' + } }, settings: { title: 'Page style setting', diff --git a/src/lang/es.js b/src/lang/es.js index 8187bfe7061..c262c9a4f03 100755 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -163,7 +163,17 @@ export default { refresh: 'Actualizar', close: 'Cerrar', closeOthers: 'Cerrar otros', - closeAll: 'Cerrar todos' + closeAll: 'Cerrar todos', + table: { + label: 'Cerrar Ventana', + tab: 'PestaƱa', + field: 'Campo', + value: 'Valor' + }, + buttonClose: { + discardChanges: 'Descartar Cambios', + returnToWindow: 'Regresar a la Ventana' + } }, settings: { title: 'Page style setting', diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index b6af7354685..c72cd27e49a 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -24,14 +24,14 @@ }" tag="span" class="tags-view-item" - @click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''" + @click.middle.native="!isAffix(tag) ? closeValidateTag(tag) : ''" @contextmenu.prevent.native="openMenu(tag,$event)" >
{{ generateTitle(tag.title) }}
-
+
@@ -46,21 +46,54 @@ :to="{ name: tag.name, path: tag.path, query: tag.query, fullPath: tag.fullPath, params: tag.params }" tag="span" class="tags-view-item" - @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''" + @click.middle.native="!isAffix(tag)?closeValidateTag(tag):''" @contextmenu.prevent.native="openMenu(tag,$event)" > {{ generateTitle(tag.title) }} - +
  • {{ $t('tagsView.refresh') }}
  • -
  • {{ $t('tagsView.close') }}
  • +
  • {{ $t('tagsView.close') }}
  • {{ $t('tagsView.closeOthers') }}
  • {{ $t('tagsView.closeAll') }}
+ + + + + + + + + + + + {{ $t('tagsView.buttonClose.discardChanges') }} + + + {{ $t('tagsView.buttonClose.returnToWindow') }} + + +
@@ -75,6 +108,7 @@ import { REPORT_VIEWER_NAME } from '@/utils/ADempiere/constants/report' // utils and helper methods import { capitalize } from '@/utils/ADempiere/formatValue/stringFormat' +import { isEmptyValue } from '@/utils/ADempiere' export default { components: { ScrollPane, draggable }, @@ -84,7 +118,9 @@ export default { top: 0, left: 0, selectedTag: {}, - affixTags: [] + affixTags: [], + dialogVisible: false, + recordModifiedTab: [] } }, computed: { @@ -202,6 +238,33 @@ export default { }) }) }, + discardChanges(view) { + this.dialogVisible = false + }, + closeValidateTag(view) { + const isWindow = this.$store.getters.getStoredWindow(view.meta.uuid) + if (!isEmptyValue(isWindow)) { + const allListTabs = isWindow.tabsList.map(tabs => { + const { parentUuid, name, containerUuid } = tabs + const emptyMandatory = this.$store.getters.getPersistenceAttributesChanges({ + parentUuid, + containerUuid, + recordUuid: this.$store.getters.getUuidOfContainer(containerUuid) + }) + return { + name, + emptyMandatory, + view: view + } + }) + this.recordModifiedTab = allListTabs.filter(modifiedTab => !isEmptyValue(modifiedTab.emptyMandatory)) + if (!isEmptyValue(this.recordModifiedTab)) { + this.dialogVisible = true + return + } + } + this.closeSelectedTag(view) + }, closeSelectedTag(view) { this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { if (this.isActive(view)) {