From 3fa2a8c2d8f4e8e25727b64fe85b65a8724907fa Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 15 Jul 2023 18:03:16 +0530 Subject: [PATCH] chore: fix linting issues --- .../doctype/journal_entry/journal_entry.js | 8 +- .../doctype/payment_order/payment_order.js | 2 +- .../sales_payment_summary.js | 1 - erpnext/assets/doctype/asset/asset.js | 2 +- .../supplier_scorecard_period.js | 3 - .../supplier_scorecard_standing.js | 1 - .../supplier_scorecard_variable.js | 2 - erpnext/crm/doctype/lead/lead.js | 5 +- .../doctype/work_order/work_order.js | 9 +- erpnext/public/js/agriculture/ternary_plot.js | 232 ------------------ erpnext/public/js/stock_analytics.js | 9 +- erpnext/public/js/stock_grid_report.js | 21 +- .../page/point_of_sale/pos_item_cart.js | 2 +- erpnext/stock/doctype/batch/batch_list.js | 2 +- .../doctype/delivery_trip/delivery_trip.js | 2 +- .../stock_reconciliation.js | 4 +- erpnext/templates/includes/product_list.js | 10 +- erpnext/templates/pages/projects.js | 2 +- 18 files changed, 42 insertions(+), 275 deletions(-) delete mode 100644 erpnext/public/js/agriculture/ternary_plot.js diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index a51e38eefe..8d8cbefa71 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -264,11 +264,11 @@ erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Contro } if(jvd.party_type && jvd.party) { - var party_field = ""; + let party_field = ""; if(jvd.reference_type.indexOf("Sales")===0) { - var party_field = "customer"; + party_field = "customer"; } else if (jvd.reference_type.indexOf("Purchase")===0) { - var party_field = "supplier"; + party_field = "supplier"; } if (party_field) { @@ -368,7 +368,7 @@ cur_frm.cscript.update_totals = function(doc) { td += flt(accounts[i].debit, precision("debit", accounts[i])); tc += flt(accounts[i].credit, precision("credit", accounts[i])); } - var doc = locals[doc.doctype][doc.name]; + doc = locals[doc.doctype][doc.name]; doc.total_debit = td; doc.total_credit = tc; doc.difference = flt((td - tc), precision("difference")); diff --git a/erpnext/accounts/doctype/payment_order/payment_order.js b/erpnext/accounts/doctype/payment_order/payment_order.js index 7d85d89c45..6630e7122c 100644 --- a/erpnext/accounts/doctype/payment_order/payment_order.js +++ b/erpnext/accounts/doctype/payment_order/payment_order.js @@ -124,7 +124,7 @@ frappe.ui.form.on('Payment Order', { return frappe.call({ method: "erpnext.accounts.doctype.payment_order.payment_order.make_payment_records", args: { - "name": me.frm.doc.name, + "name": frm.doc.name, "supplier": args.supplier, "mode_of_payment": args.mode_of_payment }, diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js index 44e20e83c5..92e6f7f514 100644 --- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js +++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js @@ -29,7 +29,6 @@ frappe.query_reports["Sales Payment Summary"] = { "label": __("Owner"), "fieldtype": "Link", "options": "User", - "defaults": user }, { "fieldname":"is_pos", diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 43920adca3..97a41de526 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -473,7 +473,7 @@ frappe.ui.form.on('Asset', { } const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code); if (!item) { - doctype_field = frappe.scrub(doctype) + let doctype_field = frappe.scrub(doctype) frm.set_value(doctype_field, ''); frappe.msgprint({ title: __('Invalid {0}', [__(doctype)]), diff --git a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.js b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.js index a4cdeb3195..62079cc3e0 100644 --- a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.js +++ b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.js @@ -1,9 +1,6 @@ // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -/* global frappe */ - - frappe.ui.form.on("Supplier Scorecard Period", { onload: function(frm) { let criteria_grid = frm.get_field("criteria").grid; diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.js b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.js index dccfcc34bb..22756e75cf 100644 --- a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.js +++ b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.js @@ -1,7 +1,6 @@ // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -/* global frappe */ frappe.ui.form.on("Supplier Scorecard Standing", { refresh: function() { diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.js b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.js index 2d74fdd190..b3b4321a88 100644 --- a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.js +++ b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.js @@ -1,8 +1,6 @@ // Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -/* global frappe */ - frappe.ui.form.on("Supplier Scorecard Variable", { refresh: function() { diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 9ac54183a2..b1799cee6c 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -54,6 +54,7 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller } add_lead_to_prospect () { + let me = this; frappe.prompt([ { fieldname: 'prospect', @@ -67,12 +68,12 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller frappe.call({ method: 'erpnext.crm.doctype.lead.lead.add_lead_to_prospect', args: { - 'lead': cur_frm.doc.name, + 'lead': me.frm.doc.name, 'prospect': data.prospect }, callback: function(r) { if (!r.exc) { - frm.reload_doc(); + me.frm.reload_doc(); } }, freeze: true, diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js index c1a078d65e..58945bba77 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.js +++ b/erpnext/manufacturing/doctype/work_order/work_order.js @@ -624,7 +624,7 @@ erpnext.work_order = { if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) { frm.has_finish_btn = true; - var finish_btn = frm.add_custom_button(__('Finish'), function() { + let finish_btn = frm.add_custom_button(__('Finish'), function() { erpnext.work_order.make_se(frm, 'Manufacture'); }); @@ -648,7 +648,7 @@ erpnext.work_order = { } } else { if ((flt(doc.produced_qty) < flt(doc.qty))) { - var finish_btn = frm.add_custom_button(__('Finish'), function() { + let finish_btn = frm.add_custom_button(__('Finish'), function() { erpnext.work_order.make_se(frm, 'Manufacture'); }); finish_btn.addClass('btn-primary'); @@ -756,13 +756,14 @@ erpnext.work_order = { }, make_consumption_se: function(frm, backflush_raw_materials_based_on) { + let max = 0; if(!frm.doc.skip_transfer){ - var max = (backflush_raw_materials_based_on === "Material Transferred for Manufacture") ? + max = (backflush_raw_materials_based_on === "Material Transferred for Manufacture") ? flt(frm.doc.material_transferred_for_manufacturing) - flt(frm.doc.produced_qty) : flt(frm.doc.qty) - flt(frm.doc.produced_qty); // flt(frm.doc.qty) - flt(frm.doc.material_transferred_for_manufacturing); } else { - var max = flt(frm.doc.qty) - flt(frm.doc.produced_qty); + max = flt(frm.doc.qty) - flt(frm.doc.produced_qty); } frappe.call({ diff --git a/erpnext/public/js/agriculture/ternary_plot.js b/erpnext/public/js/agriculture/ternary_plot.js deleted file mode 100644 index b06a1fd7c8..0000000000 --- a/erpnext/public/js/agriculture/ternary_plot.js +++ /dev/null @@ -1,232 +0,0 @@ -frappe.provide('agriculture'); - -agriculture.TernaryPlot = class TernaryPlot { - constructor(opts) { - Object.assign(this, opts); - - frappe.require('assets/frappe/js/lib/snap.svg-min.js', () => { - this.make_svg(); - this.init_snap(); - this.init_config(); - this.make_plot(); - this.make_plot_marking(); - this.make_legend(); - this.mark_blip(); - }); - } - - make_svg() { - this.$svg = $(''); - $(this.parent).append(this.$svg); - } - - init_snap() { - this.paper = new Snap(this.$svg.get(0)); - } - - init_config() { - this.config = { - triangle_side: 300, - spacing: 50, - strokeWidth: 1, - stroke: frappe.ui.color.get('black') - }; - this.config.scaling_factor = this.config.triangle_side / 100; - let { triangle_side: t, spacing: s, scaling_factor: p } = this.config; - - this.coords = { - sand: { - points: [ - s + t * Snap.cos(60), s, - s, s + t * Snap.cos(30), - s + t, s + t * Snap.cos(30) - ], - color: frappe.ui.color.get('peach') - }, - loamy_sand: { - points: [ - s + 15 * p * Snap.cos(60), s + (100 - 15) * p * Snap.cos(30), - s + 10 * p * Snap.cos(60), s + (100 - 10) * p * Snap.cos(30), - s + (100 - 85) * p, s + t * Snap.cos(30), - s + (100 - 70) * p, s + t * Snap.cos(30) - ], - color: frappe.ui.color.get('pink') - }, - sandy_loam: { - points: [ - s + 20 * p * Snap.cos(60) + 27.5 * p, s + (100 - 20) * p * Snap.cos(30), - s + 20 * p * Snap.cos(60), s + (100 - 20) * p * Snap.cos(30), - s + 15 * p * Snap.cos(60), s + (100 - 15) * p * Snap.cos(30), - s + (100 - 75) * p, s + t * Snap.cos(30), - s + (100 - 50) * p, s + t * Snap.cos(30), - s + (100 - 50) * p + 7.5 * p * Snap.cos(60), s + t * Snap.cos(30) - 7.5 * p * Snap.cos(30), - s + (100 - 50) * p + 7.5 * p * Snap.cos(60) - 10 * p, s + t * Snap.cos(30) - 7.5 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('pink', 'light') - }, - loam: { - points: [ - s + (100 - 50) * p + 27.5 * p * Snap.cos(60), s + t * Snap.cos(30) - 27.5 * p * Snap.cos(30), - s + (100 - 50) * p + 27.5 * p * Snap.cos(60) - 22.5 * p, s + t * Snap.cos(30) - 27.5 * p * Snap.cos(30), - s + 20 * p * Snap.cos(60) + 27.5 * p, s + (100 - 20) * p * Snap.cos(30), - s + (100 - 50) * p + 7.5 * p * Snap.cos(60) - 10 * p, s + t * Snap.cos(30) - 7.5 * p * Snap.cos(30), - s + (100 - 50) * p + 7.5 * p * Snap.cos(60), s + t * Snap.cos(30) - 7.5 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('brown') - }, - silt_loam: { - points: [ - s + t - 27.5 * p * Snap.cos(60), s + 72.5 * p * Snap.cos(30), - s + (100 - 50) * p + 27.5 * p * Snap.cos(60), s + t * Snap.cos(30) - 27.5 * p * Snap.cos(30), - s + (100 - 50) * p, s + t * Snap.cos(30), - s + (100 - 20) * p, s + t * Snap.cos(30), - s + (100 - 20) * p + 12.5 * p * Snap.cos(60), s + 90 * p * Snap.cos(30), - s + t - 12.5 * p * Snap.cos(60), s + (100 - 12.5) * p * Snap.cos(30) - ], - color: frappe.ui.color.get('green', 'dark') - }, - silt: { - points: [ - s + t - 12.5 * p * Snap.cos(60), s + (100 - 12.5) * p * Snap.cos(30), - s + (100 - 20) * p + 12.5 * p * Snap.cos(60), s + 90 * p * Snap.cos(30), - s + (100 - 20) * p, s + t * Snap.cos(30), - s + t, s + t * Snap.cos(30) - ], - color: frappe.ui.color.get('green') - }, - silty_clay_loam: { - points: [ - s + t - 40 * p * Snap.cos(60), s + 60 * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60) - 20 * p, s + 60 * p * Snap.cos(30), - s + t - 27.5 * p * Snap.cos(60) - 20 * p, s + 72.5 * p * Snap.cos(30), - s + t - 27.5 * p * Snap.cos(60), s + 72.5 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('cyan', 'dark') - }, - silty_clay: { - points: [ - s + t - 60 * p * Snap.cos(60), s + 40 * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60) - 20 * p, s + 60 * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60), s + 60 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('cyan') - }, - clay_loam: { - points: [ - s + t - 40 * p * Snap.cos(60) - 20 * p, s + 60 * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60) - 45 * p, s + 60 * p * Snap.cos(30), - s + t - 27.5 * p * Snap.cos(60) - 45 * p, s + 72.5 * p * Snap.cos(30), - s + t - 27.5 * p * Snap.cos(60) - 20 * p, s + 72.5 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('green', 'light') - }, - sandy_clay_loam: { - points: [ - s + 35 * p * Snap.cos(60) + 20 * p, s + (100 - 35) * p * Snap.cos(30), - s + 35 * p * Snap.cos(60), s + (100 - 35) * p * Snap.cos(30), - s + 20 * p * Snap.cos(60), s + (100 - 20) * p * Snap.cos(30), - s + 20 * p * Snap.cos(60) + 27.5 * p, s + (100 - 20) * p * Snap.cos(30), - s + t - 27.5 * p * Snap.cos(60) - 45 * p, s + 72.5 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('pink', 'dark') - }, - sandy_clay: { - points: [ - s + 55 * p * Snap.cos(60), s + (100 - 55) * p * Snap.cos(30), - s + 35 * p * Snap.cos(60), s + (100 - 35) * p * Snap.cos(30), - s + 35 * p * Snap.cos(60) + 20 * p, s + (100 - 35) * p * Snap.cos(30) - ], - color: frappe.ui.color.get('red') - }, - clay: { - points: [ - s + t * Snap.cos(60), s, - s + 55 * p * Snap.cos(60), s + (100 - 55) * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60) - 45 * p, s + 60 * p * Snap.cos(30), - s + t - 40 * p * Snap.cos(60) - 20 * p, s + 60 * p * Snap.cos(30), - s + t - 60 * p * Snap.cos(60), s + 40 * p * Snap.cos(30) - ], - color: frappe.ui.color.get('yellow') - }, - }; - } - - get_coords(soil_type) { - return this.coords[soil_type].points; - } - - get_color(soil_type) { - return this.coords[soil_type].color; - } - - make_plot() { - for (let soil_type in this.coords) { - this.paper.polygon(this.get_coords(soil_type)).attr({ - fill: this.get_color(soil_type), - stroke: this.config.stroke, - strokeWidth: this.config.strokeWidth - }); - } - } - - make_plot_marking() { - let { triangle_side: t, spacing: s, scaling_factor: p } = this.config; - - let clay = this.paper.text(t * Snap.cos(60) / 2, s + t * Snap.cos(30) / 2, __("Clay")).attr({ - fill: frappe.ui.color.get('black') - }); - clay.transform("r300"); - - let silt = this.paper.text(t, s + t * Snap.cos(30) / 2, __("Silt")).attr({ - fill: frappe.ui.color.get('black') - }); - silt.transform("r60"); - - let sand = this.paper.text(35 + t * Snap.cos(60), 90 + t * Snap.cos(30), __("Sand")).attr({ - fill: frappe.ui.color.get('black') - }); - sand.transform("r0"); - } - - make_legend() { - // let side = len(this.coords)/2; - let index = 1; - let offset = 0; - let exec_once = true; - for (let soil_type in this.coords) { - if (index > 6 && exec_once){ - offset = 300; - index = 1; - exec_once = false; - } - let rect = this.paper.rect(0+offset, 0+index*20, 100, 19, 5, 5).attr({ - fill: this.get_color(soil_type), - stroke: frappe.ui.color.get('black') - }); - let text = this.paper.text(5+offset, 16+index*20, soil_type).attr({ - fill: frappe.ui.color.get('black'), - 'font-size': 12 - }); - index++; - } - } - - mark_blip({clay, sand, silt} = this) { - if (clay + sand + silt != 0){ - let { triangle_side: t, spacing: s, scaling_factor: p } = this.config; - - let x_blip = s + clay * p * Snap.cos(60) + silt * p; - let y_blip = s + silt * p * Snap.cos(30) + sand * p * Snap.sin(60); - this.blip = this.paper.circle(x_blip, y_blip, 4).attr({ - fill: frappe.ui.color.get("orange"), - stroke: frappe.ui.color.get("orange"), - strokeWidth: 2 - }); - } - } - - remove_blip() { - if (typeof this.blip !== 'undefined') - this.blip.remove(); - } -}; diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js index a343c3402a..98e7f7849e 100644 --- a/erpnext/public/js/stock_analytics.js +++ b/erpnext/public/js/stock_analytics.js @@ -125,6 +125,7 @@ erpnext.StockAnalytics = class StockAnalytics extends erpnext.StockGridReport { this.serialized_buying_rates = this.get_serialized_buying_rates(); for(var i=0, j=data.length; i 0) { // incoming - rate is given - var rate = sl.incoming_rate; - var add_qty = sl.qty; + let rate = sl.incoming_rate; + let add_qty = sl.qty; if(wh.balance_qty < 0) { // negative valuation // only add value of quantity if @@ -25,10 +27,11 @@ erpnext.StockGridReport = class StockGridReport extends frappe.views.TreeGridRep add_qty = 0; } } + if(sl.serial_no) { - var value_diff = this.get_serialized_value_diff(sl); + value_diff = this.get_serialized_value_diff(sl); } else { - var value_diff = (rate * add_qty); + value_diff = (rate * add_qty); } if(add_qty) @@ -39,19 +42,19 @@ erpnext.StockGridReport = class StockGridReport extends frappe.views.TreeGridRep // outgoing if(sl.serial_no) { - var value_diff = -1 * this.get_serialized_value_diff(sl); + value_diff = -1 * this.get_serialized_value_diff(sl); } else if(is_fifo) { - var value_diff = fifo_value_diff; + value_diff = fifo_value_diff; } else { // average rate for weighted average - var rate = (wh.balance_qty.toFixed(2) == 0.00 ? 0 : + let rate = (wh.balance_qty.toFixed(2) == 0.00 ? 0 : flt(wh.balance_value) / flt(wh.balance_qty)); // no change in value if negative qty if((wh.balance_qty + sl.qty).toFixed(2) >= 0.00) - var value_diff = (rate * sl.qty); + value_diff = (rate * sl.qty); else - var value_diff = -wh.balance_value; + value_diff = -wh.balance_value; } } diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js index 12cc629776..46490c43ae 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -945,7 +945,7 @@ erpnext.PointOfSale.ItemCart = class { `
No recent transactions found
` ) return; - }; + } const elapsed_time = moment(res[0].posting_date+" "+res[0].posting_time).fromNow(); this.$customer_section.find('.customer-desc').html(`Last transacted ${elapsed_time}`); diff --git a/erpnext/stock/doctype/batch/batch_list.js b/erpnext/stock/doctype/batch/batch_list.js index 0de9fd0150..f1a0643cfd 100644 --- a/erpnext/stock/doctype/batch/batch_list.js +++ b/erpnext/stock/doctype/batch/batch_list.js @@ -9,6 +9,6 @@ frappe.listview_settings['Batch'] = { return [__("Expired"), "red", "expiry_date,not in,|expiry_date,<=,Today|batch_qty,>,0|disabled,=,0"] } else { return [__("Active"), "green", "batch_qty,>,0|disabled,=,0"]; - }; + } } }; diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.js b/erpnext/stock/doctype/delivery_trip/delivery_trip.js index a6fbb66aa2..de503dc73f 100755 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.js +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.js @@ -92,7 +92,7 @@ frappe.ui.form.on('Delivery Trip', { frm.set_value("driver_email", data.message.email); } }); - }; + } }, optimize_route: function (frm) { diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index 0664c2929c..564562d722 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -67,6 +67,7 @@ frappe.ui.form.on("Stock Reconciliation", { }, company: function(frm) { + frm.trigger("toggle_display_account_head"); erpnext.accounts.dimensions.update_dimension(frm, frm.doctype); }, @@ -221,9 +222,6 @@ frappe.ui.form.on("Stock Reconciliation", { frappe.model.set_value(cdt, cdn, "amount_difference", flt(d.amount) - flt(d.current_amount)); } }, - company: function(frm) { - frm.trigger("toggle_display_account_head"); - }, toggle_display_account_head: function(frm) { frm.toggle_display(['expense_account', 'cost_center'], erpnext.is_perpetual_inventory_enabled(frm.doc.company)); diff --git a/erpnext/templates/includes/product_list.js b/erpnext/templates/includes/product_list.js index 2f9d978eb1..acee36c80c 100644 --- a/erpnext/templates/includes/product_list.js +++ b/erpnext/templates/includes/product_list.js @@ -27,10 +27,10 @@ window.get_product_list = function() { } window.render_product_list = function(data) { - var table = $("#search-list .table"); + let table = $("#search-list .table"); if(data.length) { if(!table.length) - var table = $("").appendTo("#search-list"); + table = $("
").appendTo("#search-list"); $.each(data, function(i, d) { $(d).appendTo(table); @@ -38,11 +38,13 @@ window.render_product_list = function(data) { } if(data.length < 10) { if(!table) { + let message = __("No products found."); $(".more-btn") - .replaceWith("
{{ _("No products found.") }}
"); + .replaceWith(`
{{ ${message} }}
`); } else { + let message = __("Nothing more to show."); $(".more-btn") - .replaceWith("
{{ _("Nothing more to show.") }}
"); + .replaceWith(`
{{ ${message} }}
`); } } else { $(".more-btn").toggle(true) diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js index bd6bcea7ca..7149ceea10 100644 --- a/erpnext/templates/pages/projects.js +++ b/erpnext/templates/pages/projects.js @@ -72,7 +72,7 @@ frappe.ready(function() { var more_items = function(item, item_status){ if(item_status) { - var item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-completed-'+ item) + item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-completed-'+ item) ? 'completed' : 'open'; } $.ajax({