fix: Custom dashboard sections

This commit is contained in:
Suraj Shetty 2020-09-10 17:15:52 +05:30
parent 2b405b9bb3
commit 67095d239f
7 changed files with 8 additions and 11 deletions

View File

@ -101,7 +101,8 @@ frappe.ui.form.on('Opening Invoice Creation Tool', {
frappe.render_template('opening_invoice_creation_tool_dashboard', {
data: opening_invoices_summary,
max_count: max_count
})
}),
__("Opening Invoices Summary")
);
section.on('click', '.invoice-link', function() {

View File

@ -1,4 +1,3 @@
<h5 style="margin-top: 0px;">{{ __("Opening Invoices Summary") }}</h5>
{% $.each(data, (company, summary) => { %}
<h6 style="margin: 15px 0px -10px 0px;"><a class="company-link"> {{ company }}</a></h6>

View File

@ -40,8 +40,7 @@ frappe.ui.form.on('Asset Maintenance', {
if(!r.message) {
return;
}
var section = frm.dashboard.add_section(`<h5 style="margin-top: 0px;">
${ __("Maintenance Log") }</a></h5>`);
const section = frm.dashboard.add_section('', __("Maintenance Log"));
var rows = $('<div></div>').appendTo(section);
// show
(r.message || []).forEach(function(d) {

View File

@ -75,7 +75,8 @@ frappe.ui.form.on("Leave Application", {
frm.dashboard.add_section(
frappe.render_template('leave_application_dashboard', {
data: leave_details
})
}),
__("Allocated Leaves")
);
frm.dashboard.show();
let allowed_leave_types = Object.keys(leave_details);

View File

@ -1,6 +1,5 @@
{% if not jQuery.isEmptyObject(data) %}
<h5 style="margin-top: 20px;"> {{ __("Allocated Leaves") }} </h5>
<table class="table table-bordered small">
<thead>
<tr>

View File

@ -47,8 +47,7 @@ frappe.ui.form.on('Batch', {
return;
}
var section = frm.dashboard.add_section(`<h5 style="margin-top: 0px;">
${ __("Stock Levels") }</a></h5>`);
const section = frm.dashboard.add_section('', __("Stock Levels"));
// sort by qty
r.message.sort(function(a, b) { a.qty > b.qty ? 1 : -1 });

View File

@ -380,8 +380,7 @@ $.extend(erpnext.item, {
// Show Stock Levels only if is_stock_item
if (frm.doc.is_stock_item) {
frappe.require('assets/js/item-dashboard.min.js', function() {
var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">\
<a href="#stock-balance">' + __("Stock Levels") + '</a></h5>');
const section = frm.dashboard.add_section('', __("Stock Levels"));
erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
parent: section,
item_code: frm.doc.name