From bb60523fa78f1035c6d3e1d36960c4f09fc9dae6 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 15 Jul 2021 20:09:02 +0530 Subject: [PATCH] feat: Cart minor UI/UX Refresh - Added Setting to show or hide price if checkout is disabled - Show Web Item name in cart instead of Desk Item name - Cart minor UI Refresh: added images in cart - Cart minor UI Refresh: repositioned remove button and redesigned - Cart minor UI Refresh: Payment Summary section - Cart minor UI Refresh: Disable input on free item - Cart minor UI Refresh: Add address button in cards - New file for cart payment summary UI with coupon code (old) --- .../e_commerce_settings.json | 12 +- erpnext/e_commerce/shopping_cart/cart.py | 8 +- erpnext/public/js/shopping_cart.js | 2 +- erpnext/public/scss/shopping_cart.scss | 130 ++++++++++++++---- .../quotation_item/quotation_item.json | 2 +- .../templates/includes/cart/cart_address.html | 56 ++++---- .../templates/includes/cart/cart_items.html | 126 ++++++++++------- .../includes/cart/cart_payment_summary.html | 80 +++++++++++ erpnext/templates/pages/cart.html | 58 +++++--- 9 files changed, 347 insertions(+), 127 deletions(-) create mode 100644 erpnext/templates/includes/cart/cart_payment_summary.html diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json index 8eeaf530150..54e88ca081c 100644 --- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json +++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.json @@ -39,8 +39,9 @@ "quotation_series", "checkout_settings_section", "enable_checkout", - "save_quotations_as_draft", + "show_price_in_quotation", "column_break_27", + "save_quotations_as_draft", "payment_gateway_account", "payment_success_url", "filter_categories_section", @@ -379,12 +380,19 @@ "fieldname": "enable_recommendations", "fieldtype": "Check", "label": "Enable Recommendations" + }, + { + "default": "0", + "depends_on": "eval: doc.enable_checkout == 0", + "fieldname": "show_price_in_quotation", + "fieldtype": "Check", + "label": "Show Price in Quotation" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2021-07-13 16:30:14.715949", + "modified": "2021-07-15 16:50:50.087281", "modified_by": "Administrator", "module": "E-commerce", "name": "E Commerce Settings", diff --git a/erpnext/e_commerce/shopping_cart/cart.py b/erpnext/e_commerce/shopping_cart/cart.py index 6bdb02a12e2..9aa2d582841 100644 --- a/erpnext/e_commerce/shopping_cart/cart.py +++ b/erpnext/e_commerce/shopping_cart/cart.py @@ -268,8 +268,12 @@ def guess_territory(): def decorate_quotation_doc(doc): for d in doc.get("items", []): - d.update(frappe.db.get_value("Website Item", {"item_code": d.item_code}, - ["thumbnail", "website_image", "description", "route"], as_dict=True)) + d.update(frappe.db.get_value( + "Website Item", + {"item_code": d.item_code}, + ["web_item_name", "thumbnail", "website_image", "description", "route"], + as_dict=True) + ) return doc diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js index 4c134e2dff9..847d8c62459 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -121,7 +121,7 @@ $.extend(shopping_cart, { $(".cart-items").html('Cart is Empty'); $(".cart-tax-items").hide(); $(".btn-place-order").hide(); - $(".cart-addresses").hide(); + $(".cart-payment-addresses").hide(); } else { $cart.css("display", "inline"); diff --git a/erpnext/public/scss/shopping_cart.scss b/erpnext/public/scss/shopping_cart.scss index 612a05ed547..871e488b228 100644 --- a/erpnext/public/scss/shopping_cart.scss +++ b/erpnext/public/scss/shopping_cart.scss @@ -618,6 +618,7 @@ body.product-page { display: flex; flex-direction: column; justify-content: space-between; + height: fit-content; } .cart-items-header { @@ -646,8 +647,29 @@ body.product-page { color: var(--text-color); } + .cart-item-image { + width: 20%; + min-width: 100px; + img { + max-height: 112px; + } + + .no-image-cart-item { + max-height: 112px; + display: flex; justify-content: center; + background-color: var(--gray-200); + align-items: center; + color: var(--gray-400); + margin-top: .15rem; + border-radius: 6px; + height: 100%; + font-size: 24px; + } + } + .cart-items { .item-title { + width: 80%; font-size: 14px; font-weight: 500; color: var(--text-color); @@ -678,9 +700,18 @@ body.product-page { color: var(--text-muted); } - textarea { - width: 40%; + .free-tag { + padding: 4px 8px; + border-radius: 4px; + background-color: var(--dark-green-50); } + + textarea { + width: 80%; + height: 60px; + font-size: 14px; + } + } .cart-tax-items { @@ -705,52 +736,95 @@ body.product-page { } .remove-cart-item { - border-radius: 50%; + border-radius: 6px; border: 1px solid var(--gray-100); - width: 22px; - height: 22px; - background-color: var(--gray-200); + width: 28px; + height: 28px; + font-weight: 300; + color: var(--gray-700); + background-color: var(--gray-100); float: right; cursor: pointer; + margin-top: .25rem; + justify-content: center; } .remove-cart-item-logo { - margin-bottom: 6px; - margin-left: 1px; - } - - .totals { - padding-right: 4rem; - @media (max-width: 992px) { - padding-right: 1rem; - } + margin-top: 2px; + margin-left: 2.2px; + fill: var(--gray-700) !important; } } - .cart-addresses { + .cart-payment-addresses { hr { border-color: var(--border-color); } } + .payment-summary { + h6 { + padding-bottom: 1rem; + border-bottom: solid 1px var(--gray-200); + } + + table { + font-size: 14px; + td { + padding: 0; + padding-top: 0.35rem !important; + border: none !important; + } + + &.grand-total { + border-top: solid 1px var(--gray-200); + } + } + + .bill-label { + color: var(--gray-600); + } + + .bill-content { + font-weight: 500; + &.net-total { + font-size: 16px; + font-weight: 600; + } + } + + .btn-coupon-code { + font-size: 14px; + border: dashed 1px var(--gray-400); + box-shadow: none; + } + } + .number-spinner { width: 75%; min-width: 105px; .cart-btn { border: none; - background: var(--primary-color); - color: white; + background: var(--gray-100); + color: var(--gray-500); box-shadow: none; width: 24px; height: 28px; align-items: center; justify-content: center; display: flex; + font-size: 20px; + font-weight: 300; + color: var(--gray-700); } .cart-qty { height: 28px; font-size: 13px; + &:disabled { + background: var(--gray-100); + opacity: 0.65; + } } } @@ -792,19 +866,29 @@ body.product-page { font-size: 13px; svg use { - stroke: var(--blue-500); + stroke: var(--primary-color); } } .btn-change-address { - color: var(--blue-500); + border: 1px solid var(--primary-color); + color: var(--primary-color); + box-shadow: none; } } +.address-header { + margin-top: .15rem;padding: 0; +} + +.btn-new-address { + float: right; + font-size: 15px !important; + color: var(--primary-color) !important; +} + .btn-new-address:hover, .btn-change-address:hover { - box-shadow: none; - color: var(--blue-500) !important; - border: 1px solid var(--blue-500); + color: var(--primary-color) !important; } .modal .address-card { diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index 8b53902d32f..31a95896bc1 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -649,7 +649,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2021-02-23 01:13:54.670763", + "modified": "2021-07-15 12:40:51.074820", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", diff --git a/erpnext/templates/includes/cart/cart_address.html b/erpnext/templates/includes/cart/cart_address.html index 93de75800d0..cf600173731 100644 --- a/erpnext/templates/includes/cart/cart_address.html +++ b/erpnext/templates/includes/cart/cart_address.html @@ -4,18 +4,14 @@ {% set select_address = True %} {% endif %} -{% set show_coupon_code = frappe.db.get_single_value('E Commerce Settings', 'show_apply_coupon_code_in_website') %} -{% if show_coupon_code == 1%} -
-
- - - -
-
-{% endif %}
-
{{ _("Shipping Address") }}
+
+
{{ _("Shipping Address") }}
+ +
+
{% for address in shipping_addresses %} {% if doc.shipping_address_name == address.name %} @@ -27,28 +23,36 @@ {% endif %} {% endfor %}
+ +
-
-
{{ _("Billing Address") }}
-
- {% for address in billing_addresses %} - {% if doc.customer_address == address.name %} -
-
- {% include "templates/includes/cart/address_card.html" %} -
+ +{% if billing_addresses %} +
+
+
{{ _("Billing Address") }}
+
- {% endif %} - {% endfor %} -
- + +
+ {% for address in billing_addresses %} + {% if doc.customer_address == address.name %} +
+
+ {% include "templates/includes/cart/address_card.html" %} +
+
+ {% endif %} + {% endfor %} +
+{% endif %}