fix(pos): broken image in item details section
This commit is contained in:
parent
bc46a9772d
commit
3f32969bee
@ -133,13 +133,24 @@ erpnext.PointOfSale.ItemDetails = class {
|
|||||||
this.$item_description.html(get_description_html());
|
this.$item_description.html(get_description_html());
|
||||||
this.$item_price.html(format_currency(price_list_rate, this.currency));
|
this.$item_price.html(format_currency(price_list_rate, this.currency));
|
||||||
if (image) {
|
if (image) {
|
||||||
this.$item_image.html(`<img src="${image}" alt="${image}">`);
|
this.$item_image.html(
|
||||||
|
`<img
|
||||||
|
onerror="cur_pos.item_details.handle_broken_image(this)"
|
||||||
|
class="h-full" src="${image}"
|
||||||
|
alt="${frappe.get_abbr(item_name)}"
|
||||||
|
style="object-fit: cover;">`
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.$item_image.html(`<div class="item-abbr">${frappe.get_abbr(item_name)}</div>`);
|
this.$item_image.html(`<div class="item-abbr">${frappe.get_abbr(item_name)}</div>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_broken_image($img) {
|
||||||
|
const item_abbr = $($img).attr('alt');
|
||||||
|
$($img).replaceWith(`<div class="item-abbr">${item_abbr}</div>`);
|
||||||
|
}
|
||||||
|
|
||||||
render_discount_dom(item) {
|
render_discount_dom(item) {
|
||||||
if (item.discount_percentage) {
|
if (item.discount_percentage) {
|
||||||
this.$dicount_section.html(
|
this.$dicount_section.html(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user