Merge branch 'master' into edge
Conflicts:
setup/doctype/backup_manager/backup_dropbox.py
diff --git a/accounts/Print Format/SalesInvoice/SalesInvoice.html b/accounts/Print Format/SalesInvoice/SalesInvoice.html
new file mode 100644
index 0000000..2b08197
--- /dev/null
+++ b/accounts/Print Format/SalesInvoice/SalesInvoice.html
@@ -0,0 +1,135 @@
+{%- if doc.letter_head -%}
+ {{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
+{%- endif -%}
+<!-- Page Layout Settings -->
+<div class='common page-header'>
+ <table class='header-table' cellspacing=0>
+ <thead>
+ <tr><td colspan="2"><h1>{{ doc.select_print_heading or 'Invoice' }}</h1></td></tr>
+ <tr><td colspan="2"><h3>{{ doc.name }}</h3></td></tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td width=60%><table width=100% cellspacing=0><tbody>
+ <tr>
+ <td width=39%><b>Name</b></td>
+ <td>{{ doc.customer_name }}</td>
+ </tr>
+ <tr>
+ <td><b>Address</b></td>
+ <td>{{ doc.address_display.replace("\n", "<br>") }}</td>
+ </tr>
+ <tr>
+ <td><b>Contact</b></td>
+ <td>{{ doc.contact_display }}</td>
+ </tr>
+ </tbody></table></td>
+ <td><table width=100% cellspacing=0><tbody>
+ <tr>
+ <td width=40%><b>Invoice Date</b></td>
+ <td>{{ utils.formatdate(doc.posting_date) }}</td>
+ <tr>
+ {%- if doc.convert_into_recurring_invoice and doc.recurring_id -%}
+ <tr>
+ <td width=40%><b>Invoice Period</b></td>
+ <td>{{ (utils.formatdate(doc.invoice_period_from_date)) +
+ ' to ' + utils.formatdate(doc.invoice_period_to_date) }}</td>
+ <tr>
+ {%- endif -%}
+ <tr>
+ <td><b>Due Date</b></td>
+ <td>{{ utils.formatdate(doc.due_date) }}</td>
+ <tr>
+ </tbody></table></td>
+ </tr>
+ </tbody>
+ <tfoot>
+
+ </tfoot>
+ </table>
+</div>
+<div class='common page-body'>
+ <!--
+ Page Body will contain
+ + table 2
+ - Sales Invoice Data
+ -->
+ <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 Invoice 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 class='common page-footer'>
+ <!--
+ Page Footer will contain
+ + table 3
+ - Terms and Conditions
+ - Total Rounded Amount Calculation
+ - Total Rounded Amount in Words
+ -->
+ <table class='footer-table' width=100% cellspacing=0>
+ <thead>
+
+ </thead>
+ <tbody>
+ <tr>
+ <td width=60% style='padding-right: 10px;'>
+ <b>Terms, Conditions & Other Information:</b><br />
+ {{ doc.terms }}
+ </td>
+ <td>
+ <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>
+ <br /><b>In Words</b><br />
+ <i>{{ doc.in_words_export }}</i>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ </tfoot>
+ </table>
+</div>
diff --git a/accounts/Print Format/SalesInvoice/SalesInvoice.txt b/accounts/Print Format/SalesInvoice/SalesInvoice.txt
new file mode 100644
index 0000000..d2b1cdb
--- /dev/null
+++ b/accounts/Print Format/SalesInvoice/SalesInvoice.txt
@@ -0,0 +1,20 @@
+[
+ {
+ "creation": "2013-03-21 15:24:28",
+ "docstatus": 0,
+ "modified": "2013-03-21 15:26:21",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doc_type": "Sales Invoice",
+ "doctype": "Print Format",
+ "module": "Accounts",
+ "name": "__common__",
+ "standard": "Yes"
+ },
+ {
+ "doctype": "Print Format",
+ "name": "SalesInvoice"
+ }
+]
\ No newline at end of file
diff --git a/public/build.json b/public/build.json
index 121d333..05d603f 100644
--- a/public/build.json
+++ b/public/build.json
@@ -7,7 +7,8 @@
"app/public/js/startup.css"
],
"public/js/all-web.min.js": [
- "app/public/js/website_utils.js"
+ "app/public/js/website_utils.js",
+ "lib/public/js/wn/misc/number_format.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 502b5eb..a33eee0 100644
--- a/public/js/website_utils.js
+++ b/public/js/website_utils.js
@@ -1,36 +1,88 @@
var erpnext = {};
+var wn = {};
+// Add / update a new Lead / Communication
// subject, sender, description
erpnext.send_message = function(opts) {
+ wn.call({
+ type: "POST",
+ method: "website.helpers.contact.send_message",
+ args: opts,
+ callback: opts.callback
+ })
+}
+
+wn.call = function(opts) {
if(opts.btn) {
+ var $spinner = $('<img src="lib/images/ui/button-load.gif">').appendTo($(opts.btn).parent())
$(opts.btn).attr("disabled", "disabled");
}
-
+
+ if(opts.msg) {
+ $(opts.msg).toggle(false);
+ }
+
+ // get or post?
+ if(!opts.args._type) {
+ opts.args._type = opts.type || "GET";
+ }
+
+ // method
+ if(opts.method) {
+ opts.args.cmd = opts.method;
+ }
+
+ // stringify
+ $.each(opts.args, function(key, val) {
+ if(typeof val != "string") {
+ opts.args[key] = JSON.stringify(val);
+ }
+ });
+
$.ajax({
type: "POST",
url: "server.py",
- data: {
- cmd: "website.helpers.contact.send_message",
- subject: opts.subject,
- sender: opts.sender,
- status: opts.status,
- _type: "POST",
- message: typeof opts.message == "string"
- ? opts.message
- : JSON.stringify(opts.message)
- },
+ data: opts.args,
dataType: "json",
success: function(data) {
if(opts.btn) {
$(opts.btn).attr("disabled", false);
+ $spinner.remove();
}
- if(opts.callback)
+ if(data.exc) {
+ console.log(data.exc);
+ }
+ if(opts.msg && data.message) {
+ $(opts.msg).html(data.message).toggle(true);
+ }
+ if(opts.callback)
opts.callback(data);
}
});
+
+ return false;
}
+// Setup the user tools
+//
+$(document).ready(function() {
+ // update login
+ var full_name = getCookie("full_name");
+ if(full_name) {
+ $("#user-tools").html(repl('<a href="profile" title="My Profile" id="user-full-name">%(full_name)s</a> | \
+ <a href="account" title="My Account">My Account</a> | \
+ <!--<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i> (%(count)s)</a> | -->\
+ <a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>', {
+ full_name: full_name,
+ count: getCookie("cart_count") || "0"
+ }));
+ $("#user-tools a").tooltip({"placement":"bottom"});
+ }
+})
+
+// Utility functions
+
function valid_email(id) {
if(id.toLowerCase().search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)
return 0; else return 1; }
@@ -55,3 +107,58 @@
}
return s;
}
+
+function replace_all(s, t1, t2) {
+ return s.split(t1).join(t2);
+}
+
+function getCookie(name) {
+ return getCookies()[name];
+}
+
+function getCookies() {
+ var c = document.cookie, v = 0, cookies = {};
+ if (document.cookie.match(/^\s*\$Version=(?:"1"|1);\s*(.*)/)) {
+ c = RegExp.$1;
+ v = 1;
+ }
+ if (v === 0) {
+ c.split(/[,;]/).map(function(cookie) {
+ var parts = cookie.split(/=/, 2),
+ name = decodeURIComponent(parts[0].trimLeft()),
+ value = parts.length > 1 ? decodeURIComponent(parts[1].trimRight()) : null;
+ if(value.charAt(0)==='"') {
+ value = value.substr(1, value.length-2);
+ }
+ cookies[name] = value;
+ });
+ } else {
+ c.match(/(?:^|\s+)([!#$%&'*+\-.0-9A-Z^`a-z|~]+)=([!#$%&'*+\-.0-9A-Z^`a-z|~]*|"(?:[\x20-\x7E\x80\xFF]|\\[\x00-\x7F])*")(?=\s*[,;]|$)/g).map(function($0, $1) {
+ var name = $0,
+ value = $1.charAt(0) === '"'
+ ? $1.substr(1, -1).replace(/\\(.)/g, "$1")
+ : $1;
+ cookies[name] = value;
+ });
+ }
+ return cookies;
+}
+
+if (typeof String.prototype.trimLeft !== "function") {
+ String.prototype.trimLeft = function() {
+ return this.replace(/^\s+/, "");
+ };
+}
+if (typeof String.prototype.trimRight !== "function") {
+ String.prototype.trimRight = function() {
+ return this.replace(/\s+$/, "");
+ };
+}
+if (typeof Array.prototype.map !== "function") {
+ Array.prototype.map = function(callback, thisArg) {
+ for (var i=0, n=this.length, a=[]; i<n; i++) {
+ if (i in this) a[i] = callback.call(thisArg, this[i]);
+ }
+ return a;
+ };
+}
diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js
index 867a711..d34261d 100644
--- a/selling/doctype/sales_common/sales_common.js
+++ b/selling/doctype/sales_common/sales_common.js
@@ -310,7 +310,8 @@
var callback = function(r, rt) {
cur_frm.cscript.item_code(doc, cdt, cdn);
}
- get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname, doc, cdt, cdn, 1, callback);
+ get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname,
+ doc, cdt, cdn, 1, callback);
}
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query =
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 5009c4e..6a52e5a 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -16,6 +16,8 @@
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
@@ -352,4 +354,52 @@
return get_obj('Sales Common').get_item_list( self, is_stopped)
def on_update(self):
- pass
\ No newline at end of file
+ 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""")))
+ }
\ No newline at end of file
diff --git a/setup/doctype/backup_manager/backup_dropbox.py b/setup/doctype/backup_manager/backup_dropbox.py
index 659af68..4e9efdf 100644
--- a/setup/doctype/backup_manager/backup_dropbox.py
+++ b/setup/doctype/backup_manager/backup_dropbox.py
@@ -61,7 +61,7 @@
webnotes.response['page_name'] = 'message.html'
def backup_to_dropbox():
- from dropbox import client, session, rest
+ from dropbox import client, session
from conf import dropbox_access_key, dropbox_secret_key
from webnotes.utils.backups import new_backup
if not webnotes.conn:
@@ -97,13 +97,14 @@
from dropbox import session
try:
from conf import dropbox_access_key, dropbox_secret_key
- except ImportError, e:
+ except ImportError:
webnotes.msgprint(_("Please set Dropbox access keys in") + " conf.py",
raise_exception=True)
sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
return sess
def upload_file_to_dropbox(filename, folder, dropbox_client):
+ from dropbox import rest
size = os.stat(filename).st_size
f = open(filename,'r')
if size > 4194304:
@@ -111,11 +112,11 @@
while uploader.offset < size:
try:
uploader.upload_chunked()
- uploader.finish(os.path.join(folder, os.path.basename(filename)), overwrite='True')
- except rest.ErrorResponse, e:
+ uploader.finish(os.path.join(folder, os.path.basename(filename)), overwrite=True)
+ except rest.ErrorResponse:
pass
else:
- response = dropbox_client.put_file(os.path.join(folder, os.path.basename(filename)), f, overwrite=True)
+ dropbox_client.put_file(os.path.join(folder, os.path.basename(filename)), f, overwrite=True)
if __name__=="__main__":
backup_to_dropbox()
\ No newline at end of file
diff --git a/setup/doctype/contact_control/contact_control.py b/setup/doctype/contact_control/contact_control.py
index 3c37ecf..54a2fcc 100644
--- a/setup/doctype/contact_control/contact_control.py
+++ b/setup/doctype/contact_control/contact_control.py
@@ -1,99 +1,7 @@
-# Please edit this list and import only required elements
from __future__ import unicode_literals
import webnotes
-from webnotes.utils import set_default
-from webnotes.model import db_exists
-from webnotes.model.doc import Document
-from webnotes.model.bean import copy_doclist
-from webnotes.model.code import get_obj
-from webnotes import msgprint
-
-sql = webnotes.conn.sql
-
-
-
class DocType:
- def __init__(self,doc,doclist=[]):
- self.doc = doc
- self.doclist = doclist
-
- def enable_login(self,arg):
- arg = eval(arg)
- sql("update tabContact set disable_login = 'No' where name=%s",arg['contact'])
- sql("update tabProfile set enabled=1 where name=%s",arg['email'])
-
- def disable_login(self,arg):
- arg = eval(arg)
- sql("update tabContact set disable_login = 'Yes' where name=%s",arg['contact'])
- sql("update tabProfile set enabled=0 where name=%s",arg['email'])
-
- def create_login(self,arg):
- arg = eval(arg)
- cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
- if cont_det[0]['docstatus'] !=0:
- msgprint('Please save the corresponding contact first')
- raise Exception
-
- if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
- msgprint('Profile with same name already exist.')
- raise Exception
- else:
- p = Document('Profile')
- p.name = cont_det[0]['email_id']
- p.first_name = cont_det[0]['first_name']
- p.last_name = cont_det[0]['last_name']
- p.email = cont_det[0]['email_id']
- p.cell_no = cont_det[0]['contact_no']
- p.password = 'password'
- p.enabled = 1
- p.user_type = 'Partner';
- p.save(1)
-
- get_obj(doc=p).on_update()
-
- role = []
- if cont_det[0]['contact_type'] == 'Individual':
- role = ['Customer']
- else:
- if cont_det[0]['is_customer']:
- role.append('Customer')
- if cont_det[0]['is_supplier']:
- role.append('Supplier')
- if cont_det[0]['is_sales_partner']:
- role.append('Partner')
-
- if role:
- prof_nm = p.name
- for i in role:
- r = Document('UserRole')
- r.parent = p.name
- r.role = i
- r.parenttype = 'Profile'
- r.parentfield = 'userroles'
- r.save(1)
-
- if i == 'Customer':
- def_keys = ['from_company','customer_name','customer']
- def_val = cont_det[0]['customer_name']
- self.set_default_val(def_keys,def_val,prof_nm)
-
- if i == 'Supplier':
- def_keys = ['supplier_name','supplier']
- def_val = cont_det[0]['supplier_name']
- self.set_default_val(def_keys,def_val,prof_nm)
-
- sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
- sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
- msgprint('User login is created.')
-
- #------set default values---------
- def set_default_val(self,def_keys,def_val,prof_nm):
- for d in def_keys:
- kv = Document('DefaultValue')
- kv.defkey = d
- kv.defvalue = def_val
- kv.parent = prof_nm
- kv.parenttype = 'Profile'
- kv.parentfield = 'defaults'
- kv.save(1)
\ No newline at end of file
+ def __init__(self,doc,doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 8d94a03..f68a6d1 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -21,6 +21,7 @@
from webnotes.utils import cint
keydict = {
+ "print_style": "print_style",
"fiscal_year": "current_fiscal_year",
'company': 'default_company',
'currency': 'default_currency',
diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt
index 6317439..ac1671e 100644
--- a/setup/doctype/global_defaults/global_defaults.txt
+++ b/setup/doctype/global_defaults/global_defaults.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-21 14:54:43",
+ "creation": "2013-02-21 12:28:24",
"docstatus": 0,
- "modified": "2013-03-19 14:46:49",
+ "modified": "2013-03-21 15:42:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -27,8 +27,6 @@
"permlevel": 0
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -61,6 +59,19 @@
},
{
"doctype": "DocField",
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break"
+ },
+ {
+ "description": "For Server Side Print Formats",
+ "doctype": "DocField",
+ "fieldname": "print_style",
+ "fieldtype": "Select",
+ "label": "Print Format Style",
+ "options": "Standard\nClassic\nModern\nSpartan"
+ },
+ {
+ "doctype": "DocField",
"fieldname": "company",
"fieldtype": "Section Break",
"label": "Company"
@@ -425,6 +436,11 @@
"label": "SMS Sender Name"
},
{
+ "amend": 0,
+ "cancel": 0,
+ "doctype": "DocPerm"
+ },
+ {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt
index 5976be6..d9c6ffe 100644
--- a/setup/doctype/item_group/item_group.txt
+++ b/setup/doctype/item_group/item_group.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:23",
+ "creation": "2013-01-23 20:00:16",
"docstatus": 0,
- "modified": "2013-01-22 14:56:03",
+ "modified": "2013-03-20 15:09:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -125,6 +125,13 @@
},
{
"doctype": "DocField",
+ "fieldname": "item_website_specifications",
+ "fieldtype": "Table",
+ "label": "Item Website Specifications",
+ "options": "Item Website Specification"
+ },
+ {
+ "doctype": "DocField",
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
@@ -175,6 +182,20 @@
"print_hide": 1
},
{
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "role": "System Manager",
+ "write": 1
+ },
+ {
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "role": "Material Master Manager",
+ "write": 1
+ },
+ {
"amend": 0,
"cancel": 0,
"create": 0,
@@ -189,19 +210,5 @@
"doctype": "DocPerm",
"role": "Material User",
"write": 0
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "role": "Material Master Manager",
- "write": 1
}
]
\ No newline at end of file
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index 5b32a34..8b3e044 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -137,3 +137,17 @@
+ wn.meta.get_docfield(doc.doctype, "description_html").label);
}
};
+
+cur_frm.cscript.copy_from_item_group = function(doc) {
+ wn.model.with_doc("Item Group", doc.item_group, function() {
+ $.each(wn.model.get("Item Website Specification", {parent:doc.item_group}),
+ function(i, d) {
+ var n = wn.model.add_child(doc, "Item Website Specification",
+ "item_website_specifications");
+ n.label = d.label;
+ n.description = d.description;
+ }
+ );
+ cur_frm.refresh();
+ });
+}
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index 036b9d5..b7f7be4 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-21 14:54:43",
+ "creation": "2013-03-07 15:53:11",
"docstatus": 0,
- "modified": "2013-03-06 16:02:47",
+ "modified": "2013-03-20 15:10:12",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,7 +33,6 @@
"parent": "Item",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
"read": 1,
"report": 1,
"submit": 0
@@ -786,6 +785,12 @@
"fieldtype": "Section Break"
},
{
+ "doctype": "DocField",
+ "fieldname": "copy_from_item_group",
+ "fieldtype": "Button",
+ "label": "Copy From Item Group"
+ },
+ {
"depends_on": "show_in_website",
"doctype": "DocField",
"fieldname": "item_website_specifications",
@@ -804,6 +809,24 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
+ "permlevel": 0,
+ "role": "System Manager",
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 1,
+ "role": "Material Master Manager",
+ "write": 0
+ },
+ {
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "permlevel": 0,
"role": "Material Master Manager",
"write": 1
},
@@ -812,6 +835,15 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "permlevel": 1,
+ "role": "System Manager"
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 1,
"role": "Material Manager",
"write": 0
},
@@ -820,6 +852,25 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "permlevel": 0,
+ "role": "Material Manager",
+ "write": 0
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 1,
+ "role": "Material User",
+ "write": 0
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 0,
"role": "Material User",
"write": 0
}
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 170497d..5625f11 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -70,4 +70,28 @@
st = webnotes.bean("Support Ticket", name)
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:
+ return {
+ "doc": {"name": "Not Allowed"}
+ }
+ else:
+ return {
+ "doc": bean.doc,
+ "doclist": bean.doclist,
+ "webnotes": webnotes,
+ "utils": webnotes.utils
+ }
diff --git a/website/css/website.css b/website/css/website.css
index dc5b967..25e2c91 100644
--- a/website/css/website.css
+++ b/website/css/website.css
@@ -2,11 +2,10 @@
padding: 30px;
margin: 30px -30px 10px -30px;
min-height: 400px;
- overflow: hidden;
}
.outer .navbar {
- margin: -30px -30px 10px -30px;
+ margin: -30px -30px 20px -30px;
}
footer {
diff --git a/website/doctype/blog_post/blog_post.txt b/website/doctype/blog_post/blog_post.txt
index 480bca4..4144e40 100644
--- a/website/doctype/blog_post/blog_post.txt
+++ b/website/doctype/blog_post/blog_post.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-08 11:36:50",
"docstatus": 0,
- "modified": "2013-03-11 15:23:21",
+ "modified": "2013-03-18 13:55:53",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -65,6 +65,7 @@
"doctype": "DocField",
"fieldname": "blogger",
"fieldtype": "Link",
+ "in_list_view": 1,
"label": "Blogger",
"options": "Blogger",
"reqd": 1
@@ -73,6 +74,7 @@
"doctype": "DocField",
"fieldname": "blog_category",
"fieldtype": "Link",
+ "in_list_view": 1,
"label": "Blog Category",
"options": "Blog Category"
},
@@ -86,6 +88,7 @@
"doctype": "DocField",
"fieldname": "blog_intro",
"fieldtype": "Small Text",
+ "in_list_view": 1,
"label": "Blog Intro",
"reqd": 1
},
diff --git a/website/doctype/style_settings/style_settings.py b/website/doctype/style_settings/style_settings.py
index 1cc3467..71478a4 100644
--- a/website/doctype/style_settings/style_settings.py
+++ b/website/doctype/style_settings/style_settings.py
@@ -89,7 +89,7 @@
self.doc.at_import = ""
for f in fonts:
- self.doc.at_import += "\n@import url(http://fonts.googleapis.com/css?family=%s:400,700);" % f.replace(" ", "+")
+ self.doc.at_import += "\n@import url(https://fonts.googleapis.com/css?family=%s:400,700);" % f.replace(" ", "+")
def on_update(self):
diff --git a/website/helpers/contact.py b/website/helpers/contact.py
index 251e1f6..bf1521e 100644
--- a/website/helpers/contact.py
+++ b/website/helpers/contact.py
@@ -18,6 +18,7 @@
import webnotes
from core.doctype.communication.communication import make
+from webnotes.utils import now
max_communications_per_hour = 300
@@ -38,7 +39,7 @@
# guest method, cap max writes per hour
if webnotes.conn.sql("""select count(*) from `tabCommunication`
- where TIMEDIFF(NOW(), modified) < '01:00:00'""")[0][0] > max_communications_per_hour:
+ where TIMEDIFF(%s, modified) < '01:00:00'""", now())[0][0] > max_communications_per_hour:
webnotes.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
return
diff --git a/website/settings.py b/website/settings.py
new file mode 100644
index 0000000..3fff19e
--- /dev/null
+++ b/website/settings.py
@@ -0,0 +1,33 @@
+import webnotes
+
+page_map = {
+ 'Web Page': webnotes._dict({
+ "template": 'html/web_page.html',
+ "condition_field": "published"
+ }),
+ 'Blog Post': webnotes._dict({
+ "template": 'html/blog_page.html',
+ "condition_field": "published",
+ }),
+ 'Item': webnotes._dict({
+ "template": 'html/product_page.html',
+ "condition_field": "show_in_website",
+ }),
+ 'Item Group': webnotes._dict({
+ "template": "html/product_group.html",
+ "condition_field": "show_in_website"
+ })
+}
+
+page_settings_map = {
+ "about": "website.doctype.about_us_settings.about_us_settings.get_args",
+ "contact": "Contact Us Settings",
+ "blog": "website.helpers.blog.get_blog_template_args",
+ "writers": "website.helpers.blog.get_writers_args",
+ "print": "core.doctype.print_format.print_format.get_args",
+ "orders": "selling.doctype.sales_order.sales_order.get_currency_and_number_format",
+ "order": "selling.doctype.sales_order.sales_order.get_website_args",
+ "ticket": "support.doctype.support_ticket.support_ticket.get_website_args"
+}
+
+no_cache = ["message", "print", "order", "ticket"]
diff --git a/website/templates/css/login.css b/website/templates/css/login.css
index c2a7af2..4120807 100644
--- a/website/templates/css/login.css
+++ b/website/templates/css/login.css
@@ -4,9 +4,17 @@
margin: 70px auto;
}
+ #login_wrapper,
+ #login_wrapper h3 {
+ color: #333;
+ }
+
+ #login_wrapper a {
+ color: #0088cc;
+ }
+
.layout-wrapper {
background-color: #fff;
- color: #333;
padding: 10px;
box-shadow: 1px 1px 3px 3px #ccc;
font-size: 12px;
@@ -32,7 +40,4 @@
text-align: center;
padding: 15px;
}
- .login-footer, .login-footer a {
- color: #999;
- }
</style>
\ No newline at end of file
diff --git a/website/templates/html/base.html b/website/templates/html/base.html
index 2719f8d..6889d67 100644
--- a/website/templates/html/base.html
+++ b/website/templates/html/base.html
@@ -10,21 +10,18 @@
<script type="text/javascript" src="js/wn-web.js"></script>
<link type="text/css" rel="stylesheet" href="css/all-web.css">
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
-
- {% if favicon %}
+ {%- if favicon %}
<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
{% else %}
<link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
- {% endif %}
-
- {% if description %}
+ {% endif -%}
+ {% if description -%}
<meta name="description" content="{{ description }}">
- {% endif %}
-
- {% block header %}
- {% endblock %}
+ {%- endif %}
+ {% block header -%}
+ {%- endblock %}
</head>
<body>
{% block body %}
diff --git a/website/templates/html/navbar.html b/website/templates/html/navbar.html
index 8112499..55e8094 100644
--- a/website/templates/html/navbar.html
+++ b/website/templates/html/navbar.html
@@ -1,7 +1,6 @@
-<div class="navbar navbar-inverse"
- style="">
+<div class="navbar navbar-inverse" style="">
<div class="navbar-inner">
- {% if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif %}
+ {%- if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif -%}
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
@@ -10,45 +9,27 @@
</button>
<div class="nav-collapse collapse">
<ul class="nav">
- {% for page in top_bar_items %}
- {% if not page.parent_label %}
- <li data-label="{{ page.label }}"
- {% if page.child_items %}
- class="dropdown"
- {% endif %}>
- <a href="{{ page.url or '#' }}"
- {% if page.child_items %}
- class="dropdown-toggle"
- onclick="return false;"
- data-toggle="dropdown"
- {% endif %}
- {{ page.target or ''}}>
- {{ page.label }}
- {% if page.child_items %}
- <b class="caret"></b>
- </a>
- <ul class="dropdown-menu">
- {% for child in page.child_items %}
- <li data-label="{{ child.label }}">
- <a {% if child.indent %}
- style="padding-left:
- {{(int(child.indent)+1)*15 }}px"
- {% endif %}
- href="{{ child.url }}" {{ child.target or '' }}>
- {{ child.label }}
- </a>
- </li>
- {% endfor %}
- </ul>
- {% else %}
- </a>
- {% endif %}
- </li>
- {% endif %}
- {% endfor %}
- </ul>
- <ul class="nav pull-right">
- <li id="login-topbar-item"><a href="login">Login</a></li>
+ {%- for page in top_bar_items -%}
+ {% if not page.parent_label -%}
+ <li data-label="{{ page.label }}" {% if page.child_items %} class="dropdown"{% endif %}>
+ <a href="{{ page.url or '#' }}" {% if page.child_items %} class="dropdown-toggle" onclick="return false;" data-toggle="dropdown"{% endif %} {{ page.target or ''}}>
+ {{ page.label }}
+ {%- if page.child_items -%}
+ <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ {%- for child in page.child_items -%}
+ <li data-label="{{ child.label }}">
+ <a {% if child.indent %} style="padding-left: {{(int(child.indent)+1)*15 }}px"{% endif %} href="{{ child.url }}" {{ child.target or '' }}>{{ child.label }}</a>
+ </li>
+ {%- endfor -%}
+ </ul>
+ {%- else -%}
+ </a>
+ {%- endif -%}
+ </li>
+ {%- endif -%}
+ {%- endfor %}
</ul>
</div>
</div>
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
index f7296e4..624371e 100644
--- a/website/templates/html/outer.html
+++ b/website/templates/html/outer.html
@@ -1,17 +1,19 @@
{% extends "html/base.html" %}
{% block body %}
- <header>
- </header>
<div class="container">
+ <div class="pull-right" style="margin:4px;" id="user-tools">
+ <a id="login-link" href="login">Login</a>
+ </div>
+ <div class="clearfix"></div>
{% if banner_html %}<div class="row" style="margin-top: 30px;">
<div class="span12">{{ banner_html }}</div>
</div>{% endif %}
<div class="outer">
{% include "html/navbar.html" %}
<div class="content row" id="page-{{ name }}" style="display: block;">
- {% block content %}
- {% endblock %}
+ {%- block content -%}
+ {%- endblock -%}
</div>
</div>
</div>
diff --git a/website/templates/html/page.html b/website/templates/html/page.html
index 11d7b0f..9d38cdc 100644
--- a/website/templates/html/page.html
+++ b/website/templates/html/page.html
@@ -1,20 +1,20 @@
{% extends "html/outer.html" %}
-{% block title %}{{ title }}{% endblock %}
+{% block title -%}{{ title }}{%- endblock %}
-{% block header %}
+{% block header -%}
{{ super() }}
<script>
- {% block javascript %}
- {% endblock %}
+ {% block javascript -%}
+ {%- endblock %}
</script>
- {% block css %}
- {% if insert_style %}
+ {% block css -%}
+ {% if insert_style -%}
<style>{{ css }}</style>
- {% endif %}
- {% endblock %}
-{% endblock %}
+ {%- endif %}
+ {%- endblock %}
+{%- endblock -%}
-{% block content %}
+{%- block content -%}
{{ content }}
-{% endblock %}
\ No newline at end of file
+{%- endblock %}
\ No newline at end of file
diff --git a/website/templates/js/login.js b/website/templates/js/login.js
index 96b820a..06ea4c5 100644
--- a/website/templates/js/login.js
+++ b/website/templates/js/login.js
@@ -17,27 +17,53 @@
// Login
login.do_login = function(){
-
var args = {};
- args['usr']=$("#login_id").val();
- args['pwd']=$("#password").val();
+ if(window.is_sign_up) {
+ args.cmd = "core.doctype.profile.profile.sign_up";
+ args.email = $("#login_id").val();
+ args.full_name = $("#full_name").val();
- if(!args.usr || !args.pwd) {
- login.set_message("Both login and password required.");
+ if(!args.email || !valid_email(args.email) || !args.full_name) {
+ login.set_message("Valid email and name required.");
+ return false;
+ }
+ } else if(window.is_forgot) {
+ args.cmd = "reset_password";
+ args.user = $("#login_id").val();
+
+ if(!args.user) {
+ login.set_message("Valid Login Id required.");
+ return false;
+ }
+
+ } else {
+ args.cmd = "login"
+ args.usr = $("#login_id").val();
+ args.pwd = $("#password").val();
+
+ if(!args.usr || !args.pwd) {
+ login.set_message("Both login and password required.");
+ return false;
+ }
}
$('#login_btn').attr("disabled", "disabled");
+ $("#login-spinner").toggle(true);
$('#login_message').toggle(false);
$.ajax({
type: "POST",
url: "server.py",
- data: {cmd:"login", usr:args.usr, pwd: args.pwd},
+ data: args,
dataType: "json",
success: function(data) {
+ $("input").val("");
+ $("#login-spinner").toggle(false);
$('#login_btn').attr("disabled", false);
if(data.message=="Logged In") {
window.location.href = "app.html";
+ } else if(data.message=="No App") {
+ window.location.href = "index";
} else {
login.set_message(data.message);
}
@@ -47,28 +73,23 @@
return false;
}
-login.show_forgot_password = function(){
- // create dialog
- var login_id = $("#login_id").val();
- if(!login_id || !valid_email(login_id)) {
- login.set_message("Please set your login id (which is your email where the password will be sent);");
- return;
- }
- login.set_message("Sending email with new password...");
- $("#forgot-password").remove();
+login.sign_up = function() {
+ $("#login_wrapper h3").html("Sign Up");
+ $("#login-label").html("Email Id");
+ $("#password-row, #sign-up-wrapper, #login_message").toggle(false);
+ $("#full-name-row").toggle(true);
+ $("#login_btn").html("Register");
+ $("#forgot-wrapper").html("<a onclick='location.reload()' href='#'>Login</a>")
+ window.is_sign_up = true;
+}
- $.ajax({
- method: "POST",
- url: "server.py",
- data: {
- cmd: "reset_password",
- user: login_id,
- _type: "POST"
- },
- success: function(data) {
- login.set_message("A new password has been sent to your email id.", "GREEN");
- }
- })
+login.show_forgot_password = function() {
+ $("#login_wrapper h3").html("Forgot");
+ $("#login-label").html("Email Id");
+ $("#password-row, #sign-up-wrapper, #login_message").toggle(false);
+ $("#login_btn").html("Send Password");
+ $("#forgot-wrapper").html("<a onclick='location.reload()' href='#'>Login</a>")
+ window.is_forgot = true;
}
login.set_message = function(message, color) {
diff --git a/website/templates/pages/account.html b/website/templates/pages/account.html
new file mode 100644
index 0000000..8e8f4b4
--- /dev/null
+++ b/website/templates/pages/account.html
@@ -0,0 +1,18 @@
+{% extends "html/page.html" %}
+
+{% set title="My Account" %}
+
+{% block content %}
+<div class="span12">
+ <ul class="breadcrumb">
+ <li><a href="index">Home</a> <span class="divider">/</span></li>
+ <li class="active">My Account</li>
+ </ul>
+ <h3>My Account</h3>
+ <p><a href="profile"><i class="icon-user"></i> Change my name, password</a></p>
+ <p><a href="orders"><i class="icon-list"></i> My Orders</a></p>
+ <p><a href="tickets"><i class="icon-tags"></i> My Tickets</a></p>
+ <p><a href="server.py?cmd=web_logout"><i class="icon-signout"></i> Logout</a></p>
+ </ul>
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/login.html b/website/templates/pages/login.html
index ef9b7bb..6b847ff 100644
--- a/website/templates/pages/login.html
+++ b/website/templates/pages/login.html
@@ -10,7 +10,7 @@
{% set title="Login" %}
{% block body %}
- <div id='login_wrapper'>
+ <div class="container" id='login_wrapper'>
<div class='layout-wrapper layout-main'>
<p id="login_message" class="alert" style="display: none;"></p>
<h3><i class="icon-lock" style="margin-top: 7px"></i> Login</h3>
@@ -18,34 +18,45 @@
<table border="0" class="login-box">
<tbody>
<tr>
- <td style="text-align: right; padding: 3px;">Login Id</td>
+ <td style="text-align: right; padding: 3px;"
+ id="login-label">Login Id</td>
<td><input id="login_id" type="text" style="width: 180px"/></td>
</tr>
- <tr>
- <td style="text-align: right; padding: 3px;">Password</td>
+ <tr id="password-row">
+ <td style="text-align: right; padding: 3px;" >Password</td>
<td><input id="password" type="password" style="width: 180px" /></td>
</tr>
+ <tr id="full-name-row" style="display: none;">
+ <td style="text-align: right; padding: 3px;">Full Name</td>
+ <td><input id="full_name" type="text" style="width: 180px" /></td>
+ </tr>
<tr>
<td> </td>
<td>
<button type="submit" id="login_btn"
class="btn btn-small btn-primary">Login</button>
+ <img src="lib/images/ui/button-load.gif" id="login-spinner"
+ style="display: none;">
</td>
</tr>
</tbody>
</table>
</form>
<br>
- <p style="text-align: center"><a id="forgot-password"
+ <p style="text-align: center" id="forgot-wrapper">
+ <a id="forgot-password" style="cursor:pointer"
onclick="return login.show_forgot_password()">Forgot Password</a></p>
+ <p style="text-align: center" id="sign-up-wrapper">
+ New user? <a id="sign-up" style="cursor:pointer"
+ onclick="return login.sign_up()">Sign Up</a></p>
</div>
- <div class="login-footer">
- <a href="index.html">Home</a> |
- <a href="https://erpnext.com">ERPNext</a><br><br>
- {% if copyright %}
- <div class="web-footer-copyright">© {{ copyright }}
- {% endif %}
- </div>
+ </div>
+ <div class="web-footer login-footer container">
+ <a href="index.html">Home</a> |
+ <a href="https://erpnext.com">ERPNext</a><br><br>
+ {% if copyright %}
+ <div class="web-footer-copyright">© {{ copyright }}
+ {% endif %}
</div>
{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/order.html b/website/templates/pages/order.html
new file mode 100644
index 0000000..9e80694
--- /dev/null
+++ b/website/templates/pages/order.html
@@ -0,0 +1,88 @@
+{% extends "html/page.html" %}
+
+{% set title=doc.name %}
+
+{% block content %}
+<div class="span12">
+ <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="orders">My Orders</a> <span class="divider">/</span></li>
+ <li class="active">{{ doc.name }}</li>
+ </ul>
+ <h3><i class="icon-file"></i> {{ doc.name }}</h3>
+ <hr>
+ {%- if doc.status -%}
+ <div style="font-size: 13px;">
+ <div class="row">
+ <div class="span2">
+ <div class="label">{{ doc.status }}</div>
+ </div>
+ <div class="span4">
+ {{ utils.formatdate(doc.transaction_date) }}
+ </div>
+ </div>
+ <br>
+ <div class="row">
+ <div class="span12">
+ <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="span6"></div>
+ <div class="span6">
+ <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 %}
\ No newline at end of file
diff --git a/website/templates/pages/orders.html b/website/templates/pages/orders.html
new file mode 100644
index 0000000..3bb7bd4
--- /dev/null
+++ b/website/templates/pages/orders.html
@@ -0,0 +1,70 @@
+{% extends "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="span12">
+ <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"></i> My Orders</h3>
+ <hr>
+ <div id="order-list" style="font-size: 13px;">
+ <div class="progress progress-striped active">
+ <div class="bar" 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="span3"><a href="order?name=%(name)s">%(name)s</a></div>\
+ <div class="span9"></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="span3">%(item_name)s</div>\
+ <div class="span2" style="text-align: right;">%(export_rate)s</div>\
+ <div class="span2" style="text-align: right;">%(qty)s %(stock_uom)s</div>\
+ <div class="span2" style="text-align: right;">%(export_amount)s</div>\
+ </div>\
+ </div>', item)).appendTo($order.find(".span9"));
+ });
+
+ $("<hr>").appendTo($list);
+ });
+ }
+ })
+})
+</script>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/print.html b/website/templates/pages/print.html
new file mode 100644
index 0000000..b684dfe
--- /dev/null
+++ b/website/templates/pages/print.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Print Format</title>
+ <meta name="generator" content="wnframework">
+ <style>
+ {{ css }}
+ </style>
+</head>
+<body>
+ {{ body }}
+</body>
+{%- if comment -%}
+<!-- {{ comment }} -->
+{%- endif -%}
+</html>
\ No newline at end of file
diff --git a/website/templates/pages/profile.html b/website/templates/pages/profile.html
new file mode 100644
index 0000000..1b9350c
--- /dev/null
+++ b/website/templates/pages/profile.html
@@ -0,0 +1,56 @@
+{% extends "html/page.html" %}
+
+{% set title="My Profile" %}
+
+{% block content %}
+<div class="span12">
+ <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>
+ </ul>
+ <h2><i class="icon-user"></i> My Profile</h2>
+ <hr>
+ <div class="alert" id="message" style="display: none;"></div>
+ <form class="form-horizontal">
+ <div class="control-group">
+ <label class="control-label" for="fullname">Full Name</label>
+ <div class="controls">
+ <input type="text" id="fullname" placeholder="Your Name">
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label" for="password">Password</label>
+ <div class="controls">
+ <input type="password" id="password" placeholder="Password">
+ </div>
+ </div>
+ <div class="control-group">
+ <div class="controls">
+ <button id="update_profile" type="submit" class="btn">Update</button>
+ </div>
+ </div>
+ </form>
+</div>
+<script>
+$(document).ready(function() {
+ $("#fullname").val(getCookie("full_name") || "");
+ $("#update_profile").click(function() {
+ wn.call({
+ method: "core.doctype.profile.profile.update_profile",
+ type: "POST",
+ args: {
+ fullname: $("#fullname").val(),
+ password: $("#password").val()
+ },
+ btn: this,
+ msg: $("#message"),
+ callback: function(r) {
+ if(!r.exc) $("#user-full-name").html($("#fullname").val());
+ }
+ });
+ return false;
+ })
+})
+</script>
+{% endblock %}
diff --git a/website/templates/pages/ticket.html b/website/templates/pages/ticket.html
new file mode 100644
index 0000000..fe185f8
--- /dev/null
+++ b/website/templates/pages/ticket.html
@@ -0,0 +1,49 @@
+{% extends "html/page.html" %}
+
+{% set title=doc.name %}
+
+{% block content %}
+<div class="span12">
+ <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>
+ </ul>
+ <h3><i class="icon-file"></i> {{ doc.name }}</h3>
+ <hr>
+ {%- if doc.status -%}
+ <div class="row">
+ <div class="span2">
+ <div class="label">{{ doc.status }}</div>
+ </div>
+ <div class="span7">
+ {{ doc.subject }}
+ </div>
+ <div class="span3">
+ {{ utils.formatdate(doc.transaction_date) }}
+ </div>
+ </div>
+ <br>
+ <h4>Messages</h4>
+ {%- if doclist.get({"doctype":"Communication"}) -%}
+ <div style="font-size: 13px;">
+ <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>
+ </td>
+ </tr>
+ {% endfor -%}
+ </tbody>
+ </table>
+ </div>
+ {%- else -%}
+ <div class="alert">No messages</div>
+ {%- endif -%}
+ {%- endif -%}
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/website/templates/pages/tickets.html b/website/templates/pages/tickets.html
new file mode 100644
index 0000000..11da329
--- /dev/null
+++ b/website/templates/pages/tickets.html
@@ -0,0 +1,53 @@
+{% extends "html/page.html" %}
+
+{% set title="My Tickets" %}
+
+{% block content %}
+<div class="span12">
+ <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 Tickets</li>
+ </ul>
+ <h3><i class="icon-tags"></i> My Tickets</h3>
+ <hr>
+ <div id="ticket-list" style="font-size: 13px;">
+ <div class="progress progress-striped active">
+ <div class="bar" 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="span2"><span class="label">%(status)s</span></div>\
+ <div class="span3"><a href="ticket?name=%(name)s">%(name)s</a></div>\
+ <div class="span7">%(subject)s</div>\
+ </div>', ticket)).appendTo($list);
+
+ $("<hr>").appendTo($list);
+ });
+ }
+ })
+})
+</script>
+{% endblock %}
\ No newline at end of file
diff --git a/website/utils.py b/website/utils.py
index 97cec72..14e3e13 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -18,35 +18,9 @@
import os
import conf
+from website.settings import *
import webnotes
-
-page_map = {
- 'Web Page': webnotes._dict({
- "template": 'html/web_page.html',
- "condition_field": "published"
- }),
- 'Blog Post': webnotes._dict({
- "template": 'html/blog_page.html',
- "condition_field": "published",
- }),
- 'Item': webnotes._dict({
- "template": 'html/product_page.html',
- "condition_field": "show_in_website",
- }),
- 'Item Group': webnotes._dict({
- "template": "html/product_group.html",
- "condition_field": "show_in_website"
- })
-}
-
-page_settings_map = {
- "about": "website.doctype.about_us_settings.about_us_settings.get_args",
- "contact": "Contact Us Settings",
- "blog": "website.helpers.blog.get_blog_template_args",
- "writers": "website.helpers.blog.get_writers_args"
-}
-
-no_cache = "message"
+import webnotes.utils
def render(page_name):
"""render html page"""
@@ -75,7 +49,10 @@
from_cache = True
if not html:
- webnotes.connect()
+ from webnotes.auth import HTTPRequest
+ webnotes.http_request = HTTPRequest()
+
+ #webnotes.connect()
html = load_into_cache(page_name)
from_cache = False
@@ -254,7 +231,8 @@
order by idx asc""", as_dict=1),
'int':int,
- "webnotes": webnotes
+ "webnotes": webnotes,
+ "utils": webnotes.utils
})
args.update(ret)