[hub] set page title dynamically

This commit is contained in:
Prateeksha Singh 2018-06-07 14:13:00 +05:30
parent 9a7f957ace
commit 00ab78d768

View File

@ -5,7 +5,7 @@ erpnext.hub.HubDetailsPage = class HubDetailsPage extends frappe.views.BaseList
super.setup_defaults();
this.method = 'erpnext.hub_node.get_details';
const route = frappe.get_route();
this.page_name = route[2];
// this.page_name = route[2];
}
setup_fields() {
@ -359,6 +359,11 @@ erpnext.hub.ItemPage = class ItemPage extends erpnext.hub.HubDetailsPage {
}, 'octicon octicon-plus');
}
prepare_data(r) {
super.prepare_data(r);
this.page.set_title(this.data["item_name"]);
}
make_rfq(item, supplier, btn) {
console.log(supplier);
return new Promise((resolve, reject) => {
@ -467,7 +472,6 @@ erpnext.hub.ItemPage = class ItemPage extends erpnext.hub.HubDetailsPage {
erpnext.hub.CompanyPage = class CompanyPage extends erpnext.hub.HubDetailsPage {
constructor(opts) {
super(opts);
this.show();
}
@ -477,6 +481,11 @@ erpnext.hub.CompanyPage = class CompanyPage extends erpnext.hub.HubDetailsPage {
this.image_field_name = 'company_logo';
}
prepare_data(r) {
super.prepare_data(r);
this.page.set_title(this.data["company_name"]);
}
getFormFields() {
let fieldnames = ['company_name', 'description', 'route', 'country', 'seller', 'site_name'];;
this.formFields = this.prepareFormFields(this.meta.fields, fieldnames);