Add initial implementation of Simple Gantt chart and sample names list

- Created index.html for the Gantt chart with sample tasks and configurations.
- Added styles for the Gantt chart and linked necessary CSS and JS files.
- Introduced a names.txt file containing a list of names for potential use in the application.
This commit is contained in:
2025-04-12 02:08:00 +02:00
parent ec48c84b4b
commit 9e3811cf7a
19 changed files with 5289 additions and 1864 deletions

View File

@@ -2,40 +2,15 @@
namespace controls;
class Tasks
{
static public function gantt_json() {
static public function task_change_dates() {
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 );
foreach ( $tasks as $task ) {
$response = [ 'status' => 'error', 'msg' => 'Podczas zmiany daty wystąpił błąd. Proszę spróbować ponownie.' ];
$class = '';
if ( $task['status'] == 6 )
$class = 'ganttGrey';
elseif ( $task['status'] == 5 )
$class = 'ganttRed';
if ( \factory\Tasks::task_change_dates( \S::get( 'task_id' ), \S::get( 'date_start' ), \S::get( 'date_end' ) ) )
$response = [ 'status' => 'success', 'msg' => 'Data została zmieniona.' ];
$task_json['name'] = $task['client_id'] ? \factory\Crm::get_client_name( (int)$task['client_id'] ) : $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,
'dataObj' => [
'task_id' => $task['id'],
]
]
];
$data[] = $task_json;
}
header('Content-Type: application/json');
// Zwróć dane jako JSON
echo json_encode($data);
echo json_encode( $response );
exit;
}
@@ -195,6 +170,7 @@ class Tasks
'show_tasks_bulk' => $show_tasks_bulk,
'show_tasks_to_review' => $show_tasks_to_review,
'users' => \factory\Users::users_list(),
'tasks_gantt' => \factory\Tasks::get_tasks_gantt(),
] );
}