diff --git a/posnext/fixtures/custom_field.json b/posnext/fixtures/custom_field.json index c04e8bf..a1750fb 100644 --- a/posnext/fixtures/custom_field.json +++ b/posnext/fixtures/custom_field.json @@ -1455,6 +1455,62 @@ "unique": 0, "width": null }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "POS Profile", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_show_item_discription", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "custom_show_incoming_rate", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Show Item Discription", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2025-05-06 23:01:00.706600", + "module": "Posnext", + "name": "POS Profile-custom_show_item_discription", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, { "allow_in_quick_entry": 0, "allow_on_submit": 0, diff --git a/posnext/public/js/pos_item_cart.js b/posnext/public/js/pos_item_cart.js index 1cf784c..0bef29d 100644 --- a/posnext/public/js/pos_item_cart.js +++ b/posnext/public/js/pos_item_cart.js @@ -22,6 +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_edit_uom = settings.custom_edit_uom; this.settings = settings; this.warehouse = settings.warehouse; @@ -525,7 +526,6 @@ this.highlight_checkout_btn(true); this.$component.on('click', '.add-branch-wrapper', function () { const $wrapper = $(this); const posProfileName = me.settings.name; - console.log("POS Profile:", posProfileName); const branchFieldWrapper = $('
'); $wrapper.replaceWith(branchFieldWrapper); @@ -971,7 +971,7 @@ this.highlight_checkout_btn(true); this.update_empty_cart_section(no_of_cart_items); } - render_cart_item(item_data, $item_to_update) { + async render_cart_item(item_data, $item_to_update) { const currency = this.events.get_frm().doc.currency; const me = this; @@ -1000,7 +1000,7 @@ this.highlight_checkout_btn(true); item_html += `
${item_data.item_name}
- ${get_description_html()} + ${ await get_description_html()} ${get_rate_discount_html()}` @@ -1316,8 +1316,18 @@ this.highlight_checkout_btn(true); } - function get_description_html() { - if (item_data.description) { + 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) { + console.log(`
${item_data.description}
`) if (item_data.description.indexOf('
') != -1) { try { item_data.description = $(item_data.description).text(); diff --git a/posnext/public/js/pos_item_selector.js b/posnext/public/js/pos_item_selector.js index cd5f8d2..743f029 100644 --- a/posnext/public/js/pos_item_selector.js +++ b/posnext/public/js/pos_item_selector.js @@ -304,9 +304,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); } - render_cart_item(item_data) { - console.log("Rener cart item") - console.log(item_data) + async render_cart_item(item_data) { const me = this; const currency = me.events.get_frm().currency || me.currency; this.$cart_items_wrapper.append( @@ -324,7 +322,6 @@ posnext.PointOfSale.ItemSelector = class {
` ) var $item_to_update = this.get_cart_item1(item_data); - $item_to_update.html( `${get_item_image_html()} ${get_item_name()} @@ -332,7 +329,7 @@ posnext.PointOfSale.ItemSelector = class {
${item_data.item_name}
- ${get_description_html()} + ${await get_description_html(item_data)}
${get_item_code()} ${get_rate_discount_html()}` @@ -433,8 +430,18 @@ posnext.PointOfSale.ItemSelector = class { } } - function get_description_html() { - if (item_data.description) { + 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) { if (item_data.description.indexOf('
') != -1) { try { item_data.description = $(item_data.description).text(); @@ -554,15 +561,6 @@ posnext.PointOfSale.ItemSelector = class { frappe.pages['posnext'].refresh(window.wrapper,window.onScan,this.value) } - // console.log("ON ON CHANGE") - // console.log(this.pos_profile_field) - // var value = this.pos_profile_field.get_value() - // if(value !== me.pos_profile){ - // this.events.check_opening_entry() - // } - // window.wrapper.please_refresh = true - // frappe.pages['posnext'].refresh_data(window.wrapper) - // console.log("HEEEERE") } }, parent: this.$component.find('.pos-profile'), @@ -718,7 +716,6 @@ posnext.PointOfSale.ItemSelector = class { this.$component.on('click', '.item-wrapper', function() { - console.log("Item Selected") const $item = $(this); const item_code = unescape($item.attr('data-item-code')); let batch_no = unescape($item.attr('data-batch-no'));