[website] [minor] moving to framework

This commit is contained in:
Anand Doshi
2013-09-10 13:46:15 +05:30
parent 429fd1d3d8
commit 330dae90cb
44 changed files with 382 additions and 417 deletions

View File

View 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 %}

View File

@@ -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 %}

View File

@@ -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 %}

View File

View File

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title="My Account" %}

View File

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% block javascript %}
{% include "app/website/templates/js/cart.js" %}

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sale.html" %}

View 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

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View 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)

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sale.html" %}

View 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

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View 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)

View 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 %}

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sale.html" %}

View 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

View File

@@ -0,0 +1 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View 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)

View File

@@ -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>

View File

@@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title=doc.name %}

View File

@@ -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 %}

View File

@@ -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 %}