diff --git a/src/api/ADempiere/data.js b/src/api/ADempiere/data.js index 57669a89..c91565ce 100644 --- a/src/api/ADempiere/data.js +++ b/src/api/ADempiere/data.js @@ -484,3 +484,15 @@ export function requestListChatEntries({ uuid, pageToken, pageSize }) { pageSize }) } +/** + * @param {string} tableName + * @param {string} recordId + * @param {string} comment + */ +export function requestCreateChatEntry({ tableName, recordId, comment }) { + return Instance.call(this).requestCreateChatEntry({ + tableName, + recordId, + comment + }) +} diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index 882aa1d5..b47de3d8 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -278,7 +278,8 @@ export default { message: 'Message', responsible: 'Responsible', workflowName: 'Name of Workflow Status', - timeElapsed: 'Time Elapsed' + timeElapsed: 'Time Elapsed', + addNote: 'Notas' } } }, diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index fdb88059..25d94a60 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -253,7 +253,8 @@ export default { message: 'Mensaje', responsible: 'Responsable', workflowName: 'Nombre de estado del flujo de trabajo', - timeElapsed: 'Tiempo transcurrido' + timeElapsed: 'Tiempo transcurrido', + addNote: 'Notas' } } }, diff --git a/src/store/modules/ADempiere/containerInfo.js b/src/store/modules/ADempiere/containerInfo.js index 383ed16e..7e11be20 100644 --- a/src/store/modules/ADempiere/containerInfo.js +++ b/src/store/modules/ADempiere/containerInfo.js @@ -1,4 +1,5 @@ -import { requestListRecordsLogs, requestListWorkflowsLogs, requestListWorkflows, requestListRecordChats, requestListChatEntries } from '@/api/ADempiere/data' +import { requestListRecordsLogs, requestListWorkflowsLogs, requestListWorkflows, requestListRecordChats, requestListChatEntries, requestCreateChatEntry } from '@/api/ADempiere/data' +import { isEmptyValue } from '@/utils/ADempiere/valueUtils' const containerInfo = { state: { @@ -6,7 +7,8 @@ const containerInfo = { listRecordLogs: [], listRecordChats: [], listChatEntries: [], - ListWorkflows: [] + listWorkflows: [], + note: [] }, mutations: { addListWorkflow(state, payload) { @@ -23,9 +25,25 @@ const containerInfo = { }, addListChatEntries(state, payload) { state.listChatEntries = payload + }, + addNote(state, payload) { + state.note = payload } }, actions: { + createChatEntry({ commit, dispatch }, params) { + const tableName = params.tableName + const recordId = params.recordId + const comment = params.comment + return requestCreateChatEntry({ tableName, recordId, comment }) + .then(response => { + dispatch('listChatEntries', { + tableName: params.tableName, + recordId: params.recordId + }) + commit('addNote', response) + }) + }, listWorkflowLogs({ commit, state, dispatch }, params) { const tableName = params.tableName const recordId = params.recordId @@ -68,7 +86,8 @@ const containerInfo = { .then(response => { var listRecord = { recordCount: response.recordCount, - recorLogs: response.recordLogsList + recorLogs: response.recordLogsList, + epale: true } commit('addListRecordLogs', listRecord) }) @@ -83,15 +102,16 @@ const containerInfo = { const pageToken = 0 return requestListRecordChats({ tableName, recordId, pageSize, pageToken }) .then(response => { - var listRecordChats = { + var listRecord = { recordChatsList: response.recordChatsList, recordCount: response.recordCount, + epale: isEmptyValue(response.recordChatsList), nextPageToken: response.nextPageToken } dispatch('listRecordChat', { chatUuid: response.recordChatsList[0].chatUuid }) - commit('addListRecordChats', listRecordChats) + commit('addListRecordChats', listRecord) }) .catch(error => { console.warn(`Error getting List Chat: ${error.message}. Code: ${error.code}.`) diff --git a/src/views/ADempiere/Window/index.vue b/src/views/ADempiere/Window/index.vue index 8fd61590..1ccc69fa 100644 --- a/src/views/ADempiere/Window/index.vue +++ b/src/views/ADempiere/Window/index.vue @@ -183,7 +183,7 @@
-

{{ list.displayColumnName }} : {{ list.oldDisplayValue }} {{ list.newDisplayValue }}

+

{{ list.displayColumnName }} : {{ list.oldDisplayValue }} {{ list.newDisplayValue }}

@@ -270,11 +270,11 @@ > {{ $t('window.containerInfo.notes') }}
- {{ $t('window.containerInfo.notes') }} {{ gettersLisRecordChats[0].description }} + {{ $t('window.containerInfo.notes') }}
@@ -295,14 +295,20 @@
-
+
+ +
+ {{ $t('window.containerInfo.logWorkflow.addNote') }} +
+ +
+
@@ -354,6 +360,7 @@ export default { isPanel: false, activeInfo: 'listRecordLogs', show: false, + chatNote: '', typeAction: 0, isLoadingFromServer: false, listRecordNavigation: 0, @@ -468,23 +475,20 @@ export default { getIsChangeLog() { if (this.isEmptyValue(this.gettersListRecordLogs)) { return false - } else { - return true } + return true }, getIsWorkflowLog() { if (this.isEmptyValue(this.gettersListWorkflow)) { return false - } else { - return true } + return true }, getIsChat() { - if (this.isEmptyValue(this.gettersLischat)) { + if (this.isEmptyValue(this.gettersLisRecordChats)) { return false - } else { - return true } + return true }, getTypeLogs() { const groupLog = this.gettersListRecordLogs.reduce((groupLog, item) => { @@ -506,7 +510,7 @@ export default { return this.$store.getters.getChatEntries.chatEntriesList }, gettersLisRecordChats() { - return this.$store.getters.getListRecordChats.recordChatsList + return this.$store.getters.getListRecordChats }, gettersListWorkflow() { return this.$store.getters.getWorkflow @@ -522,6 +526,12 @@ export default { } }, watch: { + $route(value) { + this.$store.dispatch('listChatEntries', { + tableName: value.params.tableName, + recordId: value.params.recordId + }) + }, 'this.$route.params'(newValue, oldValue) { if (!this.isEmptyValue(newValue)) { this.getIsRecordLocked() @@ -532,6 +542,14 @@ export default { this.getWindow() }, methods: { + sendComment(comment) { + this.$store.dispatch('createChatEntry', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId, + comment: comment + }) + this.chatNote = '' + }, showkey(key, index) { if (key === this.currentKey && index === this.typeAction) { this.currentKey = 1000 @@ -566,17 +584,24 @@ export default { } }, handleClick(tab, event) { - if (tab.name === 'listChatEntries') { - 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 - }) - } + this.$store.dispatch(tab.name, { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + }, + refres() { + this.$store.dispatch('listWorkflowLogs', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + this.$store.dispatch('listRecordLogs', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) + this.$store.dispatch('listChatEntries', { + tableName: this.$route.params.tableName, + recordId: this.$route.params.recordId + }) }, // callback new size onDrag(size) { @@ -825,7 +850,7 @@ export default { max-height: 68vh !important; } .scroll-window-log-chat { - max-height: 68vh !important; + max-height: 45vh !important; } .el-card__header { background: rgba(245, 247, 250, 0.75);