From 983c551796cd78075d3b5fe7f6f0bdad4e77fd7b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 4 Jun 2012 13:20:42 +0530 Subject: [PATCH] gantt chart fixes --- erpnext/projects/page/projects/projects.js | 53 ++++++++-------------- public/js/all-app.js | 5 +- public/js/all-web.js | 5 +- 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js index 59b039a8c3..9fec3c9bb6 100644 --- a/erpnext/projects/page/projects/projects.js +++ b/erpnext/projects/page/projects/projects.js @@ -164,6 +164,13 @@ GanttGrid = function(chart, s_date, e_date) { this.make(); } +GanttGrid.prototype.make = function() { + this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']); + this.make_grid(); + this.make_labels(); + this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'}); +} + GanttGrid.prototype.make_grid = function() { // grid ----------- var ht = this.chart.tasks.length * 40 + 'px'; @@ -191,17 +198,12 @@ GanttGrid.prototype.make_labels = function() { if(d.getDate()==today.getDate() && d.getMonth()==today.getMonth() && d.getYear() == today.getYear()) { $y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'}) } - var d = date.add_days(this.start_date, 1); + var d = date.str_to_obj(date.add_days(this.start_date, 1)); } this.start_date = date.str_to_obj(date.user_to_str(this.s_date)); } -GanttGrid.prototype.make = function() { - this.body = make_table(this.wrapper, 1, 2, '100%', ['30%','70%']); - this.make_grid(); - this.make_labels(); - this.y_labels = $a($td(this.body, 0, 0), 'div', '', {marginTop:'2px', position:'relative'}); -} + GanttGrid.prototype.get_x = function(dt) { var d = date.str_to_obj(dt); // convert to obj @@ -256,33 +258,18 @@ GanttTask = function(grid, data, idx) { } GanttTask.prototype.make_tooltip = function(d) { - var t = '
'; - if(d[0]) t += 'Task: ' + d[0]; - if(d[5]) t += '
Priority: ' + d[5]; - if(d[6]) t += '
Status: ' + d[6]; - if(d[1]) t += '
Allocated To: ' + d[1]; - if(d[2]) t += '
Project: ' + d[2]; - if(d[3]) t += '
From: ' + date.str_to_user(d[3]); - if(d[4]) t += '
To: ' + date.str_to_user(d[4]); - t += '
'; + $(this.body).click(function() { + var t = '
'; + if(d[0]) t += 'Task: ' + d[0]; + if(d[5]) t += '
Priority: ' + d[5]; + if(d[6]) t += '
Status: ' + d[6]; + if(d[1]) t += '
Allocated To: ' + d[1]; + if(d[2]) t += '
Project: ' + d[2]; + if(d[3]) t += '
From: ' + date.str_to_user(d[3]); + if(d[4]) t += '
To: ' + date.str_to_user(d[4]); + t += '
'; - $(this.body).qtip({ - content:t, - position:{ - corner:{ - tooltip: 'topMiddle', // Use the corner... - target: 'bottomMiddle' // ...and opposite corner - } - }, - style:{ - border: { - width: 5, - radius: 10 - }, - padding: 10, - tip: true, // Give it a speech bubble tip with automatic corner detection - name: 'green' // Style it according to the preset 'cream' style - } + msgprint(t) }) } diff --git a/public/js/all-app.js b/public/js/all-app.js index 60fa6029ee..c75636e849 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -473,9 +473,8 @@ var doc_link=DocLink;function roundNumber(num,dec){var result=Math.round(num*Mat function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d2.getMonth()&&d1.getDate()==d2.getDate())return true;else return false;} var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31} var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length