diff --git a/posnext/public/js/pos_item_cart.js b/posnext/public/js/pos_item_cart.js index 0fd1799..3a7cbdf 100644 --- a/posnext/public/js/pos_item_cart.js +++ b/posnext/public/js/pos_item_cart.js @@ -22,7 +22,7 @@ posnext.PointOfSale.ItemCart = class { this.custom_show_uom_in_cart = settings.custom_show_uom_in_cart && settings.custom_edit_rate_and_uom; this.show_branch = settings.show_branch; this.show_batch_in_cart = settings.show_batch_in_cart - this.show_item_description = settings.custom_show_item_discription; + this.custom_show_item_discription = settings.custom_show_item_discription; // this.custom_edit_uom = settings.custom_edit_uom; this.settings = settings; this.warehouse = settings.warehouse; @@ -946,7 +946,7 @@ this.highlight_checkout_btn(true); this.update_empty_cart_section(no_of_cart_items); } - async render_cart_item(item_data, $item_to_update) { + render_cart_item(item_data, $item_to_update) { const currency = this.events.get_frm().doc.currency; const me = this; @@ -975,7 +975,7 @@ this.highlight_checkout_btn(true); item_html += `
${item_data.item_name}
- ${ await get_description_html()} + ${ get_description_html(item_data) } ${get_rate_discount_html()}` @@ -1291,22 +1291,17 @@ this.highlight_checkout_btn(true); } - async function get_description_html() { - var posname = me.settings.name - const response =await frappe.call({ - method: 'frappe.client.get_value', - args: { - doctype: 'POS Profile', - filters: { name: posname }, - fieldname: 'custom_show_item_discription' - } - }); - if (item_data.description && response.message.custom_show_item_discription==1) { + function get_description_html(item_data) { + const hide_description = me.custom_show_item_discription; + if (hide_description) { if (item_data.description.indexOf('
') != -1) { try { item_data.description = $(item_data.description).text(); } catch (error) { - item_data.description = item_data.description.replace(/
/g, ' ').replace(/<\/div>/g, ' ').replace(/ +/g, ' '); + item_data.description = item_data.description + .replace(/
/g, ' ') + .replace(/<\/div>/g, ' ') + .replace(/ +/g, ' '); } } item_data.description = frappe.ellipsis(item_data.description, 45); diff --git a/posnext/public/js/pos_item_selector.js b/posnext/public/js/pos_item_selector.js index 743f029..7a1a71e 100644 --- a/posnext/public/js/pos_item_selector.js +++ b/posnext/public/js/pos_item_selector.js @@ -30,6 +30,7 @@ posnext.PointOfSale.ItemSelector = class { this.show_only_card_view = settings.custom_show_only_card_view this.custom_edit_rate = settings.custom_edit_rate_and_uom this.custom_show_incoming_rate = settings.custom_show_incoming_rate && settings.custom_edit_rate_and_uom; + this.custom_show_item_discription = settings.custom_show_item_discription; // this.custom_edit_uom = settings.custom_edit_uom this.inti_component(); } @@ -304,7 +305,7 @@ posnext.PointOfSale.ItemSelector = class { const item_selector = `.cart-item-wrapper[data-row-name="${escape(item_code)}"]`; return this.$cart_items_wrapper.find(item_selector); } - async render_cart_item(item_data) { + render_cart_item(item_data) { const me = this; const currency = me.events.get_frm().currency || me.currency; this.$cart_items_wrapper.append( @@ -329,7 +330,7 @@ posnext.PointOfSale.ItemSelector = class {
${item_data.item_name}
- ${await get_description_html(item_data)} + ${get_description_html(item_data)}
${get_item_code()} ${get_rate_discount_html()}` @@ -430,18 +431,9 @@ posnext.PointOfSale.ItemSelector = class { } } - async function get_description_html(item_data) { - var posname = me.pos_profile - console.log(me.pos_profile) - const response = await frappe.call({ - method: 'frappe.client.get_value', - args: { - doctype: 'POS Profile', - filters: { name: posname }, - fieldname: 'custom_show_item_discription' - } - }); - if (item_data.description && response.message.custom_show_item_discription==1) { + function get_description_html(item_data) { + + if (me.custom_show_item_discription) { if (item_data.description.indexOf('
') != -1) { try { item_data.description = $(item_data.description).text();