diff --git a/src/components/ADempiere/Field/FieldTextLong.vue b/src/components/ADempiere/Field/FieldTextLong.vue index 1596c4e5..1a4a6351 100644 --- a/src/components/ADempiere/Field/FieldTextLong.vue +++ b/src/components/ADempiere/Field/FieldTextLong.vue @@ -1,5 +1,5 @@ + diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index b420b622..fc5b1975 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -268,7 +268,21 @@ export default { window: { newRecord: 'New Record', deleteRecord: 'Delete Record', - undoNew: 'Undo New Record' + undoNew: 'Undo New Record', + containerInfo: { + notes: 'Notes', + changeLog: 'Change Log', + workflowLog: 'Workflow Log', + changeDetail: 'Detalle del cambio', + eventType: { + insert: 'Insert', + update: 'Update', + delete: 'Delete', + field: 'The Fiel', + newValue: 'New Value', + oldValue: 'Old Value' + } + } }, data: { emtpyTableName: 'Error: Table Name is not defined', diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index b0b3b44a..05fd713b 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -243,7 +243,21 @@ export default { window: { newRecord: 'Nuevo Registro', deleteRecord: 'Eliminar Registro', - undoNew: 'Descartar Nuevo Registro' + undoNew: 'Descartar Nuevo Registro', + containerInfo: { + notes: 'Notas', + changeLog: 'Histórico de Cambios', + workflowLog: 'Histórico de Flujo de Trabajo', + changeDetail: 'Detalle del cambio', + eventType: { + insert: 'Se Creo', + update: 'Se Actualizo', + delete: 'Eliminar', + field: 'El Campo', + newValue: 'Nuevo Valor', + oldValue: 'Antiguo Valor' + } + } }, data: { emtpyTableName: 'Error: El nombre de la tabla no esta definida', diff --git a/src/store/modules/ADempiere/containerInfo.js b/src/store/modules/ADempiere/containerInfo.js new file mode 100644 index 00000000..dace1216 --- /dev/null +++ b/src/store/modules/ADempiere/containerInfo.js @@ -0,0 +1,140 @@ +import { requestListRecordsLogs, requestListWorkflowsLogs, requestListRecordChats, requestListChatEntries } from '@/api/ADempiere/data' +import { isEmptyValue } from '@/utils/ADempiere/valueUtils' + +const containerInfo = { + state: { + listworkflowLog: [], + listRecordLogs: [], + listRecordChats: [], + listChatEntries: [] + }, + mutations: { + addListWorkflow(state, payload) { + state.listworkflowLog = payload + }, + addListRecordLogs(state, payload) { + state.listRecordLogs = payload + }, + addListRecordChats(state, payload) { + state.listRecordChats = payload + }, + addListChatEntries(state, payload) { + state.listChatEntries = payload + } + }, + actions: { + listWorkflowLogs({ commit, state }, params) { + const tableName = params.tableName + const recordId = params.recordId + const page_size = 0 + const page_token = 0 + return requestListWorkflowsLogs({ tableName, recordId, page_size, page_token }) + .then(response => { + commit('addListWorkflow', response) + }) + .catch(error => { + console.warn(`Error getting List workflow: ${error.message}. Code: ${error.code}.`) + }) + }, + listRecordLogs({ commit, state }, params) { + const tableName = params.tableName + const recordId = params.recordId + const page_size = 0 + const page_token = 0 + return requestListRecordsLogs({ tableName, recordId, page_size, page_token }) + .then(response => { + var listRecord = { + recordCount: response.recordCount, + recorLogs: response.recordLogsList + } + commit('addListRecordLogs', listRecord) + }) + .catch(error => { + console.warn(`Error getting List Record Logs: ${error.message}. Code: ${error.code}.`) + }) + }, + listChatEntries({ commit, state }, params) { + const tableName = params.tableName + const recordId = params.recordId + const page_size = 0 + const page_token = 0 + return requestListRecordChats({ tableName, recordId, page_size, page_token }) + .then(response => { + console.log('requestListRecordChats response =>', response) + commit('addListChatEntries', response) + }) + .catch(error => { + console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`) + }) + }, + listRecordChat({ commit, state }, params) { + const uuid = params.uuid + const page_size = 0 + const page_token = 0 + return requestListChatEntries({ uuid, page_size, page_token }) + .then(response => { + console.log('requestListChatEntries response =>', response) + commit('addListChatEntries', response) + }) + .catch(error => { + console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`) + }) + } + }, + getters: { + getWorkflow: (state) => { + return state.listworkflowLog.workflowLogsList + }, + getRecordLogs: (state) => { + const recordLogs = state.listRecordLogs.recorLogs + if (isEmptyValue(recordLogs)) { + var listRecord = [{ + columnName: 'Compañía', + description: 'Compañía', + displayColumnName: 'Compañía', + eventType: 0, + eventTypeName: 'INSERT', + logDate: 0, + logUuid: 'e0c976cc-b49e-40fd-b52b-f2f5020436f6', + newDisplayValue: '', + newValue: '', + oldDisplayValue: '', + oldValue: '', + recordId: 100000, + sessionUuid: '', + tableName: '', + transactionName: '', + userName: '', + userUuid: '' + }, + { + columnName: 'Compañía', + description: 'Compañía', + displayColumnName: 'Compañía', + eventType: 0, + eventTypeName: 'INSERT', + logDate: 0, + logUuid: 'e0c976cc-b49e-40fd-b52b-f2f5020436f6', + newDisplayValue: '', + newValue: '', + oldDisplayValue: '', + oldValue: '', + recordId: 100000, + sessionUuid: '', + tableName: '', + transactionName: '', + userName: '', + userUuid: '' + }] + return listRecord + } else { + return state.listRecordLogs + } + }, + getChatEntries: (state) => { + return state.listChatEntries + } + } +} + +export default containerInfo diff --git a/src/store/modules/ADempiere/utils.js b/src/store/modules/ADempiere/utils.js index 0187bdcc..8fd663c0 100644 --- a/src/store/modules/ADempiere/utils.js +++ b/src/store/modules/ADempiere/utils.js @@ -13,7 +13,8 @@ const utils = { recordUuidTable: 0, isShowedTabChildren: false, recordTable: 0, - selectionProcess: [] + selectionProcess: [], + isContainerInfo: false }, mutations: { setWidth(state, width) { @@ -31,6 +32,9 @@ const utils = { showMenuTable(state, isShowedTable) { state.isShowedTable = isShowedTable }, + showContainerInfo(state, isContainerInfo) { + state.isContainerInfo = isContainerInfo + }, showMenuTabChildren(state, isShowedTabChildren) { state.isShowedTabChildren = isShowedTabChildren }, @@ -66,6 +70,9 @@ const utils = { showMenuTable({ commit }, isShowedTable) { commit('showMenuTable', isShowedTable) }, + showContainerInfo({ commit, state }, isContainerInfo) { + commit('showContainerInfo', isContainerInfo) + }, showMenuTabChildren({ commit }, isShowedTabChildren) { commit('showMenuTabChildren', isShowedTabChildren) }, @@ -126,6 +133,10 @@ const utils = { const menu = state.isShowedTable.isShowedTable return menu }, + getShowContainerInfo: (state) => { + const showInfo = state.isContainerInfo + return showInfo + }, getShowContextMenuTabChildren: (state) => { const menu = state.isShowedTabChildren.isShowedTabChildren return menu diff --git a/src/store/modules/ADempiere/windowControl.js b/src/store/modules/ADempiere/windowControl.js index f04379ac..d0f237fc 100644 --- a/src/store/modules/ADempiere/windowControl.js +++ b/src/store/modules/ADempiere/windowControl.js @@ -275,7 +275,12 @@ const windowControl = { } return true }) - + // if (rootGetters.getShowContainerInfo) { + // dispatch('listRecordLogs', { + // tableName: panel.tableName, + // recordId + // }) + // } return updateEntity({ tableName: panel.tableName, recordUuid, @@ -283,7 +288,6 @@ const windowControl = { }) .then(updateEntityResponse => { const newValues = updateEntityResponse.values - // set data log to undo action // TODO: Verify performance with tableName_ID let recordId = updateEntityResponse.id @@ -309,7 +313,12 @@ const windowControl = { recordUuid, eventType: 'UPDATE' }) - + // if (containerInfo) { + dispatch('listRecordLogs', { + tableName: panel.tableName, + recordId + }) + // } return newValues }) .catch(error => { diff --git a/src/views/ADempiere/Window/index.vue b/src/views/ADempiere/Window/index.vue index b089b7ee..f3292c07 100644 --- a/src/views/ADempiere/Window/index.vue +++ b/src/views/ADempiere/Window/index.vue @@ -4,139 +4,217 @@ key="window-loaded" > - - - - + + + + + + +
+ +
+
+ +

+ + + + {{ $t('window.containerInfo.changeLog') }} + + + + +

+ {{ evenType.userName }} + + + {{ $t('window.containerInfo.changeDetail') }} + + +
+
+ +
+

{{ evenType.displayColumnName }}: {{ evenType.oldDisplayValue }} {{ evenType.newDisplayValue }}

+
+
+ + + + + + + + {{ $t('window.containerInfo.workflowLog') }} + + {{ gettersrecorCount }} + + + + {{ $t('window.containerInfo.notes') }} + + + +

+
+
+
+
+
{ + if (!reducer.includes(item.eventTypeName)) { + reducer.push(item.eventTypeName) + } + return reducer + }, []) + .map(i => { + // agrup for logId + return { + logs: this.gettersListRecordLogs.filter(b => b.eventTypeName === i), + eventTypeName: i + } + }) + return reducer + }, + gettersListWorkflow() { + return this.$store.getters.getWorkflow + }, + gettersrecorCount() { + return 1 + }, + language() { + return this.$store.getters.language + }, + getterShowContainerInfo() { + return this.$store.getters.getShowContainerInfo } }, watch: { @@ -292,6 +406,58 @@ export default { this.getWindow() }, methods: { + showkey(key) { + if (key === this.currentKey) { + this.currentKey = 1000 + } else { + this.currentKey = key + } + this.show3 = !this.show3 + }, + changeField(log) { + this.$store.dispatch('notifyPanelChange', { + newValues: log.oldDisplayValue, + isSendToServer: false, + isSendCallout: false, + isPrivateAccess: false + }) + }, + translateDate(value) { + return this.$d(new Date(value), 'long', this.language) + }, + conteInfo() { + this.show = !this.show + this.$store.dispatch('listRecordChat', { + uuid: this.$route.query.action + }) + this.$store.dispatch('listChatEntries', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + this.$store.dispatch('showContainerInfo', !this.getterShowContainerInfo) + if (this.show) { + this.$store.dispatch('listRecordLogs', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + } + }, + handleClick(tab, event) { + if (tab.name === 'listChatEntries') { + this.$store.dispatch('listRecordChat', { + uuid: this.$route.query.action + }) + this.$store.dispatch(tab.name, { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + } else { + this.$store.dispatch(tab.name, { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + } + }, // callback new size onDrag(size) { var bottomPanel = size[1] @@ -373,6 +539,19 @@ export default {