feat: Init call summary popup

This commit is contained in:
Suraj Shetty 2019-05-02 14:59:44 +05:30
parent dff4cce8fd
commit 8b0588deaf
3 changed files with 36 additions and 1 deletions

View File

@ -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]

View File

@ -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",

View File

@ -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(`<div>Incoming Call: ${this.number}</div>`);
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();
}
};