[ui] listviews

This commit is contained in:
Rushabh Mehta 2015-01-12 16:10:42 +05:30
parent e8500ad4e6
commit 135fe3405f
17 changed files with 67 additions and 157 deletions

View File

@ -27,7 +27,7 @@
"fieldname": "status",
"fieldtype": "Select",
"in_filter": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
@ -56,7 +56,7 @@
"description": "Bill of Material to be considered for manufacturing",
"fieldname": "bom_no",
"fieldtype": "Link",
"in_list_view": 1,
"in_list_view": 0,
"label": "BOM No",
"oldfieldname": "bom_no",
"oldfieldtype": "Link",
@ -77,7 +77,7 @@
"depends_on": "",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"in_list_view": 0,
"label": "Qty To Manufacture",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
@ -351,7 +351,7 @@
"idx": 1,
"in_create": 0,
"is_submittable": 1,
"modified": "2014-12-24 14:36:25.662920",
"modified": "2015-01-08 12:59:51.111895",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",

View File

@ -1,47 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-11">
<div class="text-ellipsis">
{% var per = 100 - cint((doc.qty - doc.produced_qty) * 100 / doc.qty); %}
{%= list.get_avatar_and_id(doc) %}
<span style="margin-right: 8px; display: inline-block">
<span class="filterable"
data-filter="customer,=,{%= doc.customer %}">
{%= doc.customer_name %}</span></span>
{% if(per < 100 && doc.status!=="Stopped") { %}
{% if(frappe.datetime.get_diff(doc.expected_delivery_date) < 0) { %}
<span class="label label-danger filterable"
title="{%= doc.get_formatted("expected_delivery_date")%}"
data-filter="status,=,Submitted|expected_delivery_date,<,Today"
>
{%= __("Overdue") %}
</span>
{% } else { %}
<span class="label label-warning filterable"
data-filter="produced_qty,<,{%= doc.qty %}|status,!=,Stopped"
title="{%= __("Pending") %}">
{%= doc.get_formatted("expected_delivery_date")%}</span>
{% } %}
{% } %}
{% if(per == 100 && doc.status!=="Stopped") { %}
<span class="filterable text-muted"
data-filter="produced_qty,=,{%= doc.qty %}|status,!=,Stopped">
<i class="icon-ok-sign"></i></span>
{% } %}
{% if(doc.status==="Stopped") { %}
<span class="label label-danger filterable"
data-filter="status,=,Stopped">{%= __("Stopped") %}</span>
{% } %}
<span class="label label-default filterable"
data-filter="sales_order,=,{%= doc.sales_order %}"
title="{%= __("Sales Order") %}">
<i class="icon-file-text"></i> {%= doc.sales_order %}</span>
<span class="label label-default filterable"
data-filter="bom_no,=,{%= doc.bom_no %}" title="{%= __("BOM") %}">
<i class="icon-sitemap"></i> {%= doc.bom_no %}</span>
</div>
</div>
<div class="col-xs-1 text-right">
{% var completed = per, title = __("Completed") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
</div>

View File

@ -1,5 +1,15 @@
frappe.listview_settings['Production Order'] = {
add_fields: ["bom_no", "status", "sales_order", "qty",
"produced_qty", "expected_delivery_date"],
filters: [["status", "!=", "Completed"], ["status", "!=", "Stopped"]]
filters: [["status", "!=", "Completed"], ["status", "!=", "Stopped"]],
get_indicator: function(doc) {
return [__(doc.status), {
"Draft": "red",
"Submitted": "blue",
"Stopped": "red",
"In Process": "orange",
"Completed": "green",
"Cancelled": "darkgrey"
}[doc.status], "status,=," + doc.status];
}
};

View File

@ -30,7 +30,7 @@
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_list_view": 0,
"label": "Status",
"options": "Draft\nSubmitted\nBilled\nCancelled",
"permlevel": 0,
@ -40,7 +40,7 @@
"description": "Will be updated after Sales Invoice is Submitted.",
"fieldname": "sales_invoice",
"fieldtype": "Link",
"in_list_view": 1,
"in_list_view": 0,
"label": "Sales Invoice",
"options": "Sales Invoice",
"permlevel": 0,
@ -83,7 +83,7 @@
"icon": "icon-time",
"idx": 1,
"is_submittable": 1,
"modified": "2014-12-24 16:48:03.419707",
"modified": "2015-01-08 12:06:19.123049",
"modified_by": "Administrator",
"module": "Projects",
"name": "Time Log Batch",

View File

@ -1,15 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<span class="label label-{%= doc.status=="Billed" ? "success" :
frappe.utils.guess_style(doc.status) %} filterable"
style="margin-right: 8px;"
data-filter="status,=,{%= doc.status %}">
{%= doc.status %}</span>
<span style="margin-right: 8px;" class="text-muted">
({%= doc.total_hours + " " + __("hours") %})
</span>
</div>
</div>
</div>

View File

@ -1,3 +1,6 @@
frappe.listview_settings['Time Log Batch'] = {
add_fields: ["status", "total_hours", "rate"]
add_fields: ["status", "total_hours", "rate"],
get_indicator: function(doc) {
return [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
}
};

View File

@ -127,7 +127,7 @@ erpnext.pos.PointOfSale = Class.extend({
item_code: obj.name,
item_price: format_currency(obj.price_list_rate, obj.currency),
item_name: obj.name===obj.item_name ? "" : obj.item_name,
item_image: obj.image
item_image: obj.image ? "url('" + obj.image + "')" : null
})).tooltip().appendTo($wrap);
});
}

View File

@ -1,6 +1,6 @@
<div class="pos-item" data-item-code="{%= item_code %}" title="{%= item_name || item_code %}">
<div class="pos-item-image {% if (!item_image) { %} no-image {% } %}"
style="{% if (item_image) { %} background-image: url({%= item_image %}) {% } %}">
style="{% if (item_image) { %} background-image: {%= item_image %} {% } %}">
</div>
<div class="pos-item-text">
<h6 class="item-code text-ellipsis">{%= item_code %}</h6>

View File

@ -133,7 +133,7 @@
},
{
"fieldname": "image",
"fieldtype": "Image",
"fieldtype": "Attach",
"label": "Image",
"options": "",
"permlevel": 0,
@ -877,7 +877,7 @@
"icon": "icon-tag",
"idx": 1,
"max_attachments": 1,
"modified": "2015-01-07 10:40:54.901356",
"modified": "2015-01-08 14:59:49.747106",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@ -1,24 +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-4 hidden-xs">
{% if(doc.from_warehouse) { %}
<span class="label label-default filterable"
data-filter="from_warehouse,=,{%= doc.from_warehouse %}">
{%= doc.from_warehouse %}
</span>
{% } %}
{% if(doc.from_warehouse || doc.to_warehouse) { %}
<i class="octicon octicon-arrow-right text-muted"></i>
{% } %}
{% if(doc.to_warehouse) { %}
<span class="label label-primary filterable"
data-filter="to_warehouse,=,{%= doc.to_warehouse %}">
{%= doc.to_warehouse %}
</span>
{% } %}
</div>
</div>

View File

@ -1,4 +1,21 @@
frappe.listview_settings['Stock Entry'] = {
add_fields: ["`tabStock Entry`.`from_warehouse`", "`tabStock Entry`.`to_warehouse`",
"`tabStock Entry`.`purpose`", "`tabStock Entry`.`production_order`", "`tabStock Entry`.`bom_no`"]
"`tabStock Entry`.`purpose`", "`tabStock Entry`.`production_order`", "`tabStock Entry`.`bom_no`"],
column_render: {
"from_warehouse": function(doc) {
var html = "";
if(doc.from_warehouse) {
html += '<span class="filterable h6"\
data-filter="from_warehouse,=,'+doc.from_warehouse+'">'+doc.from_warehouse+' </span>';
}
if(doc.from_warehouse || doc.to_warehouse) {
html += '<i class="octicon octicon-arrow-right text-muted"></i> ';
}
if(doc.to_warehouse) {
html += '<span class="filterable h6"\
data-filter="to_warehouse,=,'+doc.to_warehouse+'">'+doc.to_warehouse+'</span>';
}
return html;
}
}
};

View File

@ -35,7 +35,7 @@
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 1,
"in_list_view": 0,
"label": "Customer Name",
"permlevel": 0,
"read_only": 1
@ -279,7 +279,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2015-01-01 14:30:02.998219",
"modified": "2015-01-08 14:02:17.403671",
"modified_by": "Administrator",
"module": "Support",
"name": "Maintenance Visit",
@ -303,5 +303,6 @@
],
"search_fields": "status,maintenance_type,customer,customer_name,mntc_date,company,fiscal_year",
"sort_field": "modified",
"sort_order": "DESC"
"sort_order": "DESC",
"title_field": "customer_name"
}

View File

@ -1,35 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
<!-- sample text -->
<span style="margin-right: 8px;" class="filterable"
data-filter="customer,=,{%= doc.customer %}">
{%= doc.customer_name %}</span>
<!-- sample label -->
{% var style = {
"Scheduled": "default",
"Unscheduled": "default",
"Breakdown": "danger"
}[doc.maintenance_type] %}
<span class="label
label-{%= style %} filterable"
data-filter="maintenance_type,=,{%= doc.maintenance_type %}">
{%= doc.maintenance_type %}
</span>
{% var style = doc.completion_status==="Partially Completed" ? "warning" : "success" %}
<span class="label
label-{%= style %} filterable"
data-filter="completion_status,=,{%= doc.completion_status %}">
{%= doc.completion_status %}
</span>
</div>
</div>
<!-- sample graph -->
<div class="col-xs-1 text-right">
{% var completed = doc.completed, title = __("Completed") %}
{% include "templates/form_grid/includes/progress.html" %}
</div>
</div>

View File

@ -1,3 +1,11 @@
frappe.listview_settings['Maintenance Visit'] = {
add_fields: ["customer", "customer_name", "completion_status", "maintenance_type"],
get_indicator: function(doc) {
var s = doc.completion_status || "Pending";
return [__(s), {
"Pending": "blue",
"Partially Completed": "orange",
"Fully Completed": "green"
}[s], "completion_status,=," + doc.completion_status];
}
};

View File

@ -81,7 +81,7 @@
{
"fieldname": "subject",
"fieldtype": "Small Text",
"in_list_view": 1,
"in_list_view": 0,
"label": "Subject",
"permlevel": 0,
"reqd": 1
@ -123,7 +123,7 @@
{
"fieldname": "email_sent",
"fieldtype": "Check",
"in_list_view": 1,
"in_list_view": 0,
"label": "Email Sent?",
"no_copy": 1,
"permlevel": 0,
@ -132,7 +132,7 @@
],
"icon": "icon-envelope",
"idx": 1,
"modified": "2014-08-04 07:22:06.445634",
"modified": "2015-01-08 10:45:54.106948",
"modified_by": "Administrator",
"module": "Support",
"name": "Newsletter",

View File

@ -1,15 +0,0 @@
<div class="row" style="max-height: 30px;">
<div class="col-xs-12 col-sm-9">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
</div>
</div>
<div class="col-sm-3 hidden-xs">
{% if (!doc.email_sent) { %}
<span class="indicator orange filterable"
data-filter="email_sent,=,No">
{%= __("Not Sent") %}
</span>
{% } %}
</div>
</div>

View File

@ -1,3 +1,10 @@
frappe.listview_settings['Newsletter'] = {
add_fields: ["subject", "send_to_type", "email_sent"]
add_fields: ["subject", "send_to_type", "email_sent"],
get_indicator: function(doc) {
if(doc.email_sent) {
return [__("Sent"), "green", "email_sent,=,Yes"];
} else {
return [__("Not Sent"), "orange", "email_sent,=,No"];
}
}
};