From e30f83a8afe06b389cbb2854c2fb5f37a623c0df Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 24 Feb 2017 18:02:50 +0530 Subject: [PATCH] [Enhancement] POS, numeric keypad --- erpnext/accounts/page/pos/pos.js | 25 ++++++++++++++ erpnext/public/build.json | 1 + erpnext/public/css/erpnext.css | 31 ++++++++++++++--- erpnext/public/js/pos/pos.html | 35 ++++++++++++++++---- erpnext/public/js/pos/pos_selected_item.html | 27 +++++++++++++++ erpnext/public/less/erpnext.less | 34 ++++++++++++++++--- 6 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 erpnext/public/js/pos/pos_selected_item.html diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js index ed54ab400e..961b2a112c 100644 --- a/erpnext/accounts/page/pos/pos.js +++ b/erpnext/accounts/page/pos/pos.js @@ -374,6 +374,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.add_customer_btn = this.wrapper.find('.add-customer-btn'); this.pos_bill = this.wrapper.find('.pos-bill').hide(); this.list_customers = this.wrapper.find('.list-customers'); + this.numeric_keypad = this.wrapper.find('.numeric_keypad'); this.list_customers_btn.on('click', function () { $(this).toggleClass("view_customer"); @@ -383,12 +384,16 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ me.party_field.$input.attr('disabled', true); me.list_customers.show(); me.pos_bill.hide(); + me.numeric_keypad.hide(); } else { if(me.frm.doc.docstatus == 0) { me.party_field.$input.attr('disabled', false); } me.pos_bill.show(); me.list_customers.hide() + if(me.frm.doc.items.length > 0) { + me.numeric_keypad.show(); + } } }); this.add_customer_btn.on('click', function() { @@ -662,6 +667,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.frm.doc.customer_group = doc.customer_group; this.frm.doc.territory = doc.territory; this.pos_bill.show(); + this.numeric_keypad.show(); }, get_customers: function (key) { @@ -835,12 +841,29 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ update_rate: function () { var me = this; + + $(this.wrapper).find(".pos-bill-item").click(function() { + var item_code = $(this).attr("data-item-code"); + doc = me.get_child_item(item_code); + html_data = frappe.render_template("pos_selected_item", doc[0]) + $(me.wrapper).find('.selected-item').html(html_data) + me.bind_qty_event() + }) $(this.wrapper).find(".pos-item-rate").on("change", function () { var item_code = $(this).parents(".pos-bill-item").attr("data-item-code"); me.set_item_details(item_code, "rate", $(this).val()); }) }, + + get_child_item: function(item_code) { + var me = this; + return $.map(me.frm.doc.items, function(doc){ + if(doc.item_code == item_code) { + return doc + } + }) + }, set_item_details: function (item_code, field, value) { var me = this; @@ -950,6 +973,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.add_new_item_to_grid(); this.update_paid_amount_status(false) + this.wrapper.find(".item-cart").scrollTop(1000); }, add_new_item_to_grid: function () { @@ -959,6 +983,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({ this.child.item_name = this.items[0].item_name; this.child.stock_uom = this.items[0].stock_uom; this.child.description = this.items[0].description; + this.child.discount_percentage = 0.0; this.child.qty = 1; this.child.item_group = this.items[0].item_group; this.child.cost_center = this.pos_profile_data['cost_center'] || this.items[0].cost_center; diff --git a/erpnext/public/build.json b/erpnext/public/build.json index c4056813b6..858514edfe 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -20,6 +20,7 @@ "public/js/controllers/transaction.js", "public/js/pos/pos.html", "public/js/pos/pos_bill_item.html", + "public/js/pos/pos_selected_item.html", "public/js/pos/pos_item.html", "public/js/pos/pos_tax_row.html", "public/js/pos/pos_invoice_list.html", diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index cfe9f63ac8..b1f1985fd3 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -59,7 +59,8 @@ padding: 10px 0px; border-bottom: 1px solid #d1d8dd; } -.item-list-area { +.item-list-area, +.list-customers { padding: 15px 0px; overflow-y: scroll; height: calc(100vh - 162px); @@ -82,6 +83,19 @@ margin-left: -15px; margin-right: -15px; } +.item-cart { + overflow-y: scroll; + height: calc(100vh - 60vh); +} +.edit-pos-item { + height: 40px; + font-size: 14px; + border-top: 1px solid #d1d8dd; +} +.pos-bill-item:hover { + background-color: #f5f7fa; + cursor: pointer; +} .pos-bill-row { margin: 0px; padding: 7px 0px; @@ -157,13 +171,20 @@ .pos-keyboard-key, .delete-btn { border: 1px solid #d1d8dd; - height: 85px; - width: 85px; - margin: 10px 10px; - font-size: 24px; + height: 69px; + width: 69px; + font-size: 20px; font-weight: 200; background-color: #FDFDFD; border-color: #e8e8e8; + margin-left: -4px; +} +.pos-pay { + height: 69px; + width: 69px; + font-size: 17px; + font-weight: 200; + margin-left: -4px; } .multimode-payments { padding-left: 30px; diff --git a/erpnext/public/js/pos/pos.html b/erpnext/public/js/pos/pos.html index 44e42d79b1..c6341353fa 100644 --- a/erpnext/public/js/pos/pos.html +++ b/erpnext/public/js/pos/pos.html @@ -17,12 +17,12 @@
-
+
@@ -54,15 +54,38 @@
{% } %} -
+
{%= __("Grand Total") %}
-
+ + +
+
+ +
+ +
@@ -77,10 +100,10 @@
-
+
diff --git a/erpnext/public/js/pos/pos_selected_item.html b/erpnext/public/js/pos/pos_selected_item.html new file mode 100644 index 0000000000..491938e5c8 --- /dev/null +++ b/erpnext/public/js/pos/pos_selected_item.html @@ -0,0 +1,27 @@ +
Item {%= item_name %}
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
\ No newline at end of file diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less index 495e618f7e..34ea901650 100644 --- a/erpnext/public/less/erpnext.less +++ b/erpnext/public/less/erpnext.less @@ -74,7 +74,7 @@ border-bottom: 1px solid #d1d8dd; } -.item-list-area { +.item-list-area, .list-customers { padding: 15px 0px; overflow-y: scroll; height: ~"calc(100vh - 162px)"; @@ -102,6 +102,22 @@ margin-right: -15px; } +.item-cart { + overflow-y: scroll; + height: ~"calc(100vh - 60vh)"; +} + +.edit-pos-item { + height: 40px; + font-size: 14px; + border-top: 1px solid @border-color; +} + +.pos-bill-item:hover { + background-color: #f5f7fa; + cursor: pointer; +} + .pos-bill-row { margin: 0px; padding: 7px 0px; @@ -197,13 +213,21 @@ .pos-keyboard-key, .delete-btn { border: 1px solid #d1d8dd; - height:85px; - width:85px; - margin:10px 10px; - font-size:24px; + height:69px; + width:69px; + font-size:20px; font-weight:200; background-color: #FDFDFD; border-color: #e8e8e8; + margin-left:-4px; +} + +.pos-pay { + height:69px; + width:69px; + font-size:17px; + font-weight:200; + margin-left:-4px; } .multimode-payments {