Merge branch 'master' of github.com:webnotes/erpnext into customer-login
diff --git a/accounts/doctype/sales_invoice/pos.js b/accounts/doctype/sales_invoice/pos.js
index 1bd6de1..b5a781c 100644
--- a/accounts/doctype/sales_invoice/pos.js
+++ b/accounts/doctype/sales_invoice/pos.js
@@ -395,7 +395,7 @@
});
dialog.show();
- dialog.get_input("total_amount").attr("disabled", "disabled");
+ dialog.get_input("total_amount").prop("disabled", true);
dialog.fields_dict.pay.input.onclick = function() {
cur_frm.set_value("mode_of_payment", dialog.get_values().mode_of_payment);
diff --git a/config.json b/config.json
index ef5a164..61df211 100644
--- a/config.json
+++ b/config.json
@@ -106,8 +106,23 @@
},
"orders": {
"no_cache": true,
- "template": "app/website/templates/pages/orders",
- "args_method": "selling.doctype.sales_order.sales_order.get_currency_and_number_format"
+ "template": "app/website/templates/pages/sales_transactions",
+ "args_method": "website.helpers.transaction.order_list_args"
+ },
+ "invoices": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/sales_transactions",
+ "args_method": "website.helpers.transaction.invoice_list_args"
+ },
+ "shipments": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/sales_transactions",
+ "args_method": "website.helpers.transaction.shipment_list_args"
+ },
+ "messages": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/messages",
+ "args_method": "website.helpers.transaction.message_list_args"
},
"product_search": {
"template": "app/website/templates/pages/product_search"
@@ -118,7 +133,8 @@
"args_method": "support.doctype.support_ticket.support_ticket.get_website_args"
},
"tickets": {
- "template": "app/website/templates/pages/tickets"
+ "template": "app/website/templates/pages/tickets",
+ "args_method": "website.helpers.transaction.ticket_list_args"
},
"address": {
"no_cache": true,
diff --git a/public/build.json b/public/build.json
index 24abde2..b8d7dd4 100644
--- a/public/build.json
+++ b/public/build.json
@@ -7,8 +7,7 @@
"app/public/js/startup.css"
],
"public/js/all-web.min.js": [
- "app/public/js/website_utils.js",
- "lib/public/js/wn/misc/number_format.js"
+ "app/public/js/website_utils.js"
],
"public/js/all-app.min.js": [
"app/public/js/startup.js",
diff --git a/public/js/website_utils.js b/public/js/website_utils.js
index 95cae1b..1b7f0f7 100644
--- a/public/js/website_utils.js
+++ b/public/js/website_utils.js
@@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt
-var erpnext = {};
-var wn = {};
+if(!window.erpnext) erpnext = {};
+if(!window.wn) wn = {};
// Add / update a new Lead / Communication
// subject, sender, description
@@ -18,7 +18,7 @@
wn.call = function(opts) {
if(opts.btn) {
- $(opts.btn).attr("disabled", "disabled");
+ $(opts.btn).prop("disabled", true);
}
if(opts.msg) {
@@ -51,7 +51,7 @@
dataType: "json",
success: function(data) {
if(opts.btn) {
- $(opts.btn).attr("disabled", false);
+ $(opts.btn).prop("disabled", false);
}
if(data.exc) {
if(opts.btn) {
@@ -229,4 +229,17 @@
if(cart_count)
$(".cart-count").html("( "+ cart_count +" )")
}
-});
\ No newline at end of file
+});
+
+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;
+}
\ No newline at end of file
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 8e3ed70..604c5eb 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -4,7 +4,6 @@
from __future__ import unicode_literals
import webnotes
import webnotes.utils
-import json
from webnotes.utils import cstr, flt, getdate
from webnotes.model.bean import getlist
@@ -287,31 +286,6 @@
def on_update(self):
pass
-@webnotes.whitelist()
-def get_orders():
- # find customer id
- customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
- "customer")
-
- if customer:
- orders = webnotes.conn.sql("""select
- name, creation, currency from `tabSales Order`
- where customer=%s
- and docstatus=1
- order by creation desc
- limit 20
- """, customer, as_dict=1)
- for order in orders:
- order.items = webnotes.conn.sql("""select
- item_name, qty, export_rate, export_amount, delivered_qty, stock_uom
- from `tabSales Order Item`
- where parent=%s
- order by idx""", order.name, as_dict=1)
-
- return orders
- else:
- return []
-
def get_website_args():
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer")
@@ -325,17 +299,9 @@
"doc": bean.doc,
"doclist": bean.doclist,
"webnotes": webnotes,
- "utils": webnotes.utils
+ "utils": webnotes.utils,
}
-def get_currency_and_number_format():
- return {
- "global_number_format": webnotes.conn.get_default("number_format") or "#,###.##",
- "currency": webnotes.conn.get_default("currency"),
- "currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol
- from tabCurrency where ifnull(enabled,0)=1""")))
- }
-
def set_missing_values(source, target):
bean = webnotes.bean(target)
bean.run_method("onload_post_render")
diff --git a/stock/page/stock_ledger/stock_ledger.js b/stock/page/stock_ledger/stock_ledger.js
index dacd78c..c83fc0e 100644
--- a/stock/page/stock_ledger/stock_ledger.js
+++ b/stock/page/stock_ledger/stock_ledger.js
@@ -100,11 +100,11 @@
toggle_enable_brand: function() {
if(!this.filter_inputs.item_code.val()) {
- this.filter_inputs.brand.removeAttr("disabled");
+ this.filter_inputs.brand.prop("disabled", false);
} else {
this.filter_inputs.brand
.val(this.filter_inputs.brand.get(0).opts.default_value)
- .attr("disabled", "disabled");
+ .prop("disabled", true);
}
},
diff --git a/stock/page/stock_level/stock_level.js b/stock/page/stock_level/stock_level.js
index 0699b7d..df7c8c5 100644
--- a/stock/page/stock_level/stock_level.js
+++ b/stock/page/stock_level/stock_level.js
@@ -115,11 +115,11 @@
toggle_enable_brand: function() {
if(!this.filter_inputs.item_code.val()) {
- this.filter_inputs.brand.removeAttr("disabled");
+ this.filter_inputs.brand.prop("disabled", false);
} else {
this.filter_inputs.brand
.val(this.filter_inputs.brand.get(0).opts.default_value)
- .attr("disabled", "disabled");
+ .prop("disabled", true);
}
},
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 2b8fe85..5e0ffd5 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -73,17 +73,6 @@
st.doc.status = status
st.save()
-@webnotes.whitelist()
-def get_tickets():
- tickets = webnotes.conn.sql("""select
- name, subject, status
- from `tabSupport Ticket`
- where raised_by=%s
- order by modified desc
- limit 20""",
- webnotes.session.user, as_dict=1)
- return tickets
-
def get_website_args():
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
if bean.doc.raised_by != webnotes.session.user:
diff --git a/utilities/demo/demo-login.js b/utilities/demo/demo-login.js
index 229d169..509057b 100644
--- a/utilities/demo/demo-login.js
+++ b/utilities/demo/demo-login.js
@@ -3,7 +3,7 @@
$("#login_btn").click(function() {
var me = this;
- $(this).html("Logging In...").attr("disabled", "disabled");
+ $(this).html("Logging In...").prop("disabled", true);
wn.call({
"method": "login",
args: {
@@ -12,7 +12,7 @@
lead_email: $("#lead-email").val(),
},
callback: function(r) {
- $(me).attr("disabled", false);
+ $(me).prop("disabled", false);
if(r.exc) {
alert("Error, please contact support@erpnext.com");
} else {
@@ -23,5 +23,5 @@
})
return false;
})
- .attr("disabled", false);
+ .prop("disabled", false);
})
\ No newline at end of file
diff --git a/website/css/website.css b/website/css/website.css
index 24553d9..47a969c 100644
--- a/website/css/website.css
+++ b/website/css/website.css
@@ -157,21 +157,32 @@
}
/* buttons */
+
.btn-default {
color: #ffffff;
background-color: #a7a9aa;
border-color: #a7a9aa;
}
+.dropup .btn-default .caret,
+.btn-default .caret {
+ border-bottom-color: #ffffff;
+ border-top-color: #ffffff;
+}
+
.btn-default:hover,
.btn-default:focus,
.btn-default:active,
-.btn-default.active {
- color: #ffffff;
+.btn-default.active,
+.open .dropdown-toggle.btn-default {
background-color: #9a9c9d;
border-color: #8d9091;
+ color: #ffffff;
}
+.btn-default.disabled,
+.btn-default[disabled],
+fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
@@ -186,4 +197,4 @@
fieldset[disabled] .btn-default.active {
background-color: #a7a9aa;
border-color: #a7a9aa;
-}
\ No newline at end of file
+}
diff --git a/website/helpers/transaction.py b/website/helpers/transaction.py
new file mode 100644
index 0000000..1aded2e
--- /dev/null
+++ b/website/helpers/transaction.py
@@ -0,0 +1,119 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+from webnotes.utils import cint, formatdate
+import json
+
+def get_transaction_list(doctype, start):
+ # find customer id
+ customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
+ "customer")
+
+ if customer:
+ transactions = webnotes.conn.sql("""select name, creation, currency, grand_total_export
+ from `tab%s` where customer=%s and docstatus=1
+ order by creation desc
+ limit %s, 20""" % (doctype, "%s", "%s"), (customer, cint(start)), as_dict=True)
+ for doc in transactions:
+ doc.items = ", ".join(webnotes.conn.sql_list("""select item_name
+ from `tab%s Item` where parent=%s limit 5""" % (doctype, "%s"), doc.name))
+ doc.creation = formatdate(doc.creation)
+ return transactions
+ else:
+ return []
+
+def get_common_args():
+ return {
+ "global_number_format": webnotes.conn.get_default("number_format") or "#,###.##",
+ "currency": webnotes.conn.get_default("currency"),
+ "currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol
+ from tabCurrency where ifnull(enabled,0)=1""")))
+ }
+
+@webnotes.whitelist()
+def get_orders(start=0):
+ return get_transaction_list("Sales Order", start)
+
+def order_list_args():
+ args = get_common_args()
+ args.update({
+ "title": "My Orders",
+ "method": "website.helpers.transaction.get_orders",
+ "icon": "icon-list",
+ "empty_list_message": "No Orders Yet",
+ "page": "order",
+ })
+ return args
+
+@webnotes.whitelist()
+def get_invoices(start=0):
+ return get_transaction_list("Sales Invoice", start)
+
+def invoice_list_args():
+ args = get_common_args()
+ args.update({
+ "title": "Invoices",
+ "method": "website.helpers.transaction.get_invoices",
+ "icon": "icon-file-text",
+ "empty_list_message": "No Invoices Found",
+ "page": "invoice"
+ })
+ return args
+
+@webnotes.whitelist()
+def get_shipments(start=0):
+ return get_transaction_list("Delivery Note", start)
+
+def shipment_list_args():
+ args = get_common_args()
+ args.update({
+ "title": "Shipments",
+ "method": "website.helpers.transaction.get_shipments",
+ "icon": "icon-truck",
+ "empty_list_message": "No Shipments Found",
+ "page": "shipment"
+ })
+ return args
+
+@webnotes.whitelist()
+def get_tickets(start=0):
+ tickets = webnotes.conn.sql("""select name, subject, status, creation
+ from `tabSupport Ticket` where raised_by=%s
+ order by modified desc
+ limit %s, 20""", (webnotes.session.user, cint(start)), as_dict=True)
+ for t in tickets:
+ t.creation = formatdate(t.creation)
+
+ return tickets
+
+def ticket_list_args():
+ return {
+ "title": "My Tickets",
+ "method": "website.helpers.transaction.get_tickets",
+ "icon": "icon-ticket",
+ "empty_list_message": "No Tickets Raised",
+ "page": "ticket"
+ }
+
+@webnotes.whitelist()
+def get_messages(start=0):
+ search_term = "%%%s%%" % webnotes.session.user
+ messages = webnotes.conn.sql("""select name, subject, creation,
+ sender, recipients, content
+ from `tabCommunication` where sender like %s or recipients like %s
+ order by creation desc
+ limit %s, 20""", (search_term, search_term, cint(start)), as_dict=True)
+ for m in messages:
+ m.creation = formatdate(m.creation)
+
+ return messages
+
+def message_list_args():
+ return {
+ "title": "Messages",
+ "method": "website.helpers.transaction.get_messages",
+ "icon": "icon-comments",
+ "empty_list_message": "No Messages Found",
+ }
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
index 462f4dd..3ecb057 100644
--- a/website/templates/html/outer.html
+++ b/website/templates/html/outer.html
@@ -11,8 +11,7 @@
<a id="login-link" href="login">Login</a>
</div>
<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login">
- <a href="profile" title="My Profile" id="user-full-name"></a> |
- <a href="account" title="My Account">My Account</a> |
+ <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> |
diff --git a/website/templates/html/transactions.html b/website/templates/html/transactions.html
new file mode 100644
index 0000000..1e61124
--- /dev/null
+++ b/website/templates/html/transactions.html
@@ -0,0 +1,59 @@
+{% extends "app/website/templates/html/page.html" %}
+
+{% block content -%}
+<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">
+ <div class="progress progress-striped active">
+ <div class="progress-bar progress-bar-info" style="width: 100%;"></div>
+ </div>
+ </div>
+ <div class="text-center">
+ <button class="btn btn-default btn-show-more hide">More</button>
+ </div>
+</div>
+{%- endblock %}
+
+{% block javascript -%}
+$(document).ready(function() {
+ window.start = 0;
+ window.$list = $(".transaction-list");
+ window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); })
+
+ get_transactions();
+});
+
+var get_transactions = function(btn) {
+ wn.call({
+ method: "{{ method }}",
+ args: { start: start },
+ btn: btn,
+ callback: function(r) {
+ $list.find(".progress").remove();
+ $show_more.toggleClass("hide", !(r.message && r.message.length===20));
+
+ if(!(r.message && r.message.length)) {
+ console.log("empty");
+ if(!$list.html().trim()) {
+ $list.html("<div class='alert alert-warning'>\
+ {{ empty_list_message }}</div>");
+ }
+ return;
+ }
+
+ start += r.message.length;
+
+ $.each(r.message, function(i, doc) {
+ render(doc);
+ });
+ }
+ })
+};
+
+// var render = function(doc) { };
+
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/account.html b/website/templates/pages/account.html
index 539e014..9d29589 100644
--- a/website/templates/pages/account.html
+++ b/website/templates/pages/account.html
@@ -8,12 +8,21 @@
<li><a href="index">Home</a></li>
<li class="active">My Account</li>
</ul>
- <h3>My Account</h3>
- <p><a href="profile"><i class="icon-user icon-fixed-width"></i> Change my name, password</a></p>
- <p><a href="addresses"><i class="icon-map-marker icon-fixed-width"></i> My Addresses</a></p>
- <p><a href="orders"><i class="icon-list icon-fixed-width"></i> My Orders</a></p>
- <p><a href="tickets"><i class="icon-tags icon-fixed-width"></i> My Tickets</a></p>
- <p><a href="server.py?cmd=web_logout"><i class="icon-signout icon-fixed-width"></i> Logout</a></p>
+ <!-- <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><a href="messages"><i class="icon-comments icon-fixed-width"></i> Messages</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 %}
\ No newline at end of file
diff --git a/website/templates/pages/address.html b/website/templates/pages/address.html
index faf7bb0..6544b12 100644
--- a/website/templates/pages/address.html
+++ b/website/templates/pages/address.html
@@ -42,9 +42,9 @@
<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">{{ title }}</li>
+ <li class="active"><i class="icon-map-marker icon-fixed-width"></i> {{ title }}</li>
</ul>
- <h3><i class="icon-map-marker"></i> {{ title }}</h3>
+ <h3><i class="icon-map-marker icon-fixed-width"></i> {{ title }}</h3>
<button type="button" class="btn btn-primary pull-right" id="address-save"><i class="icon-ok"></i>
{{ doc and "Save" or "Insert" }}</button>
<div class="clearfix"></div>
diff --git a/website/templates/pages/addresses.html b/website/templates/pages/addresses.html
index 90d0d13..04fc47b 100644
--- a/website/templates/pages/addresses.html
+++ b/website/templates/pages/addresses.html
@@ -7,10 +7,8 @@
<ul class="breadcrumb">
<li><a href="index">Home</a></li>
<li><a href="account">My Account</a></li>
- <li class="active">My Addresses</li>
+ <li class="active"><i class="icon-map-marker icon-fixed-width"></i> My Addresses</li>
</ul>
- <h3><i class="icon-map-marker icon-fixed-width"></i> My Addresses</h3>
- <hr>
<p><a class="btn btn-default" href="address"><i class="icon-plus"> New Address</i></a></p>
<hr>
<div id="address-list">
diff --git a/website/templates/pages/messages.html b/website/templates/pages/messages.html
new file mode 100644
index 0000000..e1ea8d0
--- /dev/null
+++ b/website/templates/pages/messages.html
@@ -0,0 +1,31 @@
+{% extends "app/website/templates/html/transactions.html" %}
+
+{% block javascript -%}
+{{ super() }}
+
+var render = function(doc) {
+ doc.sender = doc.sender ? doc.sender : "To ";
+ doc.recipients = doc.recipients ? (" to " + doc.recipients) : "";
+ doc.content = remove_script_and_style(doc.content);
+
+ if(!is_html(doc.content)) {
+ doc.content = doc.content.replace("\n", "<br>");
+ }
+
+ $(repl('<a class="list-group-item">\
+ <div class="row col-md-12">%(subject)s</div>\
+ <div class="row text-muted">\
+ <div class="col-md-6">%(sender)s%(recipients)s</div>\
+ <div class="col-md-6 text-right">%(creation)s</div>\
+ </div>\
+ <div class="row col-md-12 msg-content" style="display: none;"><hr>%(content)s</div>\
+ </a>', doc))
+ .appendTo($list)
+ .on("click", function() {
+ $(this).find(".msg-content").toggle();
+ });
+
+
+}
+
+{%- endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/order.html b/website/templates/pages/order.html
index 1893575..c70dcb1 100644
--- a/website/templates/pages/order.html
+++ b/website/templates/pages/order.html
@@ -8,9 +8,9 @@
<li><a href="index">Home</a></li>
<li><a href="account">My Account</a></li>
<li><a href="orders">My Orders</a></li>
- <li class="active">{{ doc.name }}</li>
+ <li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
</ul>
- <h3><i class="icon-file"></i> {{ doc.name }}</h3>
+ <h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
<hr>
{%- if doc.status -%}
<div style="font-size: 13px;">
diff --git a/website/templates/pages/orders.html b/website/templates/pages/orders.html
deleted file mode 100644
index e0bf4d7..0000000
--- a/website/templates/pages/orders.html
+++ /dev/null
@@ -1,70 +0,0 @@
-{% extends "app/website/templates/html/page.html" %}
-
-{% set title="My Orders" %}
-
-{% block content %}
-<script>
-global_number_format = "{{ global_number_format }}";
-currency = "{{ currency }}";
-wn.currency_symbols = {{ currency_symbols }};
-</script>
-<div class="col-md-12">
- <ul class="breadcrumb">
- <li><a href="index">Home</a> <span class="divider">/</span></li>
- <li><a href="account">My Account</a> <span class="divider">/</span></li>
- <li class="active">My Orders</li>
- </ul>
- <h3><i class="icon-list icon-fixed-width"></i> My Orders</h3>
- <hr>
- <div id="order-list" style="font-size: 13px;">
- <div class="progress progress-striped active">
- <div class="progress-bar progress-bar-info" style="width: 100%;"></div>
- </div>
- </div>
-</div>
-<script>
-$(document).ready(function() {
- var order_start = 0;
-
- wn.call({
- method: "selling.doctype.sales_order.sales_order.get_orders",
- args: {
- start: order_start
- },
- callback: function(r) {
- $("#order-list .progress").remove();
- var $list = $("#order-list");
-
- if(!(r.message && r.message.length)) {
- $list.html("<div class='alert'>No Orders Yet</div>");
- return;
- }
-
- $.each(r.message, function(i, order) {
-
- // parent
- var $order = $(repl('<div class="row">\
- <div class="col-md-3"><a href="order?name=%(name)s">%(name)s</a></div>\
- <div class="col-md-9"></div>\
- </div>', order)).appendTo($list);
-
- // items
- $.each(order.items || [], function(i, item) {
- item.export_rate = format_currency(item.export_rate, order.currency);
- item.export_amount = format_currency(item.export_amount, order.currency);
- var $item = $(repl('<div class="row">\
- <div class="col-md-3">%(item_name)s</div>\
- <div class="col-md-2" style="text-align: right;">%(export_rate)s</div>\
- <div class="col-md-2" style="text-align: right;">%(qty)s %(stock_uom)s</div>\
- <div class="col-md-2" style="text-align: right;">%(export_amount)s</div>\
- </div>\
- </div>', item)).appendTo($order.find(".col-md-9"));
- });
-
- $("<hr>").appendTo($list);
- });
- }
- })
-})
-</script>
-{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/profile.html b/website/templates/pages/profile.html
index ea2433b..4c03b40 100644
--- a/website/templates/pages/profile.html
+++ b/website/templates/pages/profile.html
@@ -5,12 +5,10 @@
{% block content %}
<div class="col-md-12">
<ul class="breadcrumb">
- <li><a href="index">Home</a> <span class="divider">/</span></li>
- <li><a href="account">My Account</a> <span class="divider">/</span></li>
- <li class="active">My Profile</li>
+ <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>
- <h2><i class="icon-user"></i> My Profile</h2>
- <hr>
<div class="alert" id="message" style="display: none;"></div>
<form>
<fieldset>
diff --git a/website/templates/pages/sales_transactions.html b/website/templates/pages/sales_transactions.html
new file mode 100644
index 0000000..7215339
--- /dev/null
+++ b/website/templates/pages/sales_transactions.html
@@ -0,0 +1,25 @@
+{% extends "app/website/templates/html/transactions.html" %}
+
+{% block javascript -%}
+global_number_format = "{{ global_number_format }}";
+currency = "{{ currency }}";
+wn.currency_symbols = {{ currency_symbols }};
+
+{{ super() }}
+
+var render = function(doc) {
+ doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
+
+ $(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
+ <div class="row">\
+ <div class="col-md-6">\
+ <div class="row col-md-12">%(name)s</div>\
+ <div class="row col-md-12 text-muted">%(items)s...</div>\
+ </div>\
+ <div class="col-md-3 text-right">%(grand_total_export)s</div>\
+ <div class="col-md-3 text-right text-muted">%(creation)s</div>\
+ </div>\
+ </a>', doc)).appendTo($list);
+};
+
+{%- endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/ticket.html b/website/templates/pages/ticket.html
index 1ae2e88..2f85ac0 100644
--- a/website/templates/pages/ticket.html
+++ b/website/templates/pages/ticket.html
@@ -5,12 +5,12 @@
{% block content %}
<div class="col-md-12">
<ul class="breadcrumb">
- <li><a href="index">Home</a> <span class="divider">/</span></li>
- <li><a href="account">My Account</a> <span class="divider">/</span></li>
- <li><a href="tickets">My Tickets</a> <span class="divider">/</span></li>
- <li class="active">{{ doc.name }}</li>
+ <li><a href="index">Home</a></li>
+ <li><a href="account">My Account</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-file"></i> {{ doc.name }}</h3>
+ <h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3>
<hr>
{%- if doc.status -%}
<div class="row">
diff --git a/website/templates/pages/tickets.html b/website/templates/pages/tickets.html
index 3d5cf21..248384d 100644
--- a/website/templates/pages/tickets.html
+++ b/website/templates/pages/tickets.html
@@ -1,53 +1,35 @@
-{% extends "app/website/templates/html/page.html" %}
+{% extends "app/website/templates/html/transactions.html" %}
-{% set title="My Tickets" %}
+{% block javascript -%}
+{{ super() }}
-{% block content %}
-<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">My Tickets</li>
- </ul>
- <h3><i class="icon-tags icon-fixed-width"></i> My Tickets</h3>
- <hr>
- <div id="ticket-list" style="font-size: 13px;">
- <div class="progress progress-striped active">
- <div class="progress-bar progress-bar-info" style="width: 100%;"></div>
- </div>
- </div>
-</div>
-<script>
-$(document).ready(function() {
- var order_start = 0;
-
- wn.call({
- method: "support.doctype.support_ticket.support_ticket.get_tickets",
- args: {
- start: order_start
- },
- callback: function(r) {
- $("#ticket-list .progress").remove();
- var $list = $("#ticket-list");
-
- if(!(r.message && r.message.length)) {
- $list.html("<div class='alert'>No Tickets Yet</div>");
- return;
- }
-
- $.each(r.message, function(i, ticket) {
-
- // parent
- var $ticket = $(repl('<div class="row">\
- <div class="col-md-2"><span class="label">%(status)s</span></div>\
- <div class="col-md-3"><a href="ticket?name=%(name)s">%(name)s</a></div>\
- <div class="col-md-7">%(subject)s</div>\
- </div>', ticket)).appendTo($list);
-
- $("<hr>").appendTo($list);
- });
- }
- })
-})
-</script>
-{% endblock %}
\ No newline at end of file
+var status_label = {
+ "Open": "label-success",
+ "Waiting for Customer": "label-danger",
+ "Closed": "label-default"
+}
+
+var render = function(doc) {
+ doc.status = doc.status.trim();
+ doc.label_class = status_label[doc.status] || "label-default";
+ if(doc.status==="Waiting for Customer") doc.status = "To Reply";
+
+ $(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
+ <div class="row">\
+ <div class="col-md-8">\
+ <div class="row col-md-12">%(name)s</div>\
+ <div class="row col-md-12 text-muted">%(subject)s</div>\
+ </div>\
+ <div class="col-md-4">\
+ <div class="pull-left">\
+ <span class="label %(label_class)s" \
+ style="padding-top: 0.3em; margin-right: 5px;">%(status)s</span>\
+ </div>\
+ <div class="pull-right">\
+ <span class="text-muted">%(creation)s</span>\
+ </div>\
+ </div>\
+ </div>\
+ </a>', doc)).appendTo($list);
+};
+{%- endblock %}
\ No newline at end of file