[website] [minor] moving to framework
This commit is contained in:
parent
429fd1d3d8
commit
330dae90cb
@ -10,7 +10,6 @@ def execute():
|
||||
# remove pyc files
|
||||
utils_pyc = os.path.join(get_base_path(), "app", "selling", "utils.pyc")
|
||||
if os.path.exists(utils_pyc):
|
||||
print exists
|
||||
os.remove(utils_pyc)
|
||||
|
||||
shutil.rmtree(os.path.join(get_base_path(), "app", "website"))
|
||||
|
0
portal/__init__.py
Normal file
0
portal/__init__.py
Normal file
0
portal/templates/__init__.py
Normal file
0
portal/templates/__init__.py
Normal file
@ -1,20 +1,22 @@
|
||||
{% extends "lib/website/templates/base.html" %}
|
||||
|
||||
{% block toolbar %}
|
||||
<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 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 %}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% block content -%}
|
||||
<div class="col-md-12">
|
||||
@ -19,6 +19,7 @@
|
||||
{%- endblock %}
|
||||
|
||||
{% block javascript -%}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
window.start = 0;
|
||||
window.$list = $(".transaction-list");
|
||||
@ -53,7 +54,7 @@ var get_transactions = function(btn) {
|
||||
}
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
||||
// var render = function(doc) { };
|
||||
|
||||
<!-- // var render = function(doc) { }; -->
|
||||
{% endblock %}
|
@ -1,88 +0,0 @@
|
||||
{% 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="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 icon-fixed-width"></i> {{ doc.name }}</h3>
|
||||
<hr>
|
||||
{%- if doc.status -%}
|
||||
<div style="font-size: 13px;">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="label">{{ doc.status }}</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ utils.formatdate(doc.transaction_date) }}
|
||||
</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":"Sales Order 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 %}
|
0
portal/templates/pages/__init__.py
Normal file
0
portal/templates/pages/__init__.py
Normal file
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Account" %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% block javascript %}
|
||||
{% include "app/website/templates/js/cart.js" %}
|
1
portal/templates/pages/invoice.html
Normal file
1
portal/templates/pages/invoice.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
14
portal/templates/pages/invoice.py
Normal file
14
portal/templates/pages/invoice.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_transaction_context
|
||||
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
|
||||
context.update({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
return context
|
1
portal/templates/pages/invoices.html
Normal file
1
portal/templates/pages/invoices.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sales_transactions.html" %}
|
22
portal/templates/pages/invoices.py
Normal file
22
portal/templates/pages/invoices.py
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Invoices",
|
||||
"method": "portal.templates.pages.invoices.get_invoices",
|
||||
"icon": "icon-file-text",
|
||||
"empty_list_message": "No Invoices Found",
|
||||
"page": "invoice"
|
||||
})
|
||||
return context
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_invoices(start=0):
|
||||
from portal.website_transactions import get_transaction_list
|
||||
return get_transaction_list("Sales Invoice", start)
|
1
portal/templates/pages/order.html
Normal file
1
portal/templates/pages/order.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
14
portal/templates/pages/order.py
Normal file
14
portal/templates/pages/order.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_transaction_context
|
||||
context = get_transaction_context("Sales Order", webnotes.form_dict.name)
|
||||
context.update({
|
||||
"parent_link": "orders",
|
||||
"parent_title": "My Orders"
|
||||
})
|
||||
return context
|
1
portal/templates/pages/orders.html
Normal file
1
portal/templates/pages/orders.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sales_transactions.html" %}
|
23
portal/templates/pages/orders.py
Normal file
23
portal/templates/pages/orders.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "My Orders",
|
||||
"method": "portal.templates.pages.orders.get_orders",
|
||||
"icon": "icon-list",
|
||||
"empty_list_message": "No Orders Yet",
|
||||
"page": "order",
|
||||
})
|
||||
return context
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_orders(start=0):
|
||||
from portal.website_transactions import get_transaction_list
|
||||
return get_transaction_list("Sales Order", start)
|
||||
|
61
portal/templates/pages/profile.html
Normal file
61
portal/templates/pages/profile.html
Normal file
@ -0,0 +1,61 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Profile" %}
|
||||
|
||||
{% 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-user icon-fixed-width"></i> My Profile</li>
|
||||
</ul>
|
||||
<div class="alert" id="message" style="display: none;"></div>
|
||||
<form>
|
||||
<fieldset>
|
||||
<label>Full Name</label>
|
||||
<input class="form-control" type="text" id="fullname" placeholder="Your Name">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Password</label>
|
||||
<input class="form-control" type="password" id="password" placeholder="Password">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Company Name</label>
|
||||
<input class="form-control" type="text" id="company_name" placeholder="Company Name" value="{{ company_name }}">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Mobile No</label>
|
||||
<input class="form-control" type="text" id="mobile_no" placeholder="Mobile No" value="{{ mobile_no }}">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Phone</label>
|
||||
<input class="form-control" type="text" id="phone" placeholder="Phone" value="{{ phone }}">
|
||||
</fieldset>
|
||||
<button id="update_profile" type="submit" class="btn btn-default">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#fullname").val(getCookie("full_name") || "");
|
||||
$("#update_profile").click(function() {
|
||||
wn.call({
|
||||
method: "startup.webutils.update_profile",
|
||||
type: "POST",
|
||||
args: {
|
||||
fullname: $("#fullname").val(),
|
||||
password: $("#password").val(),
|
||||
company_name: $("#company_name").val(),
|
||||
mobile_no: $("#mobile_no").val(),
|
||||
phone: $("#phone").val()
|
||||
},
|
||||
btn: this,
|
||||
msg: $("#message"),
|
||||
callback: function(r) {
|
||||
if(!r.exc) $("#user-full-name").html($("#fullname").val());
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
1
portal/templates/pages/shipment.html
Normal file
1
portal/templates/pages/shipment.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
14
portal/templates/pages/shipment.py
Normal file
14
portal/templates/pages/shipment.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_transaction_context
|
||||
context = get_transaction_context("Delivery Note", webnotes.form_dict.name)
|
||||
context.update({
|
||||
"parent_link": "shipments",
|
||||
"parent_title": "Shipments"
|
||||
})
|
||||
return context
|
1
portal/templates/pages/shipments.html
Normal file
1
portal/templates/pages/shipments.html
Normal file
@ -0,0 +1 @@
|
||||
{% extends "app/portal/templates/sales_transactions.html" %}
|
22
portal/templates/pages/shipments.py
Normal file
22
portal/templates/pages/shipments.py
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
from portal.website_transactions import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Shipments",
|
||||
"method": "portal.templates.pages.shipments.get_shipments",
|
||||
"icon": "icon-truck",
|
||||
"empty_list_message": "No Shipments Found",
|
||||
"page": "shipment"
|
||||
})
|
||||
return context
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_shipments(start=0):
|
||||
from portal.website_transactions import get_transaction_list
|
||||
return get_transaction_list("Delivery Note", start)
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Profile" %}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<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" id="message" style="display: none;"></div>
|
||||
<div class="alert alert-warning" id="message" style="display: none;"></div>
|
||||
<form>
|
||||
<fieldset>
|
||||
<label>Full Name</label>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
|
@ -1,25 +1,28 @@
|
||||
{% extends "app/website/templates/html/transactions.html" %}
|
||||
{% extends "app/portal/templates/includes/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
global_number_format = "{{ global_number_format }}";
|
||||
currency = "{{ currency }}";
|
||||
wn.currency_symbols = {{ currency_symbols }};
|
||||
<script>
|
||||
global_number_format = "{{ global_number_format }}";
|
||||
currency = "{{ currency }}";
|
||||
wn.currency_symbols = {{ currency_symbols }};
|
||||
</script>
|
||||
|
||||
{{ super() }}
|
||||
|
||||
var render = function(doc) {
|
||||
doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
|
||||
<script>
|
||||
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>\
|
||||
$(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>\
|
||||
<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);
|
||||
};
|
||||
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
</script>
|
||||
{%- endblock %}
|
@ -1,77 +0,0 @@
|
||||
{% 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 %}
|
50
portal/website_transactions.py
Normal file
50
portal/website_transactions.py
Normal file
@ -0,0 +1,50 @@
|
||||
# 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_currency_context():
|
||||
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 get_transaction_context(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
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"public/css/all-web.css": [
|
||||
"app/public/js/startup.css",
|
||||
"app/website/css/website.css"
|
||||
],
|
||||
"public/css/all-app.css": [
|
||||
"app/public/js/startup.css"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="col-md-12 clearfix">
|
||||
<div class="row clearfix">
|
||||
<div class="pull-right" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<form class="form-search">
|
||||
<div class="input-group col-md-4 col-md-offset-8">
|
||||
|
@ -72,18 +72,4 @@ class DocType(TransactionBase):
|
||||
def set_status(name, status):
|
||||
st = webnotes.bean("Support Ticket", name)
|
||||
st.doc.status = status
|
||||
st.save()
|
||||
|
||||
def get_website_args():
|
||||
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
st.save()
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
19
support/doctype/support_ticket/templates/pages/ticket.py
Normal file
19
support/doctype/support_ticket/templates/pages/ticket.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_context():
|
||||
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
33
support/doctype/support_ticket/templates/pages/tickets.html
Normal file
33
support/doctype/support_ticket/templates/pages/tickets.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "app/portal/templates/includes/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
{{ super() }}
|
||||
|
||||
<script>
|
||||
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-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);
|
||||
};
|
||||
</script>
|
||||
{%- endblock %}
|
26
support/doctype/support_ticket/templates/pages/tickets.py
Normal file
26
support/doctype/support_ticket/templates/pages/tickets.py
Normal file
@ -0,0 +1,26 @@
|
||||
# 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
|
||||
|
||||
def get_context():
|
||||
return {
|
||||
"title": "My Tickets",
|
||||
"method": "support.doctype.support_ticket.templates.pages.tickets.get_tickets",
|
||||
"icon": "icon-ticket",
|
||||
"empty_list_message": "No Tickets Raised",
|
||||
"page": "ticket"
|
||||
}
|
||||
|
||||
@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
|
@ -1,31 +0,0 @@
|
||||
{% extends "app/website/templates/html/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
{{ super() }}
|
||||
|
||||
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-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 %}
|
@ -51,25 +51,3 @@ class DocType:
|
||||
webnotes.conn.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
|
||||
(is_address_type, fieldname, "%s", "%s"), (self.doc.fields[fieldname], self.doc.name))
|
||||
break
|
||||
|
||||
def get_website_args():
|
||||
def _get_fields(fieldnames):
|
||||
return [webnotes._dict(zip(["label", "fieldname", "fieldtype", "options"],
|
||||
[df.label, df.fieldname, df.fieldtype, df.options]))
|
||||
for df in webnotes.get_doctype("Address", processed=True).get({"fieldname": ["in", fieldnames]})]
|
||||
|
||||
bean = None
|
||||
if webnotes.form_dict.name:
|
||||
bean = webnotes.bean("Address", webnotes.form_dict.name)
|
||||
|
||||
return {
|
||||
"doc": bean.doc if bean else None,
|
||||
"meta": webnotes._dict({
|
||||
"left_fields": _get_fields(["address_title", "address_type", "address_line1", "address_line2",
|
||||
"city", "state", "pincode", "country"]),
|
||||
"right_fields": _get_fields(["email_id", "phone", "fax", "is_primary_address",
|
||||
"is_shipping_address"])
|
||||
}),
|
||||
"cint": cint
|
||||
}
|
||||
|
||||
|
0
utilities/doctype/address/templates/__init__.py
Normal file
0
utilities/doctype/address/templates/__init__.py
Normal file
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc and doc.name or "New Address" %}
|
||||
{% set docname=(doc and doc.name or "") %}
|
28
utilities/doctype/address/templates/pages/address.py
Normal file
28
utilities/doctype/address/templates/pages/address.py
Normal file
@ -0,0 +1,28 @@
|
||||
# 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
|
||||
|
||||
def get_context():
|
||||
def _get_fields(fieldnames):
|
||||
return [webnotes._dict(zip(["label", "fieldname", "fieldtype", "options"],
|
||||
[df.label, df.fieldname, df.fieldtype, df.options]))
|
||||
for df in webnotes.get_doctype("Address", processed=True).get({"fieldname": ["in", fieldnames]})]
|
||||
|
||||
bean = None
|
||||
if webnotes.form_dict.name:
|
||||
bean = webnotes.bean("Address", webnotes.form_dict.name)
|
||||
|
||||
return {
|
||||
"doc": bean.doc if bean else None,
|
||||
"meta": webnotes._dict({
|
||||
"left_fields": _get_fields(["address_title", "address_type", "address_line1", "address_line2",
|
||||
"city", "state", "pincode", "country"]),
|
||||
"right_fields": _get_fields(["email_id", "phone", "fax", "is_primary_address",
|
||||
"is_shipping_address"])
|
||||
}),
|
||||
"cint": cint
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "app/website/templates/html/page.html" %}
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Addresses" %}
|
||||
|
@ -1,139 +0,0 @@
|
||||
# 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": "utilities.website_transactions.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": "utilities.website_transactions.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": "utilities.website_transactions.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": "utilities.website_transactions.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
|
Loading…
x
Reference in New Issue
Block a user