[ui] [listviews] indicators

This commit is contained in:
Rushabh Mehta
2015-01-06 18:08:44 +05:30
parent 50d7e8cf8f
commit 738d4ef5c8
30 changed files with 787 additions and 1011 deletions

View File

@@ -31,7 +31,7 @@
"fieldtype": "Data",
"hidden": 0,
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Full Name",
"no_copy": 1,
"oldfieldname": "customer_name",
@@ -78,6 +78,7 @@
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Customer Group",
"oldfieldname": "customer_group",
"oldfieldtype": "Link",
@@ -266,7 +267,7 @@
],
"icon": "icon-user",
"idx": 1,
"modified": "2015-01-01 14:30:00.368262",
"modified": "2015-01-06 17:08:55.045595",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",

View File

@@ -1,28 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12 col-sm-6">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
{% if(doc.customer_name != doc.name) { %}
<span style="margin-right: 8px; display: inline-block">
{%= doc.customer_name %}</span>
{% } %}
<span style="margin-right: 8px; display: inline-block"
title="{%= doc.customer_type %}" class="filterable"
data-filter="customer_type,=,{%= doc.customer_type %}">
</span>
</div>
</div>
<div class="col-sm-3 hidden-xs text-ellipsis">
<span class="indicator darkgrey filterable"
data-filter="customer_group,=,{%= doc.customer_group %}">
{%= doc.customer_group %}</span>
</div>
<div class="col-sm-3 hidden-xs text-ellipsis">
{% if(doc.territory) { %}
<a class="h6 text-muted filterable"
data-filter="territory,=,{%= doc.territory %}">
<i class="icon-map-marker"></i>
{%= doc.territory %}</a>
{% } %}
</div>
</div>

View File

@@ -28,7 +28,7 @@
"fieldname": "lead_name",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Contact Name",
"oldfieldname": "lead_name",
"oldfieldtype": "Data",
@@ -63,7 +63,7 @@
"fieldname": "status",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
@@ -77,7 +77,7 @@
"fieldname": "source",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Source",
"no_copy": 1,
"oldfieldname": "source",
@@ -331,7 +331,7 @@
],
"icon": "icon-user",
"idx": 1,
"modified": "2015-01-01 14:30:02.458843",
"modified": "2015-01-06 17:13:05.622160",
"modified_by": "Administrator",
"module": "Selling",
"name": "Lead",

View File

@@ -1,12 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12 col-sm-9 text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
{%= doc.company_name %}</span>
</div>
<div class="col-sm-3 hidden-xs">
<span class="indicator
{%= doc.status=="Open" ? "red" : "darkgrey" %} filterable"
data-filter="status,=,{%= doc.status %}">{%= __(doc.status) %}</span>
</div>
</div>

View File

@@ -1,3 +1,9 @@
frappe.listview_settings['Lead'] = {
add_fields: ["territory", "company_name", "status", "source"]
add_fields: ["territory", "company_name", "status", "source"],
get_indicator: function(doc) {
var indicator = [__(doc.status), "darkgrey", "status,=," + doc.status];
if(doc.status==="Open") indicator[1] = "red";
if(doc.status==="Opportunity") indicator[1] = "green";
return indicator;
}
};

View File

@@ -81,7 +81,7 @@
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Customer / Lead Name",
"permlevel": 0,
"read_only": 1
@@ -800,7 +800,7 @@
"idx": 1,
"is_submittable": 1,
"max_attachments": 1,
"modified": "2015-01-05 12:33:02.162194",
"modified": "2015-01-06 17:17:04.598365",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",

View File

@@ -1,16 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12 col-sm-8 text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
</div>
<div class="col-sm-2 hidden-xs">
<span class="indicator {%= doc.status=="Draft" ? "red" :
(doc.status=="Ordered" ? "green": "blue") %}
filterable"
data-filter="status,=,{%= doc.status %}">{%= __(doc.status) %}</span>
</div>
<div class="col-sm-2 hidden-xs text-right">
<div class="text-ellipsis" title="{%= doc.get_formatted('grand_total_export') %}">
{%= doc.get_formatted("grand_total_export") %}
</div>
</div>
</div>

View File

@@ -1,4 +1,11 @@
frappe.listview_settings['Quotation'] = {
add_fields: ["customer_name", "quotation_to", "grand_total", "status",
"company", "currency", "order_type", "lead", "customer"]
add_fields: ["customer_name", "grand_total", "status",
"company", "currency"],
get_indicator: function(doc) {
if(doc.status==="Ordered") {
return [__("Ordered"), "green", "status,=,Ordered"];
} else if(doc.status==="Lost") {
return [__("Lost"), "darkgrey", "status,=,Lost"];
}
}
};

View File

@@ -38,7 +38,7 @@
"fieldname": "customer",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Customer",
"oldfieldname": "customer",
"oldfieldtype": "Link",
@@ -93,7 +93,7 @@
"default": "Sales",
"fieldname": "order_type",
"fieldtype": "Select",
"in_list_view": 1,
"in_list_view": 0,
"label": "Order Type",
"oldfieldname": "order_type",
"oldfieldtype": "Select",
@@ -509,6 +509,7 @@
{
"fieldname": "grand_total_export",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Grand Total",
"oldfieldname": "grand_total_export",
"oldfieldtype": "Currency",
@@ -1021,7 +1022,7 @@
"idx": 1,
"is_submittable": 1,
"issingle": 0,
"modified": "2015-01-05 12:25:02.687860",
"modified": "2015-01-06 17:28:44.639230",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@@ -1,35 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12 col-sm-8">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
</div>
</div>
<div class="col-sm-2 hidden-xs text-ellipsis">
{% if(doc.per_delivered < 100 && doc.status!=="Stopped" &&
frappe.datetime.get_diff(doc.delivery_date) < 0) { %}
<span class="indicator red filterable"
title="{%= doc.get_formatted("delivery_date")%}"
data-filter="per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped">
{%= __("Overdue") %}
</span>
{% } else if(doc.per_delivered < 100 && doc.status!=="Stopped") { %}
<span class="indicator orange filterable"
data-filter="per_delivered,<,100|status,!=,Stopped"
title="{%= __("Pending") %}">
{%= doc.get_formatted("delivery_date") || "Pending" %}</span>
{% } else if(doc.per_delivered == 100 && doc.status!=="Stopped") { %}
<span class="filterable indicator green"
data-filter="per_delivered,=,100|status,!=,Stopped">
{%= __("Delivered") %}
</span>
{% } else if(doc.status==="Stopped") { %}
<span class="indicator red filterable"
data-filter="status,=,Stopped">{%= __("Stopped") %}</span>
{% } %}
</div>
<div class="col-sm-2 hidden-xs text-ellipsis text-right">
<div title="{%= doc.get_formatted('grand_total_export') %}">
{%= doc.get_formatted("grand_total_export") %}
</div>
</div>
</div>

View File

@@ -1,6 +1,18 @@
frappe.listview_settings['Sales Order'] = {
add_fields: ["`tabSales Order`.`grand_total`", "`tabSales Order`.`company`", "`tabSales Order`.`currency`",
"`tabSales Order`.`customer`", "`tabSales Order`.`customer_name`", "`tabSales Order`.`per_delivered`",
"`tabSales Order`.`per_billed`", "`tabSales Order`.`delivery_date`"],
filters: [["per_delivered", "<", 100]]
add_fields: ["grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed",
"status"],
filters: [["per_delivered", "<", 100]],
get_indicator: function(doc) {
if(doc.status==="Stopped") {
return [__("Stopped"), "red", "status,=,Stopped"];
} else if(doc.per_delivered < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"];
} else if(doc.per_delivered < 100 && doc.status!=="Stopped") {
return [__("Not Delivered"), "orange", "per_delivered,<,100|status,!=,Stopped"];
} else if(doc.per_delivered == 100 && doc.per_billed < 100 && doc.status!=="Stopped") {
return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"];
} else if(doc.per_delivered == 100 && doc.per_billed == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
}
}
};