[website] [minor] moving to framework
diff --git a/portal/templates/includes/cart.js b/portal/templates/includes/cart.js
index 63c6463..84d49f3 100644
--- a/portal/templates/includes/cart.js
+++ b/portal/templates/includes/cart.js
@@ -128,7 +128,7 @@
render_item_row: function($cart_items, doc) {
doc.image_html = doc.image ?
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.image + '" /></div>' :
- '{% include "app/website/templates/html/product_missing_image.html" %}';
+ '{% include "app/stock/doctype/item/templates/includes/product_missing_image.html" %}';
if(doc.description === doc.item_name) doc.description = "";
diff --git a/portal/templates/pages/account.py b/portal/templates/pages/account.py
new file mode 100644
index 0000000..24b474a
--- /dev/null
+++ b/portal/templates/pages/account.py
@@ -0,0 +1,6 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+no_cache = True
\ No newline at end of file
diff --git a/portal/templates/pages/cart.html b/portal/templates/pages/cart.html
index 372f524..f210772 100644
--- a/portal/templates/pages/cart.html
+++ b/portal/templates/pages/cart.html
@@ -1,7 +1,7 @@
{% extends base_template %}
{% block javascript %}
- {% include "app/website/templates/js/cart.js" %}
+<script>{% include "app/portal/templates/includes/cart.js" %}</script>
{% endblock %}
{% set title="Shopping Cart" %}
diff --git a/portal/templates/pages/cart.py b/portal/templates/pages/cart.py
new file mode 100644
index 0000000..24b474a
--- /dev/null
+++ b/portal/templates/pages/cart.py
@@ -0,0 +1,6 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+no_cache = True
\ No newline at end of file
diff --git a/portal/templates/pages/invoice.html b/portal/templates/pages/invoice.html
deleted file mode 100644
index 376e5df..0000000
--- a/portal/templates/pages/invoice.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sale.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/invoice.py b/portal/templates/pages/invoice.py
deleted file mode 100644
index ed6e40a..0000000
--- a/portal/templates/pages/invoice.py
+++ /dev/null
@@ -1,14 +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
-
-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
\ No newline at end of file
diff --git a/portal/templates/pages/invoices.html b/portal/templates/pages/invoices.html
deleted file mode 100644
index f108683..0000000
--- a/portal/templates/pages/invoices.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sales_transactions.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/invoices.py b/portal/templates/pages/invoices.py
deleted file mode 100644
index 2bb6490..0000000
--- a/portal/templates/pages/invoices.py
+++ /dev/null
@@ -1,22 +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
-
-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)
\ No newline at end of file
diff --git a/portal/templates/pages/order.html b/portal/templates/pages/order.html
deleted file mode 100644
index 376e5df..0000000
--- a/portal/templates/pages/order.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sale.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/order.py b/portal/templates/pages/order.py
deleted file mode 100644
index 47e2c68..0000000
--- a/portal/templates/pages/order.py
+++ /dev/null
@@ -1,14 +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
-
-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
\ No newline at end of file
diff --git a/portal/templates/pages/orders.html b/portal/templates/pages/orders.html
deleted file mode 100644
index f108683..0000000
--- a/portal/templates/pages/orders.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sales_transactions.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/orders.py b/portal/templates/pages/orders.py
deleted file mode 100644
index 3c62d35..0000000
--- a/portal/templates/pages/orders.py
+++ /dev/null
@@ -1,23 +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
-
-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)
-
\ No newline at end of file
diff --git a/portal/templates/pages/profile.html b/portal/templates/pages/profile.html
index 2fe03ba..65f3e37 100644
--- a/portal/templates/pages/profile.html
+++ b/portal/templates/pages/profile.html
@@ -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>
@@ -39,7 +39,7 @@
$("#fullname").val(getCookie("full_name") || "");
$("#update_profile").click(function() {
wn.call({
- method: "startup.webutils.update_profile",
+ method: "portal.templates.pages.profile.update_profile",
type: "POST",
args: {
fullname: $("#fullname").val(),
diff --git a/portal/templates/pages/profile.py b/portal/templates/pages/profile.py
new file mode 100644
index 0000000..b7be74c
--- /dev/null
+++ b/portal/templates/pages/profile.py
@@ -0,0 +1,32 @@
+# 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 cstr
+
+no_cache = True
+
+def get_context():
+ from selling.utils.cart import get_lead_or_customer
+ party = get_lead_or_customer()
+ if party.doctype == "Lead":
+ mobile_no = party.mobile_no
+ phone = party.phone
+ else:
+ mobile_no, phone = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user,
+ "customer": party.name}, ["mobile_no", "phone"])
+
+ return {
+ "company_name": cstr(party.customer_name if party.doctype == "Customer" else party.company_name),
+ "mobile_no": cstr(mobile_no),
+ "phone": cstr(phone)
+ }
+
+@webnotes.whitelist()
+def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
+ from selling.utils.cart import update_party
+ update_party(fullname, company_name, mobile_no, phone)
+
+ from core.doctype.profile import profile
+ return profile.update_profile(fullname, password)
\ No newline at end of file
diff --git a/portal/templates/pages/shipment.html b/portal/templates/pages/shipment.html
deleted file mode 100644
index 376e5df..0000000
--- a/portal/templates/pages/shipment.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sale.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/shipment.py b/portal/templates/pages/shipment.py
deleted file mode 100644
index 5d9d1d1..0000000
--- a/portal/templates/pages/shipment.py
+++ /dev/null
@@ -1,14 +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
-
-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
\ No newline at end of file
diff --git a/portal/templates/pages/shipments.html b/portal/templates/pages/shipments.html
deleted file mode 100644
index f108683..0000000
--- a/portal/templates/pages/shipments.html
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "app/portal/templates/sales_transactions.html" %}
\ No newline at end of file
diff --git a/portal/templates/pages/shipments.py b/portal/templates/pages/shipments.py
deleted file mode 100644
index 4847b9f..0000000
--- a/portal/templates/pages/shipments.py
+++ /dev/null
@@ -1,22 +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
-
-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)
diff --git a/portal/templates/profile.html b/portal/templates/profile.html
deleted file mode 100644
index e8e60b4..0000000
--- a/portal/templates/profile.html
+++ /dev/null
@@ -1,61 +0,0 @@
-{% 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 alert-warning" 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 %}
\ No newline at end of file