[website] [partners listing] first cut
This commit is contained in:
parent
48519ef8ae
commit
8e2ea5fed6
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,32 +16,23 @@
|
|||||||
|
|
||||||
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
|
||||||
|
update_page_name(self.doc, self.doc.partner_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):
|
if self.doc.page_name:
|
||||||
return "Please enter address"
|
from webnotes.webutils import clear_cache
|
||||||
|
clear_cache(self.doc.page_name)
|
||||||
else:
|
|
||||||
address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
|
|
||||||
comp_address=''
|
|
||||||
for d in address:
|
|
||||||
if self.doc.fields[d]:
|
|
||||||
comp_address += self.doc.fields[d] + "\n"
|
|
||||||
self.doc.address = comp_address
|
|
||||||
|
|
||||||
def get_contacts(self,nm):
|
def get_contacts(self,nm):
|
||||||
if nm:
|
if nm:
|
||||||
@ -49,3 +40,18 @@ class DocType:
|
|||||||
return contact_details
|
return contact_details
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def prepare_template_args(self):
|
||||||
|
address = webnotes.conn.get_value("Address",
|
||||||
|
{"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
|
|
||||||
}
|
}
|
||||||
]
|
]
|
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),
|
||||||
|
}
|
28
website/templates/html/partner_page.html
Normal file
28
website/templates/html/partner_page.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{% 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 %}
|
||||||
|
<div>
|
||||||
|
<address>
|
||||||
|
{% if partner_website -%}<p><a href="{{ partner_website }}"
|
||||||
|
target="_blank">{{ partner_website }}</a></p>{%- endif %}
|
||||||
|
{% if partner_address -%}<p>{{ partner_address }}</p>{%- endif %}
|
||||||
|
{% if phone -%}<p>{{ phone }}</p>{%- endif %}
|
||||||
|
{% if email -%}<p><a href="mailto:{{ email }}">{{ email }}</a></p>{%- endif %}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col col-lg-8">
|
||||||
|
<h3 itemprop="name" style="margin-top: 0px;">{{ partner_name }}</h3>
|
||||||
|
<p>{{ description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
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 %}
|
Loading…
x
Reference in New Issue
Block a user