diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 37da031..9e5403c 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -139,8 +139,8 @@ }, "class.Tasks.php": { "type": "-", - "size": 18282, - "lmtime": 1744416198811, + "size": 18381, + "lmtime": 1744445308848, "modified": false }, "class.Users.php": { @@ -297,14 +297,14 @@ "Simple-Gant-master": { "frappe-gantt.css": { "type": "-", - "size": 4631, - "lmtime": 1744416274241, + "size": 4756, + "lmtime": 1744445361651, "modified": false }, "frappe-gantt.js": { "type": "-", - "size": 78780, - "lmtime": 1744416131313, + "size": 78713, + "lmtime": 1744445195672, "modified": false }, "frappe-gantt.js.map": { @@ -374,8 +374,8 @@ }, "main_view.php": { "type": "-", - "size": 32482, - "lmtime": 1744416116971, + "size": 31686, + "lmtime": 1744443300056, "modified": false }, "task_edit.php": { diff --git a/autoload/class.Cron.php b/autoload/class.Cron.php index 8e2cdef..553caa1 100644 --- a/autoload/class.Cron.php +++ b/autoload/class.Cron.php @@ -97,8 +97,10 @@ class Cron if ( in_array( 6, $task_users ) ) $status = 6; + $row['show_in_calendar'] ? $show_in_calendar = 'on' : $show_in_calendar = 'off'; + $new_task_id = \factory\Tasks::task_save( - null, $row['id'], $row['created_by'], $row['name'], $row['text'], $new_date_start, $new_date_end, $row['project_id'], $row['client_id'], $row['pay_rate'], $row['reminders_interval'], $row['recursively'] ? 'on' : 'off', $row['frequency'], $row['period'], $task_users, $row['date_end_month_day'], $row['date_start_month_day'], null, $row['task_change_status'], true, $status, $row['show_in_calendar'] + null, $row['id'], $row['created_by'], $row['name'], $row['text'], $new_date_start, $new_date_end, $row['project_id'], $row['client_id'], $row['pay_rate'], $row['reminders_interval'], $row['recursively'] ? 'on' : 'off', $row['frequency'], $row['period'], $task_users, $row['date_end_month_day'], $row['date_start_month_day'], null, $row['task_change_status'], true, $status, $show_in_calendar ); if ( $new_task_id ) { diff --git a/autoload/controls/class.Tasks.php b/autoload/controls/class.Tasks.php index 417d2f0..b5f621e 100644 --- a/autoload/controls/class.Tasks.php +++ b/autoload/controls/class.Tasks.php @@ -95,7 +95,8 @@ class Tasks 'user' => $user, 'statuses' => \factory\Tasks::get_statuses(), 'open_task_id' => $open_task_id - ] ) + ] ), + 'tasks_gantt' => \factory\Tasks::get_tasks_gantt(), ] ); exit; } diff --git a/autoload/factory/class.Tasks.php b/autoload/factory/class.Tasks.php index 93452a1..d0c57b8 100644 --- a/autoload/factory/class.Tasks.php +++ b/autoload/factory/class.Tasks.php @@ -23,7 +23,7 @@ class Tasks static public function get_tasks_gantt() { global $mdb; - $tasks = $mdb -> query( 'SELECT t.id, t.name, t.date_start, t.date_end, t.status, t.client_id FROM tasks AS t WHERE show_in_calendar = 1 AND status != 2 ORDER BY date_start ASC' ) -> fetchAll( \PDO::FETCH_ASSOC ); + $tasks = $mdb -> query( 'SELECT t.id, t.name, t.date_start, t.date_end, t.status, t.client_id FROM tasks AS t WHERE show_in_calendar = 1 AND status != 2 AND t.date_start <= DATE_ADD(NOW(), INTERVAL 1 MONTH) ORDER BY date_start ASC' ) -> fetchAll( \PDO::FETCH_ASSOC ); foreach ( $tasks as $task ) { $task_json = []; $task_json['name'] = $task['client_id'] ? \factory\Crm::get_client_name( (int)$task['client_id'] ) : $task['name']; diff --git a/libraries/Simple-Gant-master/frappe-gantt.css b/libraries/Simple-Gant-master/frappe-gantt.css index fb20022..2e94d6f 100644 --- a/libraries/Simple-Gant-master/frappe-gantt.css +++ b/libraries/Simple-Gant-master/frappe-gantt.css @@ -229,11 +229,11 @@ } .gantt .bar.gantt-task-faktura { - fill: #a1277d; + fill: #a900fc; } .gantt .bar-wrapper:hover .bar.gantt-task-faktura { - fill: #a1277d; + fill: #a900fc; } .gantt .bar-progress { @@ -353,4 +353,58 @@ .upper-date-separator { stroke: #ccc; stroke-width: 1; +} + +/* Styl dla podświetlenia tekstu dzisiejszej daty w nagłówku */ +.gantt .date text.today-date-highlight { + fill: #E91E63; + /* Wybierz kolor podświetlenia, np. różowy */ + font-weight: bold; +} + +/* Opcjonalnie: Styl dla podświetlenia całej kolumny dzisiejszej daty */ +/* Ta reguła już prawdopodobnie istnieje w Twoim kodzie (make_grid_highlights) */ +.gantt .grid .today-highlight { + fill: #fcf8e3; + /* Jasnożółte tło dla całej kolumny */ + opacity: 0.7; + /* Lekka przezroczystość */ +} + +/* Poprawka dla czytelności tekstu na podświetlonym tle */ +.gantt .grid .today-highlight+.date text.today-date-highlight { + /* Można dodać dodatkowe style, jeśli tekst zlewa się z tłem kolumny */ +} + +/* Upewnij się, że górny i dolny tekst daty są dobrze widoczne */ +.gantt .date .upper-text { + fill: #555; + font-size: 12px; + /* text-anchor: middle; */ + /* Usunięte stąd, ustawiane dynamicznie w JS */ +} + +.gantt .date .lower-text { + fill: #333; + font-size: 12px; + /* text-anchor: middle; */ + /* Usunięte stąd, ustawiane dynamicznie w JS */ +} + +/* Styl dla linii oddzielających daty w nagłówku */ +.gantt .date .date-separator { + stroke: #e0e0e0; + stroke-width: 1; +} + +/* Opcjonalnie: Podświetlenie linii separatora dla dzisiejszej daty */ +.gantt .date .date-separator.today-date-highlight { + stroke: #E91E63; + /* Ten sam kolor co tekst */ +} + +.upper-text.today-date { + fill: red !important; + font-weight: bold; + font-size: 16px !important; } \ No newline at end of file diff --git a/libraries/Simple-Gant-master/frappe-gantt.js b/libraries/Simple-Gant-master/frappe-gantt.js index e88e9cc..1789ef6 100644 --- a/libraries/Simple-Gant-master/frappe-gantt.js +++ b/libraries/Simple-Gant-master/frappe-gantt.js @@ -1751,9 +1751,9 @@ class Gantt { } refresh(tasks) { - this.setup_tasks(tasks); - this.synchronizing_date(tasks); - this.change_view_mode(); + this.setup_tasks(tasks); + this.synchronizing_date(tasks); + this.change_view_mode(); } change_view_mode(mode = this.options.view_mode) { @@ -2206,13 +2206,22 @@ class Gantt { // Rysujemy górny tekst if (date.upper_text) { - const $upper_text = createSVG('text', { - x: date.upper_x + this.options.column_width, - y: date.upper_y, - innerHTML: date.upper_text, - class: 'upper-text', - append_to: this.layers.date - }); + const original_date = this.dates[i]; + const today = date_utils.today(); + + const isToday = + original_date.getDate() === today.getDate() && + original_date.getMonth() === today.getMonth() && + original_date.getFullYear() === today.getFullYear(); + console.log(date.upper_text + ' | ' + isToday ); + + const $upper_text = createSVG('text', { + x: date.upper_x + this.options.column_width, + y: date.upper_y, + innerHTML: date.upper_text, + class: 'upper-text' + (isToday ? ' today-date' : ''), + append_to: this.layers.date + }); // Ramka na końcu kolumny createSVG('line', { diff --git a/templates/tasks/main_view.php b/templates/tasks/main_view.php index 1d812c5..5ac84fd 100644 --- a/templates/tasks/main_view.php +++ b/templates/tasks/main_view.php @@ -261,6 +261,7 @@ $( '.tasks_container .tasks_suspended ul' ).empty().append( data.tasks_suspended ); $( '.tasks_container .tasks_to_do ul' ).empty().append( data.tasks_to_do ); $( '.tasks_container .tasks_fvat ul' ).empty().append( data.tasks_fvat ); + gantt_chart.refresh( data.tasks_gantt ); } }); }