Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
This commit is contained in:
		
						commit
						1475e4d295
					
				| @ -131,6 +131,10 @@ | |||||||
| 			"cart": { | 			"cart": { | ||||||
| 				"no_cache": true, | 				"no_cache": true, | ||||||
| 				"template": "app/website/templates/pages/cart.html" | 				"template": "app/website/templates/pages/cart.html" | ||||||
|  | 			}, | ||||||
|  | 			"partners": { | ||||||
|  | 				"template": "app/website/templates/pages/partners", | ||||||
|  | 				"args_method": "website.helpers.partner.get_partner_args" | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"generators": { | 		"generators": { | ||||||
| @ -149,6 +153,10 @@ | |||||||
| 			"Item Group":{ | 			"Item Group":{ | ||||||
| 				"template": "app/website/templates/html/product_group.html", | 				"template": "app/website/templates/html/product_group.html", | ||||||
| 				"condition_field": "show_in_website" | 				"condition_field": "show_in_website" | ||||||
|  | 			}, | ||||||
|  | 			"Sales Partner": { | ||||||
|  | 				"template": "app/website/templates/html/partner_page.html", | ||||||
|  | 				"condition_field": "show_in_website" | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -70,16 +70,17 @@ $(document).ready(function() { | |||||||
| 	// update login
 | 	// update login
 | ||||||
| 	var full_name = getCookie("full_name"); | 	var full_name = getCookie("full_name"); | ||||||
| 	if(full_name) { | 	if(full_name) { | ||||||
| 		$("#user-tools").html(repl('<a href="profile" title="My Profile" id="user-full-name">%(full_name)s</a> | \ | 		$("#user-tools").addClass("hide"); | ||||||
| 			<a href="account" title="My Account">My Account</a> | \ | 		$("#user-tools-post-login").removeClass("hide"); | ||||||
| 			<!--<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i> (%(count)s)</a> | -->\ | 		$("#user-full-name").text(full_name); | ||||||
| 			<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"}); |  | ||||||
| 	} | 	} | ||||||
| }) | 	 | ||||||
|  | 	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
 | // Utility functions
 | ||||||
| 
 | 
 | ||||||
| @ -162,3 +163,43 @@ if (typeof Array.prototype.map !== "function") { | |||||||
| 		return a; | 		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() + " )"); | ||||||
|  | 	} | ||||||
|  | }); | ||||||
| @ -8,44 +8,51 @@ | |||||||
| #  | #  | ||||||
| # This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | ||||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | # 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. | # GNU General Public License for more details. | ||||||
| #  | #  | ||||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||||
| # along with this program.  If not, see <http://www.gnu.org/licenses/>. | # along with this program.	If not, see <http://www.gnu.org/licenses/>. | ||||||
| 
 | 
 | ||||||
| from __future__ import unicode_literals | from __future__ import unicode_literals | ||||||
| import webnotes | import webnotes | ||||||
| 
 | from webnotes.utils import cint, cstr, filter_strip_join | ||||||
| from webnotes.model import db_exists |  | ||||||
| from webnotes.model.bean import copy_doclist |  | ||||||
| 
 | 
 | ||||||
| sql = webnotes.conn.sql | sql = webnotes.conn.sql | ||||||
| 	 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| class DocType: | class DocType: | ||||||
|   def __init__(self, doc, doclist=[]): | 	def __init__(self, doc, doclist=None): | ||||||
|     self.doc = doc | 		self.doc = doc | ||||||
|     self.doclist = doclist | 		self.doclist = doclist | ||||||
| 
 | 
 | ||||||
|   def validate(self): | 	def on_update(self): | ||||||
|     import string | 		if cint(self.doc.show_in_website): | ||||||
|    | 			from webnotes.webutils import update_page_name | ||||||
|     if not (self.doc.address_line1)  and not (self.doc.address_line2) and not (self.doc.city) and not (self.doc.state) and not (self.doc.country) and not (self.doc.pincode): | 			update_page_name(self.doc, self.doc.partner_name) | ||||||
|       return "Please enter address" | 		 | ||||||
|        | 		if self.doc.page_name: | ||||||
|     else: | 			from webnotes.webutils import clear_cache | ||||||
|       address =["address_line1", "address_line2", "city", "state", "country", "pincode"] | 			clear_cache(self.doc.page_name) | ||||||
|       comp_address='' | 			clear_cache("partners") | ||||||
|       for d in address: | 		 | ||||||
|         if self.doc.fields[d]: | 	def get_contacts(self,nm): | ||||||
|           comp_address += self.doc.fields[d] + "\n" | 		if nm: | ||||||
|       self.doc.address = comp_address | 			contact_details =webnotes.conn.convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm)) | ||||||
|      | 			return contact_details | ||||||
|   def get_contacts(self,nm): | 		else: | ||||||
|     if nm: | 			return '' | ||||||
|       contact_details =webnotes.conn.convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm)) | 			 | ||||||
|       return contact_details | 	def prepare_template_args(self): | ||||||
|     else: | 		address = webnotes.conn.get_value("Address",  | ||||||
|       return '' | 			{"sales_partner": self.doc.name, "is_primary_address": 1},  | ||||||
|  | 			"*", as_dict=True) | ||||||
|  | 		if address: | ||||||
|  | 			city_state = ", ".join(filter(None, [address.city, address.state])) | ||||||
|  | 			address_rows = [address.address_line1, address.address_line2, | ||||||
|  | 				city_state, address.pincode, address.country] | ||||||
|  | 				 | ||||||
|  | 			self.doc.fields.update({ | ||||||
|  | 				"email": address.email_id, | ||||||
|  | 				"partner_address": filter_strip_join(address_rows, "\n<br>"), | ||||||
|  | 				"phone": filter_strip_join(cstr(address.phone).split(","), "\n<br>") | ||||||
|  | 			}) | ||||||
|  | |||||||
| @ -1,8 +1,8 @@ | |||||||
| [ | [ | ||||||
|  { |  { | ||||||
|   "creation": "2013-01-10 16:34:24",  |   "creation": "2013-04-12 15:34:06",  | ||||||
|   "docstatus": 0,  |   "docstatus": 0,  | ||||||
|   "modified": "2013-01-22 15:04:05",  |   "modified": "2013-06-13 14:40:04",  | ||||||
|   "modified_by": "Administrator",  |   "modified_by": "Administrator",  | ||||||
|   "owner": "Administrator" |   "owner": "Administrator" | ||||||
|  },  |  },  | ||||||
| @ -25,6 +25,7 @@ | |||||||
|   "permlevel": 0 |   "permlevel": 0 | ||||||
|  },  |  },  | ||||||
|  { |  { | ||||||
|  |   "amend": 0,  | ||||||
|   "doctype": "DocPerm",  |   "doctype": "DocPerm",  | ||||||
|   "name": "__common__",  |   "name": "__common__",  | ||||||
|   "parent": "Sales Partner",  |   "parent": "Sales Partner",  | ||||||
| @ -39,14 +40,6 @@ | |||||||
|   "doctype": "DocType",  |   "doctype": "DocType",  | ||||||
|   "name": "Sales Partner" |   "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",  |   "doctype": "DocField",  | ||||||
|   "fieldname": "partner_name",  |   "fieldname": "partner_name",  | ||||||
| @ -69,6 +62,14 @@ | |||||||
|   "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller",  |   "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller",  | ||||||
|   "search_index": 0 |   "search_index": 0 | ||||||
|  },  |  },  | ||||||
|  |  { | ||||||
|  |   "doctype": "DocField",  | ||||||
|  |   "fieldname": "territory",  | ||||||
|  |   "fieldtype": "Link",  | ||||||
|  |   "label": "Territory",  | ||||||
|  |   "options": "Territory",  | ||||||
|  |   "reqd": 1 | ||||||
|  |  },  | ||||||
|  { |  { | ||||||
|   "doctype": "DocField",  |   "doctype": "DocField",  | ||||||
|   "fieldname": "column_break0",  |   "fieldname": "column_break0",  | ||||||
| @ -85,14 +86,6 @@ | |||||||
|   "oldfieldtype": "Currency",  |   "oldfieldtype": "Currency",  | ||||||
|   "reqd": 1 |   "reqd": 1 | ||||||
|  },  |  },  | ||||||
|  { |  | ||||||
|   "doctype": "DocField",  |  | ||||||
|   "fieldname": "territory",  |  | ||||||
|   "fieldtype": "Link",  |  | ||||||
|   "label": "Territory",  |  | ||||||
|   "options": "Territory",  |  | ||||||
|   "reqd": 1 |  | ||||||
|  },  |  | ||||||
|  { |  { | ||||||
|   "doctype": "DocField",  |   "doctype": "DocField",  | ||||||
|   "fieldname": "address_contacts",  |   "fieldname": "address_contacts",  | ||||||
| @ -162,7 +155,67 @@ | |||||||
|   "options": "Budget Distribution" |   "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,  |   "cancel": 0,  | ||||||
|   "create": 0,  |   "create": 0,  | ||||||
|   "doctype": "DocPerm",  |   "doctype": "DocPerm",  | ||||||
| @ -170,7 +223,6 @@ | |||||||
|   "write": 0 |   "write": 0 | ||||||
|  },  |  },  | ||||||
|  { |  { | ||||||
|   "amend": 0,  |  | ||||||
|   "cancel": 0,  |   "cancel": 0,  | ||||||
|   "create": 0,  |   "create": 0,  | ||||||
|   "doctype": "DocPerm",  |   "doctype": "DocPerm",  | ||||||
| @ -178,18 +230,10 @@ | |||||||
|   "write": 0 |   "write": 0 | ||||||
|  },  |  },  | ||||||
|  { |  { | ||||||
|   "amend": 0,  |  | ||||||
|   "cancel": 1,  |   "cancel": 1,  | ||||||
|   "create": 1,  |   "create": 1,  | ||||||
|   "doctype": "DocPerm",  |   "doctype": "DocPerm",  | ||||||
|   "role": "Sales Master Manager",  |   "role": "Sales Master Manager",  | ||||||
|   "write": 1 |   "write": 1 | ||||||
|  },  |  | ||||||
|  { |  | ||||||
|   "cancel": 1,  |  | ||||||
|   "create": 1,  |  | ||||||
|   "doctype": "DocPerm",  |  | ||||||
|   "role": "System Manager",  |  | ||||||
|   "write": 1 |  | ||||||
|  } |  } | ||||||
| ] | ] | ||||||
| @ -1,3 +1,7 @@ | |||||||
|  | .container { | ||||||
|  | 	max-width: 728px !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| h1, h2, h3, h4, h5 { | h1, h2, h3, h4, h5 { | ||||||
| 	font-weight: bold; | 	font-weight: bold; | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								website/helpers/partner.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								website/helpers/partner.py
									
									
									
									
									
										Normal file
									
								
							| @ -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), | ||||||
|  | 	} | ||||||
| @ -3,8 +3,17 @@ | |||||||
| {% block body %} | {% block body %} | ||||||
| 	<div class="container"> | 	<div class="container"> | ||||||
| 		<div class="pull-right" style="margin:4px;" id="user-tools"> | 		<div class="pull-right" style="margin:4px;" id="user-tools"> | ||||||
|  | 			<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>  | ||||||
|  | 				<span class="cart-count"></span></a> | | ||||||
| 			<a id="login-link" href="login">Login</a> | 			<a id="login-link" href="login">Login</a> | ||||||
| 		</div> | 		</div> | ||||||
|  | 		<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login"> | ||||||
|  | 			<a href="profile" title="My Profile" id="user-full-name"></a> | | ||||||
|  | 			<a href="account" title="My Account">My Account</a> | | ||||||
|  | 			<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>  | ||||||
|  | 				<span class="cart-count"></span></a> | | ||||||
|  | 			<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a> | ||||||
|  | 		</div> | ||||||
| 		<div class="clearfix"></div> | 		<div class="clearfix"></div> | ||||||
| 		{% if banner_html %}<div class="row" style="margin-top: 30px;"> | 		{% if banner_html %}<div class="row" style="margin-top: 30px;"> | ||||||
| 			<div class="col col-lg-12">{{ banner_html }}</div> | 			<div class="col col-lg-12">{{ banner_html }}</div> | ||||||
|  | |||||||
							
								
								
									
										26
									
								
								website/templates/html/partner_page.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								website/templates/html/partner_page.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | {% extends "app/website/templates/html/page.html" %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | 	<div class="col col-lg-12" itemscope itemtype="http://schema.org/Organization"> | ||||||
|  | 		<div class="row"> | ||||||
|  | 			<div class="col col-lg-4"> | ||||||
|  | 				{% if logo -%} | ||||||
|  | 				<img itemprop="brand" src="{{ logo }}" class="partner-logo"  | ||||||
|  | 					alt="{{ partner_name }}" title="{{ partner_name }}" /> | ||||||
|  | 				<br><br> | ||||||
|  | 				{%- endif %} | ||||||
|  | 				<address> | ||||||
|  | 					{% if partner_website -%}<p><a href="{{ partner_website }}"  | ||||||
|  | 						target="_blank">{{ partner_website }}</a></p>{%- endif %} | ||||||
|  | 					{% if partner_address -%}<p itemprop="address">{{ partner_address }}</p>{%- endif %} | ||||||
|  | 					{% if phone -%}<p itemprop="telephone">{{ phone }}</p>{%- endif %} | ||||||
|  | 					{% if email -%}<p itemprop="email"><span class="icon-envelope"></span> {{ email }}</p>{%- endif %} | ||||||
|  | 				</address> | ||||||
|  | 			</div> | ||||||
|  | 			<div class="col col-lg-8"> | ||||||
|  | 				<h3 itemprop="name" style="margin-top: 0px;">{{ partner_name }}</h3> | ||||||
|  | 				<p>{{ description }}</p> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
|  | 	</div> | ||||||
|  | {% endblock %} | ||||||
| @ -1,4 +1,5 @@ | |||||||
| <div class="col col-lg-3"> | <!-- TODO product listing --> | ||||||
|  | <div class="col col-lg-12"> | ||||||
| 	<div style="height: 120px; overflow: hidden;"> | 	<div style="height: 120px; overflow: hidden;"> | ||||||
| 		<a href="{{ page_name }}"> | 		<a href="{{ page_name }}"> | ||||||
| 		{%- if website_image -%} | 		{%- if website_image -%} | ||||||
|  | |||||||
| @ -29,14 +29,18 @@ | |||||||
| 			</div> | 			</div> | ||||||
| 			<div class="col col-lg-6"> | 			<div class="col col-lg-6"> | ||||||
| 				<h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3> | 				<h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3> | ||||||
| 				<p class="help">Item Code: {{ name }}</p> | 				<p class="help">Item Code: <span itemprop="productID">{{ name }}</span></p> | ||||||
| 				<h4>Product Description</h4> | 				<h4>Product Description</h4> | ||||||
| 				<div itemprop="description"> | 				<div itemprop="description"> | ||||||
| 				{{ web_long_description or web_short_description or  | 				{{ web_long_description or web_short_description or  | ||||||
| 					"[No description given]" }} | 					"[No description given]" }} | ||||||
| 				</div> | 				</div> | ||||||
| 				<div class="item-price hide"></div> | 				<div class="item-price-info" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> | ||||||
| 				<div class="item-stock"></div> | 					<div class="item-price hide" itemprop="price"></div> | ||||||
|  | 					<div class="item-stock" itemprop="availablity"></div> | ||||||
|  | 					<button class="btn btn-primary item-add-to-cart hide">Add to Cart</button> | ||||||
|  | 					<button class="btn btn-default item-remove-from-cart hide">Remove from Cart</button> | ||||||
|  | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 		{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%} | 		{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%} | ||||||
|  | |||||||
							
								
								
									
										66
									
								
								website/templates/js/cart.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								website/templates/js/cart.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,66 @@ | |||||||
|  | // ERPNext - web based ERP (http://erpnext.com)
 | ||||||
|  | // Copyright (C) 2012 Web Notes Technologies Pvt Ltd
 | ||||||
|  | // 
 | ||||||
|  | // This program is free software: you can redistribute it and/or modify
 | ||||||
|  | // it under the terms of the GNU General Public License as published by
 | ||||||
|  | // the Free Software Foundation, either version 3 of the License, or
 | ||||||
|  | // (at your option) any later version.
 | ||||||
|  | // 
 | ||||||
|  | // 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
 | ||||||
|  | // 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 <http://www.gnu.org/licenses/>.
 | ||||||
|  | 
 | ||||||
|  | // js inside blog page
 | ||||||
|  | 
 | ||||||
|  | $(document).ready(function() { | ||||||
|  | 	// make list of items in the cart
 | ||||||
|  | 	wn.cart.render(); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | // shopping cart
 | ||||||
|  | if(!wn.cart) wn.cart = {}; | ||||||
|  | $.extend(wn.cart, { | ||||||
|  | 	render: function() { | ||||||
|  | 		var $cart_wrapper = $("#cart-added-items").empty(); | ||||||
|  | 		if(Object.keys(wn.cart.get_cart()).length) { | ||||||
|  | 			$('<div class="row">\ | ||||||
|  | 				<div class="col col-lg-10 col-sm-10">\ | ||||||
|  | 					<div class="row">\ | ||||||
|  | 						<div class="col col-lg-3"></div>\ | ||||||
|  | 						<div class="col col-lg-9"><strong>Item Details</strong></div>\ | ||||||
|  | 					</div>\ | ||||||
|  | 				</div>\ | ||||||
|  | 				<div class="col col-lg-2 col-sm-2"><strong>Qty</strong></div>\ | ||||||
|  | 			</div><hr>').appendTo($cart_wrapper); | ||||||
|  | 			 | ||||||
|  | 			$.each(wn.cart.get_cart(), function(item_code, item) { | ||||||
|  | 				item.image_html = item.image ? | ||||||
|  | 					'<div style="height: 120px; overflow: hidden;"><img src="' + item.image + '" /></div>' : | ||||||
|  | 					'{% include "app/website/templates/html/product_missing_image.html" %}'; | ||||||
|  | 				item.price_html = item.price ? ('<p>@ ' + item.price + '</p>') : ""; | ||||||
|  | 
 | ||||||
|  | 				$(repl('<div class="row">\ | ||||||
|  | 					<div class="col col-lg-10 col-sm-10">\ | ||||||
|  | 						<div class="row">\ | ||||||
|  | 							<div class="col col-lg-3">%(image_html)s</div>\ | ||||||
|  | 							<div class="col col-lg-9">\ | ||||||
|  | 								<h4><a href="%(url)s">%(item_name)s</a></h4>\ | ||||||
|  | 								<p>%(description)s</p>\ | ||||||
|  | 							</div>\ | ||||||
|  | 						</div>\ | ||||||
|  | 					</div>\ | ||||||
|  | 					<div class="col col-lg-2 col-sm-2">\ | ||||||
|  | 						<input type="text" placeholder="Qty" value="%(qty)s">\ | ||||||
|  | 						%(price_html)s\ | ||||||
|  | 					</div>\ | ||||||
|  | 				</div><hr>', item)).appendTo($cart_wrapper); | ||||||
|  | 			}); | ||||||
|  | 		} else { | ||||||
|  | 			$('<p class="alert">No Items added to cart.</p>').appendTo($cart_wrapper); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | }); | ||||||
| @ -28,16 +28,41 @@ $(document).ready(function() { | |||||||
| 				if(data.message.price) { | 				if(data.message.price) { | ||||||
| 					$("<h4>").html(data.message.price.ref_currency + " "  | 					$("<h4>").html(data.message.price.ref_currency + " "  | ||||||
| 						+ data.message.price.ref_rate).appendTo(".item-price"); | 						+ data.message.price.ref_rate).appendTo(".item-price"); | ||||||
| 					$(".item-price").toggle(true); | 					$(".item-price").removeClass("hide"); | ||||||
| 				} | 				} | ||||||
| 				if(data.message.stock==0) { | 				if(data.message.stock==0) { | ||||||
| 					$(".item-stock").html("<div class='help'>Not in stock</div>") | 					$(".item-stock").html("<div class='help'>Not in stock</div>"); | ||||||
| 				} | 				} | ||||||
| 				else if(data.message.stock==1) { | 				else if(data.message.stock==1) { | ||||||
| 					$(".item-stock").html("<div style='color: green'>\ | 					$(".item-stock").html("<div style='color: green'>\ | ||||||
| 						<i class='icon-check'></i> Available (in stock)</div>") | 						<i class='icon-check'></i> Available (in stock)</div>"); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	}) | 	}); | ||||||
|  | 	 | ||||||
|  | 	if(wn.cart.get_cart()[$('[itemscope] [itemprop="name"]').text().trim()]) { | ||||||
|  | 		$(".item-remove-from-cart").removeClass("hide"); | ||||||
|  | 	} else { | ||||||
|  | 		$(".item-add-to-cart").removeClass("hide"); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	$("button.item-add-to-cart").on("click", function() { | ||||||
|  | 		wn.cart.add_to_cart({ | ||||||
|  | 			url: window.location.href, | ||||||
|  | 			image: $('[itemscope] [itemprop="image"]').attr("src"), | ||||||
|  | 			item_code: $('[itemscope] [itemprop="name"]').text().trim(), | ||||||
|  | 			item_name: $('[itemscope] [itemprop="productID"]').text().trim(), | ||||||
|  | 			description: $('[itemscope] [itemprop="description"]').html().trim(), | ||||||
|  | 			price: $('[itemscope] [itemprop="price"]').text().trim() | ||||||
|  | 		}); | ||||||
|  | 		$(".item-add-to-cart").addClass("hide"); | ||||||
|  | 		$(".item-remove-from-cart").removeClass("hide"); | ||||||
|  | 	}); | ||||||
|  | 	 | ||||||
|  | 	$("button.item-remove-from-cart").on("click", function() { | ||||||
|  | 		wn.cart.remove_from_cart($('[itemscope] [itemprop="name"]').text().trim()); | ||||||
|  | 		$(".item-add-to-cart").removeClass("hide"); | ||||||
|  | 		$(".item-remove-from-cart").addClass("hide"); | ||||||
|  | 	}); | ||||||
| }) | }) | ||||||
| @ -19,7 +19,7 @@ | |||||||
| 	<h3 id="blot-subtitle" style="display:none;"></h3> | 	<h3 id="blot-subtitle" style="display:none;"></h3> | ||||||
| 	<br> | 	<br> | ||||||
| 	<div class="progress progress-striped active"> | 	<div class="progress progress-striped active"> | ||||||
| 		<div class="bar" style="width: 100%;"></div> | 		<div class="progress-bar progress-bar-info" style="width: 100%;"></div> | ||||||
| 	</div> | 	</div> | ||||||
| 	<div id="blog-list"> | 	<div id="blog-list"> | ||||||
| 		<!-- blog list will be generated dynamically --> | 		<!-- blog list will be generated dynamically --> | ||||||
|  | |||||||
							
								
								
									
										17
									
								
								website/templates/pages/cart.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								website/templates/pages/cart.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | {% extends "app/website/templates/html/page.html" %} | ||||||
|  | 
 | ||||||
|  | {% block javascript %} | ||||||
|  | 	{% include "app/website/templates/js/cart.js" %} | ||||||
|  | {% endblock %} | ||||||
|  | 
 | ||||||
|  | {% set title="Shopping Cart" %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | <div class="col col-lg-12"> | ||||||
|  | 	<h2>Shopping Cart</h2> | ||||||
|  | 	<hr> | ||||||
|  | 	<div id="cart-added-items"> | ||||||
|  | 		<!-- list of items in the cart will be generated using javascript --> | ||||||
|  | 	</div> | ||||||
|  | </div> | ||||||
|  | {% endblock %} | ||||||
| @ -18,7 +18,7 @@ wn.currency_symbols = {{ currency_symbols }}; | |||||||
| 	<hr> | 	<hr> | ||||||
| 	<div id="order-list" style="font-size: 13px;"> | 	<div id="order-list" style="font-size: 13px;"> | ||||||
| 		<div class="progress progress-striped active"> | 		<div class="progress progress-striped active"> | ||||||
| 			<div class="bar" style="width: 100%;"></div> | 			<div class="progress-bar progress-bar-info" style="width: 100%;"></div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
|  | |||||||
							
								
								
									
										30
									
								
								website/templates/pages/partners.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								website/templates/pages/partners.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | {% extends "app/website/templates/html/page.html" %} | ||||||
|  | 
 | ||||||
|  | {% set title="Sales Partners" %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | 	<div class="col col-lg-12"> | ||||||
|  | 		<h2 id="blog-title">Sales Partners</h2> | ||||||
|  | 		<hr> | ||||||
|  | 		{% for partner_info in partners %} | ||||||
|  | 		<div class="row"> | ||||||
|  | 			<div class="col col-lg-3"> | ||||||
|  | 				{% if partner_info.logo -%} | ||||||
|  | 				<a href="{{ partner_info.page_name }}"> | ||||||
|  | 					<img itemprop="brand" src="{{ partner_info.logo }}" class="partner-logo"  | ||||||
|  | 						alt="{{ partner_info.partner_name }}" title="{{ partner_info.partner_name }}" /> | ||||||
|  | 				</a> | ||||||
|  | 				{%- endif %} | ||||||
|  | 			</div> | ||||||
|  | 			<div class="col col-lg-9"> | ||||||
|  | 				<a href="{{ partner_info.page_name }}"> | ||||||
|  | 					<h4>{{ partner_info.partner_name }}</h4> | ||||||
|  | 				</a> | ||||||
|  | 				<p style="color: #999">{{ partner_info.territory }} - {{ partner_info.partner_type }}</p> | ||||||
|  | 				<p>{{ partner_info.introduction }}</p> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
|  | 		<hr> | ||||||
|  | 		{% endfor %} | ||||||
|  | 	</div> | ||||||
|  | {% endblock %} | ||||||
| @ -13,7 +13,7 @@ | |||||||
| 	<hr> | 	<hr> | ||||||
| 	<div id="ticket-list" style="font-size: 13px;"> | 	<div id="ticket-list" style="font-size: 13px;"> | ||||||
| 		<div class="progress progress-striped active"> | 		<div class="progress progress-striped active"> | ||||||
| 			<div class="bar" style="width: 100%;"></div> | 			<div class="progress-bar progress-bar-info" style="width: 100%;"></div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user