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 d806c628ff50639f9b0665fe51d32507edc15dfe..a446b74c69ee43b7d0c3cdc7d9db53659c7e3ad9 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -279,16 +279,21 @@ erpnext.PointOfSale.ItemCart = class { } toggle_item_highlight(item) { + // @dokos const $cart_item = $(item); - const item_is_highlighted = $cart_item.attr("style") == "background-color:var(--gray-50);"; - + const item_is_highlighted = !this.$numpad_section.is(":visible"); + this.$cart_container.find(".cart-item-wrapper").css({ + "background-color": "", + "box-shadow": "", + }); if (!item || item_is_highlighted) { this.item_is_selected = false; - this.$cart_container.find('.cart-item-wrapper').css("background-color", ""); } else { - $cart_item.css("background-color", "var(--control-bg)"); this.item_is_selected = true; - this.$cart_container.find('.cart-item-wrapper').not(item).css("background-color", ""); + $cart_item.css({ + "background-color": "var(--alert-bg-info)", + "box-shadow": "inset 0px 0px 0px 2px var(--alert-text-info)", + }); } } @@ -803,6 +808,7 @@ erpnext.PointOfSale.ItemCart = class { } else { this.$totals_section.css('display', 'flex'); this.$numpad_section.css('display', 'none'); + this.toggle_item_highlight(); } this.reset_numpad(); } diff --git a/erpnext/selling/page/point_of_sale/pos_item_details.js b/erpnext/selling/page/point_of_sale/pos_item_details.js index 453aff1395f05c94a1f635dd439f0afc0cc5f99f..2fa6d4c4dad71ee62af36083330ab69b49556562 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_details.js +++ b/erpnext/selling/page/point_of_sale/pos_item_details.js @@ -236,8 +236,9 @@ erpnext.PointOfSale.ItemDetails = class { if (this.value) { me.events.form_updated(me.current_item, 'warehouse', this.value).then(() => { me.item_stock_map = me.events.get_item_stock_map(); - const available_qty = me.item_stock_map[me.item_row.item_code][this.value][0]; - const is_stock_item = Boolean(me.item_stock_map[me.item_row.item_code][this.value][1]); + const stock_map = me.item_stock_map[me.item_row.item_code][this.value]; + const available_qty = stock_map?.[0]; + const is_stock_item = Boolean(stock_map?.[1]); if (available_qty === undefined) { me.events.get_available_stock(me.item_row.item_code, this.value).then(() => { // item stock map is updated now reset warehouse 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 c552333829738aefa6107c467c77cfdcb4de5eca..eff22e8a9c5d5f6948101a56a10802c5ee8163cd 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_selector.js +++ b/erpnext/selling/page/point_of_sale/pos_item_selector.js @@ -52,6 +52,7 @@ erpnext.PointOfSale.ItemSelector = class { } get_items({start = 0, page_length = 40, search_term=''}) { + if (this.page_length) { page_length = this.page_length; } const doc = this.events.get_frm().doc; const price_list = (doc && doc.selling_price_list) || this.price_list; let { item_group, pos_profile } = this; @@ -65,14 +66,28 @@ erpnext.PointOfSale.ItemSelector = class { }); } + render_item_list(items, append = false) { + if (!append) { + this.$items_container.html(''); + } - render_item_list(items) { - this.$items_container.html(''); - - items.forEach(item => { + items?.forEach(item => { const item_html = this.get_item_html(item); this.$items_container.append(item_html); }); + + if (items?.length >= (this.page_length || 40)) { + // @dokos + const $load_more_btn = $('