more listviews

This commit is contained in:
Anand Doshi 2012-05-21 18:40:53 +05:30
parent ee2201cc68
commit 2c4cd08844
11 changed files with 360 additions and 17 deletions

View File

@ -0,0 +1,53 @@
// render
wn.doclistviews['Project'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabProject`.project_name',
'`tabProject`.status',
'`tabProject`.is_active',
'`tabProject`.priority',
'IFNULL(`tabProject`.project_value, 0) as project_value',
'IFNULL(`tabProject`.per_gross_margin, 0) as per_gross_margin',
'`tabProject`.completion_date',
]);
//this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
data.completion_date = wn.datetime.str_to_user(data.completion_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '22%', content: 'project_name+tags'},
{
width: '20%',
content: function(parent, data) {
$(parent).html(data.status + " [" + data.priority + "] "
+ (data.is_active=='No'?" [Inactive]":""));
},
},
{
width: '15%',
content: function(parent, data) {
$(parent).html(sys_defaults.currency + " "
+ fmt_money(data.project_value));
},
css: {'text-align': 'right'},
},
{
width: '10%',
content: function(parent, data) {
$(parent).html(fmt_money(data.per_gross_margin) + " %");
},
css: {'text-align': 'right'},
},
{width: '12%', content:'completion_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});

View File

@ -0,0 +1,38 @@
// render
wn.doclistviews['Task'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabTask`.subject',
'`tabTask`.status',
'`tabTask`.opening_date',
'`tabTask`.priority',
'`tabTask`.allocated_to',
]);
},
prepare_data: function(data) {
this._super(data);
data.opening_date = wn.datetime.str_to_user(data.opening_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '12%', content: 'name'},
{width: '30%', content: 'subject+tags'},
{
width: '15%',
content: function(parent, data) {
$(parent).html(data.status +
(data.priority ? " [" + data.priority + "]" : "")
);
},
},
{width: '20%', content: 'allocated_to'},
{width: '12%', content:'opening_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});

View File

@ -0,0 +1,35 @@
// render
wn.doclistviews['Timesheet'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabTimesheet`.status',
'`tabTimesheet`.timesheet_date',
'`tabTimesheet`.owner',
'`tabTimesheet`.notes',
]);
},
prepare_data: function(data) {
this._super(data);
data.timesheet_date = wn.datetime.str_to_user(data.timesheet_date);
if(data.notes && data.notes.length > 50) {
data.notes = '<span title="'+data.notes+'">' +
data.notes.substr(0,50) + '...</span>';
}
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '18%', content: 'name'},
{width: '12%', content: 'status'},
{width: '27%', content: 'notes+tags', css: {'color': '#777'}},
{width: '20%', content: 'owner'},
{width: '12%', content:'timesheet_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});

View File

@ -0,0 +1,28 @@
// render
wn.doclistviews['Batch'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabBatch`.item",
"`tabBatch`.description",
]);
this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
if(data.description && data.description.length > 50) {
data.description = '<span title="'+data.description+'">' +
data.description.substr(0,50) + '...</span>';
}
},
columns: [
{width: '3%', content:'check'},
{width: '5%', content:'avatar'},
{width: '15%', content:'name'},
{width: '15%', content:'item'},
{width: '50%', content:'tags+description'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -13,7 +13,8 @@ wn.doclistviews['Item'] = wn.views.ListView.extend({
this._super(data);
data.description = repl("%(item_name)s | %(description)s", data);
if(data.description && data.description.length > 50) {
data.description = '<span title="'+data.description+'">' + data.description.substr(0,50) + '...</span>';
data.description = '<span title="'+data.description+'">' +
data.description.substr(0,50) + '...</span>';
}
},

View File

@ -0,0 +1,28 @@
// render
wn.doclistviews['Serial No'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabSerial No`.item_code",
"`tabSerial No`.item_name",
"`tabSerial No`.status",
"`tabSerial No`.warehouse",
]);
this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
data.item_name = data.item_name ? data.item_name : data.item_code;
},
columns: [
{width: '3%', content:'check'},
{width: '5%', content:'avatar'},
{width: '15%', content:'name'},
{width: '30%', content:'item_name+tags'},
{width: '15%', content:'status'},
{width: '20%', content:'warehouse', css: {'color': '#777'}},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -0,0 +1,35 @@
// render
wn.doclistviews['Warehouse'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabWarehouse`.warehouse_type",
"`tabWarehouse`.address_line_1",
"`tabWarehouse`.address_line_2",
"`tabWarehouse`.city",
"`tabWarehouse`.state",
"`tabWarehouse`.pin",
]);
this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
var concat_list = [];
data.address_line_1 && concat_list.push(data.address_line_1);
data.address_line_2 && concat_list.push(data.address_line_2);
data.city && concat_list.push(data.city);
data.state && concat_list.push(data.state);
data.pin && concat_list.push(data.pin);
data.address = concat_list.join(", ");
},
columns: [
{width: '3%', content:'check'},
{width: '5%', content:'avatar'},
{width: '20%', content:'name'},
{width: '15%', content:'warehouse_type'},
{width: '45%', content:'tags+address'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-04-11 13:18:57',
'creation': '2012-05-15 12:15:13',
'docstatus': 0,
'modified': '2012-04-11 17:47:35',
'modified': '2012-05-21 18:02:46',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -25,7 +25,7 @@
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 59
'version': 1
},
# These values are common for all DocField
@ -319,19 +319,6 @@
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'state',
'fieldtype': u'Select',
'label': u'State',
'oldfieldname': u'state',
'oldfieldtype': u'Select',
'options': u'\nSelect country first',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
@ -344,6 +331,19 @@
'reqd': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'state',
'fieldtype': u'Data',
'label': u'State',
'oldfieldname': u'state',
'oldfieldtype': u'Select',
'options': u'Suggest',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',

View File

@ -0,0 +1,60 @@
// render
wn.doclistviews['Customer Issue'] = wn.views.ListView.extend({
me: this,
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabCustomer Issue`.customer",
"`tabCustomer Issue`.serial_no",
"`tabCustomer Issue`.item_name",
"`tabCustomer Issue`.complaint",
"`tabCustomer Issue`.status",
]);
this.stats = this.stats.concat(['status', 'company']);
//this.show_hide_check_column();
},
prepare_data: function(data) {
this._super(data);
if(data.status=='Open') {
data.label_type = 'important';
} else if(data.status=='Closed') {
data.label_type = 'success';
} else if(data.status=='Cancelled') {
data.label_type = 'info';
} else if(data.status=='Work In Progress') {
data.label_type = 'info';
data.status = 'WIP';
}
data.status_html = repl(
'<span class="label label-%(label_type)s">%(status)s</span>', data);
var a = $(data.status_html).click(function() {
me.set_filter('status', $(this).text());
});
var concat_list = [data.customer];
data.serial_no && concat_list.push(data.serial_no);
data.complaint && concat_list.push(data.complaint);
data.complaint = concat_list.join(" | ");
// description
if(data.complaint && data.complaint.length > 50) {
data.complaint = '<span title="'+data.complaint+'">' +
data.complaint.substr(0,50) + '...</span>';
}
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '20%', content: 'name'},
{width: '10%', content: 'status_html'},
{width: '47%', content: 'tags+complaint', css: {color:'#777'}},
{width: '12%', content: 'modified',
css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -0,0 +1,24 @@
// render
wn.doclistviews['Maintenance Schedule'] = wn.views.ListView.extend({
me: this,
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabMaintenance Schedule`.customer",
]);
this.stats = this.stats.concat(['company']);
//this.show_hide_check_column();
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '20%', content: 'name'},
{width: '55%', content: 'customer+tags'},
{width: '14%', content: 'modified',
css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -0,0 +1,41 @@
// render
wn.doclistviews['Maintenance Visit'] = wn.views.ListView.extend({
me: this,
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabMaintenance Visit`.customer_name",
"`tabMaintenance Visit`.mntc_date",
"`tabMaintenance Visit`.mntc_time",
"`tabMaintenance Visit`.maintenance_type",
"`tabMaintenance Visit`.completion_status",
]);
this.stats = this.stats.concat(['completion_status', 'company']);
//this.show_hide_check_column();
},
prepare_data: function(data) {
this._super(data);
data.mntc_date = wn.datetime.str_to_user(data.mntc_date);
data.mntc_time = wn.datetime.time_to_ampm(data.mntc_time);
data.date_time = "on " + data.mntc_date + " at " +
data.mntc_time[0] + ":" + data.mntc_time[1] + " " + data.mntc_time[2];
data.customer_name = data.customer_name + " " + data.date_time;
data.completion_status = data.completion_status +
(data.maintenance_type ? " [" + data.maintenance_type + "]": "");
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '40%', content: 'customer_name+tags'},
{width: '20%', content: 'completion_status'},
{width: '14%', content: 'modified',
css: {'text-align': 'right', 'color':'#777'}}
]
});