upgraded to bootstrap 2.2
This commit is contained in:
parent
a93ba77918
commit
ee472b0926
@ -27,7 +27,7 @@ wn.pages['trial-balance'].onload = function(wrapper) {
|
||||
var msgbox = msgprint('<p>Select To Download:</p>\
|
||||
<p><input type="checkbox" name="with_groups" checked> Account Groups</p>\
|
||||
<p><input type="checkbox" name="with_ledgers" checked> Account Ledgers</p>\
|
||||
<p><button class="btn btn-info btn-small">Download</button>');
|
||||
<p><button class="btn btn-info">Download</button>');
|
||||
|
||||
var me = this;
|
||||
|
||||
|
@ -9,11 +9,11 @@ wn.pages['voucher-import-tool'].onload = function(wrapper) {
|
||||
<p class="help">Import multiple accounting entries via CSV (spreadsheet) file:</p>\
|
||||
<h3>1. Download Template</h3><br>\
|
||||
<div style="padding-left: 30px;">\
|
||||
<button class="btn btn-small btn-download-two-accounts">Download</button>\
|
||||
<button class="btn btn-download-two-accounts">Download</button>\
|
||||
<p class="help">Import multiple vouchers with one debit and one credit entry</p>\
|
||||
</div>\
|
||||
<div style="padding-left: 30px;">\
|
||||
<button class="btn btn-small btn-download-multiple-accounts">Download</button>\
|
||||
<button class="btn btn-download-multiple-accounts">Download</button>\
|
||||
<p class="help">Import multiple vouchers with multiple accounts</p>\
|
||||
</div>\
|
||||
<hr>\
|
||||
|
@ -95,7 +95,7 @@ EditableText = function(args) {
|
||||
<textarea class="ed-text-input %(inp_class)s hide"></textarea>\
|
||||
<div class="help hide"><br>Formatted as <a href="#markdown-reference"\
|
||||
target="_blank">markdown</a></div>\
|
||||
<button class="btn btn-small btn-info hide ed-text-save">Save</button>\
|
||||
<button class="btn btn-info hide ed-text-save">Save</button>\
|
||||
<a class="ed-text-cancel hide" style="cursor: pointer;">Cancel</a>\
|
||||
</div>', args)).appendTo(me.parent);
|
||||
|
||||
|
@ -28,7 +28,7 @@ wn.pages.messages.onload = function(wrapper) {
|
||||
</div><hr>\
|
||||
<div id="post-message">\
|
||||
<textarea style="width: 100%; height: 24px;"></textarea>\
|
||||
<div><button class="btn btn-small">Post</button></div><hr>\
|
||||
<div><button class="btn">Post</button></div><hr>\
|
||||
</div>\
|
||||
<div class="all-messages"></div>').appendTo($(wrapper).find('.layout-main-section'));
|
||||
|
||||
@ -182,7 +182,7 @@ erpnext.Messages = Class.extend({
|
||||
var $body = $(me.wrapper).find('.layout-side-section');
|
||||
$('<h4>Users</h4><hr>\
|
||||
<div id="show-everyone">\
|
||||
<a href="#messages/'+user+'" class="btn btn-small">\
|
||||
<a href="#messages/'+user+'" class="btn">\
|
||||
Show messages from everyone</a><hr></div>\
|
||||
').appendTo($body);
|
||||
r.message.sort(function(a, b) { return b.has_session - a.has_session; });
|
||||
|
@ -4,6 +4,25 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_product_info(item_code):
|
||||
"""get product price / stock info"""
|
||||
price_list = webnotes.conn.get_value("Item", item_code, "website_price_list")
|
||||
warehouse = webnotes.conn.get_value("Item", item_code, "website_warehouse")
|
||||
if warehouse:
|
||||
in_stock = webnotes.conn.sql("""select actual_qty from tabBin where
|
||||
item_code=%s and warehouse=%s""", (item_code, warehouse))
|
||||
if in_stock:
|
||||
in_stock = in_stock[0][0] > 0 and 1 or 0
|
||||
else:
|
||||
in_stock = -1
|
||||
return {
|
||||
"price": price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
|
||||
`tabItem Price` where parent=%s and price_list_name=%s""",
|
||||
(item_code, price_list), as_dict=1) or [],
|
||||
"stock": in_stock
|
||||
}
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_product_list(args=None):
|
||||
"""
|
||||
|
@ -1,6 +1,9 @@
|
||||
<style>
|
||||
.product-page-content {
|
||||
margin-left: -20px;
|
||||
}
|
||||
.item-main-image {
|
||||
max-width: 60%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.web-long-description {
|
||||
font-size: 18px;
|
||||
|
@ -20,9 +20,10 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" id="content-product-{{ name }}">
|
||||
<div class="layout-main" style="padding: 30px;">
|
||||
{% include 'html/product_search.html' %}
|
||||
<h1>{{ item_name }}</h1>
|
||||
<div class="product-page-content">
|
||||
<br><br>
|
||||
<div class="span6">
|
||||
{% if website_image %}
|
||||
<image class="item-main-image" src="files/{{ website_image }}" />
|
||||
{% else %}
|
||||
@ -30,23 +31,34 @@
|
||||
<span style="font-size: 11px">This is an auto-generated Image</span>
|
||||
{% endif %}
|
||||
<br><br>
|
||||
<h3>Product Description</h3>
|
||||
<div>
|
||||
{{ web_long_description or web_short_description }}
|
||||
</div>
|
||||
<hr>
|
||||
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
|
||||
<h3>Specifications</h3>
|
||||
<table class="table table-striped table-bordered" style="width: 80%">
|
||||
{% for d in obj.doclist.get(
|
||||
{"doctype":"Item Website Specification"}) %}
|
||||
<tr>
|
||||
<td>{{ d.label }}</td>
|
||||
<td>{{ d.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
<div class="span3">
|
||||
<div class="item-price hide">
|
||||
<p>Price:</p>
|
||||
</div>
|
||||
<div class="item-stock"></div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="span9">
|
||||
<h3>Product Description</h3>
|
||||
<div>
|
||||
{{ web_long_description or web_short_description }}
|
||||
</div>
|
||||
<hr>
|
||||
{% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
|
||||
<h3>Specifications</h3>
|
||||
<table class="table table-striped table-bordered" style="width: 100%">
|
||||
{% for d in obj.doclist.get(
|
||||
{"doctype":"Item Website Specification"}) %}
|
||||
<tr>
|
||||
<td>{{ d.label }}</td>
|
||||
<td>{{ d.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
9
website/templates/html/product_search.html
Normal file
9
website/templates/html/product_search.html
Normal file
@ -0,0 +1,9 @@
|
||||
<div class="pull-right">
|
||||
<form class="form-search">
|
||||
<div class="input-append">
|
||||
<input type="text" class="span2 search-query" id="product-search">
|
||||
<button class="btn"><i class="icon-search"></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
@ -14,79 +14,30 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
{% include "js/product_category.js" %}
|
||||
|
||||
wn.pages['{{ name }}'].onload = function(wrapper) {
|
||||
wrapper.product_group = "{{ item_group }}";
|
||||
wrapper.product_name = "{{ name }}";
|
||||
erpnext.products.make_product_categories(wrapper);
|
||||
erpnext.products.make_similar_products(wrapper);
|
||||
|
||||
// if website image missing, autogenerate one
|
||||
var $img = $(wrapper).find('.product-page-content .img-area');
|
||||
if ($img && $img.length > 0) {
|
||||
$img.append(wn.dom.placeholder(160, "{{ item_name }}"));
|
||||
}
|
||||
|
||||
erpnext.products.adjust_page_height(wrapper);
|
||||
|
||||
}
|
||||
|
||||
erpnext.products.adjust_page_height = function(wrapper) {
|
||||
if (!wrapper) { wrapper = erpnext.products.wrapper; }
|
||||
if (!wrapper) { return; }
|
||||
|
||||
// adjust page height based on sidebar height
|
||||
var $main_page = $(wrapper).find('.layout-main-section');
|
||||
var $sidebar = $(wrapper).find('.layout-side-section');
|
||||
if ($sidebar.height() > $main_page.height()) {
|
||||
$main_page.height($sidebar.height());
|
||||
}
|
||||
}
|
||||
|
||||
erpnext.products.make_similar_products = function(wrapper) {
|
||||
if (!wrapper) { wrapper = erpnext.products.wrapper; }
|
||||
if (!wrapper) { return; }
|
||||
|
||||
// similar products
|
||||
wrapper.similar = new wn.ui.Listing({
|
||||
parent: $(wrapper).find('.similar-products').get(0),
|
||||
hide_refresh: true,
|
||||
page_length: 5,
|
||||
method: 'website.helpers.product.get_similar_product_list',
|
||||
get_args: function() {
|
||||
return {
|
||||
product_group: wrapper.product_group,
|
||||
product_name: wrapper.product_name
|
||||
}
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url:"server.py",
|
||||
dataType: "json",
|
||||
data: {
|
||||
cmd: "website.helpers.product.get_product_info",
|
||||
item_code: "{{ name }}"
|
||||
},
|
||||
render_row: function(parent, data) {
|
||||
if (!data.web_short_description) {
|
||||
data.web_short_description = data.description;
|
||||
success: function(data) {
|
||||
if(data.message) {
|
||||
if(data.message.price) {
|
||||
$("<h4>").html(data.message.price[0].ref_currency + " "
|
||||
+ data.message.price[0].ref_rate).appendTo(".item-price");
|
||||
$(".item-price").toggle(true);
|
||||
}
|
||||
if(data.message.stock==0) {
|
||||
$(".item-stock").html("<div class='help'>Not in stock</div>")
|
||||
}
|
||||
else if(data.message.stock==1) {
|
||||
$(".item-stock").html("<div style='color: green'>\
|
||||
<i class='icon-check'></i> Available (in stock)</div>")
|
||||
}
|
||||
}
|
||||
if(data.web_short_description.length > 100) {
|
||||
data.web_short_description =
|
||||
data.web_short_description.substr(0,100) + '...';
|
||||
}
|
||||
parent.innerHTML = repl('\
|
||||
<a href="%(page_name)s.html"><div class="img-area"></div></a>\
|
||||
<div class="similar-product-description">\
|
||||
<h5><a href="%(page_name)s.html">%(item_name)s</a></h5>\
|
||||
<span>%(web_short_description)s</span>\
|
||||
</div>\
|
||||
<div style="clear:both"></div>', data);
|
||||
|
||||
if(data.website_image) {
|
||||
$(parent).find('.img-area').append(repl(
|
||||
'<img src="files/%(website_image)s" />', data))
|
||||
} else {
|
||||
$(parent).find('.img-area').append(wn.dom.placeholder(55,
|
||||
data.item_name));
|
||||
}
|
||||
|
||||
// adjust page height, if sidebar height keeps increasing
|
||||
erpnext.products.adjust_page_height(wrapper);
|
||||
}
|
||||
});
|
||||
wrapper.similar.run();
|
||||
}
|
||||
})
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user