From 8b0588deaff36bffe41be0aafebab0481a1bc6d3 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Thu, 2 May 2019 14:59:44 +0530 Subject: [PATCH] feat: Init call summary popup --- .../crm/call_summary/call_summary_utils.py | 10 ++++++++ erpnext/public/build.json | 3 ++- erpnext/public/js/call_summary_dialog.js | 24 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 erpnext/crm/call_summary/call_summary_utils.py create mode 100644 erpnext/public/js/call_summary_dialog.js diff --git a/erpnext/crm/call_summary/call_summary_utils.py b/erpnext/crm/call_summary/call_summary_utils.py new file mode 100644 index 0000000000..822fb3e038 --- /dev/null +++ b/erpnext/crm/call_summary/call_summary_utils.py @@ -0,0 +1,10 @@ +import frappe + +@frappe.whitelist() +def get_contact_doc(phone_number): + contacts = frappe.get_all('Contact', filters={ + 'phone': phone_number + }, fields=['*']) + + if contacts: + return contacts[0] \ No newline at end of file diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 45de6eb294..25fe0d61a3 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -48,7 +48,8 @@ "public/js/utils/customer_quick_entry.js", "public/js/education/student_button.html", "public/js/education/assessment_result_tool.html", - "public/js/hub/hub_factory.js" + "public/js/hub/hub_factory.js", + "public/js/call_summary_dialog.js" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", diff --git a/erpnext/public/js/call_summary_dialog.js b/erpnext/public/js/call_summary_dialog.js new file mode 100644 index 0000000000..c4c6d483eb --- /dev/null +++ b/erpnext/public/js/call_summary_dialog.js @@ -0,0 +1,24 @@ +frappe.call_summary_dialog = class { + constructor(opts) { + this.number = '+91234444444'; + this.make(); + } + + make() { + var d = new frappe.ui.Dialog(); + this.$modal_body = $(d.body); + this.call_summary_dialog = d; + $(d.header).html(`
Incoming Call: ${this.number}
`); + frappe.xcall('erpnext.crm.call_summary.call_summary_utils.get_contact_doc', { + phone_number: this.number + }).then(res => { + if (!res) { + this.$modal_body.html('Unknown Contact'); + } else { + this.$modal_body.html(`${res.first_name}`); + } + }); + d.show(); + } + +}; \ No newline at end of file