mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 18:24:10 +00:00
Website Listing
This commit is contained in:
@@ -36,3 +36,36 @@ $(function() {
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
<style>
|
||||
.product-link {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.product-image-wrapper {
|
||||
max-width: 300px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 100%;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.product-image.missing-image {
|
||||
border: 1px dashed {{ border_color or "#d1d8dd" }};
|
||||
}
|
||||
|
||||
.product-text {
|
||||
padding: 15px 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
<div class="col-sm-3">
|
||||
<div style="height: 120px; overflow: hidden;">
|
||||
<a href="{{ route or page_name }}">
|
||||
{%- if website_image -%}
|
||||
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
|
||||
{%- else -%}
|
||||
{% include 'templates/includes/product_missing_image.html' %}
|
||||
{%- endif -%}
|
||||
</a>
|
||||
<a class="product-link" href="{{ route or page_name }}">
|
||||
<div class="col-sm-2 product-image-wrapper">
|
||||
<div class="product-image {% if not website_image -%}missing-image{%- endif %}"
|
||||
{% if website_image -%} style="background-image: url({{ website_image }});" {%- endif %}>
|
||||
</div>
|
||||
<div class="product-text small">{{ item_name }}</div>
|
||||
</div>
|
||||
<div style="height: 100px; overflow: hidden; font-size: 80%;">
|
||||
<div style="margin-bottom: 2px;"><a href="{{ route or page_name }}">{{ item_name }}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<div class="sale-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">
|
||||
{% if doc.status -%}{{ doc.status }}{%- endif %}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<span class="pull-right">{{ frappe.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 doc.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;">{{ frappe.utils.fmt_money(row.rate, currency=doc.currency) }}</td>
|
||||
<td style="width: 15%; text-align: right;">{{ frappe.utils.fmt_money(row.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;">{{
|
||||
frappe.utils.fmt_money(doc.base_net_total/doc.conversion_rate, currency=doc.currency)
|
||||
}}</td>
|
||||
</tr>
|
||||
{%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||
{%- if not charge.included_in_print_rate -%}
|
||||
<tr>
|
||||
<td>{{ charge.description }}</td>
|
||||
<td style="text-align: right;">{{ frappe.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;">{{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
<tr style='font-weight: bold'>
|
||||
<td>Rounded Total</td>
|
||||
<td style="text-align: right;">{{ frappe.utils.fmt_money(doc.rounded_total, currency=doc.currency) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
</div>
|
||||
|
||||
<!-- no-sidebar -->
|
||||
@@ -1,30 +0,0 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
global_number_format = "{{ global_number_format }}";
|
||||
currency = "{{ currency }}";
|
||||
frappe.currency_symbols = {{ currency_symbols }};
|
||||
});
|
||||
</script>
|
||||
|
||||
{% include "templates/includes/transactions.html" %}
|
||||
|
||||
<script>
|
||||
var render = function(doc) {
|
||||
doc.grand_total = format_currency(doc.grand_total, 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)s</div>\
|
||||
<div class="col-md-3 text-right text-muted">%(creation)s</div>\
|
||||
</div>\
|
||||
</a>', doc)).appendTo($list);
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- no-sidebar -->
|
||||
30
erpnext/templates/includes/transaction_row.html
Normal file
30
erpnext/templates/includes/transaction_row.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% set doc = frappe.get_doc(doc) %}
|
||||
<a class="website-list-row" href="/{{ pathname }}/{{ doc.name }}" no-pjax>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-xs-7">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">{{ doc.customer or doc.supplier }}</div>
|
||||
<div class="col-sm-3">
|
||||
{%- if doc.status_percent > 0 -%}
|
||||
{%- if doc.status_percent % 100 == 0 -%}
|
||||
<span class="indicator green">{{ doc.status_display }}</span>
|
||||
{%- else -%}
|
||||
<span class="indicator orange">{{ doc.status_display }}</span>
|
||||
{%- endif -%}
|
||||
{%- elif doc.status -%}
|
||||
<span class="indicator">{{ doc.status }}</span>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2 col-xs-5 text-right">
|
||||
{{ doc.get_formatted("grand_total") }}
|
||||
</div>
|
||||
<div class="col-sm-2 text-muted text-right">
|
||||
{{ doc.name }}
|
||||
</div>
|
||||
<div class="col-sm-2 small text-muted text-right" title="{{ frappe.utils.format_datetime(doc.creation, "medium") }}">
|
||||
{{ frappe.utils.pretty_date(doc.creation) }}</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<div class="transactions-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="text-muted progress">{{ _("Loading") }}...</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-default btn-show-more hide">More</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var get_transactions = function(btn) {
|
||||
frappe.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)) {
|
||||
if(!$list.html().trim()) {
|
||||
$list.html("<div class='text-muted'>\
|
||||
{{ empty_list_message }}</div>");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
start += r.message.length;
|
||||
|
||||
$.each(r.message, function(i, doc) {
|
||||
render(doc);
|
||||
});
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
window.start = 0;
|
||||
window.$list = $(".transaction-list");
|
||||
window.$list.find(".list-group-item").remove();
|
||||
window.$show_more = $(".btn-show-more").on("click", function() { get_transactions(this); })
|
||||
|
||||
get_transactions();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- no-sidebar -->
|
||||
@@ -1,6 +0,0 @@
|
||||
{% block title %} {{ doc.name }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ doc.name }}</h2>{% endblock %}
|
||||
|
||||
{% block content%}{% include "templates/includes/sale.html" %}{% endblock %}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# 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 frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, fmt_money
|
||||
from erpnext.templates.utils import get_transaction_context
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
invoice_context = frappe._dict({
|
||||
"parent_link": "invoices",
|
||||
"parent_title": "Invoices"
|
||||
})
|
||||
invoice_context.update(get_transaction_context("Sales Invoice", frappe.form_dict.name))
|
||||
modify_status(invoice_context.doc)
|
||||
return invoice_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,6 +0,0 @@
|
||||
{% block title %} {{ title }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ title }}</h2>{% endblock %}
|
||||
|
||||
{% block content %}{% include "templates/includes/sales_transactions.html" %}{% endblock %}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# 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 frappe
|
||||
from erpnext.templates.utils import get_currency_context
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
invoices_context = get_currency_context()
|
||||
invoices_context.update({
|
||||
"title": "Invoices",
|
||||
"method": "erpnext.templates.pages.invoices.get_invoices",
|
||||
"icon": "icon-file-text",
|
||||
"empty_list_message": "No Invoices Found",
|
||||
"page": "invoice"
|
||||
})
|
||||
return invoices_context
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_invoices(start=0):
|
||||
from erpnext.templates.utils import get_transaction_list
|
||||
from erpnext.templates.pages.invoice import modify_status
|
||||
invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"])
|
||||
for d in invoices:
|
||||
modify_status(d)
|
||||
return invoices
|
||||
@@ -1,6 +0,0 @@
|
||||
{% block title %} {{ doc.name }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ doc.name }}</h2>{% endblock %}
|
||||
|
||||
{% block content%}{% include "templates/includes/sale.html" %}{% endblock %}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# 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 frappe
|
||||
from frappe import _
|
||||
from erpnext.templates.utils import get_transaction_context
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
order_context = frappe._dict({
|
||||
"parent_link": "orders",
|
||||
"parent_title": "My Orders"
|
||||
})
|
||||
|
||||
order_context.update(get_transaction_context("Sales Order", frappe.form_dict.name))
|
||||
modify_status(order_context.doc)
|
||||
return order_context
|
||||
|
||||
def modify_status(doc):
|
||||
doc.status = []
|
||||
if 0 < doc.per_billed < 100:
|
||||
doc.status.append(("label-warning", "icon-ok", _("Partially Billed")))
|
||||
elif doc.per_billed == 100:
|
||||
doc.status.append(("label-success", "icon-ok", _("Billed")))
|
||||
|
||||
if 0 < doc.per_delivered < 100:
|
||||
doc.status.append(("label-warning", "icon-truck", _("Partially Delivered")))
|
||||
elif doc.per_delivered == 100:
|
||||
doc.status.append(("label-success", "icon-truck", _("Delivered")))
|
||||
doc.status = " " + " ".join(('<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % s
|
||||
for s in doc.status))
|
||||
@@ -1,5 +0,0 @@
|
||||
{% block title %} {{ title }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ title }}</h2>{% endblock %}
|
||||
|
||||
{% block content %}{% include "templates/includes/sales_transactions.html" %}{% endblock %}
|
||||
@@ -1,30 +0,0 @@
|
||||
# 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 frappe
|
||||
from erpnext.templates.utils import get_currency_context, get_transaction_list
|
||||
from erpnext.templates.pages.order import modify_status
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
orders_context = get_currency_context()
|
||||
orders_context.update({
|
||||
"title": "My Orders",
|
||||
"method": "erpnext.templates.pages.orders.get_orders",
|
||||
"icon": "icon-list",
|
||||
"empty_list_message": "No Orders Yet",
|
||||
"page": "order",
|
||||
})
|
||||
return orders_context
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_orders(start=0):
|
||||
orders = get_transaction_list("Sales Order", start, ["per_billed", "per_delivered"])
|
||||
for d in orders:
|
||||
modify_status(d)
|
||||
|
||||
return orders
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{% block title %} {{ doc.name }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ doc.name }}</h2>{% endblock %}
|
||||
|
||||
{% block content%}{% include "templates/includes/sale.html" %}{% endblock %}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# 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 frappe
|
||||
from erpnext.templates.utils import get_transaction_context
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
shipment_context = frappe._dict({
|
||||
"parent_link": "shipments",
|
||||
"parent_title": "Shipments"
|
||||
})
|
||||
shipment_context.update(get_transaction_context("Delivery Note", frappe.form_dict.name))
|
||||
return shipment_context
|
||||
@@ -1,5 +0,0 @@
|
||||
{% block title %} {{ title }} {% endblock %}
|
||||
|
||||
{% block header %}<h2>{{ title }}</h2>{% endblock %}
|
||||
|
||||
{% block content %}{% include "templates/includes/sales_transactions.html" %}{% endblock %}
|
||||
@@ -1,25 +0,0 @@
|
||||
# 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 frappe
|
||||
from erpnext.templates.utils import get_currency_context
|
||||
|
||||
no_cache = 1
|
||||
no_sitemap = 1
|
||||
|
||||
def get_context(context):
|
||||
shipments_context = get_currency_context()
|
||||
shipments_context.update({
|
||||
"title": "Shipments",
|
||||
"method": "erpnext.templates.pages.shipments.get_shipments",
|
||||
"icon": "icon-truck",
|
||||
"empty_list_message": "No Shipments Found",
|
||||
"page": "shipment"
|
||||
})
|
||||
return shipments_context
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_shipments(start=0):
|
||||
from erpnext.templates.utils import get_transaction_list
|
||||
return get_transaction_list("Delivery Note", start)
|
||||
@@ -21,47 +21,3 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
|
||||
"sent_or_received": "Received"
|
||||
})
|
||||
comm.insert(ignore_permissions=True)
|
||||
|
||||
def get_transaction_list(doctype, start, additional_fields=None):
|
||||
# find customer id
|
||||
customer = frappe.db.get_value("Contact", {"email_id": frappe.session.user},
|
||||
"customer")
|
||||
|
||||
if customer:
|
||||
if additional_fields:
|
||||
additional_fields = ", " + ", ".join(("`%s`" % f for f in additional_fields))
|
||||
else:
|
||||
additional_fields = ""
|
||||
|
||||
transactions = frappe.db.sql("""select name, creation, currency, grand_total
|
||||
%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 = frappe.db.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": frappe.db.get_default("number_format") or "#,###.##",
|
||||
"currency": frappe.db.get_default("currency"),
|
||||
"currency_symbols": json.dumps(dict(frappe.db.sql("""select name, symbol
|
||||
from tabCurrency where ifnull(enabled,0)=1""")))
|
||||
}
|
||||
|
||||
def get_transaction_context(doctype, name):
|
||||
customer = frappe.db.get_value("Contact", {"email_id": frappe.session.user},
|
||||
"customer")
|
||||
|
||||
doc = frappe.get_doc(doctype, name)
|
||||
if doc.customer != customer:
|
||||
return { "doc": frappe._dict({"name": _("Not Allowed")}) }
|
||||
else:
|
||||
return { "doc": doc }
|
||||
|
||||
Reference in New Issue
Block a user