feat: Enhance task management with client and parent ID prefill in task edit and popup, and improve UI for subtask actions

This commit is contained in:
2026-03-06 01:06:39 +01:00
parent 7c2a42a66f
commit f35b561d07
5 changed files with 103 additions and 24 deletions

View File

@@ -121,8 +121,8 @@
}, },
"class.Tasks.php": { "class.Tasks.php": {
"type": "-", "type": "-",
"size": 26739, "size": 27574,
"lmtime": 1772360724134, "lmtime": 1772534579077,
"modified": false "modified": false
}, },
"class.Users.php": { "class.Users.php": {
@@ -133,8 +133,8 @@
}, },
"class.Wiki.php": { "class.Wiki.php": {
"type": "-", "type": "-",
"size": 1825, "size": 2532,
"lmtime": 0, "lmtime": 1772532019810,
"modified": false "modified": false
} }
}, },
@@ -235,8 +235,8 @@
}, },
"class.Tasks.php": { "class.Tasks.php": {
"type": "-", "type": "-",
"size": 29961, "size": 33489,
"lmtime": 1772361497784, "lmtime": 1772534585287,
"modified": false "modified": false
}, },
"class.Users.php": { "class.Users.php": {
@@ -247,8 +247,8 @@
}, },
"class.Wiki.php": { "class.Wiki.php": {
"type": "-", "type": "-",
"size": 1911, "size": 3707,
"lmtime": 0, "lmtime": 1772534016525,
"modified": false "modified": false
} }
}, },
@@ -318,6 +318,12 @@
"size": 542, "size": 542,
"lmtime": 1772360740310, "lmtime": 1772360740310,
"modified": false "modified": false
},
"2026-03-03-task-wiki-relations.sql": {
"type": "-",
"size": 294,
"lmtime": 1772531577097,
"modified": false
} }
} }
}, },
@@ -336,20 +342,20 @@
"layout": { "layout": {
"style.css": { "style.css": {
"type": "-", "type": "-",
"size": 31663, "size": 32723,
"lmtime": 1772109274106, "lmtime": 1772532793626,
"modified": false "modified": false
}, },
"style.css.map": { "style.css.map": {
"type": "-", "type": "-",
"size": 55516, "size": 56837,
"lmtime": 1772109274106, "lmtime": 1772532793626,
"modified": false "modified": false
}, },
"style.scss": { "style.scss": {
"type": "-", "type": "-",
"size": 39770, "size": 39846,
"lmtime": 1772111528605, "lmtime": 1772532792986,
"modified": false "modified": false
} }
}, },
@@ -638,14 +644,14 @@
}, },
"task_edit.php": { "task_edit.php": {
"type": "-", "type": "-",
"size": 33540, "size": 35593,
"lmtime": 1772361385635, "lmtime": 1772534468454,
"modified": false "modified": false
}, },
"task_popup.php": { "task_popup.php": {
"type": "-", "type": "-",
"size": 36954, "size": 39914,
"lmtime": 1772395947362, "lmtime": 1772534728286,
"modified": false "modified": false
}, },
"task_single.php": { "task_single.php": {
@@ -708,8 +714,8 @@
}, },
"main-view.php": { "main-view.php": {
"type": "-", "type": "-",
"size": 3649, "size": 12222,
"lmtime": 0, "lmtime": 1772532898338,
"modified": false "modified": false
} }
} }
@@ -796,6 +802,12 @@
"size": 230708, "size": 230708,
"lmtime": 1771920013460, "lmtime": 1771920013460,
"modified": false "modified": false
},
"AGENTS.md": {
"type": "-",
"size": 250,
"lmtime": 1772530976286,
"modified": false
} }
} }
}, },

View File

@@ -1,5 +1,20 @@
# AGENTS.md # AGENTS.md
## Zasady pisania kodu
- Kod ma być czytelny „dla obcego”: jasne nazwy, mało magii
- Brak „skrótów na szybko” typu logika w widokach, copy-paste, losowe helpery bez spójności
- Każda funkcja/klasa ma mieć jedną odpowiedzialność, zwykle do 3050 linii (jeśli dłuższe dzielić)
- max 3 poziomy zagnieżdżeń (if/foreach), reszta do osobnych metod
- Nazewnictwo:
- klasy: PascalCase
- metody/zmienne: camelCase
- stałe: UPPER_SNAKE_CASE
- Zero „skrótologii” w nazwach (np. $d, $tmp, $x1) poza pętlami 23 linijki
- medoo + prepared statements bez wyjątków (żadnego sklejania SQL stringiem)
- XSS: escape w widokach (np. helper e())
- CSRF dla formularzy, sensowna obsługa sesji
- Kod ma mieć komentarze tylko tam, gdzie wyjaśniają „dlaczego”, nie „co”
## Sposób pracy ## Sposób pracy
- Pisz do mnie po polsku, zwięźle i krótko, ale merytorycznie - Pisz do mnie po polsku, zwięźle i krótko, ale merytorycznie

View File

@@ -454,6 +454,22 @@ class Tasks
if ( !is_array( $task ) ) if ( !is_array( $task ) )
$task = []; $task = [];
if ( !$task_id )
{
$prefill_project_id = \S::get( 'project_id' );
$prefill_client_id = \S::get( 'client_id' );
$prefill_parent_id = \S::get( 'parent_id' );
if ( $prefill_project_id !== '' and $prefill_project_id !== null )
$task['project_id'] = (int)$prefill_project_id;
if ( $prefill_client_id !== '' and $prefill_client_id !== null )
$task['client_id'] = (int)$prefill_client_id;
if ( $prefill_parent_id !== '' and $prefill_parent_id !== null )
$task['parent_id'] = (int)$prefill_parent_id;
}
$task['status'] = \Controllers\TasksController::resolveTaskStatusForForm( $task ); $task['status'] = \Controllers\TasksController::resolveTaskStatusForForm( $task );
$task['id'] = isset( $task['id'] ) ? (int)$task['id'] : $task_id; $task['id'] = isset( $task['id'] ) ? (int)$task['id'] : $task_id;
$task_id_for_attachments = (int)$task['id']; $task_id_for_attachments = (int)$task['id'];

View File

@@ -30,6 +30,9 @@ $project_id = $this -> task['project_id'] ? $this -> task[ 'project_id' ] : 0;
if ( !$this -> task['id'] and !$project_id ) if ( !$this -> task['id'] and !$project_id )
$project_id = 72; $project_id = 72;
$selected_client_id = isset( $this -> task['client_id'] ) ? (int)$this -> task['client_id'] : 0;
$selected_parent_id = isset( $this -> task['parent_id'] ) ? (int)$this -> task['parent_id'] : 0;
$clients = [ 0 => '--- wybierz klienta ---' ]; $clients = [ 0 => '--- wybierz klienta ---' ];
if ( is_array( $this -> clients ) ) if ( is_array( $this -> clients ) )
foreach ( $this -> clients as $client ) foreach ( $this -> clients as $client )
@@ -134,7 +137,7 @@ ob_start();
'label' => 'Klient', 'label' => 'Klient',
'name' => 'client_id', 'name' => 'client_id',
'id' => 'client_id', 'id' => 'client_id',
'value' => $this -> task[ 'id' ] ? $this -> task[ 'client_id' ] : 0, 'value' => $selected_client_id,
'values' => $clients 'values' => $clients
] ); ] );
?> ?>
@@ -143,7 +146,7 @@ ob_start();
'label' => 'Zadanie nadrzędne', 'label' => 'Zadanie nadrzędne',
'name' => 'parent_id', 'name' => 'parent_id',
'id' => 'parent_id', 'id' => 'parent_id',
'value' => $this -> task[ 'parent_id' ], 'value' => $selected_parent_id,
'values' => $parent_tasks 'values' => $parent_tasks
] ); ] );
?> ?>

View File

@@ -265,6 +265,9 @@
<? endforeach;?> <? endforeach;?>
</select> </select>
</div> </div>
<div class="task-subtask-action">
<a href="/tasks/task_edit/project_id=<?= (int)$this -> task['project_id'];?>&client_id=<?= (int)$this -> task['client_id'];?>&parent_id=<?= (int)$this -> task['id'];?>" class="btn btn-success btn-sm task-popup-compact-btn">Dodaj podzadanie</a>
</div>
</div> </div>
<div class="dates box"> <div class="dates box">
<h3>Termin</h3> <h3>Termin</h3>
@@ -278,7 +281,9 @@
<input type="date" class="form-control task-date-end-input" value="<?= htmlspecialchars( (string)$this -> task['date_end'] );?>"> <input type="date" class="form-control task-date-end-input" value="<?= htmlspecialchars( (string)$this -> task['date_end'] );?>">
</div> </div>
</div> </div>
<a href="#" class="btn btn-primary btn-sm task-popup-compact-btn js-save-task-dates" task_id="<?= (int)$this -> task['id'];?>" style="margin-top: 10px;">Zapisz terminy</a> <div class="task-date-actions">
<a href="#" class="btn btn-primary btn-sm task-popup-compact-btn js-save-task-dates" task_id="<?= (int)$this -> task['id'];?>">Zapisz terminy</a>
</div>
</div> </div>
<div class="client box"> <div class="client box">
<h3>Klient</h3> <h3>Klient</h3>
@@ -595,10 +600,33 @@
min-height: 120px; min-height: 120px;
resize: vertical; resize: vertical;
} }
.task_popup .task_details .content .right .project .task-subtask-action {
margin-top: 10px;
}
.task_popup .task_details .content .right .project .task-subtask-action a {
display: flex;
width: 100%;
height: 30px;
align-items: center;
justify-content: center;
line-height: 1;
}
.task_popup .task_details .content .right .dates .task-date-edit-grid { .task_popup .task_details .content .right .dates .task-date-edit-grid {
display: grid; display: grid;
gap: 8px; gap: 8px;
grid-template-columns: 1fr; grid-template-columns: 1fr 1fr;
}
.task_popup .task_details .content .right .dates .task-date-actions {
margin-top: 10px;
}
.task_popup .task_details .content .right .dates .task-date-actions .js-save-task-dates {
display: flex;
width: 100%;
height: 30px;
padding: 0 10px;
align-items: center;
justify-content: center;
line-height: 1;
} }
.task_popup .task_details .content .right .dates .task-date-field label { .task_popup .task_details .content .right .dates .task-date-field label {
display: block; display: block;
@@ -607,6 +635,11 @@
margin-bottom: 4px; margin-bottom: 4px;
color: #4e5e6a; color: #4e5e6a;
} }
@media (max-width: 767px) {
.task_popup .task_details .content .right .dates .task-date-edit-grid {
grid-template-columns: 1fr;
}
}
.task_popup .task_details .task-popup-compact-btn { .task_popup .task_details .task-popup-compact-btn {
height: 30px; height: 30px;
padding: 0 10px; padding: 0 10px;