Merge branch 'customer-login'
This commit is contained in:
commit
512113ae51
@ -395,7 +395,7 @@ erpnext.POS = Class.extend({
|
||||
});
|
||||
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);
|
||||
|
54
config.json
54
config.json
@ -101,13 +101,51 @@
|
||||
},
|
||||
"order": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/order",
|
||||
"args_method": "selling.doctype.sales_order.sales_order.get_website_args"
|
||||
"template": "app/website/templates/pages/sale",
|
||||
"args_method": "website.helpers.transaction.get_order_args",
|
||||
"portal": {
|
||||
"doctype": "Sales Order",
|
||||
"conditions": {
|
||||
"docstatus": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"invoice": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sale",
|
||||
"args_method": "website.helpers.transaction.get_invoice_args",
|
||||
"portal": {
|
||||
"doctype": "Sales Invoice",
|
||||
"conditions": {
|
||||
"docstatus": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"invoices": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sales_transactions",
|
||||
"args_method": "website.helpers.transaction.invoice_list_args"
|
||||
},
|
||||
"shipment": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sale",
|
||||
"args_method": "website.helpers.transaction.get_shipment_args",
|
||||
"portal": {
|
||||
"doctype": "Delivery Note",
|
||||
"conditions": {
|
||||
"docstatus": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipments": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sales_transactions",
|
||||
"args_method": "website.helpers.transaction.shipment_list_args"
|
||||
},
|
||||
"product_search": {
|
||||
"template": "app/website/templates/pages/product_search"
|
||||
@ -115,10 +153,14 @@
|
||||
"ticket": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/ticket",
|
||||
"args_method": "support.doctype.support_ticket.support_ticket.get_website_args"
|
||||
"args_method": "support.doctype.support_ticket.support_ticket.get_website_args",
|
||||
"portal": {
|
||||
"doctype": "Support Ticket"
|
||||
}
|
||||
},
|
||||
"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,
|
||||
|
@ -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",
|
||||
|
@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
// 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 +17,7 @@ erpnext.send_message = function(opts) {
|
||||
|
||||
wn.call = function(opts) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).attr("disabled", "disabled");
|
||||
$(opts.btn).prop("disabled", true);
|
||||
}
|
||||
|
||||
if(opts.msg) {
|
||||
@ -51,7 +50,7 @@ wn.call = function(opts) {
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(opts.btn) {
|
||||
$(opts.btn).attr("disabled", false);
|
||||
$(opts.btn).prop("disabled", false);
|
||||
}
|
||||
if(data.exc) {
|
||||
if(opts.btn) {
|
||||
@ -200,7 +199,7 @@ $.extend(wn.cart, {
|
||||
update_cart: function(opts) {
|
||||
if(!full_name) {
|
||||
if(localStorage) {
|
||||
localStorage.setItem("last_visited", window.location.pathname.slice(1));
|
||||
localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]);
|
||||
localStorage.setItem("pending_add_to_cart", opts.item_code);
|
||||
}
|
||||
window.location.href = "login";
|
||||
@ -230,3 +229,25 @@ $.extend(wn.cart, {
|
||||
$(".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]);
|
||||
}
|
||||
window.location.href = "login";
|
||||
}
|
||||
}
|
@ -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,55 +286,6 @@ class DocType(SellingController):
|
||||
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")
|
||||
bean = webnotes.bean("Sales Order", webnotes.form_dict.name)
|
||||
if bean.doc.customer != customer:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"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")
|
||||
|
@ -100,11 +100,11 @@ erpnext.StockLedger = erpnext.StockGridReport.extend({
|
||||
|
||||
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);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -115,11 +115,11 @@ erpnext.StockLevel = erpnext.StockGridReport.extend({
|
||||
|
||||
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);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -74,17 +74,6 @@ def set_status(name, status):
|
||||
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:
|
||||
|
@ -3,7 +3,7 @@ $(document).ready(function() {
|
||||
|
||||
$("#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 @@ $(document).ready(function() {
|
||||
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 @@ $(document).ready(function() {
|
||||
})
|
||||
return false;
|
||||
})
|
||||
.attr("disabled", false);
|
||||
.prop("disabled", false);
|
||||
})
|
@ -157,21 +157,32 @@ fieldset {
|
||||
}
|
||||
|
||||
/* 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,
|
||||
@ -187,3 +198,7 @@ fieldset[disabled] .btn-default.active {
|
||||
background-color: #a7a9aa;
|
||||
border-color: #a7a9aa;
|
||||
}
|
||||
|
||||
.label {
|
||||
padding-top: 0.3em;
|
||||
}
|
139
website/helpers/transaction.py
Normal file
139
website/helpers/transaction.py
Normal file
@ -0,0 +1,139 @@
|
||||
# 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"
|
||||
}
|
||||
|
||||
def get_transaction_args(doctype, name):
|
||||
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
|
||||
"customer")
|
||||
|
||||
bean = webnotes.bean(doctype, name)
|
||||
if bean.doc.customer != customer:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
|
||||
def get_order_args():
|
||||
args = get_transaction_args("Sales Order", webnotes.form_dict.name)
|
||||
args.update({
|
||||
"parent_link": "orders",
|
||||
"parent_title": "My Orders"
|
||||
})
|
||||
return args
|
||||
|
||||
def get_invoice_args():
|
||||
args = get_transaction_args("Sales Invoice", webnotes.form_dict.name)
|
||||
args.update({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
return args
|
||||
|
||||
def get_shipment_args():
|
||||
args = get_transaction_args("Delivery Note", webnotes.form_dict.name)
|
||||
args.update({
|
||||
"parent_link": "shipments",
|
||||
"parent_title": "Shipments"
|
||||
})
|
||||
return args
|
@ -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> |
|
||||
|
59
website/templates/html/transactions.html
Normal file
59
website/templates/html/transactions.html
Normal file
@ -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 %}
|
@ -8,12 +8,20 @@
|
||||
<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 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 %}
|
@ -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>
|
||||
|
@ -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">
|
||||
|
@ -7,10 +7,10 @@
|
||||
<ul class="breadcrumb">
|
||||
<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><a href="invoices">Invoices</a></li>
|
||||
<li class="active"><i class="icon-file-text 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;">
|
31
website/templates/pages/messages.html
Normal file
31
website/templates/pages/messages.html
Normal file
@ -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 %}
|
@ -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 %}
|
@ -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>
|
||||
|
90
website/templates/pages/sale.html
Normal file
90
website/templates/pages/sale.html
Normal file
@ -0,0 +1,90 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
{% 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><a href="{{ parent_link }}">{{ parent_title }}</a></li>
|
||||
<li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
|
||||
</ul>
|
||||
<h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
|
||||
{% if doc.name == "Not Allowed" -%}
|
||||
<script>ask_to_login();</script>
|
||||
{% else %}
|
||||
<hr>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
{% if doc.status -%}<div class="label label-default">{{ doc.status }}</div>{%- endif %}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<span class="pull-right">{{ utils.formatdate(doc.posting_date or doc.transaction_date) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Sr</th>
|
||||
<th>Item Name</th>
|
||||
<th>Description</th>
|
||||
<th>Qty</th>
|
||||
<th>UoM</th>
|
||||
<th>Basic Rate</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
{%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %}
|
||||
<tr>
|
||||
<td style="width: 3%;">{{ row.idx }}</td>
|
||||
<td style="width: 20%;">{{ row.item_name }}</td>
|
||||
<td style="width: 37%;">{{ row.description }}</td>
|
||||
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-6">
|
||||
<table cellspacing=0 width=100%>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Net Total</td>
|
||||
<td width=40% style="text-align: right;">{{
|
||||
utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
|
||||
}}</td>
|
||||
</tr>
|
||||
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||
{%- if not charge.included_in_print_rate -%}
|
||||
<tr>
|
||||
<td>{{ charge.description }}</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
<tr>
|
||||
<td>Grand Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
<tr style='font-weight: bold'>
|
||||
<td>Rounded Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% endblock %}
|
25
website/templates/pages/sales_transactions.html
Normal file
25
website/templates/pages/sales_transactions.html
Normal file
@ -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 %}
|
@ -2,39 +2,56 @@
|
||||
|
||||
{% 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> <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>
|
||||
{% 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">
|
||||
<div class="label">{{ doc.status }}</div>
|
||||
<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-7">
|
||||
{{ doc.subject }}
|
||||
<div class="col-md-8">
|
||||
<div class="row col-md-12">{{ doc.subject }}</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ utils.formatdate(doc.transaction_date) }}
|
||||
<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 style="font-size: 13px;">
|
||||
<div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<tbody>
|
||||
{%- for comm in doclist.get({"doctype":"Communication"}) %}
|
||||
<tr>
|
||||
<td>
|
||||
<h5>{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5>
|
||||
<p>{{ comm.content }}</p>
|
||||
<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 -%}
|
||||
@ -45,5 +62,6 @@
|
||||
<div class="alert">No messages</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,53 +1,31 @@
|
||||
{% 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;
|
||||
var status_label = {
|
||||
"Open": "label-success",
|
||||
"Waiting for Customer": "label-danger",
|
||||
"Closed": "label-default"
|
||||
}
|
||||
|
||||
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");
|
||||
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";
|
||||
|
||||
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 %}
|
||||
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
|
||||
<div class="row">\
|
||||
<div class="col-md-2" style="margin-bottom: 7px;"><span class="label %(label_class)s">\
|
||||
%(status)s</span></div>\
|
||||
<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-2 pull-right">\
|
||||
<span class="text-muted">%(creation)s</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
{%- endblock %}
|
77
website/templates/pages/transaction_list.html
Normal file
77
website/templates/pages/transaction_list.html
Normal file
@ -0,0 +1,77 @@
|
||||
{% 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" style="display: none;">More</button></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
global_number_format = "{{ global_number_format }}";
|
||||
currency = "{{ currency }}";
|
||||
wn.currency_symbols = {{ currency_symbols }};
|
||||
|
||||
$(document).ready(function() {
|
||||
var start = 0;
|
||||
var $list = $(".transaction-list");
|
||||
|
||||
var $show_more = $(".btn-show-more").on("click", function() {
|
||||
get_transactions(this);
|
||||
});
|
||||
|
||||
var get_transactions = function(btn) {
|
||||
wn.call({
|
||||
method: "{{ method }}",
|
||||
args: { start: start },
|
||||
btn: btn,
|
||||
callback: function(r) {
|
||||
$list.find(".progress").remove();
|
||||
$show_more.toggle(!(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) {
|
||||
doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
|
||||
|
||||
var $row = $(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);
|
||||
};
|
||||
|
||||
get_transactions();
|
||||
});
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user