From fb1964aa18192a6c1091e4a80656f8bd71ce9f82 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 22 May 2019 06:38:25 +0530 Subject: [PATCH] fix: Changes to fix popup --- erpnext/public/build.json | 5 ++- erpnext/public/js/call_popup/call_popup.js | 36 +++++++------------ .../{call_summary.less => call_popup.less} | 0 3 files changed, 14 insertions(+), 27 deletions(-) rename erpnext/public/less/{call_summary.less => call_popup.less} (100%) diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 3f55d0737d..818f336d9c 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -2,7 +2,7 @@ "css/erpnext.css": [ "public/less/erpnext.less", "public/less/hub.less", - "public/less/call_summary.less" + "public/less/call_popup.less" ], "css/marketplace.css": [ "public/less/hub.less" @@ -50,8 +50,7 @@ "public/js/education/student_button.html", "public/js/education/assessment_result_tool.html", "public/js/hub/hub_factory.js", - "public/js/call_popup/call_summary_dialog.js", - "public/js/call_popup/call_summary.html" + "public/js/call_popup/call_popup.js" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", diff --git a/erpnext/public/js/call_popup/call_popup.js b/erpnext/public/js/call_popup/call_popup.js index 99c2ca38b1..2d95c5db72 100644 --- a/erpnext/public/js/call_popup/call_popup.js +++ b/erpnext/public/js/call_popup/call_popup.js @@ -1,8 +1,7 @@ class CallPopup { - constructor({ contact, call_payload, last_communication }) { - this.number = call_payload.CallFrom; - this.contact = contact; - this.last_communication = last_communication; + constructor({ call_from, call_log }) { + this.number = call_from; + this.call_log = call_log; this.make(); } @@ -34,7 +33,7 @@ class CallPopup { } }] }); - this.set_call_status(); + this.set_call_status(this.call_log.call_status); this.make_customer_contact(); this.dialog.show(); this.dialog.get_close_btn().show(); @@ -62,48 +61,37 @@ class CallPopup { } } - make_last_communication_section() { - const last_communication_section = this.body.find('.last-communication'); - const last_communication = frappe.ui.form.make_control({ - parent: last_communication_section, - df: { - fieldtype: "Text", - label: "Last Communication", - fieldname: "last_communication", - 'default': 'This is not working please helpppp', - "placeholder": __("Select or add new customer") - }, - }); - last_communication.set_value('This is not working please helpppp'); - } - make_summary_section() { // } - set_call_status(status) { + set_call_status() { let title = ''; - if (status === 'incoming') { + if (this.call_log.call_status === 'Incoming') { if (this.contact) { title = __('Incoming call from {0}', [this.contact.name]); } else { title = __('Incoming call from unknown number'); } + } else { + title = __('Call Connected'); } this.dialog.set_title(title); } update(data) { - // pass + this.call_log = data.call_log; + this.set_call_status(); } } $(document).on('app_ready', function () { - frappe.realtime.on('call_update', data => { + frappe.realtime.on('show_call_popup', data => { if (!erpnext.call_popup) { erpnext.call_popup = new CallPopup(data); } else { erpnext.call_popup.update(data); + erpnext.call_popup.dialog.show(); } }); }); diff --git a/erpnext/public/less/call_summary.less b/erpnext/public/less/call_popup.less similarity index 100% rename from erpnext/public/less/call_summary.less rename to erpnext/public/less/call_popup.less