[Enhancement] POS Redesign (#7639)

* item group, discount

* POS Redesign

* offline customer

* removed offline records from modal view
This commit is contained in:
rohitwaghchaure 2017-02-01 18:07:22 +05:30 committed by Rushabh Mehta
parent 929c3890a4
commit c13dbd408f
10 changed files with 658 additions and 392 deletions

View File

@ -30,6 +30,7 @@ def get_pos_data():
'doc': doc,
'default_customer': pos_profile.get('customer'),
'items': get_items_list(pos_profile),
'item_groups': get_item_group(pos_profile),
'customers': get_customers_list(pos_profile),
'serial_no_data': get_serial_no_data(pos_profile, doc.company),
'batch_no_data': get_batch_no_data(),
@ -140,6 +141,15 @@ def get_items_list(pos_profile):
disabled = 0 and has_variants = 0 and is_sales_item = 1 and {cond}
""".format(cond=cond), tuple(item_groups), as_dict=1)
def get_item_group(pos_profile):
if pos_profile.get('item_groups'):
item_groups = []
for d in pos_profile.get('item_groups'):
item_groups.extend(get_child_nodes('Item Group', d.item_group))
return item_groups
else:
return frappe.db.sql_list("""Select name from `tabItem Group` order by name""")
def get_customers_list(pos_profile):
cond = "1=1"
customer_groups = []
@ -276,11 +286,32 @@ def validate_customer(doc):
customer_doc = frappe.new_doc('Customer')
customer_doc.customer_name = doc.get('customer')
customer_doc.customer_type = 'Company'
customer_doc.customer_group = doc.get('customer_group')
customer_doc.territory = doc.get('territory')
customer_doc.customer_group = frappe.db.get_single_value('Selling Settings', 'customer_group')
customer_doc.territory = frappe.db.get_single_value('Selling Settings', 'territory')
customer_doc.flags.ignore_mandatory = True
customer_doc.save(ignore_permissions = True)
frappe.db.commit()
doc['customer'] = customer_doc.name
if doc.get('contact_details'):
args = json.loads(doc.get("contact_details"))
make_address(doc, args, customer_doc.name)
def make_address(doc, args, customer):
if args.get("address_line1"):
address = frappe.new_doc('Address')
address.address_line1 = args.get('address_line1')
address.address_line2 = args.get('address_line2')
address.city = args.get('city')
address.state = args.get('state')
address.zip_code = args.get('zip_code')
address.email_id = args.get('email_id')
address.flags.ignore_mandatory = True
address.country = frappe.db.get_value('Company', doc.get('company'), 'country')
address.append('links',{
'link_doctype': 'Customer',
'link_name': customer
})
address.save(ignore_permissions = True)
def validate_item(doc):
for item in doc.get('items'):

View File

@ -28,7 +28,7 @@
"label": "",
"length": 0,
"no_copy": 0,
"options": "fa fa-user",
"options": "icon-user",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -232,7 +232,7 @@
"in_standard_filter": 0,
"label": "Offline POS Name",
"length": 0,
"no_copy": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -1035,7 +1035,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-shopping-cart",
"options": "icon-shopping-cart",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -1122,7 +1122,7 @@
"label": "Packing List",
"length": 0,
"no_copy": 0,
"options": "fa fa-suitcase",
"options": "icon-suitcase",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -1462,7 +1462,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-money",
"options": "icon-money",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -1941,7 +1941,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-money",
"options": "icon-money",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -2238,7 +2238,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-money",
"options": "icon-money",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -2327,7 +2327,7 @@
"label": "Payments",
"length": 0,
"no_copy": 0,
"options": "fa fa-money",
"options": "icon-money",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -3252,7 +3252,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-file-text",
"options": "icon-file-text",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -3515,7 +3515,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-group",
"options": "icon-group",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -3720,7 +3720,7 @@
"label": "Recurring",
"length": 0,
"no_copy": 0,
"options": "fa fa-time",
"options": "icon-time",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -4173,7 +4173,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-file-text",
"icon": "icon-file-text",
"idx": 181,
"image_view": 0,
"in_create": 0,
@ -4282,5 +4282,6 @@
"sort_order": "DESC",
"timeline_field": "customer",
"title_field": "title",
"track_changes": 1,
"track_seen": 0
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 99 KiB

View File

@ -67,7 +67,6 @@
.pos-toolbar,
.pos-bill-toolbar {
padding: 10px 0px;
border-bottom: 1px solid #d1d8dd;
height: 51px;
}
.pos-item-toolbar .form-group {
@ -79,6 +78,7 @@
margin-right: -1px;
}
.pos-bill {
border-top: 1px solid #d1d8dd;
margin-left: -15px;
margin-right: -15px;
}
@ -171,6 +171,9 @@
.payment-toolbar {
padding-right: 30px;
}
.list-row-head.pos-invoice-list {
border-top: 1px solid #d1d8dd;
}
body[data-route="pos"] .modal-dialog {
width: 750px;
}

View File

@ -1,14 +1,26 @@
<div class="pos">
<div class="row">
<div class="col-sm-5 pos-bill-wrapper">
<div class="pos-bill-toolbar row">
<div class="party-area col-xs-12"></div>
<div class="col-sm-6 pos-bill-wrapper">
<div class="pos-bill-toolbar" style="display: flex;">
<div class="party-area" style="flex: 1;"></div>
<button class="btn btn-default list-customers-btn" style="margin: 0 5px 0 15px;">
<i class="fa fa-list"></i>
</button>
<button class="btn btn-default add-customer-btn">
<i class="fa fa-plus"></i>
</button>
{% if (allow_delete) { %}
<button class="btn btn-default btn-danger" style="margin: 0 5px 0 5px;display:none">
<i class="octicon octicon-trashcan"></i>
</button>
{% } %}
</div>
<div class="pos-bill">
<div class="item-cart">
<div class="row pos-bill-row pos-bill-header">
<div class="col-xs-5"><h6>{%= __("Item") %}</h6></div>
<div class="col-xs-4"><h6 class="text-right">{%= __("Quantity") %}</h6></div>
<div class="col-xs-4"><h6>{%= __("Item") %}</h6></div>
<div class="col-xs-3"><h6 class="text-right">{%= __("Quantity") %}</h6></div>
<div class="col-xs-2"><h6 class="text-right">{%= __("Discount") %}</h6></div>
<div class="col-xs-3"><h6 class="text-right">{%= __("Rate") %}</h6></div>
</div>
<div class="items"></div>
@ -48,18 +60,27 @@
</div>
</div>
</div>
<div class="list-customers">
</div>
</div>
<div class="col-sm-7 pos-items-section">
<div class="col-sm-6 pos-items-section">
<div class="row pos-item-area">
</div>
<span id="customer-results" style="color:#68a;"></span>
<div class="row pos-item-toolbar">
<div class="search-area col-xs-12"></div>
<div class="search-item-group col-xs-5"></div>
<div class="search-item col-xs-7"></div>
</div>
<div class="item-list-area">
<div class="item-list-area" style="auto">
<div class="app-listing item-list"></ul>
</div>
</div>
<div class="row">
<div class="text-right list-paging-area">
<button class="btn btn-default btn-more btn-sm" style="margin:5px 20px">{{ __("More") }}</button>
</div>
</div>
</div>
</div>

View File

@ -1,25 +1,30 @@
<div class="row pos-bill-row pos-bill-item" data-item-code="{%= item_code %}">
<div class="col-xs-5"><h6>{%= item_code || "" %}{%= item_name || "" %}</h6></div>
<div class="col-xs-4">
<div class="col-xs-4"><h6>{%= item_code || "" %}{%= __(item_name) || "" %}</h6></div>
<div class="col-xs-3">
<div class="row pos-qty-row">
<div class="col-xs-2 text-center pos-qty-btn" data-action="decrease-qty"><i class="fa fa-minus text-muted" style="font-size:12px"></i></div>
<div class="col-xs-8">
<div>
<input type="text" value="{%= qty %}" class="form-control input-sm pos-item-qty text-right">
<input type="tel" value="{%= qty %}" class="form-control pos-item-qty text-right">
</div>
{% if(actual_qty != null) { %}
<div style="margin-top: 5px;" class="text-muted small text-right">
<span title="{%= __("In Stock") %}">{%= actual_qty || 0 %}<span>
{%= __("In Stock: ") %} <span>{%= actual_qty || 0.0 %}</span>
</div>
{% } %}
</div>
<div class="col-xs-2 text-center pos-qty-btn" data-action="increase-qty"><i class="fa fa-plus text-muted" style="font-size:12px"></i></div>
</div>
</div>
<div class="col-xs-2 text-right">
<div class="row input-sm">
<input type="tel" value="{%= discount_percentage %}" class="form-control text-right pos-item-discount">
</div>
</div>
<div class="col-xs-3 text-right">
<div class="text-muted" style="margin-top: 5px;">
{% if(enabled) { %}
<input type="text" value="{%= rate %}" class="form-control input-sm pos-item-rate text-right">
<input type="tel" value="{%= rate %}" class="form-control input-sm pos-item-rate text-right">
{% } else { %}
<h6>{%= format_currency(rate) %}</h6>
{% } %}

View File

@ -82,7 +82,7 @@
.pos-toolbar, .pos-bill-toolbar {
padding: 10px 0px;
border-bottom: 1px solid #d1d8dd;
// border-bottom: 1px solid #d1d8dd;
height: 51px;
}
@ -97,6 +97,7 @@
}
.pos-bill {
border-top: 1px solid @border-color;
margin-left: -15px;
margin-right: -15px;
}
@ -213,6 +214,10 @@
padding-right: 30px;
}
.list-row-head.pos-invoice-list {
border-top: 1px solid @border-color;
}
body[data-route="pos"] .modal-dialog {
width: 750px;