diff --git a/config.json b/config.json
index 33e898f2219..46cd8c98f22 100644
--- a/config.json
+++ b/config.json
@@ -131,6 +131,10 @@
"cart": {
"no_cache": true,
"template": "app/website/templates/pages/cart.html"
+ },
+ "partners": {
+ "template": "app/website/templates/pages/partners",
+ "args_method": "website.helpers.partner.get_partner_args"
}
},
"generators": {
@@ -149,6 +153,10 @@
"Item Group":{
"template": "app/website/templates/html/product_group.html",
"condition_field": "show_in_website"
+ },
+ "Sales Partner": {
+ "template": "app/website/templates/html/partner_page.html",
+ "condition_field": "show_in_website"
}
}
}
diff --git a/public/js/website_utils.js b/public/js/website_utils.js
index d1b5ab7f206..73fb04b1078 100644
--- a/public/js/website_utils.js
+++ b/public/js/website_utils.js
@@ -70,16 +70,17 @@ $(document).ready(function() {
// update login
var full_name = getCookie("full_name");
if(full_name) {
- $("#user-tools").html(repl('%(full_name)s | \
- My Account | \
- \
- ', {
- full_name: full_name,
- count: getCookie("cart_count") || "0"
- }));
- $("#user-tools a").tooltip({"placement":"bottom"});
+ $("#user-tools").addClass("hide");
+ $("#user-tools-post-login").removeClass("hide");
+ $("#user-full-name").text(full_name);
}
-})
+
+ wn.cart.update_display();
+ $("#user-tools a").tooltip({"placement":"bottom"});
+ $("#user-tools-post-login a").tooltip({"placement":"bottom"});
+
+ $(window).on("storage", function() { wn.cart.update_display(); });
+});
// Utility functions
@@ -162,3 +163,43 @@ if (typeof Array.prototype.map !== "function") {
return a;
};
}
+
+// shopping cart
+if(!wn.cart) wn.cart = {};
+$.extend(wn.cart, {
+ get_count: function() {
+ return Object.keys(this.get_cart()).length;
+ },
+
+ add_to_cart: function(itemprop) {
+ var cart = this.get_cart();
+ cart[itemprop.item_code] = $.extend(itemprop, {qty: 1});
+ this.set_cart(cart);
+ console.log(this.get_cart());
+ },
+
+ remove_from_cart: function(item_code) {
+ var cart = this.get_cart();
+ delete cart[item_code];
+ this.set_cart(cart);
+ console.log(this.get_cart());
+ },
+
+ get_cart: function() {
+ if( !("localStorage" in window) ) {
+ alert("Your browser seems to be ancient. Please use a modern browser.");
+ throw "ancient browser error";
+ }
+
+ return JSON.parse(localStorage.getItem("cart")) || {};
+ },
+
+ set_cart: function(cart) {
+ localStorage.setItem("cart", JSON.stringify(cart));
+ wn.cart.update_display();
+ },
+
+ update_display: function() {
+ $(".cart-count").text("( " + wn.cart.get_count() + " )");
+ }
+});
\ No newline at end of file
diff --git a/setup/doctype/sales_partner/sales_partner.py b/setup/doctype/sales_partner/sales_partner.py
index 285d3a9496b..dc46b20e177 100644
--- a/setup/doctype/sales_partner/sales_partner.py
+++ b/setup/doctype/sales_partner/sales_partner.py
@@ -8,44 +8,51 @@
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
"),
+ "phone": filter_strip_join(cstr(address.phone).split(","), "\n
")
+ })
diff --git a/setup/doctype/sales_partner/sales_partner.txt b/setup/doctype/sales_partner/sales_partner.txt
index 81c75008be0..6fdeb69422a 100644
--- a/setup/doctype/sales_partner/sales_partner.txt
+++ b/setup/doctype/sales_partner/sales_partner.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:24",
+ "creation": "2013-04-12 15:34:06",
"docstatus": 0,
- "modified": "2013-01-22 15:04:05",
+ "modified": "2013-06-13 14:40:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,6 +25,7 @@
"permlevel": 0
},
{
+ "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Sales Partner",
@@ -39,14 +40,6 @@
"doctype": "DocType",
"name": "Sales Partner"
},
- {
- "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts",
- "doctype": "DocField",
- "fieldname": "basic_info",
- "fieldtype": "Section Break",
- "label": "Sales Partner Details",
- "oldfieldtype": "Section Break"
- },
{
"doctype": "DocField",
"fieldname": "partner_name",
@@ -69,6 +62,14 @@
"options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller",
"search_index": 0
},
+ {
+ "doctype": "DocField",
+ "fieldname": "territory",
+ "fieldtype": "Link",
+ "label": "Territory",
+ "options": "Territory",
+ "reqd": 1
+ },
{
"doctype": "DocField",
"fieldname": "column_break0",
@@ -85,14 +86,6 @@
"oldfieldtype": "Currency",
"reqd": 1
},
- {
- "doctype": "DocField",
- "fieldname": "territory",
- "fieldtype": "Link",
- "label": "Territory",
- "options": "Territory",
- "reqd": 1
- },
{
"doctype": "DocField",
"fieldname": "address_contacts",
@@ -162,7 +155,67 @@
"options": "Budget Distribution"
},
{
- "amend": 0,
+ "doctype": "DocField",
+ "fieldname": "website",
+ "fieldtype": "Section Break",
+ "label": "Website"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "show_in_website",
+ "fieldtype": "Check",
+ "label": "Show In Website"
+ },
+ {
+ "depends_on": "eval:cint(doc.show_in_website)",
+ "doctype": "DocField",
+ "fieldname": "section_break_17",
+ "fieldtype": "Section Break"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "logo",
+ "fieldtype": "Select",
+ "label": "Logo",
+ "options": "attach_files:"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "partner_website",
+ "fieldtype": "Data",
+ "label": "Partner's Website"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "column_break_20",
+ "fieldtype": "Column Break"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "page_name",
+ "fieldtype": "Data",
+ "label": "Page Name",
+ "read_only": 1
+ },
+ {
+ "depends_on": "eval:cint(doc.show_in_website)",
+ "doctype": "DocField",
+ "fieldname": "section_break_22",
+ "fieldtype": "Section Break"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "introduction",
+ "fieldtype": "Text",
+ "label": "Introduction"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "description",
+ "fieldtype": "Text Editor",
+ "label": "Description"
+ },
+ {
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
@@ -170,7 +223,6 @@
"write": 0
},
{
- "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
@@ -178,18 +230,10 @@
"write": 0
},
{
- "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Sales Master Manager",
"write": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "role": "System Manager",
- "write": 1
}
]
\ No newline at end of file
diff --git a/website/css/website.css b/website/css/website.css
index 36e306d5eb1..4af35dcc728 100644
--- a/website/css/website.css
+++ b/website/css/website.css
@@ -1,3 +1,7 @@
+.container {
+ max-width: 728px !important;
+}
+
h1, h2, h3, h4, h5 {
font-weight: bold;
}
diff --git a/website/helpers/partner.py b/website/helpers/partner.py
new file mode 100644
index 00000000000..cfe66b9862e
--- /dev/null
+++ b/website/helpers/partner.py
@@ -0,0 +1,11 @@
+# Copyright (c) 2012 Web Notes Technologies Pvt Ltd.
+# License: GNU General Public License (v3). For more information see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+def get_partner_args():
+ return {
+ "partners": webnotes.conn.sql("""select * from `tabSales Partner`
+ where show_in_website=1 order by name asc""", as_dict=True),
+ }
\ No newline at end of file
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html
index ec71476f77b..cc1181cbd2c 100644
--- a/website/templates/html/outer.html
+++ b/website/templates/html/outer.html
@@ -3,8 +3,17 @@
{% block body %}
{{ partner_address }}
{%- endif %} + {% if phone -%}{{ phone }}
{%- endif %} + {% if email -%}{{ email }}
{%- endif %} + +{{ description }}
+Item Code: {{ name }}
+Item Code: {{ name }}
@ ' + item.price + '
') : ""; + + $(repl('%(description)s
\ +No Items added to cart.
').appendTo($cart_wrapper); + } + } +}); \ No newline at end of file diff --git a/website/templates/js/product_page.js b/website/templates/js/product_page.js index 69e9cd52feb..338f25331d9 100644 --- a/website/templates/js/product_page.js +++ b/website/templates/js/product_page.js @@ -28,16 +28,41 @@ $(document).ready(function() { if(data.message.price) { $("{{ partner_info.territory }} - {{ partner_info.partner_type }}
+{{ partner_info.introduction }}
+