From 93bdb6cd577771519c9cc4befc38658b02be5d54 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 21 Dec 2020 18:37:53 +0530 Subject: [PATCH] feat: Show email status in message box - Show link of docuement in message box --- frappe/public/icons/timeless/symbol-defs.svg | 6 +++--- .../js/frappe/form/footer/form_timeline.js | 17 ++++++++++++++++ .../form/templates/timeline_message_box.html | 20 ++++++++++++++++++- frappe/public/scss/desk/timeline.scss | 6 ++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/frappe/public/icons/timeless/symbol-defs.svg b/frappe/public/icons/timeless/symbol-defs.svg index bf4612b0b6..56e345e74f 100644 --- a/frappe/public/icons/timeless/symbol-defs.svg +++ b/frappe/public/icons/timeless/symbol-defs.svg @@ -536,11 +536,11 @@ - + - - + + diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 95670192bc..18bc7cd06d 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -172,6 +172,8 @@ class FormTimeline extends BaseTimeline { } get_communication_timeline_content(doc) { + doc._url = frappe.utils.get_form_link("Communication", doc.name); + this.set_communication_doc_status(doc); if (doc.attachments && typeof doc.attachments === "string") { doc.attachments = JSON.parse(doc.attachments); } @@ -182,6 +184,21 @@ class FormTimeline extends BaseTimeline { return communication_content; } + set_communication_doc_status(doc) { + let indicator_color = "red"; + if (in_list(["Sent", "Clicked"], doc.delivery_status)) { + indicator_color = "green"; + } else if (doc.delivery_status === "Sending") { + indicator_color = "orange"; + } else if (in_list(["Opened", "Read"], doc.delivery_status)) { + indicator_color = "blue"; + } else if (doc.delivery_status == "Error") { + indicator_color = "red"; + } + doc._doc_status = doc.delivery_status; + doc._doc_status_indicator = indicator_color; + } + get_comment_timeline_contents() { let comment_timeline_contents = []; (this.doc_info.comments || []).forEach(comment => { diff --git a/frappe/public/js/frappe/form/templates/timeline_message_box.html b/frappe/public/js/frappe/form/templates/timeline_message_box.html index 3047924602..a170dfd89d 100644 --- a/frappe/public/js/frappe/form/templates/timeline_message_box.html +++ b/frappe/public/js/frappe/form/templates/timeline_message_box.html @@ -11,7 +11,25 @@ - + + {% if (doc._doc_status && doc._doc_status_indicator) { %} + + + + {% } %} + + {% if (doc._url) { %} + + + + + + {% } %} +
{{ doc.content }} diff --git a/frappe/public/scss/desk/timeline.scss b/frappe/public/scss/desk/timeline.scss index 43db6fffed..15177e85dc 100644 --- a/frappe/public/scss/desk/timeline.scss +++ b/frappe/public/scss/desk/timeline.scss @@ -116,6 +116,12 @@ $threshold: 34; padding: 0; padding-bottom: 0; margin-left: var(--margin-sm); + --icon-stroke: var(--text-muted); + } + + .action-btn:hover { + text-decoration: none; + --icon-stroke: var(--text-color); } } .comment-edit-box {