Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions posnext/public/js/pos_item_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -975,7 +975,7 @@ this.highlight_checkout_btn(true);
item_html += `<div class="item-name" style="flex: 4; white-space: normal; word-wrap: break-word; overflow: visible; line-height: 1.2;">
${item_data.item_name}
</div>
${ await get_description_html()}
${ get_description_html(item_data) }
</div>
${get_rate_discount_html()}`

Expand Down Expand Up @@ -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('<div>') != -1) {
try {
item_data.description = $(item_data.description).text();
} catch (error) {
item_data.description = item_data.description.replace(/<div>/g, ' ').replace(/<\/div>/g, ' ').replace(/ +/g, ' ');
item_data.description = item_data.description
.replace(/<div>/g, ' ')
.replace(/<\/div>/g, ' ')
.replace(/ +/g, ' ');
}
}
item_data.description = frappe.ellipsis(item_data.description, 45);
Expand Down
20 changes: 6 additions & 14 deletions posnext/public/js/pos_item_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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(
Expand All @@ -329,7 +330,7 @@ posnext.PointOfSale.ItemSelector = class {
<div style="overflow-wrap: break-word;overflow:hidden;white-space: normal;font-weight: 700;margin-right: 10px">
${item_data.item_name}
</div>
${await get_description_html(item_data)}
${get_description_html(item_data)}
</div>
${get_item_code()}
${get_rate_discount_html()}`
Expand Down Expand Up @@ -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('<div>') != -1) {
try {
item_data.description = $(item_data.description).text();
Expand Down
Loading