mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 18:24:10 +00:00
Redesigned templates. Now all templates must be inside templates/pages templates/generators
This commit is contained in:
0
erpnext/templates/__init__.py
Normal file
0
erpnext/templates/__init__.py
Normal file
0
erpnext/templates/generators/__init__.py
Normal file
0
erpnext/templates/generators/__init__.py
Normal file
87
erpnext/templates/generators/item.html
Normal file
87
erpnext/templates/generators/item.html
Normal file
@@ -0,0 +1,87 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% block javascript %}
|
||||
<script>
|
||||
{% include "templates/includes/product_page.js" %}
|
||||
|
||||
$(function() {
|
||||
if(window.logged_in && getCookie("system_user")==="yes") {
|
||||
wn.has_permission("Item", "{{ name }}", "write", function(r) {
|
||||
wn.require("assets/webnotes/js/wn/website/editable.js");
|
||||
wn.make_editable($('[itemprop="description"]'), "Item", "{{ name }}", "web_long_description");
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
{% include "templates/includes/product_page.css" %}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'templates/includes/product_search_box.html' %}
|
||||
{% include 'templates/includes/product_breadcrumbs.html' %}
|
||||
<div class="container content product-page-content" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{% if slideshow %}
|
||||
{% include "templates/includes/slideshow.html" %}
|
||||
{% else %}
|
||||
{% if website_image %}
|
||||
<image itemprop="image" class="item-main-image"
|
||||
src="{{ website_image }}" />
|
||||
{% else %}
|
||||
<div class="img-area">
|
||||
{% include 'templates/includes/product_missing_image.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h3 itemprop="name" style="margin-top: 0px;">{{ item_name }}</h3>
|
||||
<p class="help">Item Code: <span itemprop="productID">{{ name }}</span></p>
|
||||
<h4>Product Description</h4>
|
||||
<div itemprop="description">
|
||||
{{ web_long_description or description or "[No description given]" }}
|
||||
</div>
|
||||
<div style="min-height: 100px; margin: 10px 0;">
|
||||
<div class="item-price-info" style="display: none;">
|
||||
<h4 class="item-price" itemprop="price"></h4>
|
||||
<div class="item-stock" itemprop="availablity"></div>
|
||||
<div id="item-add-to-cart">
|
||||
<button class="btn btn-primary">
|
||||
<i class="icon-shopping-cart"></i> Add to Cart</button>
|
||||
</div>
|
||||
<div id="item-update-cart" class="input-group col-md-4" style="display: none;
|
||||
padding-left: 0px; padding-right: 0px;">
|
||||
<input class="form-control" type="text">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-primary">
|
||||
<i class="icon-ok"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if obj.doclist.get({"doctype":"Item Website Specification"}) -%}
|
||||
<div class="row" style="margin-top: 20px">
|
||||
<div class="col-md-12">
|
||||
<h4>Specifications</h4>
|
||||
<table class="table table-bordered" style="width: 100%">
|
||||
{% for d in obj.doclist.get(
|
||||
{"doctype":"Item Website Specification"}) -%}
|
||||
<tr>
|
||||
<td style="width: 30%;">{{ d.label }}</td>
|
||||
<td>{{ d.description }}</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
2
erpnext/templates/generators/item.py
Normal file
2
erpnext/templates/generators/item.py
Normal file
@@ -0,0 +1,2 @@
|
||||
doctype = "Item"
|
||||
condition_field = "show_in_website"
|
||||
52
erpnext/templates/generators/item_group.html
Normal file
52
erpnext/templates/generators/item_group.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% block content %}
|
||||
{% include 'templates/includes/product_search_box.html' %}
|
||||
{% include 'templates/includes/product_breadcrumbs.html' %}
|
||||
<div class="container content">
|
||||
{% if slideshow %}<!-- slideshow -->
|
||||
{% include "templates/includes/slideshow.html" %}
|
||||
{% endif %}
|
||||
{% if description %}<!-- description -->
|
||||
<div itemprop="description">{{ description or ""}}</div>
|
||||
{% else %}
|
||||
<h3>{{ name }}</h3>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="container content">
|
||||
{% if sub_groups %}
|
||||
<hr />
|
||||
<div class="row">
|
||||
{% for d in sub_groups %}
|
||||
<div class="col-md-4">
|
||||
<a href="{{ d.page_name }}">{{ d.name }} ({{ d.count }})</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr />
|
||||
{% endif %}
|
||||
{% if items %}
|
||||
<div id="search-list" class="row">
|
||||
{% for item in items %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if (items|length)==100 %}
|
||||
<div class="alert alert-info info">Showing top 100 items.</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="alert alert-warning">No items listed.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
if(window.logged_in && getCookie("system_user")==="yes") {
|
||||
wn.has_permission("Item Group", "{{ name }}", "write", function(r) {
|
||||
wn.require("assets/webnotes/js/wn/website/editable.js");
|
||||
wn.make_editable($('[itemprop="description"]'), "Item Group", "{{ name }}", "description");
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
2
erpnext/templates/generators/item_group.py
Normal file
2
erpnext/templates/generators/item_group.py
Normal file
@@ -0,0 +1,2 @@
|
||||
doctype = "Item Group"
|
||||
condition_field = "show_in_website"
|
||||
294
erpnext/templates/includes/cart.js
Normal file
294
erpnext/templates/includes/cart.js
Normal file
@@ -0,0 +1,294 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// js inside blog page
|
||||
|
||||
$(document).ready(function() {
|
||||
erpnext.cart.bind_events();
|
||||
return wn.call({
|
||||
type: "POST",
|
||||
method: "erpnext.selling.utils.cart.get_cart_quotation",
|
||||
callback: function(r) {
|
||||
$("#cart-container").removeClass("hide");
|
||||
$(".progress").remove();
|
||||
if(r.exc) {
|
||||
if(r.exc.indexOf("WebsitePriceListMissingError")!==-1) {
|
||||
erpnext.cart.show_error("Oops!", wn._("Price List not configured."));
|
||||
} else if(r["403"]) {
|
||||
erpnext.cart.show_error("Hey!", wn._("You need to be logged in to view your cart."));
|
||||
} else {
|
||||
erpnext.cart.show_error("Oops!", wn._("Something went wrong."));
|
||||
}
|
||||
} else {
|
||||
erpnext.cart.set_cart_count();
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// shopping cart
|
||||
if(!erpnext.cart) erpnext.cart = {};
|
||||
$.extend(erpnext.cart, {
|
||||
show_error: function(title, text) {
|
||||
$("#cart-container").html('<div class="well"><h4>' + title + '</h4> ' + text + '</div>');
|
||||
},
|
||||
|
||||
bind_events: function() {
|
||||
// bind update button
|
||||
$(document).on("click", ".item-update-cart button", function() {
|
||||
var item_code = $(this).attr("data-item-code");
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: $('input[data-item-code="'+item_code+'"]').val(),
|
||||
with_doclist: 1,
|
||||
btn: this,
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
erpnext.cart.render(r.message);
|
||||
var $button = $('button[data-item-code="'+item_code+'"]').addClass("btn-success");
|
||||
setTimeout(function() { $button.removeClass("btn-success"); }, 1000);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("#cart-add-shipping-address").on("click", function() {
|
||||
window.location.href = "address?address_fieldname=shipping_address_name";
|
||||
});
|
||||
|
||||
$("#cart-add-billing-address").on("click", function() {
|
||||
window.location.href = "address?address_fieldname=customer_address";
|
||||
});
|
||||
|
||||
$(".btn-place-order").on("click", function() {
|
||||
erpnext.cart.place_order(this);
|
||||
});
|
||||
},
|
||||
|
||||
render: function(out) {
|
||||
var doclist = out.doclist;
|
||||
var addresses = out.addresses;
|
||||
|
||||
var $cart_items = $("#cart-items").empty();
|
||||
var $cart_taxes = $("#cart-taxes").empty();
|
||||
var $cart_totals = $("#cart-totals").empty();
|
||||
var $cart_billing_address = $("#cart-billing-address").empty();
|
||||
var $cart_shipping_address = $("#cart-shipping-address").empty();
|
||||
|
||||
var no_items = $.map(doclist, function(d) { return d.item_code || null;}).length===0;
|
||||
if(no_items) {
|
||||
erpnext.cart.show_error("Empty :-(", wn._("Go ahead and add something to your cart."));
|
||||
$("#cart-addresses").toggle(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var shipping_rule_added = false;
|
||||
var taxes_exist = false;
|
||||
var shipping_rule_labels = $.map(out.shipping_rules || [], function(rule) { return rule[1]; });
|
||||
$.each(doclist, function(i, doc) {
|
||||
if(doc.doctype === "Quotation Item") {
|
||||
erpnext.cart.render_item_row($cart_items, doc);
|
||||
} else if (doc.doctype === "Sales Taxes and Charges") {
|
||||
if(out.shipping_rules && out.shipping_rules.length &&
|
||||
shipping_rule_labels.indexOf(doc.description)!==-1) {
|
||||
shipping_rule_added = true;
|
||||
erpnext.cart.render_tax_row($cart_taxes, doc, out.shipping_rules);
|
||||
} else {
|
||||
erpnext.cart.render_tax_row($cart_taxes, doc);
|
||||
}
|
||||
|
||||
taxes_exist = true;
|
||||
}
|
||||
});
|
||||
|
||||
if(out.shipping_rules && out.shipping_rules.length && !shipping_rule_added) {
|
||||
erpnext.cart.render_tax_row($cart_taxes, {description: "", formatted_tax_amount: ""},
|
||||
out.shipping_rules);
|
||||
taxes_exist = true;
|
||||
}
|
||||
|
||||
if(taxes_exist)
|
||||
$('<hr>').appendTo($cart_taxes);
|
||||
|
||||
erpnext.cart.render_tax_row($cart_totals, {
|
||||
description: "<strong>Total</strong>",
|
||||
formatted_tax_amount: "<strong>" + doclist[0].formatted_grand_total_export + "</strong>"
|
||||
});
|
||||
|
||||
if(!(addresses && addresses.length)) {
|
||||
$cart_shipping_address.html('<div class="well">'+wn._("Hey! Go ahead and add an address")+'</div>');
|
||||
} else {
|
||||
erpnext.cart.render_address($cart_shipping_address, addresses, doclist[0].shipping_address_name);
|
||||
erpnext.cart.render_address($cart_billing_address, addresses, doclist[0].customer_address);
|
||||
}
|
||||
},
|
||||
|
||||
render_item_row: function($cart_items, doc) {
|
||||
doc.image_html = doc.website_image ?
|
||||
'<div style="height: 120px; overflow: hidden;"><img src="' + doc.website_image + '" /></div>' :
|
||||
'{% include "stock/doctype/item/templates/includes/product_missing_image.html" %}';
|
||||
|
||||
if(doc.description === doc.item_name) doc.description = "";
|
||||
|
||||
$(repl('<div class="row">\
|
||||
<div class="col-md-9 col-sm-9">\
|
||||
<div class="row">\
|
||||
<div class="col-md-3">%(image_html)s</div>\
|
||||
<div class="col-md-9">\
|
||||
<h4><a href="%(page_name)s">%(item_name)s</a></h4>\
|
||||
<p>%(description)s</p>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-md-3 col-sm-3 text-right">\
|
||||
<div class="input-group item-update-cart">\
|
||||
<input type="text" placeholder="Qty" value="%(qty)s" \
|
||||
data-item-code="%(item_code)s" class="text-right form-control">\
|
||||
<div class="input-group-btn">\
|
||||
<button class="btn btn-primary" data-item-code="%(item_code)s">\
|
||||
<i class="icon-ok"></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<p style="margin-top: 10px;">at %(formatted_rate)s</p>\
|
||||
<small class="text-muted" style="margin-top: 10px;">= %(formatted_amount)s</small>\
|
||||
</div>\
|
||||
</div><hr>', doc)).appendTo($cart_items);
|
||||
},
|
||||
|
||||
render_tax_row: function($cart_taxes, doc, shipping_rules) {
|
||||
var shipping_selector;
|
||||
if(shipping_rules) {
|
||||
shipping_selector = '<select class="form-control">' + $.map(shipping_rules, function(rule) {
|
||||
return '<option value="' + rule[0] + '">' + rule[1] + '</option>' }).join("\n") +
|
||||
'</select>';
|
||||
}
|
||||
|
||||
var $tax_row = $(repl('<div class="row">\
|
||||
<div class="col-md-9 col-sm-9">\
|
||||
<div class="row">\
|
||||
<div class="col-md-9 col-md-offset-3">' +
|
||||
(shipping_selector || '<p>%(description)s</p>') +
|
||||
'</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-md-3 col-sm-3 text-right">\
|
||||
<p' + (shipping_selector ? ' style="margin-top: 5px;"' : "") + '>%(formatted_tax_amount)s</p>\
|
||||
</div>\
|
||||
</div>', doc)).appendTo($cart_taxes);
|
||||
|
||||
if(shipping_selector) {
|
||||
$tax_row.find('select option').each(function(i, opt) {
|
||||
if($(opt).html() == doc.description) {
|
||||
$(opt).attr("selected", "selected");
|
||||
}
|
||||
});
|
||||
$tax_row.find('select').on("change", function() {
|
||||
erpnext.cart.apply_shipping_rule($(this).val(), this);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
apply_shipping_rule: function(rule, btn) {
|
||||
return wn.call({
|
||||
btn: btn,
|
||||
type: "POST",
|
||||
method: "erpnext.selling.utils.cart.apply_shipping_rule",
|
||||
args: { shipping_rule: rule },
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
render_address: function($address_wrapper, addresses, address_name) {
|
||||
$.each(addresses, function(i, address) {
|
||||
$(repl('<div class="panel panel-default"> \
|
||||
<div class="panel-heading"> \
|
||||
<div class="row"> \
|
||||
<div class="col-md-10 address-title" \
|
||||
data-address-name="%(name)s"><strong>%(name)s</strong></div> \
|
||||
<div class="col-md-2"><input type="checkbox" \
|
||||
data-address-name="%(name)s"></div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<div class="panel-collapse collapse" data-address-name="%(name)s"> \
|
||||
<div class="panel-body">%(display)s</div> \
|
||||
</div> \
|
||||
</div>', address))
|
||||
.css({"margin": "10px auto"})
|
||||
.appendTo($address_wrapper);
|
||||
});
|
||||
|
||||
$address_wrapper.find(".panel-heading")
|
||||
.find(".address-title")
|
||||
.css({"cursor": "pointer"})
|
||||
.on("click", function() {
|
||||
$address_wrapper.find('.panel-collapse[data-address-name="'
|
||||
+$(this).attr("data-address-name")+'"]').collapse("toggle");
|
||||
});
|
||||
|
||||
$address_wrapper.find('input[type="checkbox"]').on("click", function() {
|
||||
if($(this).prop("checked")) {
|
||||
var me = this;
|
||||
$address_wrapper.find('input[type="checkbox"]').each(function(i, chk) {
|
||||
if($(chk).attr("data-address-name")!=$(me).attr("data-address-name")) {
|
||||
$(chk).prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
return wn.call({
|
||||
type: "POST",
|
||||
method: "erpnext.selling.utils.cart.update_cart_address",
|
||||
args: {
|
||||
address_fieldname: $address_wrapper.attr("data-fieldname"),
|
||||
address_name: $(this).attr("data-address-name")
|
||||
},
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
erpnext.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$address_wrapper.find('input[type="checkbox"][data-address-name="'+ address_name +'"]')
|
||||
.prop("checked", true);
|
||||
|
||||
$address_wrapper.find(".panel-collapse").collapse({
|
||||
parent: $address_wrapper,
|
||||
toggle: false
|
||||
});
|
||||
|
||||
$address_wrapper.find('.panel-collapse[data-address-name="'+ address_name +'"]')
|
||||
.collapse("show");
|
||||
},
|
||||
|
||||
place_order: function(btn) {
|
||||
return wn.call({
|
||||
type: "POST",
|
||||
method: "erpnext.selling.utils.cart.place_order",
|
||||
btn: btn,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
var msg = "";
|
||||
if(r._server_messages) {
|
||||
msg = JSON.parse(r._server_messages || []).join("<br>");
|
||||
}
|
||||
|
||||
$("#cart-error")
|
||||
.empty()
|
||||
.html(msg || wn._("Something went wrong!"))
|
||||
.toggle(true);
|
||||
} else {
|
||||
window.location.href = "order?name=" + encodeURIComponent(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
36
erpnext/templates/includes/footer_extension.html
Normal file
36
erpnext/templates/includes/footer_extension.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="input-group col-sm-6 col-sm-offset-3" style="margin-top: 7px;">
|
||||
<input class="form-control" type="text" id="footer-subscribe-email" placeholder="Your email address...">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button" id="footer-subscribe-button">Stay Updated</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#footer-subscribe-button").click(function() {
|
||||
|
||||
$("#footer-subscribe-email").attr('disabled', true);
|
||||
$("#footer-subscribe-button").html("Sending...")
|
||||
.attr("disabled", true);
|
||||
|
||||
if($("#footer-subscribe-email").val()) {
|
||||
erpnext.send_message({
|
||||
subject:"Subscribe me",
|
||||
sender: $("#footer-subscribe-email").val(),
|
||||
message: "Subscribe to newsletter (via website footer).",
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
$("#footer-subscribe-button").html("Thank You :)")
|
||||
.addClass("btn-success").attr("disabled", true);
|
||||
} else {
|
||||
$("#footer-subscribe-button").html("Error :( Not a valid id?")
|
||||
.addClass("btn-danger").attr("disabled", false);
|
||||
$("#footer-subscribe-email").val("").attr('disabled', false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
1
erpnext/templates/includes/footer_powered.html
Normal file
1
erpnext/templates/includes/footer_powered.html
Normal file
@@ -0,0 +1 @@
|
||||
<a href="http://erpnext.org" style="color: #aaa;">ERPNext Powered</a>
|
||||
10
erpnext/templates/includes/product_breadcrumbs.html
Normal file
10
erpnext/templates/includes/product_breadcrumbs.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% if obj.parent_groups and (obj.parent_groups|length) > 1 %}
|
||||
<div class="container">
|
||||
<ul class="breadcrumb">
|
||||
{% for ig in obj.parent_groups[:-1] %}
|
||||
<li><a href="{{ ig.page_name }}.html">{{ ig.name }}</a></li>
|
||||
{% endfor %}
|
||||
<li class="active">{{ obj.parent_groups[-1].name }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
14
erpnext/templates/includes/product_in_grid.html
Normal file
14
erpnext/templates/includes/product_in_grid.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="col-md-3">
|
||||
<div style="height: 120px; overflow: hidden;">
|
||||
<a href="{{ page_name }}">
|
||||
{%- if website_image -%}
|
||||
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
|
||||
{%- else -%}
|
||||
{% include 'stock/doctype/item/templates/includes/product_missing_image.html' %}
|
||||
{%- endif -%}
|
||||
</a>
|
||||
</div>
|
||||
<div style="height: 100px; overflow: hidden; font-size: 80%;">
|
||||
<h4 style="margin-bottom: 2px;"><a href="{{ page_name }}">{{ item_name }}</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
15
erpnext/templates/includes/product_in_list.html
Normal file
15
erpnext/templates/includes/product_in_list.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!-- TODO product listing -->
|
||||
<div class="container content">
|
||||
<div style="height: 120px; overflow: hidden;">
|
||||
<a href="{{ page_name }}">
|
||||
{%- if website_image -%}
|
||||
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
|
||||
{%- else -%}
|
||||
{% include 'website/templates/html/product_missing_image.html' %}
|
||||
{%- endif -%}
|
||||
</a>
|
||||
</div>
|
||||
<div style="height: 100px; overflow: hidden; font-size: 80%;">
|
||||
<h4 style="margin-bottom: 2px;"><a href="{{ page_name }}">{{ item_name }}</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
52
erpnext/templates/includes/product_list.js
Normal file
52
erpnext/templates/includes/product_list.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
window.get_product_list = function() {
|
||||
$(".more-btn .btn").click(function() {
|
||||
window.get_product_list()
|
||||
});
|
||||
|
||||
if(window.start==undefined) {
|
||||
throw "product list not initialized (no start)"
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/",
|
||||
dataType: "json",
|
||||
data: {
|
||||
cmd: "erpnext.selling.utils.product.get_product_list",
|
||||
start: window.start,
|
||||
search: window.search,
|
||||
product_group: window.product_group
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
window.render_product_list(data.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
window.render_product_list = function(data) {
|
||||
if(data.length) {
|
||||
var table = $("#search-list .table");
|
||||
if(!table.length)
|
||||
var table = $("<table class='table'>").appendTo("#search-list");
|
||||
|
||||
$.each(data, function(i, d) {
|
||||
$(d).appendTo(table);
|
||||
});
|
||||
}
|
||||
if(data.length < 10) {
|
||||
if(!table) {
|
||||
$(".more-btn")
|
||||
.replaceWith("<div class='alert alert-warning'>No products found.</div>");
|
||||
} else {
|
||||
$(".more-btn")
|
||||
.replaceWith("<div class='text-muted'>Nothing more to show.</div>");
|
||||
}
|
||||
} else {
|
||||
$(".more-btn").toggle(true)
|
||||
}
|
||||
window.start += (data.length || 0);
|
||||
}
|
||||
1
erpnext/templates/includes/product_missing_image.html
Normal file
1
erpnext/templates/includes/product_missing_image.html
Normal file
@@ -0,0 +1 @@
|
||||
<div class="missing-image"><i class="icon-camera"></i></div>
|
||||
13
erpnext/templates/includes/product_page.css
Normal file
13
erpnext/templates/includes/product_page.css
Normal file
@@ -0,0 +1,13 @@
|
||||
<style>
|
||||
.item-main-image {
|
||||
max-width: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
.web-long-description {
|
||||
font-size: 18px;
|
||||
line-height: 200%;
|
||||
}
|
||||
.item-stock {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
</style>
|
||||
78
erpnext/templates/includes/product_page.js
Normal file
78
erpnext/templates/includes/product_page.js
Normal file
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
$(document).ready(function() {
|
||||
var item_code = $('[itemscope] [itemprop="productID"]').text().trim();
|
||||
var qty = 0;
|
||||
|
||||
wn.call({
|
||||
type: "POST",
|
||||
method: "erpnext.selling.utils.product.get_product_info",
|
||||
args: {
|
||||
item_code: "{{ name }}"
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message && r.message.price) {
|
||||
$(".item-price")
|
||||
.html(r.message.price.formatted_price + " per " + r.message.uom);
|
||||
|
||||
if(r.message.stock==0) {
|
||||
$(".item-stock").html("<div class='help'>Not in stock</div>");
|
||||
}
|
||||
else if(r.message.stock==1) {
|
||||
$(".item-stock").html("<div style='color: green'>\
|
||||
<i class='icon-check'></i> Available (in stock)</div>");
|
||||
}
|
||||
|
||||
$(".item-price-info").toggle(true);
|
||||
|
||||
if(r.message.qty) {
|
||||
qty = r.message.qty;
|
||||
toggle_update_cart(qty);
|
||||
$("#item-update-cart input").val(qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$("#item-add-to-cart button").on("click", function() {
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: 1,
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
toggle_update_cart(1);
|
||||
qty = 1;
|
||||
}
|
||||
},
|
||||
btn: this,
|
||||
});
|
||||
});
|
||||
|
||||
$("#item-update-cart button").on("click", function() {
|
||||
erpnext.cart.update_cart({
|
||||
item_code: item_code,
|
||||
qty: $("#item-update-cart input").val(),
|
||||
btn: this,
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
$("#item-update-cart input").val(qty);
|
||||
} else {
|
||||
qty = $("#item-update-cart input").val();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
if(localStorage && localStorage.getItem("pending_add_to_cart") && full_name) {
|
||||
localStorage.removeItem("pending_add_to_cart");
|
||||
$("#item-add-to-cart button").trigger("click");
|
||||
}
|
||||
});
|
||||
|
||||
var toggle_update_cart = function(qty) {
|
||||
$("#item-add-to-cart").toggle(qty ? false : true);
|
||||
$("#item-update-cart")
|
||||
.toggle(qty ? true : false)
|
||||
.find("input").val(qty);
|
||||
}
|
||||
28
erpnext/templates/includes/product_search_box.html
Normal file
28
erpnext/templates/includes/product_search_box.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<div class="container" style="margin-bottom: 7px;">
|
||||
<form class="form-inline form-search row">
|
||||
<div class="input-group col-md-4 col-md-offset-8">
|
||||
<input class="form-control" type="text" id="product-search" placeholder="Product Search...">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button" id="btn-product-search">
|
||||
<i class="icon-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
// redirect to product search page
|
||||
$(document).ready(function() {
|
||||
$('.dropdown-toggle').dropdown();
|
||||
$("#btn-product-search").click(function() {
|
||||
var txt = $("#product-search").val();
|
||||
if(txt) {
|
||||
window.location.href="product_search?q=" + txt;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("#product-search").keypress(function(e) {
|
||||
if(e.which==13) $("#btn-product-search").click();
|
||||
});
|
||||
$(".form-search").on("submit", function() { return false; });
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
60
erpnext/templates/includes/transactions.html
Normal file
60
erpnext/templates/includes/transactions.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% block content -%}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li class="active"><i class="{{ icon }} icon-fixed-width"></i> {{ title }}</li>
|
||||
</ul>
|
||||
<p id="msgprint-alert" class="alert alert-danger"
|
||||
style="display: none;"> </p>
|
||||
<div class="list-group transaction-list">
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-default btn-show-more hide">More</button>
|
||||
</div>
|
||||
</div>
|
||||
{%- endblock %}
|
||||
|
||||
{% block javascript -%}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
window.start = 0;
|
||||
window.$list = $(".transaction-list");
|
||||
window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); })
|
||||
|
||||
get_transactions();
|
||||
});
|
||||
|
||||
var get_transactions = function(btn) {
|
||||
wn.call({
|
||||
method: "{{ method }}",
|
||||
args: { start: start },
|
||||
btn: btn,
|
||||
callback: function(r) {
|
||||
$list.find(".progress").remove();
|
||||
$show_more.toggleClass("hide", !(r.message && r.message.length===20));
|
||||
if(!(r.message && r.message.length)) {
|
||||
console.log("empty");
|
||||
if(!$list.html().trim()) {
|
||||
$list.html("<div class='alert alert-warning'>\
|
||||
{{ empty_list_message }}</div>");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
start += r.message.length;
|
||||
|
||||
$.each(r.message, function(i, doc) {
|
||||
render(doc);
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- // var render = function(doc) { }; -->
|
||||
{% endblock %}
|
||||
0
erpnext/templates/pages/__init__.py
Normal file
0
erpnext/templates/pages/__init__.py
Normal file
114
erpnext/templates/pages/address.html
Normal file
114
erpnext/templates/pages/address.html
Normal file
@@ -0,0 +1,114 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc and doc.name or "New Address" %}
|
||||
{% set docname=(doc and doc.name or "") %}
|
||||
|
||||
{% macro render_fields(docfields) -%}
|
||||
{% for df in docfields -%}
|
||||
{% if df.fieldtype in ["Data", "Link"] -%}
|
||||
<fieldset>
|
||||
<label>{{ df.label }}</label>
|
||||
<input class="form-control" type="text" placeholder="Type {{ df.label }}"
|
||||
data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}"
|
||||
{% if doc and doc.fields.get(df.fieldname) -%} value="{{ doc.fields[df.fieldname] }}" {%- endif %}>
|
||||
</fieldset>
|
||||
{% elif df.fieldtype == "Check" -%}
|
||||
<fieldset class="checkbox">
|
||||
<label><input type="checkbox" data-fieldname="{{ df.fieldname }}"
|
||||
data-fieldtype="{{ df.fieldtype }}"
|
||||
{% if doc and cint(doc.fields.get(df.fieldname)) -%} checked="checked" {%- endif %}>
|
||||
{{ df.label }}</label>
|
||||
</fieldset>
|
||||
{% elif df.fieldtype == "Select" -%}
|
||||
<fieldset>
|
||||
<label>{{ df.label }}</label>
|
||||
<select class="form-control" data-fieldname="{{ df.fieldname }}" data-fieldtype="{{ df.fieldtype }}">
|
||||
{% for value in df.options.split("\n") -%}
|
||||
{% if doc and doc.fields.get(df.fieldname) == value -%}
|
||||
<option selected="selected">{{ value }}</option>
|
||||
{% else -%}
|
||||
<option>{{ value }}</option>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</select>
|
||||
</fieldset>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li><a href="addresses">My Addresses</a></li>
|
||||
<li class="active"><i class="icon-map-marker icon-fixed-width"></i> {{ title }}</li>
|
||||
</ul>
|
||||
<h3><i class="icon-map-marker icon-fixed-width"></i> {{ title }}</h3>
|
||||
<button type="button" class="btn btn-primary pull-right" id="address-save"><i class="icon-ok"></i>
|
||||
{{ doc and "Save" or "Insert" }}</button>
|
||||
<div class="clearfix"></div>
|
||||
<hr>
|
||||
<div id="address-error" class="alert alert-danger" style="display: none;"></div>
|
||||
<form autocomplete="on">
|
||||
<div class="row">
|
||||
<section class="col-md-6">
|
||||
{{ render_fields(meta.left_fields) }}
|
||||
</section>
|
||||
<section class="col-md-6">
|
||||
{{ render_fields(meta.right_fields) }}
|
||||
</section>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
;(function() {
|
||||
$(document).ready(function() {
|
||||
bind_save();
|
||||
});
|
||||
|
||||
var bind_save = function() {
|
||||
$("#address-save").on("click", function() {
|
||||
var fields = {
|
||||
name: "{{ docname }}"
|
||||
};
|
||||
|
||||
$("form").find("[data-fieldname]").each(function(i, input) {
|
||||
var $input = $(input);
|
||||
var fieldname = $(input).attr("data-fieldname");
|
||||
var fieldtype = $(input).attr("data-fieldtype");
|
||||
|
||||
if(fieldtype == "Check") {
|
||||
fields[fieldname] = $input.is(":checked") ? 1 : 0;
|
||||
} else {
|
||||
fields[fieldname] = $input.val();
|
||||
}
|
||||
});
|
||||
|
||||
wn.call({
|
||||
btn: $(this),
|
||||
type: "POST",
|
||||
method: "selling.utils.cart.save_address",
|
||||
args: { fields: fields, address_fieldname: get_url_arg("address_fieldname") },
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
var msg = "";
|
||||
if(r._server_messages) {
|
||||
msg = JSON.parse(r._server_messages || []).join("<br>");
|
||||
}
|
||||
|
||||
$("#address-error")
|
||||
.html(msg || "Something went wrong!")
|
||||
.toggle(true);
|
||||
} else if(get_url_arg("address_fieldname")) {
|
||||
window.location.href = "cart";
|
||||
} else {
|
||||
window.location.href = "address?name=" + encodeURIComponent(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
30
erpnext/templates/pages/address.py
Normal file
30
erpnext/templates/pages/address.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
def _get_fields(fieldnames):
|
||||
return [webnotes._dict(zip(["label", "fieldname", "fieldtype", "options"],
|
||||
[df.label, df.fieldname, df.fieldtype, df.options]))
|
||||
for df in webnotes.get_doctype("Address", processed=True).get({"fieldname": ["in", fieldnames]})]
|
||||
|
||||
bean = None
|
||||
if webnotes.form_dict.name:
|
||||
bean = webnotes.bean("Address", webnotes.form_dict.name)
|
||||
|
||||
return {
|
||||
"doc": bean.doc if bean else None,
|
||||
"meta": webnotes._dict({
|
||||
"left_fields": _get_fields(["address_title", "address_type", "address_line1", "address_line2",
|
||||
"city", "state", "pincode", "country"]),
|
||||
"right_fields": _get_fields(["email_id", "phone", "fax", "is_primary_address",
|
||||
"is_shipping_address"])
|
||||
}),
|
||||
"cint": cint
|
||||
}
|
||||
|
||||
51
erpnext/templates/pages/addresses.html
Normal file
51
erpnext/templates/pages/addresses.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Addresses" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li class="active"><i class="icon-map-marker icon-fixed-width"></i> My Addresses</li>
|
||||
</ul>
|
||||
<p><a class="btn btn-default" href="address"><i class="icon-plus"> New Address</i></a></p>
|
||||
<hr>
|
||||
<div id="address-list">
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
;(function() {
|
||||
$(document).ready(function() {
|
||||
fetch_addresses();
|
||||
});
|
||||
|
||||
var fetch_addresses = function() {
|
||||
wn.call({
|
||||
method: "selling.utils.cart.get_addresses",
|
||||
callback: function(r) {
|
||||
$("#address-list .progress").remove();
|
||||
var $list = $("#address-list");
|
||||
|
||||
if(!(r.message && r.message.length)) {
|
||||
$list.html("<div class='alert'>No Addresses Found</div>");
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(r.message, function(i, address) {
|
||||
address.url_name = encodeURIComponent(address.name);
|
||||
$(repl('<div> \
|
||||
<p><a href="address?name=%(url_name)s">%(name)s</a></p> \
|
||||
<p>%(display)s</p> \
|
||||
<hr> \
|
||||
</div>', address)).appendTo($list);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
6
erpnext/templates/pages/addresses.py
Normal file
6
erpnext/templates/pages/addresses.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
no_cache = True
|
||||
57
erpnext/templates/pages/cart.html
Normal file
57
erpnext/templates/pages/cart.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% block javascript %}
|
||||
<script>{% include "templates/includes/cart.js" %}</script>
|
||||
{% endblock %}
|
||||
|
||||
{% set title="Shopping Cart" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<h2><i class="icon-shopping-cart"></i> {{ title }}</h2>
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
|
||||
</div>
|
||||
<div id="cart-container" class="hide">
|
||||
<p class="pull-right"><button class="btn btn-success btn-place-order" type="button">Place Order</button></p>
|
||||
<div class="clearfix"></div>
|
||||
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-sm-9">
|
||||
<div class="row">
|
||||
<div class="col-md-9 col-md-offset-3"><h4>Item Details</h4></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-3 text-right"><h4>Qty, Amount</h4></div>
|
||||
</div><hr>
|
||||
<div id="cart-items">
|
||||
</div>
|
||||
<div id="cart-taxes">
|
||||
</div>
|
||||
<div id="cart-totals">
|
||||
</div>
|
||||
<hr>
|
||||
<div id="cart-addresses">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4>Shipping Address</h4>
|
||||
<div id="cart-shipping-address" class="panel-group"
|
||||
data-fieldname="shipping_address_name"></div>
|
||||
<button class="btn btn-default" type="button" id="cart-add-shipping-address">
|
||||
<span class="icon icon-plus"></span> New Shipping Address</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4>Billing Address</h4>
|
||||
<div id="cart-billing-address" class="panel-group"
|
||||
data-fieldname="customer_address"></div>
|
||||
<button class="btn btn-default" type="button" id="cart-add-billing-address">
|
||||
<span class="icon icon-plus"></span> New Billing Address</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<p class="pull-right"><button class="btn btn-success btn-place-order" type="button">Place Order</button></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
7
erpnext/templates/pages/cart.py
Normal file
7
erpnext/templates/pages/cart.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
no_cache = True
|
||||
no_sitemap = True
|
||||
5
erpnext/templates/pages/invoice.html
Normal file
5
erpnext/templates/pages/invoice.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% extends "templates/sale.html" %}
|
||||
|
||||
{% block status -%}
|
||||
{% if doc.status %}{{ doc.status }}{% endif %}
|
||||
{%- endblock %}
|
||||
30
erpnext/templates/pages/invoice.py
Normal file
30
erpnext/templates/pages/invoice.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
from webnotes.utils import flt, fmt_money
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from erpnext.templates.utils import get_transaction_context
|
||||
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
|
||||
modify_status(context.get("doc"))
|
||||
context.update({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
return context
|
||||
|
||||
def modify_status(doc):
|
||||
doc.status = ""
|
||||
if flt(doc.outstanding_amount):
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-warning", "icon-exclamation-sign",
|
||||
_("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency))
|
||||
else:
|
||||
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
||||
("label-success", "icon-ok", _("Paid"))
|
||||
|
||||
1
erpnext/templates/pages/invoices.html
Normal file
1
erpnext/templates/pages/invoices.html
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "templates/sales_transactions.html" %}
|
||||
28
erpnext/templates/pages/invoices.py
Normal file
28
erpnext/templates/pages/invoices.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from erpnext.templates.utils import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Invoices",
|
||||
"method": "accounts.doctype.sales_invoice.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 erpnext.templates.utils import get_transaction_list
|
||||
from erpnext.accounts.doctype.sales_invoice.templates.pages.invoice import modify_status
|
||||
invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"])
|
||||
for d in invoices:
|
||||
modify_status(d)
|
||||
return invoices
|
||||
33
erpnext/templates/pages/product_search.html
Normal file
33
erpnext/templates/pages/product_search.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="Product Search" %}
|
||||
|
||||
{% block javascript %}
|
||||
<script>{% include "stock/doctype/item/templates/includes/product_list.js" %}</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var txt = get_url_arg("q");
|
||||
$(".search-results").html("Search results for: " + txt);
|
||||
window.search = txt;
|
||||
window.start = 0;
|
||||
window.get_product_list();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% include "stock/doctype/item/templates/includes/product_search_box.html" %}
|
||||
<div class="container content">
|
||||
<h3 class="search-results">Search Results</h3>
|
||||
<div id="search-list" class="row">
|
||||
|
||||
</div>
|
||||
<div style="text-align: center;">
|
||||
<div class="more-btn"
|
||||
style="display: none; text-align: center;">
|
||||
<button class="btn">More...</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
6
erpnext/templates/pages/product_search.py
Normal file
6
erpnext/templates/pages/product_search.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
no_cache = True
|
||||
55
erpnext/templates/pages/profile.html
Normal file
55
erpnext/templates/pages/profile.html
Normal file
@@ -0,0 +1,55 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title="My Profile" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</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>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: "erpnext.templates.pages.profile.update_profile",
|
||||
type: "POST",
|
||||
args: {
|
||||
fullname: $("#fullname").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 %}
|
||||
40
erpnext/templates/pages/profile.py
Normal file
40
erpnext/templates/pages/profile.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
from webnotes.utils import cstr
|
||||
|
||||
no_cache = True
|
||||
no_sitemap = True
|
||||
|
||||
def get_context():
|
||||
from erpnext.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 erpnext.selling.utils.cart import update_party
|
||||
update_party(fullname, company_name, mobile_no, phone)
|
||||
|
||||
if not fullname:
|
||||
return _("Name is required")
|
||||
|
||||
webnotes.conn.set_value("Profile", webnotes.session.user, "first_name", fullname)
|
||||
webnotes._response.set_cookie("full_name", fullname)
|
||||
|
||||
return _("Updated")
|
||||
|
||||
1
erpnext/templates/pages/shipment.html
Normal file
1
erpnext/templates/pages/shipment.html
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "templates/sale.html" %}
|
||||
16
erpnext/templates/pages/shipment.py
Normal file
16
erpnext/templates/pages/shipment.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from erpnext.templates.utils import get_transaction_context
|
||||
context = get_transaction_context("Delivery Note", webnotes.form_dict.name)
|
||||
context.update({
|
||||
"parent_link": "shipments",
|
||||
"parent_title": "Shipments"
|
||||
})
|
||||
return context
|
||||
1
erpnext/templates/pages/shipments.html
Normal file
1
erpnext/templates/pages/shipments.html
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "templates/sales_transactions.html" %}
|
||||
24
erpnext/templates/pages/shipments.py
Normal file
24
erpnext/templates/pages/shipments.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from erpnext.templates.utils import get_currency_context
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "Shipments",
|
||||
"method": "erpnext.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 erpnext.templates.utils import get_transaction_list
|
||||
return get_transaction_list("Delivery Note", start)
|
||||
121
erpnext/templates/pages/ticket.html
Normal file
121
erpnext/templates/pages/ticket.html
Normal file
@@ -0,0 +1,121 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
{% set status_label = {
|
||||
"Open": "label-success",
|
||||
"To Reply": "label-danger",
|
||||
"Closed": "label-default"
|
||||
} %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li><a href="tickets">My Tickets</a></li>
|
||||
<li class="active"><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</li>
|
||||
</ul>
|
||||
<h3><i class="icon-ticket icon-fixed-width"></i> {{ doc.name }}</h3>
|
||||
{% if doc.name == "Not Allowed" -%}
|
||||
<script>ask_to_login();</script>
|
||||
{% else %}
|
||||
<hr>
|
||||
{%- if doc.status -%}
|
||||
{% if doc.status == "Waiting for Customer" -%}
|
||||
{% set status = "To Reply" %}
|
||||
{% else %}
|
||||
{% set status = doc.status %}
|
||||
{%- endif -%}
|
||||
<div class="row">
|
||||
<div class="col-md-2" style="margin-bottom: 7px;">
|
||||
<span class="label {{ status_label.get(status) or 'label-default' }}">{{ status }}</span>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row col-md-12">{{ doc.subject }}</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<span class="text-muted pull-right">{{ utils.formatdate(doc.creation) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h4 class="col-xs-6">Messages</h4>
|
||||
<div class="col-xs-6">
|
||||
<button class="btn btn-sm btn-primary pull-right" id="ticket-reply">
|
||||
<i class="icon-envelope icon-fixed-width"></i> Reply</button>
|
||||
<button class="btn btn-sm btn-success pull-right hide" id="ticket-reply-send">
|
||||
<i class="icon-arrow-right icon-fixed-width"></i> Send</button>
|
||||
</div>
|
||||
</div>
|
||||
<p id="ticket-alert" class="alert alert-danger"
|
||||
style="display: none;"> </p>
|
||||
{%- if doclist.get({"doctype":"Communication"}) -%}
|
||||
<div>
|
||||
<table class="table table-bordered table-striped" id="ticket-thread">
|
||||
<tbody>
|
||||
{%- for comm in
|
||||
(doclist.get({"doctype":"Communication"})|sort(reverse=True, attribute="creation")) %}
|
||||
<tr>
|
||||
<td>
|
||||
<h5 style="text-transform: none">
|
||||
{{ comm.sender }} on {{ utils.formatdate(comm.creation) }}</h5>
|
||||
<hr>
|
||||
<p>{{ webnotes.utils.is_html(comm.content) and comm.content or
|
||||
comm.content.replace("\n", "<br>")}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{%- else -%}
|
||||
<div class="alert">No messages</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#ticket-reply").on("click", function() {
|
||||
if(!$("#ticket-reply-editor").length) {
|
||||
$('<tr id="ticket-reply-editor"><td>\
|
||||
<h5 style="text-transform: none">Reply</h5>\
|
||||
<hr>\
|
||||
<textarea rows=10 class="form-control" style="resize: vertical;"></textarea>\
|
||||
</td></tr>').prependTo($("#ticket-thread").find("tbody"));
|
||||
$("#ticket-reply").addClass("hide");
|
||||
$("#ticket-reply-send").removeClass("hide");
|
||||
}
|
||||
});
|
||||
|
||||
$("#ticket-reply-send").on("click", function() {
|
||||
var reply = $("#ticket-reply-editor").find("textarea").val().trim();
|
||||
if(!reply) {
|
||||
msgprint("Please write something in reply!");
|
||||
} else {
|
||||
wn.call({
|
||||
type: "POST",
|
||||
method: "support.doctype.support_ticket.templates.pages.ticket.add_reply",
|
||||
btn: this,
|
||||
args: { ticket: "{{ doc.name }}", message: reply },
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
msgprint(r._server_messages
|
||||
? JSON.parse(r._server_messages).join("<br>")
|
||||
: "Something went wrong!");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var msgprint = function(txt) {
|
||||
if(txt) $("#ticket-alert").html(txt).toggle(true);
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
37
erpnext/templates/pages/ticket.py
Normal file
37
erpnext/templates/pages/ticket.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
from webnotes.utils import today
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def add_reply(ticket, message):
|
||||
if not message:
|
||||
raise webnotes.throw(_("Please write something"))
|
||||
|
||||
bean = webnotes.bean("Support Ticket", ticket)
|
||||
if bean.doc.raised_by != webnotes.session.user:
|
||||
raise webnotes.throw(_("You are not allowed to reply to this ticket."), webnotes.PermissionError)
|
||||
|
||||
from webnotes.core.doctype.communication.communication import make
|
||||
make(content=message, sender=bean.doc.raised_by, subject = bean.doc.subject,
|
||||
doctype="Support Ticket", name=bean.doc.name,
|
||||
date=today())
|
||||
87
erpnext/templates/pages/tickets.html
Normal file
87
erpnext/templates/pages/tickets.html
Normal file
@@ -0,0 +1,87 @@
|
||||
{% extends "templates/includes/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
{{ super() }}
|
||||
|
||||
<script>
|
||||
var status_label = {
|
||||
"Open": "label-success",
|
||||
"Waiting for Customer": "label-danger",
|
||||
"Closed": "label-default"
|
||||
}
|
||||
|
||||
var render = function(doc) {
|
||||
doc.status = doc.status.trim();
|
||||
doc.label_class = status_label[doc.status] || "label-default";
|
||||
if(doc.status==="Waiting for Customer") doc.status = "To Reply";
|
||||
|
||||
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
|
||||
<div class="row">\
|
||||
<div class="col-md-2" style="margin-bottom: 7px;"><span class="label %(label_class)s">\
|
||||
%(status)s</span></div>\
|
||||
<div class="col-md-8">\
|
||||
<div class="row col-md-12">%(name)s</div>\
|
||||
<div class="row col-md-12 text-muted">%(subject)s</div>\
|
||||
</div>\
|
||||
<div class="col-md-2 pull-right">\
|
||||
<span class="text-muted">%(creation)s</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
if(!window.$new_ticket) {
|
||||
window.$new_ticket = $('<div>\
|
||||
<button class="btn btn-primary" style="margin-bottom: 15px;" id="new-ticket">\
|
||||
<i class="icon-tag icon-fixed-width"></i> New Ticket\
|
||||
</button>\
|
||||
<button class="btn btn-success hide" style="margin-bottom: 15px;" id="new-ticket-send">\
|
||||
<i class="icon-arrow-right icon-fixed-width"></i> Send\
|
||||
</button>\
|
||||
</div>').insertBefore(".transaction-list");
|
||||
}
|
||||
|
||||
window.$new_ticket.find("#new-ticket").on("click", function() {
|
||||
$(this).addClass("hide");
|
||||
$(window.$new_ticket).find("#new-ticket-send").removeClass("hide");
|
||||
$('<div class="well" id="ticket-editor">\
|
||||
<div class="form-group"><input class="form-control" type="data"\
|
||||
placeholder="Subject" data-fieldname="subject"></div>\
|
||||
<div class="form-group"><textarea rows=10 class="form-control" \
|
||||
style="resize: vertical;" placeholder="Message" \
|
||||
data-fieldname="message"></textarea></div>\
|
||||
</div>')
|
||||
.insertAfter(window.$new_ticket);
|
||||
});
|
||||
|
||||
window.$new_ticket.find("#new-ticket-send").on("click", function() {
|
||||
var subject = $("#ticket-editor").find('[data-fieldname="subject"]').val().trim();
|
||||
var message = $("#ticket-editor").find('[data-fieldname="message"]').val().trim();
|
||||
if(!(subject && message)) {
|
||||
msgprint("Please write something in subject and message!");
|
||||
} else {
|
||||
wn.call({
|
||||
type: "POST",
|
||||
method: "support.doctype.support_ticket.templates.pages.tickets.make_new_ticket",
|
||||
btn: this,
|
||||
args: { subject: subject, message: message },
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
msgprint(r._server_messages
|
||||
? JSON.parse(r._server_messages).join("<br>")
|
||||
: "Something went wrong!");
|
||||
} else {
|
||||
window.location.href = "ticket?name=" + encodeURIComponent(r.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var msgprint = function(txt) {
|
||||
if(txt) $("#msgprint-alert").html(txt).toggle(true);
|
||||
}
|
||||
</script>
|
||||
{%- endblock %}
|
||||
38
erpnext/templates/pages/tickets.py
Normal file
38
erpnext/templates/pages/tickets.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint, formatdate
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
return {
|
||||
"title": "My Tickets",
|
||||
"method": "support.doctype.support_ticket.templates.pages.tickets.get_tickets",
|
||||
"icon": "icon-ticket",
|
||||
"empty_list_message": "No Tickets Raised",
|
||||
"page": "ticket"
|
||||
}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_tickets(start=0):
|
||||
tickets = webnotes.conn.sql("""select name, subject, status, creation
|
||||
from `tabSupport Ticket` where raised_by=%s
|
||||
order by modified desc
|
||||
limit %s, 20""", (webnotes.session.user, cint(start)), as_dict=True)
|
||||
for t in tickets:
|
||||
t.creation = formatdate(t.creation)
|
||||
|
||||
return tickets
|
||||
|
||||
@webnotes.whitelist()
|
||||
def make_new_ticket(subject, message):
|
||||
if not (subject and message):
|
||||
raise webnotes.throw(_("Please write something in subject and message!"))
|
||||
|
||||
from erpnext.support.doctype.support_ticket.get_support_mails import add_support_communication
|
||||
ticket = add_support_communication(subject, message, webnotes.session.user)
|
||||
|
||||
return ticket.doc.name
|
||||
89
erpnext/templates/sale.html
Normal file
89
erpnext/templates/sale.html
Normal file
@@ -0,0 +1,89 @@
|
||||
{% extends base_template %}
|
||||
|
||||
{% set title=doc.name %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container content">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="index">Home</a></li>
|
||||
<li><a href="{{ parent_link }}">{{ parent_title }}</a></li>
|
||||
<li class="active"><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</li>
|
||||
</ul>
|
||||
<h3><i class="icon-file icon-fixed-width"></i> {{ doc.name }}</h3>
|
||||
{% if doc.name == "Not Allowed" -%}
|
||||
<script>ask_to_login();</script>
|
||||
{% else %}
|
||||
<hr>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
{% block status -%}{%- endblock %}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<span class="pull-right">{{ utils.formatdate(doc.posting_date or doc.transaction_date) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Sr</th>
|
||||
<th>Item Name</th>
|
||||
<th>Description</th>
|
||||
<th>Qty</th>
|
||||
<th>UoM</th>
|
||||
<th>Basic Rate</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
{%- for row in doclist.get({"doctype": doc.doctype + " Item"}) %}
|
||||
<tr>
|
||||
<td style="width: 3%;">{{ row.idx }}</td>
|
||||
<td style="width: 20%;">{{ row.item_name }}</td>
|
||||
<td style="width: 37%;">{{ row.description }}</td>
|
||||
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-6">
|
||||
<table cellspacing=0 width=100%>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Net Total</td>
|
||||
<td width=40% style="text-align: right;">{{
|
||||
utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
|
||||
}}</td>
|
||||
</tr>
|
||||
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||
{%- if not charge.included_in_print_rate -%}
|
||||
<tr>
|
||||
<td>{{ charge.description }}</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
<tr>
|
||||
<td>Grand Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
<tr style='font-weight: bold'>
|
||||
<td>Rounded Total</td>
|
||||
<td style="text-align: right;">{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
32
erpnext/templates/sales_transactions.html
Normal file
32
erpnext/templates/sales_transactions.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{% extends "templates/includes/transactions.html" %}
|
||||
|
||||
{% block javascript -%}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
global_number_format = "{{ global_number_format }}";
|
||||
currency = "{{ currency }}";
|
||||
wn.currency_symbols = {{ currency_symbols }};
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ super() }}
|
||||
|
||||
<script>
|
||||
var render = function(doc) {
|
||||
doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
|
||||
if(!doc.status) doc.status = "";
|
||||
|
||||
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
|
||||
<div class="row">\
|
||||
<div class="col-md-6">\
|
||||
<div class="row col-md-12">%(name)s</div>\
|
||||
<div class="row col-md-12 text-muted">%(items)s</div>\
|
||||
<div class="row col-md-12">%(status)s</div>\
|
||||
</div>\
|
||||
<div class="col-md-3 text-right">%(grand_total_export)s</div>\
|
||||
<div class="col-md-3 text-right text-muted">%(creation)s</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
</script>
|
||||
{%- endblock %}
|
||||
77
erpnext/templates/utils.py
Normal file
77
erpnext/templates/utils.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import cint, formatdate
|
||||
import json
|
||||
|
||||
def get_transaction_list(doctype, start, additional_fields=None):
|
||||
# find customer id
|
||||
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
|
||||
"customer")
|
||||
|
||||
if customer:
|
||||
if additional_fields:
|
||||
additional_fields = ", " + ", ".join(("`%s`" % f for f in additional_fields))
|
||||
else:
|
||||
additional_fields = ""
|
||||
|
||||
transactions = webnotes.conn.sql("""select name, creation, currency, grand_total_export
|
||||
%s
|
||||
from `tab%s` where customer=%s and docstatus=1
|
||||
order by creation desc
|
||||
limit %s, 20""" % (additional_fields, doctype, "%s", "%s"),
|
||||
(customer, cint(start)), as_dict=True)
|
||||
for doc in transactions:
|
||||
items = webnotes.conn.sql_list("""select item_name
|
||||
from `tab%s Item` where parent=%s limit 6""" % (doctype, "%s"), doc.name)
|
||||
doc.items = ", ".join(items[:5]) + ("..." if (len(items) > 5) else "")
|
||||
doc.creation = formatdate(doc.creation)
|
||||
return transactions
|
||||
else:
|
||||
return []
|
||||
|
||||
def get_currency_context():
|
||||
return {
|
||||
"global_number_format": webnotes.conn.get_default("number_format") or "#,###.##",
|
||||
"currency": webnotes.conn.get_default("currency"),
|
||||
"currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol
|
||||
from tabCurrency where ifnull(enabled,0)=1""")))
|
||||
}
|
||||
|
||||
def get_transaction_context(doctype, name):
|
||||
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
|
||||
"customer")
|
||||
|
||||
bean = webnotes.bean(doctype, name)
|
||||
if bean.doc.customer != customer:
|
||||
return {
|
||||
"doc": {"name": "Not Allowed"}
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"doc": bean.doc,
|
||||
"doclist": bean.doclist,
|
||||
"webnotes": webnotes,
|
||||
"utils": webnotes.utils
|
||||
}
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def send_message(subject="Website Query", message="", sender="", status="Open"):
|
||||
from webnotes.website.doctype.contact_us_settings.templates.pages.contact \
|
||||
import send_message as website_send_message
|
||||
|
||||
if not website_send_message(subject, message, sender):
|
||||
return
|
||||
|
||||
if subject=="Support":
|
||||
# create support ticket
|
||||
from erpnext.support.doctype.support_ticket.get_support_mails import add_support_communication
|
||||
add_support_communication(subject, message, sender, mail=None)
|
||||
else:
|
||||
# make lead / communication
|
||||
from erpnext.selling.doctype.lead.get_leads import add_sales_communication
|
||||
add_sales_communication(subject or "Website Query", message, sender, sender,
|
||||
mail=None, status=status)
|
||||
|
||||
Reference in New Issue
Block a user