[cleanup] [wip] portal, shopping cart cleanup
diff --git a/erpnext/templates/includes/address_row.html b/erpnext/templates/includes/address_row.html
index f7eaa76..fd287ad 100644
--- a/erpnext/templates/includes/address_row.html
+++ b/erpnext/templates/includes/address_row.html
@@ -1,19 +1,8 @@
<div class="web-list-item">
- <a href="/addresses?name={{ doc.name }}" no-pjax>
- <div class="row">
- <div class="col-sm-4">
- <span class="strong">{{ doc.address_title }}</span>
- </div>
- <div class="col-sm-2">
- {{ doc.address_type }}
- </div>
- <div class="col-sm-4">
- {{ doc.address_line1 }}<br>
- {% if doc.address_line2 %}{{ doc.address_line2 }}<br>{% endif %}
- {{ doc.city }}<br>
- </div>
- <div class="col-sm-2">
- {% if doc.state %}{{ doc.state }}, {% endif %}{{ doc.country }}
+ <a href="/addresses?name={{ doc.name }}" no-pjax class="no-decoration">
+ <h4 class="strong">{{ doc.address_title }}</h4>
+ <p class="text-muted small">
+ {{ frappe.get_doc(doc).get_display() }}
</div>
</div>
</a>
diff --git a/erpnext/templates/includes/cart.css b/erpnext/templates/includes/cart.css
new file mode 100644
index 0000000..ed98846
--- /dev/null
+++ b/erpnext/templates/includes/cart.css
@@ -0,0 +1,7 @@
+.cart-content {
+ min-height: 400px;
+}
+
+.cart-header, .cart-footer {
+ margin-bottom: 40px;
+}
diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js
index d5956f9..349e2f5 100644
--- a/erpnext/templates/includes/cart.js
+++ b/erpnext/templates/includes/cart.js
@@ -92,12 +92,12 @@
$('<hr>').appendTo($cart_taxes);
shopping_cart.render_tax_row($cart_totals, {
- description: "<strong>Total</strong>",
- formatted_tax_amount: "<strong>" + doc.formatted_grand_total_export + "</strong>"
+ description: "",
+ formatted_tax_amount: __("Total") + ": <strong>" + doc.formatted_grand_total_export + "</strong>"
});
if(!(addresses && addresses.length)) {
- $cart_shipping_address.html('<div class="msg-box">'+frappe._("Hey! Go ahead and add an address")+'</div>');
+ $cart_shipping_address.html('<p>'+frappe._("Please add a new address")+'</p>');
} else {
shopping_cart.render_address($cart_shipping_address, addresses, doc.shipping_address_name);
shopping_cart.render_address($cart_billing_address, addresses, doc.customer_address);
@@ -113,9 +113,9 @@
$(repl('<div class="row">\
<div class="col-md-9 col-sm-9">\
<div class="row">\
- <div class="col-md-3">%(image_html)s</div>\
- <div class="col-md-9">\
- <h4><a href="%(page_name)s">%(item_name)s</a></h4>\
+ <div class="col-md-2">%(image_html)s</div>\
+ <div class="col-md-10">\
+ <h5><a href="%(page_name)s">%(item_name)s</a></h5>\
<p>%(description)s</p>\
</div>\
</div>\
@@ -129,8 +129,8 @@
<i class="icon-ok"></i></button>\
</div>\
</div>\
- <p style="margin-top: 10px;">at %(formatted_rate)s</p>\
- <small class="text-muted" style="margin-top: 10px;">= %(formatted_amount)s</small>\
+ <p class="text-muted small" style="margin-top: 10px;">' + __("Rate") + ': %(formatted_rate)s</p>\
+ <small style="margin-top: 10px;">%(formatted_amount)s</small>\
</div>\
</div><hr>', doc)).appendTo($cart_items);
},
@@ -189,12 +189,12 @@
<div class="row"> \
<div class="col-md-10 address-title" \
data-address-name="%(name)s"><strong>%(name)s</strong></div> \
- <div class="col-md-2"><input type="checkbox" \
+ <div class="col-md-2 text-right"><input type="checkbox" \
data-address-name="%(name)s"></div> \
</div> \
</div> \
<div class="panel-collapse collapse" data-address-name="%(name)s"> \
- <div class="panel-body">%(display)s</div> \
+ <div class="panel-body text-muted small">%(display)s</div> \
</div> \
</div>', address))
.css({"margin": "10px auto"})
@@ -274,24 +274,24 @@
$(document).ready(function() {
shopping_cart.bind_events();
- return frappe.call({
- type: "POST",
- method: "erpnext.shopping_cart.cart.get_cart_quotation",
- callback: function(r) {
- $("#cart-container").removeClass("hide");
- $(".progress").remove();
- if(r.exc) {
- if(r.exc.indexOf("WebsitePriceListMissingError")!==-1) {
- shopping_cart.show_error("Configuration Error", frappe._("Price List not configured."));
- } else if(r["403"]) {
- shopping_cart.show_error("Not Allowed", frappe._("You need to be logged in to view your cart."));
- } else {
- shopping_cart.show_error("Error", frappe._("Something went wrong."));
- }
- } else {
- shopping_cart.set_cart_count();
- shopping_cart.render(r.message);
- }
- }
- });
+ // return frappe.call({
+ // type: "POST",
+ // method: "erpnext.shopping_cart.cart.get_cart_quotation",
+ // callback: function(r) {
+ // $("#cart-container").removeClass("hide");
+ // $(".loading").remove();
+ // if(r.exc) {
+ // if(r.exc.indexOf("WebsitePriceListMissingError")!==-1) {
+ // shopping_cart.show_error("Configuration Error", frappe._("Price List not configured."));
+ // } else if(r["403"]) {
+ // shopping_cart.show_error("Not Allowed", frappe._("You need to be logged in to view your cart."));
+ // } else {
+ // shopping_cart.show_error("Error", frappe._("Something went wrong."));
+ // }
+ // } else {
+ // shopping_cart.set_cart_count();
+ // shopping_cart.render(r.message);
+ // }
+ // }
+ // });
});
diff --git a/erpnext/templates/includes/issue_row.html b/erpnext/templates/includes/issue_row.html
index 16a8f7b..8e87fca 100644
--- a/erpnext/templates/includes/issue_row.html
+++ b/erpnext/templates/includes/issue_row.html
@@ -1,21 +1,15 @@
<div class="web-list-item">
+ <a class="no-decoration" href="/issues?name={{ doc.name }}" no-pjax>
<div class="row">
- <div class="col-sm-6">
- <a class="no-decoration" href="/issues?name={{ doc.name }}" no-pjax>
- {{ doc.subject }}
- </a>
+ <div class="col-xs-8">
+ <span class="indicator {{ "red" if doc.status=="Open" else "blue" }}">
+ {{ doc.name }}</span>
+ <span style="margin-left: 15px;">
+ {{ doc.subject }}</span>
</div>
- <div class="col-sm-2">
- <span class="indicator {{ "red" if doc.status=="Open" else "blue" }}">
- {{ doc.status }}</span>
- </div>
- <div class="col-sm-2">
- <a class="text-muted text-right" href="/issues?name={{ doc.name }}" no-pjax>
- {{ doc.name }}
- </a>
- </div>
- <div class="col-sm-2 text-muted text-right small">
+ <div class="col-xs-4 text-right small">
{{ frappe.format_date(doc.creation) }}
</div>
</div>
+ </a>
</div>
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index 6748a5e..487968b 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -6,11 +6,25 @@
{% endmacro %}
{% macro product_image(website_image, css_class="") %}
-<div class="product-image {% if not website_image -%} missing-image {%- endif %} {{ css_class }}">
- {% if website_image -%}
- <img src="{{ frappe.utils.quoted(website_image) | abs_url }}" class="img-responsive">
- {%- else -%}
- <i class="centered octicon octicon-device-camera"></i>
- {%- endif %}
-</div>
+ <div class="product-image {% if not website_image -%} missing-image {%- endif %} {{ css_class }}">
+ {% if website_image -%}
+ <img src="{{ frappe.utils.quoted(website_image) | abs_url }}" class="img-responsive">
+ {%- else -%}
+ <i class="centered octicon octicon-device-camera"></i>
+ {%- endif %}
+ </div>
+{% endmacro %}
+
+{% macro item_name_and_description(d) %}
+ <div class="row">
+ <div class="col-xs-4 col-sm-2 order-image-col">
+ <div class="order-image">
+ {{ product_image_square(d.image) }}
+ </div>
+ </div>
+ <div class="col-xs-8 col-sm-10">
+ {{ d.item_code }}
+ <p class="text-muted small">{{ d.description }}</p>
+ </div>
+ </div>
{% endmacro %}
diff --git a/erpnext/templates/includes/order.css b/erpnext/templates/includes/order.css
new file mode 100644
index 0000000..54c8d0f
--- /dev/null
+++ b/erpnext/templates/includes/order.css
@@ -0,0 +1,25 @@
+.order-container {
+ margin: 50px 0px;
+}
+
+.order-items {
+ margin: 20px 0px;
+}
+
+.order-item-table {
+ margin: 0px -15px;
+}
+
+.order-item-header {
+ border-bottom: 1px solid #d1d8dd;
+}
+
+.order-image-col {
+ padding-right: 0px;
+}
+
+.order-image {
+ max-width: 55px;
+ max-height: 55px;
+ margin-top: -5px;
+}
diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js
index 4f4f11c..98331a4 100644
--- a/erpnext/templates/includes/product_page.js
+++ b/erpnext/templates/includes/product_page.js
@@ -1,10 +1,10 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-$(document).ready(function() {
+frappe.ready(function() {
var item_code = $('[itemscope] [itemprop="productID"]').text().trim();
var qty = 0;
-
+
frappe.call({
type: "POST",
method: "erpnext.shopping_cart.product.get_product_info",
@@ -12,10 +12,12 @@
item_code: "{{ name }}"
},
callback: function(r) {
+ console.log(r.message);
+ $(".item-cart").toggleClass("hide", !!!r.message.price);
if(r.message && r.message.price) {
$(".item-price")
.html(r.message.price.formatted_price + " per " + r.message.uom);
-
+
if(r.message.stock==0) {
$(".item-stock").html("<div class='help'>Not in stock</div>");
}
@@ -23,18 +25,17 @@
$(".item-stock").html("<div style='color: green'>\
<i class='icon-check'></i> Available (in stock)</div>");
}
-
- $(".item-price-info").toggle(true);
-
+
if(r.message.qty) {
qty = r.message.qty;
- toggle_update_cart(qty);
- $("#item-update-cart input").val(qty);
+ toggle_update_cart(r.message.qty);
+ } else {
+ toggle_update_cart(0);
}
}
}
})
-
+
$("#item-add-to-cart button").on("click", function() {
shopping_cart.update_cart({
item_code: item_code,
@@ -45,10 +46,10 @@
qty = 1;
}
},
- btn: this,
+ btn: this,
});
});
-
+
$("#item-update-cart button").on("click", function() {
shopping_cart.update_cart({
item_code: item_code,
@@ -63,7 +64,7 @@
},
});
});
-
+
if(localStorage && localStorage.getItem("pending_add_to_cart") && full_name) {
localStorage.removeItem("pending_add_to_cart");
$("#item-add-to-cart button").trigger("click");
@@ -75,4 +76,4 @@
$("#item-update-cart")
.toggle(qty ? true : false)
.find("input").val(qty);
-}
\ No newline at end of file
+}
diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html
index a677fa5..9b9fd52 100644
--- a/erpnext/templates/includes/transaction_row.html
+++ b/erpnext/templates/includes/transaction_row.html
@@ -1,29 +1,22 @@
-{% set doc = frappe.get_doc(doc) %}
<div class="web-list-item">
<a href="/{{ pathname }}/{{ doc.name }}" no-pjax>
<div class="row">
- <div class="col-sm-6 col-xs-7">
+ <div class="col-sm-8 col-xs-7">
<div class="row">
- <div class="col-sm-9">{{ doc.customer or doc.supplier }}</div>
+ <div class="col-sm-9">
+ <div>{{ doc.name }}</div>
+ <div class="small text-muted">{{ doc.items_preview }}</div>
+ </div>
<div class="col-sm-3">
- {%- if doc.status_percent > 0 -%}
- {%- if doc.status_percent % 100 == 0 -%}
- <span class="indicator green">{{ doc.status_display }}</span>
- {%- else -%}
- <span class="indicator orange">{{ doc.status_display }}</span>
- {%- endif -%}
- {%- elif doc.status -%}
- <span class="indicator blue">{{ doc.status }}</span>
- {%- endif -%}
+ <span class="indicator {{ doc.indicator_color or "darkgrey" }}">
+ {{ doc.indicator_title or doc.status or "Submitted" }}
+ </span>
</div>
</div>
</div>
<div class="col-sm-2 col-xs-5 text-right">
{{ doc.get_formatted("grand_total") }}
</div>
- <div class="col-sm-2 text-muted text-right">
- {{ doc.name }}
- </div>
<div class="col-sm-2 small text-muted text-right" title="{{ frappe.utils.format_datetime(doc.creation, "medium") }}">
{{ frappe.utils.pretty_date(doc.creation) }}</div>
</div>