[website] [minor] moving to framework
This commit is contained in:
parent
b0d996ffb1
commit
0748cb7d18
@ -1,23 +1,3 @@
|
||||
{% extends "lib/website/templates/base.html" %}
|
||||
|
||||
{% block toolbar %}
|
||||
<div class="row">
|
||||
<div class="pull-right" style="margin:4px;" id="user-tools">
|
||||
{% if shopping_cart_enabled -%}
|
||||
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
|
||||
<span class="cart-count"></span></a> |
|
||||
{%- endif %}
|
||||
<a id="login-link" href="login">Login</a>
|
||||
</div>
|
||||
<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login">
|
||||
<a href="account" title="My Account" id="user-full-name"></a> |
|
||||
{% if shopping_cart_enabled -%}
|
||||
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
|
||||
<span class="cart-count"></span></a> |
|
||||
{%- endif %}
|
||||
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{% include "app/portal/templates/includes/footer.html" %}{% endblock %}
|
@ -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">
|
||||
|
@ -1,27 +0,0 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Account" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li class="active">My Account</li>
|
||||
</ul>
|
||||
<!-- <h3>My Account</h3> -->
|
||||
<ul class="nav nav-stacked pull-left">
|
||||
<li><a href="profile"><i class="icon-user icon-fixed-width"></i>
|
||||
Change my name, password</a></li>
|
||||
<li><a href="addresses"><i class="icon-map-marker icon-fixed-width"></i>
|
||||
My Addresses</a></li>
|
||||
<li><a href="orders"><i class="icon-list icon-fixed-width"></i> My Orders</a></li>
|
||||
<li><a href="tickets"><i class="icon-tags icon-fixed-width"></i> My Tickets</a></li>
|
||||
<li style="border-top: 1px solid #ddd"></li>
|
||||
<li><a href="invoices"><i class="icon-file-text icon-fixed-width"></i> Invoices</a></li>
|
||||
<li><a href="shipments"><i class="icon-truck icon-fixed-width"></i> Shipments</a></li>
|
||||
<li style="border-top: 1px solid #ddd"></li>
|
||||
<li><a href="server.py?cmd=web_logout"><i class="icon-signout icon-fixed-width"></i>
|
||||
Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,6 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
no_cache = True
|
@ -13,7 +13,7 @@
|
||||
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
|
||||
</div>
|
||||
<div id="cart-container" class="hide">
|
||||
<button class="btn btn-success pull-right btn-place-order" type="button">Place Order</button>
|
||||
<p class="pull-right"><button class="btn btn-success btn-place-order" type="button">Place Order</button></p>
|
||||
<div class="clearfix"></div>
|
||||
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
|
||||
<hr>
|
||||
@ -51,7 +51,7 @@
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<button class="btn btn-success pull-right btn-place-order" type="button">Place Order</button>
|
||||
<p class="pull-right"><button class="btn btn-success btn-place-order" type="button">Place Order</button></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -6,7 +6,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-user icon-fixed-width"></i> My Profile</li>
|
||||
</ul>
|
||||
<div class="alert alert-warning" id="message" style="display: none;"></div>
|
||||
|
@ -6,7 +6,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><a href="{{ parent_link }}">{{ parent_title }}</a></li>
|
||||
<li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
|
||||
</ul>
|
||||
|
@ -2,7 +2,6 @@
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
if(!window.erpnext) erpnext = {};
|
||||
if(!window.wn) wn = {};
|
||||
|
||||
// Add / update a new Lead / Communication
|
||||
// subject, sender, description
|
||||
@ -15,187 +14,20 @@ erpnext.send_message = function(opts) {
|
||||
});
|
||||
}
|
||||
|
||||
wn.call = function(opts) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).prop("disabled", true);
|
||||
}
|
||||
|
||||
if(opts.msg) {
|
||||
$(opts.msg).toggle(false);
|
||||
}
|
||||
|
||||
if(!opts.args) opts.args = {};
|
||||
|
||||
// get or post?
|
||||
if(!opts.args._type) {
|
||||
opts.args._type = opts.type || "GET";
|
||||
}
|
||||
|
||||
// method
|
||||
if(opts.method) {
|
||||
opts.args.cmd = opts.method;
|
||||
}
|
||||
|
||||
// stringify
|
||||
$.each(opts.args, function(key, val) {
|
||||
if(typeof val != "string") {
|
||||
opts.args[key] = JSON.stringify(val);
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "server.py",
|
||||
data: opts.args,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).prop("disabled", false);
|
||||
}
|
||||
if(data.exc) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).addClass("btn-danger");
|
||||
setTimeout(function() { $(opts.btn).removeClass("btn-danger"); }, 1000);
|
||||
}
|
||||
try {
|
||||
var err = JSON.parse(data.exc);
|
||||
if($.isArray(err)) {
|
||||
err = err.join("\n");
|
||||
}
|
||||
console.error ? console.error(err) : console.log(err);
|
||||
} catch(e) {
|
||||
console.log(data.exc);
|
||||
}
|
||||
} else{
|
||||
if(opts.btn) {
|
||||
$(opts.btn).addClass("btn-success");
|
||||
setTimeout(function() { $(opts.btn).removeClass("btn-success"); }, 1000);
|
||||
}
|
||||
}
|
||||
if(opts.msg && data.message) {
|
||||
$(opts.msg).html(data.message).toggle(true);
|
||||
}
|
||||
if(opts.callback)
|
||||
opts.callback(data);
|
||||
},
|
||||
error: function(response) {
|
||||
console.error ? console.error(response) : console.log(response);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setup the user tools
|
||||
//
|
||||
$(document).ready(function() {
|
||||
// update login
|
||||
var full_name = getCookie("full_name");
|
||||
if(full_name) {
|
||||
$("#user-tools").addClass("hide");
|
||||
$("#user-tools-post-login").removeClass("hide");
|
||||
$("#user-full-name").text(full_name);
|
||||
}
|
||||
|
||||
wn.cart.set_cart_count();
|
||||
erpnext.cart.set_cart_count();
|
||||
|
||||
$("#user-tools a").tooltip({"placement":"bottom"});
|
||||
$("#user-tools-post-login a").tooltip({"placement":"bottom"});
|
||||
});
|
||||
|
||||
// Utility functions
|
||||
|
||||
function valid_email(id) {
|
||||
if(id.toLowerCase().search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)
|
||||
return 0; else return 1; }
|
||||
|
||||
var validate_email = valid_email;
|
||||
|
||||
function get_url_arg(name) {
|
||||
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
|
||||
var regexS = "[\\?&]"+name+"=([^&#]*)";
|
||||
var regex = new RegExp( regexS );
|
||||
var results = regex.exec( window.location.href );
|
||||
if(results == null)
|
||||
return "";
|
||||
else
|
||||
return decodeURIComponent(results[1]);
|
||||
}
|
||||
|
||||
function make_query_string(obj) {
|
||||
var query_params = [];
|
||||
$.each(obj, function(k, v) { query_params.push(encodeURIComponent(k) + "=" + encodeURIComponent(v)); });
|
||||
return "?" + query_params.join("&");
|
||||
}
|
||||
|
||||
function repl(s, dict) {
|
||||
if(s==null)return '';
|
||||
for(key in dict) {
|
||||
s = s.split("%("+key+")s").join(dict[key]);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function replace_all(s, t1, t2) {
|
||||
return s.split(t1).join(t2);
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
return getCookies()[name];
|
||||
}
|
||||
|
||||
function getCookies() {
|
||||
var c = document.cookie, v = 0, cookies = {};
|
||||
if (document.cookie.match(/^\s*\$Version=(?:"1"|1);\s*(.*)/)) {
|
||||
c = RegExp.$1;
|
||||
v = 1;
|
||||
}
|
||||
if (v === 0) {
|
||||
c.split(/[,;]/).map(function(cookie) {
|
||||
var parts = cookie.split(/=/, 2),
|
||||
name = decodeURIComponent(parts[0].trimLeft()),
|
||||
value = parts.length > 1 ? decodeURIComponent(parts[1].trimRight()) : null;
|
||||
if(value && value.charAt(0)==='"') {
|
||||
value = value.substr(1, value.length-2);
|
||||
}
|
||||
cookies[name] = value;
|
||||
});
|
||||
} else {
|
||||
c.match(/(?:^|\s+)([!#$%&'*+\-.0-9A-Z^`a-z|~]+)=([!#$%&'*+\-.0-9A-Z^`a-z|~]*|"(?:[\x20-\x7E\x80\xFF]|\\[\x00-\x7F])*")(?=\s*[,;]|$)/g).map(function($0, $1) {
|
||||
var name = $0,
|
||||
value = $1.charAt(0) === '"'
|
||||
? $1.substr(1, -1).replace(/\\(.)/g, "$1")
|
||||
: $1;
|
||||
cookies[name] = value;
|
||||
});
|
||||
}
|
||||
return cookies;
|
||||
}
|
||||
|
||||
if (typeof String.prototype.trimLeft !== "function") {
|
||||
String.prototype.trimLeft = function() {
|
||||
return this.replace(/^\s+/, "");
|
||||
};
|
||||
}
|
||||
if (typeof String.prototype.trimRight !== "function") {
|
||||
String.prototype.trimRight = function() {
|
||||
return this.replace(/\s+$/, "");
|
||||
};
|
||||
}
|
||||
if (typeof Array.prototype.map !== "function") {
|
||||
Array.prototype.map = function(callback, thisArg) {
|
||||
for (var i=0, n=this.length, a=[]; i<n; i++) {
|
||||
if (i in this) a[i] = callback.call(thisArg, this[i]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
}
|
||||
|
||||
// shopping cart
|
||||
if(!wn.cart) wn.cart = {};
|
||||
var full_name = getCookie("full_name");
|
||||
if(!erpnext.cart) erpnext.cart = {};
|
||||
|
||||
$.extend(wn.cart, {
|
||||
$.extend(erpnext.cart, {
|
||||
update_cart: function(opts) {
|
||||
if(!full_name) {
|
||||
if(localStorage) {
|
||||
@ -217,7 +49,7 @@ $.extend(wn.cart, {
|
||||
if(opts.callback)
|
||||
opts.callback(r);
|
||||
|
||||
wn.cart.set_cart_count();
|
||||
erpnext.cart.set_cart_count();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -225,29 +57,22 @@ $.extend(wn.cart, {
|
||||
|
||||
set_cart_count: function() {
|
||||
var cart_count = getCookie("cart_count");
|
||||
if(cart_count)
|
||||
$(".cart-count").html("( "+ cart_count +" )")
|
||||
}
|
||||
});
|
||||
|
||||
function remove_script_and_style(txt) {
|
||||
return (!txt || (txt.indexOf("<script>")===-1 && txt.indexOf("<style>")===-1)) ? txt :
|
||||
$("<div></div>").html(txt).find("script,noscript,style,title,meta").remove().end().html();
|
||||
}
|
||||
|
||||
function is_html(txt) {
|
||||
if(txt.indexOf("<br>")==-1 && txt.indexOf("<p")==-1
|
||||
&& txt.indexOf("<img")==-1 && txt.indexOf("<div")==-1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function ask_to_login() {
|
||||
if(!full_name) {
|
||||
if(localStorage) {
|
||||
localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]);
|
||||
var $cart = $("#website-post-login").find('[data-label="Cart"]');
|
||||
var $badge = $cart.find(".badge");
|
||||
var $cog = $("#website-post-login").find(".dropdown-toggle");
|
||||
var $cog_count = $cog.find(".cart-count");
|
||||
if(cart_count) {
|
||||
if($badge.length === 0) {
|
||||
var $badge = $('<span class="badge pull-right"></span>').appendTo($cart.find("a"));
|
||||
}
|
||||
$badge.html(cart_count);
|
||||
if($cog_count.length === 0) {
|
||||
var $cog_count = $('<sup class="cart-count"></span>').insertAfter($cog.find(".icon-cog"));
|
||||
}
|
||||
$cog_count.html(cart_count);
|
||||
} else {
|
||||
$badge.remove();
|
||||
$cog_count.remove();
|
||||
}
|
||||
window.location.href = "login";
|
||||
}
|
||||
}
|
||||
});
|
@ -4,7 +4,23 @@
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
|
||||
def get_website_settings():
|
||||
return {
|
||||
"shopping_cart_enabled": cint(webnotes.conn.get_default("shopping_cart_enabled"))
|
||||
}
|
||||
def get_website_settings(context):
|
||||
post_login = []
|
||||
cart_enabled = cint(webnotes.conn.get_default("shopping_cart_enabled"))
|
||||
if cart_enabled:
|
||||
post_login += [{"label": "Cart", "url": "cart", "icon": "icon-shopping-cart", "class": "cart-count"},
|
||||
{"class": "divider"}]
|
||||
|
||||
post_login += [
|
||||
{"label": "Profile", "url": "profile", "icon": "icon-user"},
|
||||
{"label": "Addresses", "url": "addresses", "icon": "icon-map-marker"},
|
||||
{"label": "My Orders", "url": "orders", "icon": "icon-list"},
|
||||
{"label": "My Tickets", "url": "tickets", "icon": "icon-tags"},
|
||||
{"label": "Invoices", "url": "invoices", "icon": "icon-file-text"},
|
||||
{"label": "Shipments", "url": "shipments", "icon": "icon-truck"},
|
||||
{"class": "divider"}
|
||||
]
|
||||
context.update({
|
||||
"shopping_cart_enabled": cart_enabled,
|
||||
"post_login": post_login + context.get("post_login", [])
|
||||
})
|
@ -36,7 +36,7 @@ $(document).ready(function() {
|
||||
})
|
||||
|
||||
$("#item-add-to-cart button").on("click", function() {
|
||||
wn.cart.update_cart({
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: 1,
|
||||
callback: function(r) {
|
||||
@ -50,7 +50,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$("#item-update-cart button").on("click", function() {
|
||||
wn.cart.update_cart({
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: $("#item-update-cart input").val(),
|
||||
btn: this,
|
||||
|
66
support/doctype/support_ticket/templates/ticket.html
Normal file
66
support/doctype/support_ticket/templates/ticket.html
Normal file
@ -0,0 +1,66 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
{% set status_label = {
|
||||
"Open": "label-success",
|
||||
"To Reply": "label-danger",
|
||||
"Closed": "label-default"
|
||||
} %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li><a href="tickets">My Tickets</a></li>
|
||||
<li class="active"><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</li>
|
||||
</ul>
|
||||
<h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3>
|
||||
{% if doc.name == "Not Allowed" -%}
|
||||
<script>ask_to_login();</script>
|
||||
{% else %}
|
||||
<hr>
|
||||
{%- if doc.status -%}
|
||||
{% if doc.status == "Waiting for Customer" -%}
|
||||
{% set status = "To Reply" %}
|
||||
{% else %}
|
||||
{% set status = doc.status %}
|
||||
{%- endif -%}
|
||||
<div class="row">
|
||||
<div class="col-md-2" style="margin-bottom: 7px;">
|
||||
<span class="label {{ status_label.get(status) or 'label-default' }}">{{ status }}</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row col-md-12">{{ doc.subject }}</div>
|
||||
</div>
|
||||
<div class="col-md-2 pull-right">
|
||||
<span class="text-muted">{{ utils.formatdate(doc.creation) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<h4>Messages</h4>
|
||||
{%- if doclist.get({"doctype":"Communication"}) -%}
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<tbody>
|
||||
{%- for comm in doclist.get({"doctype":"Communication"}) %}
|
||||
<tr>
|
||||
<td>
|
||||
<h5 style="text-transform: none">
|
||||
{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5>
|
||||
<hr>
|
||||
<p>{{ webnotes.utils.is_html(comm.content) and comm.content or
|
||||
comm.content.replace("\n", "<br>")}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{%- else -%}
|
||||
<div class="alert">No messages</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
</div>
|
||||
{% endblock %}
|
@ -40,7 +40,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><a href="addresses">My Addresses</a></li>
|
||||
<li class="active"><i class="icon-map-marker icon-fixed-width"></i> {{ title }}</li>
|
||||
</ul>
|
||||
|
@ -6,7 +6,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-map-marker icon-fixed-width"></i> My Addresses</li>
|
||||
</ul>
|
||||
<p><a class="btn btn-default" href="address"><i class="icon-plus"> New Address</i></a></p>
|
||||
|
Loading…
Reference in New Issue
Block a user