Merge branch 'rebrand-ui' of https://github.com/frappe/erpnext into rebrand-ui
This commit is contained in:
commit
ba54c4f1b3
@ -1,6 +1,7 @@
|
||||
import onScan from 'onscan.js';
|
||||
|
||||
erpnext.PointOfSale.ItemSelector = class {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
constructor({ frm, wrapper, events, pos_profile, settings }) {
|
||||
this.wrapper = wrapper;
|
||||
this.events = events;
|
||||
@ -39,7 +40,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
if (!this.item_group) {
|
||||
const res = await frappe.db.get_value("Item Group", {lft: 1, is_group: 1}, "name");
|
||||
this.parent_item_group = res.message.name;
|
||||
};
|
||||
}
|
||||
if (!this.price_list) {
|
||||
const res = await frappe.db.get_value("POS Profile", this.pos_profile, "selling_price_list");
|
||||
this.price_list = res.message.selling_price_list;
|
||||
@ -71,11 +72,12 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
items.forEach(item => {
|
||||
const item_html = this.get_item_html(item);
|
||||
this.$items_container.append(item_html);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
get_item_html(item) {
|
||||
const me = this;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { item_image, serial_no, batch_no, barcode, actual_qty, stock_uom } = item;
|
||||
const indicator_color = actual_qty > 10 ? "green" : actual_qty <= 0 ? "red" : "orange";
|
||||
|
||||
@ -83,7 +85,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
if (!me.hide_images && item_image) {
|
||||
return `<div class="flex items-center justify-center h-32 border-b-grey text-6xl text-grey-100">
|
||||
<img class="h-full" src="${item_image}" alt="${frappe.get_abbr(item.item_name)}" style="object-fit: cover;">
|
||||
</div>`
|
||||
</div>`;
|
||||
} else {
|
||||
return `<div class="item-display abbr">${frappe.get_abbr(item.item_name)}</div>`;
|
||||
}
|
||||
@ -105,7 +107,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
<div class="item-rate">${format_currency(item.price_list_rate, item.currency, 0) || 0}</div>
|
||||
</div>
|
||||
</div>`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
make_search_bar() {
|
||||
@ -140,7 +142,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
filters: {
|
||||
pos_profile: doc ? doc.pos_profile : ''
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
parent: this.$component.find('.item-group-field'),
|
||||
@ -176,7 +178,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
uom = uom === "undefined" ? undefined : uom;
|
||||
|
||||
me.events.item_selected({ field: 'qty', value: "+1", item: { item_code, batch_no, serial_no, uom }});
|
||||
})
|
||||
});
|
||||
|
||||
this.search_field.$input.on('input', (e) => {
|
||||
clearTimeout(this.last_search);
|
||||
@ -247,6 +249,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
|
||||
this.get_items({ search_value: search_term })
|
||||
.then(({ message }) => {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { items, serial_no, batch_no, barcode } = message;
|
||||
if (search_term && !barcode) {
|
||||
this.search_index[search_term] = items;
|
||||
@ -272,14 +275,14 @@ erpnext.PointOfSale.ItemSelector = class {
|
||||
|
||||
minimize ?
|
||||
this.$component.css('grid-column', 'span 2 / span 2') :
|
||||
this.$component.css('grid-column', 'span 6 / span 6')
|
||||
this.$component.css('grid-column', 'span 6 / span 6');
|
||||
|
||||
minimize ?
|
||||
this.$items_container.css('grid-template-columns', 'repeat(1, minmax(0, 1fr))') :
|
||||
this.$items_container.css('grid-template-columns', 'repeat(4, minmax(0, 1fr))')
|
||||
this.$items_container.css('grid-template-columns', 'repeat(4, minmax(0, 1fr))');
|
||||
}
|
||||
|
||||
toggle_component(show) {
|
||||
show ? this.$component.css('display', 'flex') : this.$component.css('display', 'none');
|
||||
}
|
||||
}
|
||||
};
|
@ -132,18 +132,17 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
||||
get_taxes_html(doc) {
|
||||
if (!doc.taxes.length) return '';
|
||||
|
||||
return `
|
||||
<div class="taxes-wrapper">
|
||||
${
|
||||
doc.taxes.map((t, i) => {
|
||||
let taxes_html = doc.taxes.map(t => {
|
||||
const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`;
|
||||
return `<div class="tax-row">
|
||||
return `
|
||||
<div class="tax-row">
|
||||
<div class="tax-label">${description}</div>
|
||||
<div class="tax-value">${format_currency(t.tax_amount_after_discount_amount, doc.currency)}</div>
|
||||
</div>`
|
||||
}).join('')
|
||||
}
|
||||
</div>`;
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
return `<div class="taxes-wrapper">${taxes_html}</div>`;
|
||||
}
|
||||
|
||||
get_grand_total_html(doc) {
|
||||
@ -178,9 +177,6 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
||||
this.$summary_container.on('click', '.delete-btn', () => {
|
||||
this.events.delete_order(this.doc.name);
|
||||
this.show_summary_placeholder();
|
||||
// this.toggle_component(false);
|
||||
// this.$component.find('.no-summary-placeholder').removeClass('d-none');
|
||||
// this.$summary_wrapper.addClass('d-none');
|
||||
});
|
||||
|
||||
this.$summary_container.on('click', '.new-btn', () => {
|
||||
@ -309,9 +305,9 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
||||
load_summary_of(doc, after_submission=false) {
|
||||
after_submission ?
|
||||
this.$component.css('grid-column', 'span 10 / span 10') :
|
||||
this.$component.css('grid-column', 'span 6 / span 6')
|
||||
this.$component.css('grid-column', 'span 6 / span 6');
|
||||
|
||||
this.toggle_summary_placeholder(false)
|
||||
this.toggle_summary_placeholder(false);
|
||||
|
||||
this.doc = doc;
|
||||
|
||||
@ -338,7 +334,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
||||
|
||||
attach_items_info(doc) {
|
||||
this.$items_container.html('');
|
||||
doc.items.forEach((item, i) => {
|
||||
doc.items.forEach(item => {
|
||||
const item_dom = this.get_item_html(doc, item);
|
||||
this.$items_container.append(item_dom);
|
||||
this.set_dynamic_rate_header_width();
|
||||
|
Loading…
x
Reference in New Issue
Block a user