feat: Integrate JS Gantt Chart library and update styles
- Added JS Gantt Chart library files including CSS and JS. - Updated existing Gantt chart styles for better visual representation. - Translated month and day names to Polish in the Gantt chart settings. - Implemented Gantt chart initialization in the main view with sample data. - Added a toggle switch for displaying tasks in the calendar. - Enhanced task edit form with a new checkbox for calendar visibility. - Improved the layout of the logged-in user template to include Gantt chart styles and scripts.
This commit is contained in:
@@ -98,7 +98,7 @@ class Cron
|
||||
$status = 6;
|
||||
|
||||
$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
|
||||
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']
|
||||
);
|
||||
|
||||
if ( $new_task_id ) {
|
||||
|
||||
@@ -2,6 +2,40 @@
|
||||
namespace controls;
|
||||
class Tasks
|
||||
{
|
||||
static public function gantt_json() {
|
||||
global $mdb;
|
||||
|
||||
$tasks = $mdb -> query( 'SELECT t.id, t.name, t.date_start, t.date_end, t.status FROM tasks AS t WHERE show_in_calendar = 1 AND status != 2' ) -> fetchAll( \PDO::FETCH_ASSOC );
|
||||
foreach ( $tasks as $task ) {
|
||||
|
||||
$class = '';
|
||||
if ( $task['status'] == 6 )
|
||||
$class = 'ganttGrey';
|
||||
elseif ( $task['status'] == 5 )
|
||||
$class = 'ganttRed';
|
||||
|
||||
$task_json['name'] = $task['name'];
|
||||
$task_json['desc'] = 'Lorem ipsum dolor sit amet.';
|
||||
$task_json['id'] = $task['id'];
|
||||
$task_json['cssClass'] = 'redLabel';
|
||||
$task_json['values'] = [
|
||||
[
|
||||
'from' => $task['date_start'] . ' 08:00',
|
||||
'to' => $task['date_end'] . ' 16:00',
|
||||
'label' => $task['name'],
|
||||
'desc' => '',
|
||||
'customClass' => $class
|
||||
]
|
||||
];
|
||||
$data[] = $task_json;
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Zwróć dane jako JSON
|
||||
echo json_encode($data);
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function task_delete() {
|
||||
global $user;
|
||||
|
||||
@@ -365,7 +399,7 @@ class Tasks
|
||||
$values = \S::json_to_array( \S::get( 'values' ) );
|
||||
|
||||
if ( $id = \factory\Tasks::task_save(
|
||||
$values['id'], null, $user['id'], $values['name'], $values['text'], $values['date_start'], $values['date_end'], $values['project_id'], $values['client_id'], $values['pay_rate'], $values['reminders_interval'], $values['recursively'], $values['frequency'], $values['period'], $values['users'], null, null, $values['send_email_notification'], $values['status_change_mail'], false, $values['status']
|
||||
$values['id'], null, $user['id'], $values['name'], $values['text'], $values['date_start'], $values['date_end'], $values['project_id'], $values['client_id'], $values['pay_rate'], $values['reminders_interval'], $values['recursively'], $values['frequency'], $values['period'], $values['users'], null, null, $values['send_email_notification'], $values['status_change_mail'], false, $values['status'], $values['show_in_calendar']
|
||||
) )
|
||||
{
|
||||
\factory\Tasks::clear_task_opened( $id );
|
||||
|
||||
@@ -311,7 +311,7 @@ class Tasks
|
||||
}
|
||||
|
||||
// przy zmianach pamiętać o zadaniach z CRON
|
||||
static public function task_save( $task_id, $parent_id = null, $user_id, $name, $text, $date_start, $date_end, $project_id, $client_id, $pay_rate, $reminders_interval, $recursively, $frequency, $period, $users, $date_end_month_day = null, $date_start_month_day = null, $send_email_notification = false, $status_change_mail, $rescursive = false, $status = 0 )
|
||||
static public function task_save( $task_id, $parent_id = null, $user_id, $name, $text, $date_start, $date_end, $project_id, $client_id, $pay_rate, $reminders_interval, $recursively, $frequency, $period, $users, $date_end_month_day = null, $date_start_month_day = null, $send_email_notification = false, $status_change_mail, $rescursive = false, $status = 0, $show_in_calendar )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
@@ -337,7 +337,8 @@ class Tasks
|
||||
'date_start_month_day' => $date_start_month_day,
|
||||
'status_change_mail' => $status_change_mail == 'on' ? 1 : 0,
|
||||
'o' => ++$order,
|
||||
'status' => $status
|
||||
'status' => $status,
|
||||
'show_in_calendar' => $show_in_calendar == 'on' ? 1 : 0,
|
||||
] );
|
||||
$id = $mdb -> id();
|
||||
|
||||
@@ -377,7 +378,8 @@ class Tasks
|
||||
'period' => $period,
|
||||
'reminders_send' => 0,
|
||||
'status_change_mail' => $status_change_mail == 'on' ? 1 : 0,
|
||||
'status' => $status
|
||||
'status' => $status,
|
||||
'show_in_calendar' => $show_in_calendar == 'on' ? 1 : 0,
|
||||
], [
|
||||
'AND' => [
|
||||
'id' => $task_id
|
||||
|
||||
Reference in New Issue
Block a user