Hello guys i have created a new app and i’m trying to create a customized module list page (menu_mpya .js) which will pull my menu list items from a tabSingle Doctype (Custom Menu) and list them to my menu_mpya page .
Custom Menu tabSingle Doctype pic below
Also here is how my menu_mpya page looks right now
Also checkout my scripts ( menu_mpya.js)
frappe.pages['menu-mpya'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'Menu Mpya',
single_column: false
});
//frappe.breadcrumbs.add("Selling")
frappe.modules_page = page;
frappe.module_links = {};
page.section_data = {};
page.get_menu = () => {
return frappe.get_custom_menu('Custom Menu');
};
let get_module_sidebar_item = (item) => `<li class="strong module-sidebar-item">
<a class="module-link" data-name="${item.item_link}" href="#List/${item.item_link}/">
<i class="fa fa-chevron-right pull-right" style="display: none;"></i>
<span>${item.item_label}</span>
</a>
</li>`;
let get_sidebar_html = () => {
let sidebar_items_html = page.get_menu()
.map(get_module_sidebar_item.bind(this)).join("");
return `<ul class="module-sidebar-nav overlay-sidebar nav nav-pills nav-stacked">
${sidebar_items_html}
<li class="divider"></li>
</ul>`;
};
// render sidebar
page.sidebar.html(get_sidebar_html());
var show_section = function(module_name) {
if (!module_name) return;
if(module_name in page.section_data) {
render_section(page.section_data[module_name]);
} else {
page.main.empty();
return frappe.call({
method: "frappe.desk.moduleview.get",
args: {
module: module_name
},
callback: function(r) {
var m = frappe.get_module(module_name);
m.data = r.message.data;
process_data(module_name, m.data);
page.section_data[module_name] = m;
render_section(m);
},
freeze: true,
});
}
};
}