From df17be4f1bc50e55dda0ad8a1d12ff9c4118677c Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 14 Oct 2024 13:00:52 +0300 Subject: [PATCH] email tasks field impr --- .../Resources/metadata/entityDefs/Email.json | 2 +- .../crm/src/views/task/fields/tasks.js | 38 +++++++++++++++++++ .../views/fields/link-multiple-with-status.js | 21 ++++++---- 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 client/modules/crm/src/views/task/fields/tasks.js diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Email.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Email.json index 3e8630d972..4053c20f5d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Email.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Email.json @@ -14,7 +14,7 @@ "columns": { "status": "status" }, - "view": "views/fields/link-multiple-with-status", + "view": "crm:views/task/fields/tasks", "customizationDefaultDisabled": true } }, diff --git a/client/modules/crm/src/views/task/fields/tasks.js b/client/modules/crm/src/views/task/fields/tasks.js new file mode 100644 index 0000000000..dcedbc524b --- /dev/null +++ b/client/modules/crm/src/views/task/fields/tasks.js @@ -0,0 +1,38 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM – Open Source CRM application. + * Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko + * Website: https://www.espocrm.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * The interactive user interfaces in modified source and object code versions + * of this program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. + ************************************************************************/ + +import LinkMultipleWithStatusFieldView from 'views/fields/link-multiple-with-status'; + +export default class extends LinkMultipleWithStatusFieldView { + + setup() { + super.setup(); + + this.canceledStatusList = this.getMetadata().get(`scopes.Task.canceledStatusList`) || []; + } +} diff --git a/client/src/views/fields/link-multiple-with-status.js b/client/src/views/fields/link-multiple-with-status.js index f660631127..aefdadfd10 100644 --- a/client/src/views/fields/link-multiple-with-status.js +++ b/client/src/views/fields/link-multiple-with-status.js @@ -30,6 +30,12 @@ import LinkMultipleFieldView from 'views/fields/link-multiple'; class LinkMultipleWithStatusFieldView extends LinkMultipleFieldView { + /** + * @protected + * @type {string[]} + */ + canceledStatusList + setup() { super.setup(); @@ -45,6 +51,8 @@ class LinkMultipleWithStatusFieldView extends LinkMultipleFieldView { this.styleMap = this.getMetadata() .get(['entityDefs', this.foreignScope, 'fields', this.statusField, 'style']) || {}; + + this.canceledStatusList = []; } getAttributeList() { @@ -56,15 +64,15 @@ class LinkMultipleWithStatusFieldView extends LinkMultipleFieldView { } getDetailLinkHtml(id, name) { - let status = (this.columns[id] || {}).status; + const status = (this.columns[id] || {}).status; if (!status) { return super.getDetailLinkHtml(id, name); } - let style = this.styleMap[status]; + const style = this.styleMap[status]; - let targetStyleList = ['success', 'danger']; + const targetStyleList = ['success', 'info']; if (!style || !~targetStyleList.indexOf(style)) { return super.getDetailLinkHtml(id, name); @@ -74,12 +82,11 @@ class LinkMultipleWithStatusFieldView extends LinkMultipleFieldView { if (style === 'success') { iconStyle = 'fas fa-check text-success small'; - } - else if (style === 'danger') { - iconStyle = 'fas fa-times text-danger small'; + } else if (this.canceledStatusList.includes(status)) { + iconStyle = `fas fa-times text-${style} small`; } - return ' ' + + return ` ` + super.getDetailLinkHtml(id, name); } }