mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
[website] [minor] moving to framework
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// js inside blog page
|
||||
|
||||
$(document).ready(function() {
|
||||
wn.cart.bind_events();
|
||||
erpnext.cart.bind_events();
|
||||
return wn.call({
|
||||
type: "POST",
|
||||
method: "selling.utils.cart.get_cart_quotation",
|
||||
@@ -14,23 +14,23 @@ $(document).ready(function() {
|
||||
$(".progress").remove();
|
||||
if(r.exc) {
|
||||
if(r.exc.indexOf("WebsitePriceListMissingError")!==-1) {
|
||||
wn.cart.show_error("Oops!", "Price List not configured.");
|
||||
erpnext.cart.show_error("Oops!", "Price List not configured.");
|
||||
} else if(r["403"]) {
|
||||
wn.cart.show_error("Hey!", "You need to be logged in to view your cart.");
|
||||
erpnext.cart.show_error("Hey!", "You need to be logged in to view your cart.");
|
||||
} else {
|
||||
wn.cart.show_error("Oops!", "Something went wrong.");
|
||||
erpnext.cart.show_error("Oops!", "Something went wrong.");
|
||||
}
|
||||
} else {
|
||||
wn.cart.set_cart_count();
|
||||
wn.cart.render(r.message);
|
||||
erpnext.cart.set_cart_count();
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// shopping cart
|
||||
if(!wn.cart) wn.cart = {};
|
||||
$.extend(wn.cart, {
|
||||
if(!erpnext.cart) erpnext.cart = {};
|
||||
$.extend(erpnext.cart, {
|
||||
show_error: function(title, text) {
|
||||
$("#cart-container").html('<div class="well"><h4>' + title + '</h4> ' + text + '</div>');
|
||||
},
|
||||
@@ -39,14 +39,14 @@ $.extend(wn.cart, {
|
||||
// bind update button
|
||||
$(document).on("click", ".item-update-cart button", function() {
|
||||
var item_code = $(this).attr("data-item-code");
|
||||
wn.cart.update_cart({
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: $('input[data-item-code="'+item_code+'"]').val(),
|
||||
with_doclist: 1,
|
||||
btn: this,
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
wn.cart.render(r.message);
|
||||
erpnext.cart.render(r.message);
|
||||
var $button = $('button[data-item-code="'+item_code+'"]').addClass("btn-success");
|
||||
setTimeout(function() { $button.removeClass("btn-success"); }, 1000);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ $.extend(wn.cart, {
|
||||
});
|
||||
|
||||
$(".btn-place-order").on("click", function() {
|
||||
wn.cart.place_order();
|
||||
erpnext.cart.place_order(this);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -79,7 +79,7 @@ $.extend(wn.cart, {
|
||||
|
||||
var no_items = $.map(doclist, function(d) { return d.item_code || null;}).length===0;
|
||||
if(no_items) {
|
||||
wn.cart.show_error("Empty :-(", "Go ahead and add something to your cart.");
|
||||
erpnext.cart.show_error("Empty :-(", "Go ahead and add something to your cart.");
|
||||
$("#cart-addresses").toggle(false);
|
||||
return;
|
||||
}
|
||||
@@ -89,14 +89,14 @@ $.extend(wn.cart, {
|
||||
var shipping_rule_labels = $.map(out.shipping_rules || [], function(rule) { return rule[1]; });
|
||||
$.each(doclist, function(i, doc) {
|
||||
if(doc.doctype === "Quotation Item") {
|
||||
wn.cart.render_item_row($cart_items, doc);
|
||||
erpnext.cart.render_item_row($cart_items, doc);
|
||||
} else if (doc.doctype === "Sales Taxes and Charges") {
|
||||
if(out.shipping_rules && out.shipping_rules.length &&
|
||||
shipping_rule_labels.indexOf(doc.description)!==-1) {
|
||||
shipping_rule_added = true;
|
||||
wn.cart.render_tax_row($cart_taxes, doc, out.shipping_rules);
|
||||
erpnext.cart.render_tax_row($cart_taxes, doc, out.shipping_rules);
|
||||
} else {
|
||||
wn.cart.render_tax_row($cart_taxes, doc);
|
||||
erpnext.cart.render_tax_row($cart_taxes, doc);
|
||||
}
|
||||
|
||||
taxes_exist = true;
|
||||
@@ -104,7 +104,7 @@ $.extend(wn.cart, {
|
||||
});
|
||||
|
||||
if(out.shipping_rules && out.shipping_rules.length && !shipping_rule_added) {
|
||||
wn.cart.render_tax_row($cart_taxes, {description: "", formatted_tax_amount: ""},
|
||||
erpnext.cart.render_tax_row($cart_taxes, {description: "", formatted_tax_amount: ""},
|
||||
out.shipping_rules);
|
||||
taxes_exist = true;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ $.extend(wn.cart, {
|
||||
if(taxes_exist)
|
||||
$('<hr>').appendTo($cart_taxes);
|
||||
|
||||
wn.cart.render_tax_row($cart_totals, {
|
||||
erpnext.cart.render_tax_row($cart_totals, {
|
||||
description: "<strong>Total</strong>",
|
||||
formatted_tax_amount: "<strong>" + doclist[0].formatted_grand_total_export + "</strong>"
|
||||
});
|
||||
@@ -120,8 +120,8 @@ $.extend(wn.cart, {
|
||||
if(!(addresses && addresses.length)) {
|
||||
$cart_shipping_address.html('<div class="well">Hey! Go ahead and add an address</div>');
|
||||
} else {
|
||||
wn.cart.render_address($cart_shipping_address, addresses, doclist[0].shipping_address_name);
|
||||
wn.cart.render_address($cart_billing_address, addresses, doclist[0].customer_address);
|
||||
erpnext.cart.render_address($cart_shipping_address, addresses, doclist[0].shipping_address_name);
|
||||
erpnext.cart.render_address($cart_billing_address, addresses, doclist[0].customer_address);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -185,7 +185,7 @@ $.extend(wn.cart, {
|
||||
}
|
||||
});
|
||||
$tax_row.find('select').on("change", function() {
|
||||
wn.cart.apply_shipping_rule($(this).val(), this);
|
||||
erpnext.cart.apply_shipping_rule($(this).val(), this);
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -198,7 +198,7 @@ $.extend(wn.cart, {
|
||||
args: { shipping_rule: rule },
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
wn.cart.render(r.message);
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -249,7 +249,7 @@ $.extend(wn.cart, {
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
wn.cart.render(r.message);
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -270,10 +270,11 @@ $.extend(wn.cart, {
|
||||
.collapse("show");
|
||||
},
|
||||
|
||||
place_order: function() {
|
||||
place_order: function(btn) {
|
||||
return wn.call({
|
||||
type: "POST",
|
||||
method: "selling.utils.cart.place_order",
|
||||
btn: btn,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
var msg = "";
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
{% extends "lib/website/templates/includes/footer.html" %}
|
||||
|
||||
{% block powered %}
|
||||
<p style="float: right; clear: right;">
|
||||
<a style="font-size: 90%; color: #888;" href="http://erpnext.org">ERPNext Powered</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
{% block powered %}<a style="font-size: 90%; color: #aaa;" href="http://erpnext.org">ERPNext Powered</a>{% endblock %}
|
||||
|
||||
{% block extension %}
|
||||
<br>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li><a href="account">My Account</a></li>
|
||||
<li class="active"><i class="{{ icon }} icon-fixed-width"></i> {{ title }}</li>
|
||||
</ul>
|
||||
<div class="list-group transaction-list">
|
||||
|
||||
Reference in New Issue
Block a user