mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-17 02:26:33 +00:00
cleanup to projects and tasks and now embedding gantt chart inside project
This commit is contained in:
@@ -16,56 +16,9 @@
|
||||
|
||||
pscript.onload_Projects = function(wrapper) {
|
||||
wn.ui.make_app_page({parent:wrapper, title:'Gantt Chart: All Tasks', single_column:true});
|
||||
|
||||
$(wrapper).find('.layout-main').html('<div class="help-box">Loading...</div>')
|
||||
|
||||
|
||||
wn.require('js/lib/jQuery.Gantt/css/style.css');
|
||||
wn.require('js/lib/jQuery.Gantt/js/jquery.fn.gantt.min.js');
|
||||
|
||||
wn.call({
|
||||
method: 'projects.page.projects.projects.get_tasks',
|
||||
callback: function(r) {
|
||||
$(wrapper).find('.layout-main').empty();
|
||||
|
||||
var source = [];
|
||||
// projects
|
||||
$.each(r.message, function(i,v) {
|
||||
source.push({
|
||||
name: v.project,
|
||||
desc: v.subject,
|
||||
values: [{
|
||||
label: v.subject,
|
||||
desc: v.description || v.subject,
|
||||
from: '/Date("'+v.exp_start_date+'")/',
|
||||
to: '/Date("'+v.exp_end_date+'")/',
|
||||
customClass: {
|
||||
'Open':'ganttRed',
|
||||
'Pending Review':'ganttOrange',
|
||||
'Working':'',
|
||||
'Completed':'ganttGreen',
|
||||
'Cancelled':'ganttGray'
|
||||
}[v.status],
|
||||
dataObj: v
|
||||
}]
|
||||
})
|
||||
})
|
||||
|
||||
var gantt_area = $('<div class="gantt">').appendTo($(wrapper).find('.layout-main'));
|
||||
gantt_area.gantt({
|
||||
source: source,
|
||||
navigate: "scroll",
|
||||
scale: "weeks",
|
||||
minScale: "weeks",
|
||||
maxScale: "months",
|
||||
onItemClick: function(data) {
|
||||
wn.set_route('Form', 'Task', data.name);
|
||||
},
|
||||
onAddClick: function(dt, rowId) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
if(!erpnext.show_task_gantt)
|
||||
wn.require('js/gantt_task.js');
|
||||
|
||||
var gantt_area = $('<div>').appendTo($(wrapper).find('.layout-main'));
|
||||
erpnext.show_task_gantt(gantt_area);
|
||||
}
|
||||
@@ -18,8 +18,11 @@ import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_tasks():
|
||||
cond = ''
|
||||
if webnotes.form_dict.get('project'):
|
||||
cond = ' and project="%s"' % webnotes.form_dict.get('project')
|
||||
return webnotes.conn.sql("""select name, project, subject, exp_start_date, exp_end_date,
|
||||
description, status from tabTask where
|
||||
project is not null
|
||||
and exp_start_date is not null
|
||||
and exp_end_date is not null""", as_dict=True)
|
||||
and exp_end_date is not null %s""" % cond, as_dict=True)
|
||||
Reference in New Issue
Block a user