From f4541271e95980bcad3d5cade0beed888a458430 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Wed, 12 May 2021 18:29:57 -0400 Subject: [PATCH] Support Notes (#837) * Support for notes in mobile and desktop mode * resolve observations Co-authored-by: elsiosanchez --- .../ADempiere/ChatEntries/index.vue | 158 ++---------------- .../ADempiere/ChatEntries/listChatEntry.vue | 137 +++++++++++++++ .../ADempiere/ChatEntries/mixinChat.js | 103 ++++++++++++ .../ADempiere/ChatEntries/modeDesktop.vue | 119 +++++++++++++ .../ADempiere/ChatEntries/modeMobile.vue | 145 ++++++++++++++++ .../ContextMenu/contextMenuMobile.vue | 34 +++- src/components/ADempiere/Field/index.vue | 1 + src/lang/ADempiere/en.js | 9 +- src/lang/ADempiere/es.js | 10 +- src/views/ADempiere/Window/index.vue | 14 +- .../ADempiere/Window/windowLogicComponent.js | 7 +- .../ADempiere/Window/windowStyleScoped.scss | 4 +- 12 files changed, 579 insertions(+), 162 deletions(-) create mode 100644 src/components/ADempiere/ChatEntries/listChatEntry.vue create mode 100644 src/components/ADempiere/ChatEntries/mixinChat.js create mode 100644 src/components/ADempiere/ChatEntries/modeDesktop.vue create mode 100644 src/components/ADempiere/ChatEntries/modeMobile.vue diff --git a/src/components/ADempiere/ChatEntries/index.vue b/src/components/ADempiere/ChatEntries/index.vue index 455ef36f..956d4761 100644 --- a/src/components/ADempiere/ChatEntries/index.vue +++ b/src/components/ADempiere/ChatEntries/index.vue @@ -16,57 +16,12 @@ along with this program. If not, see . --> - - diff --git a/src/components/ADempiere/ChatEntries/listChatEntry.vue b/src/components/ADempiere/ChatEntries/listChatEntry.vue new file mode 100644 index 00000000..c4aedff1 --- /dev/null +++ b/src/components/ADempiere/ChatEntries/listChatEntry.vue @@ -0,0 +1,137 @@ + + + + + + diff --git a/src/components/ADempiere/ChatEntries/mixinChat.js b/src/components/ADempiere/ChatEntries/mixinChat.js new file mode 100644 index 00000000..f93ce1b3 --- /dev/null +++ b/src/components/ADempiere/ChatEntries/mixinChat.js @@ -0,0 +1,103 @@ +// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution +// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. +// Contributor(s):Elsio Sanchez elsiosanches@gmail.com.com www.erpya.com +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +import inputChat from './inputChat' + +export default { + name: 'MixinChatEntries', + components: { + inputChat + }, + props: { + tableName: { + type: String, + default: undefined + }, + recordId: { + type: Number, + default: undefined + }, + rightPanel: { + type: Boolean, + default: false + } + }, + computed: { + chatList() { + const commentLogs = this.$store.getters.getChatEntries + if (this.isEmptyValue(commentLogs)) { + return [] + } + commentLogs.sort((a, b) => { + const c = new Date(a.logDate) + const d = new Date(b.logDate) + return c - d + }) + return commentLogs + }, + chatListMobile() { + const commentLogs = this.$store.getters.getChatEntries + if (this.isEmptyValue(commentLogs)) { + return [] + } + commentLogs.sort((a, b) => { + const c = new Date(a.logDate) + const d = new Date(b.logDate) + return c - d + }) + return commentLogs + }, + language() { + return this.$store.getters.language + }, + tableNameToSend() { + if (this.isEmptyValue(this.tableName)) { + return this.$route.params.tableName + } + return this.tableName + }, + recordIdToSend() { + if (this.isEmptyValue(this.recordId)) { + return this.$route.params.recordId + } + return this.recordId + }, + isNote() { + return this.$store.getters.getIsNote + }, + getHeightPanelBottom() { + return this.$store.getters.getSplitHeight + } + }, + methods: { + sendComment() { + const comment = this.$store.getters.getChatTextLong + + if (!this.isEmptyValue(comment)) { + this.$store.dispatch('createChatEntry', { + tableName: this.tableNameToSend, + recordId: this.recordIdToSend, + comment + }) + } + }, + clear() { + this.$store.commit('setChatText', '') + }, + translateDate(value) { + return this.$d(new Date(value), 'long', this.language) + } + } +} diff --git a/src/components/ADempiere/ChatEntries/modeDesktop.vue b/src/components/ADempiere/ChatEntries/modeDesktop.vue new file mode 100644 index 00000000..721354fe --- /dev/null +++ b/src/components/ADempiere/ChatEntries/modeDesktop.vue @@ -0,0 +1,119 @@ + + + + + + diff --git a/src/components/ADempiere/ChatEntries/modeMobile.vue b/src/components/ADempiere/ChatEntries/modeMobile.vue new file mode 100644 index 00000000..779f64dd --- /dev/null +++ b/src/components/ADempiere/ChatEntries/modeMobile.vue @@ -0,0 +1,145 @@ + + + + + + diff --git a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue index 09caed06..cb42e890 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuMobile.vue +++ b/src/components/ADempiere/ContextMenu/contextMenuMobile.vue @@ -49,6 +49,28 @@ + +
+
+ +
+
+ + + {{ $t('data.addNote') }} + + +

+ {{ $t('data.descriptionNote') }} +

+
+
+
{}) + } else if (action === this.$t('data.addNote')) { + this.$store.commit('changeShowRigthPanel', true) + this.$store.dispatch('setOptionField', { + name: this.$t('data.addNote') + }) } else { this.runAction(action) } diff --git a/src/components/ADempiere/Field/index.vue b/src/components/ADempiere/Field/index.vue index 8c1494cf..bda4ffd8 100644 --- a/src/components/ADempiere/Field/index.vue +++ b/src/components/ADempiere/Field/index.vue @@ -723,6 +723,7 @@ export default { } }, handleCommand(command) { + console.log({ command }) this.$store.commit('setRecordAccess', false) if (command.name === this.$t('table.ProcessActivity.zoomIn')) { this.redirect({ window: command.fieldAttributes.reference.zoomWindows[0] }) diff --git a/src/lang/ADempiere/en.js b/src/lang/ADempiere/en.js index b87b0fcb..7f485e58 100644 --- a/src/lang/ADempiere/en.js +++ b/src/lang/ADempiere/en.js @@ -309,7 +309,7 @@ export default { deleteRecord: 'Delete Record', undoNew: 'Undo New Record', containerInfo: { - notes: 'Notes', + notes: 'Notes List', changeLog: 'ACtivity', workflowLog: 'Workflow Log', changeDetail: 'Change detail', @@ -366,11 +366,14 @@ export default { }, selectionRequired: 'You must select a record', undo: 'Undo', - unlockRecord: 'Unlock Record', notification: { lockRecord: 'The Registry was Locked', unlockRecord: 'Registry was Unlocked' - } + }, + addNote: 'Add Note', + emptyNote: 'Este registro no posee ninguna nota', + descriptionNote: 'Add Note or Comment to Record', + unlockRecord: 'Unlock Record' }, sequence: { available: 'Available', diff --git a/src/lang/ADempiere/es.js b/src/lang/ADempiere/es.js index 1df5113f..779c3636 100644 --- a/src/lang/ADempiere/es.js +++ b/src/lang/ADempiere/es.js @@ -285,7 +285,7 @@ export default { deleteRecord: 'Eliminar Registro', undoNew: 'Descartar Nuevo Registro', containerInfo: { - notes: 'Notas', + notes: 'Listado de Notas', changeLog: 'Actividad', workflowLog: 'Histórico de Flujo de Trabajo', changeDetail: 'Detalle del cambio', @@ -342,12 +342,14 @@ export default { }, selectionRequired: 'Debe seleccionar un registro', undo: 'Deshacer', - unlockRecord: 'Desbloquear Registro', notification: { lockRecord: 'El Registro fue Bloqueado', unlockRecord: 'El Registro fue Desbloqueado' - } - + }, + addNote: 'Agregar Nota', + emptyNote: 'Este registro no posee ninguna nota', + descriptionNote: 'Agregar Nota o Comentario al Registro', + unlockRecord: 'Desbloquear Registro' }, sequence: { available: 'Disponibles', diff --git a/src/views/ADempiere/Window/index.vue b/src/views/ADempiere/Window/index.vue index 18114982..f8ba513a 100644 --- a/src/views/ADempiere/Window/index.vue +++ b/src/views/ADempiere/Window/index.vue @@ -107,7 +107,7 @@ />
- + @@ -115,7 +115,7 @@ {{ $t('window.containerInfo.notes') }} - @@ -326,14 +326,20 @@ +