From f67bf7ae98105357b333a7a1bec55c92dd90fd7d Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 1 Feb 2021 19:40:44 +0530 Subject: [PATCH] chore: Fix formatting issues --- .../page/point_of_sale/pos_item_selector.js | 37 +++++++------- .../point_of_sale/pos_past_order_summary.js | 50 +++++++++---------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/erpnext/selling/page/point_of_sale/pos_item_selector.js b/erpnext/selling/page/point_of_sale/pos_item_selector.js index e28551dc72..7c116e9fa1 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_selector.js +++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js @@ -1,13 +1,14 @@ import onScan from 'onscan.js'; erpnext.PointOfSale.ItemSelector = class { + // eslint-disable-next-line no-unused-vars constructor({ frm, wrapper, events, pos_profile, settings }) { this.wrapper = wrapper; this.events = events; this.pos_profile = pos_profile; this.hide_images = settings.hide_images; this.auto_add_item = settings.auto_add_item_to_cart; - + this.inti_component(); } @@ -39,7 +40,7 @@ erpnext.PointOfSale.ItemSelector = class { if (!this.item_group) { const res = await frappe.db.get_value("Item Group", {lft: 1, is_group: 1}, "name"); this.parent_item_group = res.message.name; - }; + } if (!this.price_list) { const res = await frappe.db.get_value("POS Profile", this.pos_profile, "selling_price_list"); this.price_list = res.message.selling_price_list; @@ -71,11 +72,12 @@ erpnext.PointOfSale.ItemSelector = class { items.forEach(item => { const item_html = this.get_item_html(item); this.$items_container.append(item_html); - }) + }); } get_item_html(item) { const me = this; + // eslint-disable-next-line no-unused-vars const { item_image, serial_no, batch_no, barcode, actual_qty, stock_uom } = item; const indicator_color = actual_qty > 10 ? "green" : actual_qty <= 0 ? "red" : "orange"; @@ -83,7 +85,7 @@ erpnext.PointOfSale.ItemSelector = class { if (!me.hide_images && item_image) { return `
${frappe.get_abbr(item.item_name)} -
` + `; } else { return `
${frappe.get_abbr(item.item_name)}
`; } @@ -105,7 +107,7 @@ erpnext.PointOfSale.ItemSelector = class {
${format_currency(item.price_list_rate, item.currency, 0) || 0}
` - ) + ); } make_search_bar() { @@ -140,7 +142,7 @@ erpnext.PointOfSale.ItemSelector = class { filters: { pos_profile: doc ? doc.pos_profile : '' } - } + }; }, }, parent: this.$component.find('.item-group-field'), @@ -176,7 +178,7 @@ erpnext.PointOfSale.ItemSelector = class { uom = uom === "undefined" ? undefined : uom; me.events.item_selected({ field: 'qty', value: "+1", item: { item_code, batch_no, serial_no, uom }}); - }) + }); this.search_field.$input.on('input', (e) => { clearTimeout(this.last_search); @@ -247,6 +249,7 @@ erpnext.PointOfSale.ItemSelector = class { this.get_items({ search_value: search_term }) .then(({ message }) => { + // eslint-disable-next-line no-unused-vars const { items, serial_no, batch_no, barcode } = message; if (search_term && !barcode) { this.search_index[search_term] = items; @@ -260,26 +263,26 @@ erpnext.PointOfSale.ItemSelector = class { add_filtered_item_to_cart() { this.$items_container.find(".item-wrapper").click(); } - + resize_selector(minimize) { minimize ? - this.$component.find('.filter-section').css('grid-template-columns', 'repeat(1, minmax(0, 1fr))') : - this.$component.find('.filter-section').css('grid-template-columns', 'repeat(12, minmax(0, 1fr))'); + this.$component.find('.filter-section').css('grid-template-columns', 'repeat(1, minmax(0, 1fr))') : + this.$component.find('.filter-section').css('grid-template-columns', 'repeat(12, minmax(0, 1fr))'); minimize ? - this.$component.find('.search-field').css('margin', 'var(--margin-sm) 0px') : - this.$component.find('.search-field').css('margin', '0px var(--margin-sm)'); + this.$component.find('.search-field').css('margin', 'var(--margin-sm) 0px') : + this.$component.find('.search-field').css('margin', '0px var(--margin-sm)'); minimize ? - this.$component.css('grid-column', 'span 2 / span 2') : - this.$component.css('grid-column', 'span 6 / span 6') + this.$component.css('grid-column', 'span 2 / span 2') : + this.$component.css('grid-column', 'span 6 / span 6'); minimize ? - this.$items_container.css('grid-template-columns', 'repeat(1, minmax(0, 1fr))') : - this.$items_container.css('grid-template-columns', 'repeat(4, minmax(0, 1fr))') + this.$items_container.css('grid-template-columns', 'repeat(1, minmax(0, 1fr))') : + this.$items_container.css('grid-template-columns', 'repeat(4, minmax(0, 1fr))'); } toggle_component(show) { show ? this.$component.css('display', 'flex') : this.$component.css('display', 'none'); } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js index 79eaf05cb2..be2b769a8a 100644 --- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js +++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js @@ -48,7 +48,7 @@ erpnext.PointOfSale.PastOrderSummary = class { const email_dialog = new frappe.ui.Dialog({ title: 'Email Receipt', fields: [ - {fieldname:'email_id', fieldtype:'Data', options: 'Email', label:'Email ID'}, + {fieldname: 'email_id', fieldtype: 'Data', options: 'Email', label: 'Email ID'}, // {fieldname:'remarks', fieldtype:'Text', label:'Remarks (if any)'} ], primary_action: () => { @@ -61,7 +61,7 @@ erpnext.PointOfSale.PastOrderSummary = class { const print_dialog = new frappe.ui.Dialog({ title: 'Print Receipt', fields: [ - {fieldname:'print', fieldtype:'Data', label:'Print Preview'} + {fieldname: 'print', fieldtype: 'Data', label: 'Print Preview'} ], primary_action: () => { const frm = this.events.get_frm(); @@ -132,18 +132,17 @@ erpnext.PointOfSale.PastOrderSummary = class { get_taxes_html(doc) { if (!doc.taxes.length) return ''; - return ` -
- ${ - doc.taxes.map((t, i) => { - const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`; - return `
-
${description}
-
${format_currency(t.tax_amount_after_discount_amount, doc.currency)}
-
` - }).join('') - } -
`; + let taxes_html = doc.taxes.map(t => { + const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`; + return ` +
+
${description}
+
${format_currency(t.tax_amount_after_discount_amount, doc.currency)}
+
+ `; + }).join(''); + + return `
${taxes_html}
`; } get_grand_total_html(doc) { @@ -178,9 +177,6 @@ erpnext.PointOfSale.PastOrderSummary = class { this.$summary_container.on('click', '.delete-btn', () => { this.events.delete_order(this.doc.name); this.show_summary_placeholder(); - // this.toggle_component(false); - // this.$component.find('.no-summary-placeholder').removeClass('d-none'); - // this.$summary_wrapper.addClass('d-none'); }); this.$summary_container.on('click', '.new-btn', () => { @@ -237,7 +233,7 @@ erpnext.PointOfSale.PastOrderSummary = class { const print_format = frm.pos_print_format; frappe.call({ - method:"frappe.core.doctype.communication.email.make", + method: "frappe.core.doctype.communication.email.make", args: { recipients: recipients, subject: __(frm.meta.name) + ': ' + doc.name, @@ -246,14 +242,14 @@ erpnext.PointOfSale.PastOrderSummary = class { send_email: 1, print_format, sender_full_name: frappe.user.full_name(), - _lang : doc.language + _lang: doc.language }, callback: r => { - if(!r.exc) { + if (!r.exc) { frappe.utils.play_sound("email"); - if(r.message["emails_not_sent_to"]) { + if (r.message["emails_not_sent_to"]) { frappe.msgprint(__( - "Email not sent to {0} (unsubscribed / disabled)", + "Email not sent to {0} (unsubscribed / disabled)", [ frappe.utils.escape_html(r.message["emails_not_sent_to"]) ] )); } else { @@ -309,10 +305,10 @@ erpnext.PointOfSale.PastOrderSummary = class { load_summary_of(doc, after_submission=false) { after_submission ? this.$component.css('grid-column', 'span 10 / span 10') : - this.$component.css('grid-column', 'span 6 / span 6') - - this.toggle_summary_placeholder(false) - + this.$component.css('grid-column', 'span 6 / span 6'); + + this.toggle_summary_placeholder(false); + this.doc = doc; this.attach_document_info(doc); @@ -338,7 +334,7 @@ erpnext.PointOfSale.PastOrderSummary = class { attach_items_info(doc) { this.$items_container.html(''); - doc.items.forEach((item, i) => { + doc.items.forEach(item => { const item_dom = this.get_item_html(doc, item); this.$items_container.append(item_dom); this.set_dynamic_rate_header_width();