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
56 changes: 56 additions & 0 deletions posnext/fixtures/custom_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 15 additions & 5 deletions posnext/public/js/pos_item_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = $('<div class="branch-field"></div>');
$wrapper.replaceWith(branchFieldWrapper);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -1000,7 +1000,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>
${get_description_html()}
${ await get_description_html()}
</div>
${get_rate_discount_html()}`

Expand Down Expand Up @@ -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(`<div class="item-desc">${item_data.description}</div>`)
if (item_data.description.indexOf('<div>') != -1) {
try {
item_data.description = $(item_data.description).text();
Expand Down
31 changes: 14 additions & 17 deletions posnext/public/js/pos_item_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -324,15 +322,14 @@ posnext.PointOfSale.ItemSelector = class {
<div class="seperator"></div>`
)
var $item_to_update = this.get_cart_item1(item_data);

$item_to_update.html(
`${get_item_image_html()}
${get_item_name()}

<div style="overflow-wrap: break-word;overflow:hidden;white-space: normal;font-weight: 700;margin-right: 10px">
${item_data.item_name}
</div>
${get_description_html()}
${await get_description_html(item_data)}
</div>
${get_item_code()}
${get_rate_discount_html()}`
Expand Down Expand Up @@ -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('<div>') != -1) {
try {
item_data.description = $(item_data.description).text();
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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'));
Expand Down
Loading