updated UI references in controllers

This commit is contained in:
tp_dhu 2025-05-03 08:52:21 +01:00
parent 165d4eabe5
commit 2d6cd5e48d
15 changed files with 57 additions and 154 deletions

View File

@ -6,6 +6,6 @@ class HomeController extends \BaseController
{ {
public function index($f3) public function index($f3)
{ {
$this->renderView('/ui/views/admin/index.html'); $this->renderView('views/admin/index.html');
} }
} }

View File

@ -12,7 +12,7 @@ class TicketOptionsController extends \BaseController
$model = new \TicketPriority($this->getDB()); $model = new \TicketPriority($this->getDB());
$priorities = $model->findAll(); $priorities = $model->findAll();
$this->renderView('/ui/views/admin/priorities/index.html', [ $this->renderView('views/admin/priorities/index.html', [
'priorities' => $priorities 'priorities' => $priorities
]); ]);
} }
@ -21,7 +21,7 @@ class TicketOptionsController extends \BaseController
{ {
$this->requireLogin(); $this->requireLogin();
$this->requireAdmin(); // Added admin check $this->requireAdmin(); // Added admin check
$this->renderView('/ui/views/admin/priorities/create.html'); $this->renderView('views/admin/priorities/create.html');
} }
public function createPriority() public function createPriority()
@ -51,7 +51,7 @@ class TicketOptionsController extends \BaseController
return; return;
} }
$this->renderView('/ui/views/admin/priorities/edit.html', [ $this->renderView('views/admin/priorities/edit.html', [
'priority' => $priority 'priority' => $priority
]); ]);
} }

View File

@ -25,8 +25,8 @@ class AttachmentController {
$f3->set('ticket_id', $ticket_id); $f3->set('ticket_id', $ticket_id);
$f3->set('attachments', $attachments); $f3->set('attachments', $attachments);
$f3->set('content', '../ui/views/attachment/index.html'); $f3->set('content', 'views/attachment/index.html');
// echo \Template::instance()->render('../ui/templates/layout.html'); // echo \Template::instance()->render('templates/layout.html');
echo \Template::instance()->render($f3->get('content')); echo \Template::instance()->render($f3->get('content'));
} }

View File

@ -10,8 +10,8 @@ class AuthController {
$f3->clear('SESSION.login_error'); $f3->clear('SESSION.login_error');
// this can be in our controller base // this can be in our controller base
$f3->set('content', '../ui/views/login.html'); $f3->set('content', 'views/login.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('error'); $f3->clear('error');
} }

View File

@ -66,7 +66,7 @@ abstract class BaseController
$this->f3->set('content', $viewPath); $this->f3->set('content', $viewPath);
// render tempalte // render tempalte
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
// clear SESSION.error // clear SESSION.error
$this->f3->clear('SESSION.error'); $this->f3->clear('SESSION.error');

View File

@ -86,6 +86,6 @@ class CommentController {
$comments = $results; $comments = $results;
$f3->set('comments', $comments); $f3->set('comments', $comments);
echo \Template::instance()->render('../ui/views/comments/view.html'); echo \Template::instance()->render('views/comments/view.html');
} }
} }

View File

@ -6,6 +6,6 @@ class DashboardController extends BaseController {
$this->requireLogin(); $this->requireLogin();
$this->renderView('/ui/views/dashboard.html'); $this->renderView('views/dashboard.html');
} }
} }

View File

@ -4,7 +4,7 @@ class HomeController extends BaseController {
public function display($f3){ public function display($f3){
$this->renderView('/ui/views/home.html'); $this->renderView('views/home.html');
} }
// ... // ...

View File

@ -39,8 +39,8 @@ class KBController implements CRUD {
// render // render
$f3->set('articles', $articles); $f3->set('articles', $articles);
$f3->set('content', '../ui/views/kb/index.html'); $f3->set('content', 'views/kb/index.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('SESSION.error'); $f3->clear('SESSION.error');
} }
@ -56,8 +56,8 @@ class KBController implements CRUD {
$f3->set('all_tags', $all_tags); $f3->set('all_tags', $all_tags);
// render // render
$f3->set('content', '../ui/views/kb/create.html'); $f3->set('content', 'views/kb/create.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('SESSION.error'); $f3->clear('SESSION.error');
} }
@ -120,8 +120,8 @@ class KBController implements CRUD {
); );
// render // render
$f3->set('content', '../ui/views/kb/view.html'); $f3->set('content', 'views/kb/view.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('SESSION.error'); $f3->clear('SESSION.error');
} }
@ -150,8 +150,8 @@ class KBController implements CRUD {
// render // render
$f3->set('js', 'kb_edit.js'); $f3->set('js', 'kb_edit.js');
$f3->set('content', '../ui/views/kb/edit.html'); $f3->set('content', 'views/kb/edit.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('SESSION.error'); $f3->clear('SESSION.error');
} }

View File

@ -16,8 +16,8 @@
$f3->set('projects', $projects); $f3->set('projects', $projects);
$f3->set('content', '../ui/views/project/index.html'); $f3->set('content', 'views/project/index.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
$f3->clear('SESSION.error'); $f3->clear('SESSION.error');
} }
@ -25,8 +25,8 @@
// create a new project // create a new project
public function createForm($f3){ public function createForm($f3){
$this->check_access($f3); $this->check_access($f3);
$f3->set('content', '../ui/views/project/create.html'); $f3->set('content', 'views/project/create.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
@ -47,16 +47,16 @@
$project = $result[0]; $project = $result[0];
$f3->set('project', $project); $f3->set('project', $project);
$f3->set('content', '../ui/views/project/view.html'); $f3->set('content', 'views/project/view.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
// update project details // update project details
public function editForm($f3){ public function editForm($f3){
$this->check_access($f3); $this->check_access($f3);
$f3->set('content', '../ui/views/project/edit.html'); $f3->set('content', 'views/project/edit.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }

View File

@ -14,15 +14,15 @@ class TagController implements CRUD {
$tags = $db->exec('SELECT * FROM tags ORDER BY name ASC'); $tags = $db->exec('SELECT * FROM tags ORDER BY name ASC');
$f3->set('tags', $tags); $f3->set('tags', $tags);
$f3->set('content', '../ui/views/tag/index.html'); $f3->set('content', 'views/tag/index.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
public function createForm($f3){ public function createForm($f3){
$this->check_access($f3); $this->check_access($f3);
$f3->set('content', '../ui/views/tag/create.html'); $f3->set('content', 'views/tag/create.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
public function create($f3){ public function create($f3){

View File

@ -21,7 +21,7 @@ class TicketController extends BaseController implements CRUD {
} }
// render // render
$this->renderView('../ui/views/ticket/index.html', $this->renderView('views/ticket/index.html',
['tickets' => $tickets] ['tickets' => $tickets]
); );
@ -36,10 +36,12 @@ class TicketController extends BaseController implements CRUD {
$ticket_id = $f3->get('PARAMS.id'); $ticket_id = $f3->get('PARAMS.id');
$ticket_mapper = new Ticket($this->getDB()); $ticket_mapper = new Ticket($this->getDB());
$ticket = $ticket_mapper->findById($ticket_id); $ticket = $ticket_mapper->findById($ticket_id);
$assigned_user = $ticket->getAssignedUser();
// render // render
$this->renderView('../ui/views/ticket/view.html', [ $this->renderView('views/ticket/view.html', [
'ticket' => $ticket, 'ticket' => $ticket,
'assigned_user' => $assigned_user,
'attachments' => $ticket->attachments(), 'attachments' => $ticket->attachments(),
'comments' => $ticket->comments(), 'comments' => $ticket->comments(),
'parent_tickets' => $ticket->getParentTickets(), 'parent_tickets' => $ticket->getParentTickets(),
@ -57,7 +59,7 @@ class TicketController extends BaseController implements CRUD {
$statuses = (new TicketStatus($db))->findAll(); $statuses = (new TicketStatus($db))->findAll();
$this->requireLogin(); $this->requireLogin();
$this->renderView('../ui/views/ticket/create.html',[ $this->renderView('views/ticket/create.html',[
'priorities' => $priorities, 'priorities' => $priorities,
'statuses' => $statuses 'statuses' => $statuses
]); ]);
@ -113,7 +115,7 @@ class TicketController extends BaseController implements CRUD {
$priorities = (new TicketPriority($this->getDB()))->findAll(); $priorities = (new TicketPriority($this->getDB()))->findAll();
$statuses = (new TicketStatus($this->getDB()))->findAll(); $statuses = (new TicketStatus($this->getDB()))->findAll();
$this->renderView('../ui/views/ticket/edit.html',[ $this->renderView('views/ticket/edit.html',[
'ticket' => $ticket, 'ticket' => $ticket,
'ticket_meta' => $ticket->getMeta(), 'ticket_meta' => $ticket->getMeta(),
'priorities' => $priorities, 'priorities' => $priorities,

View File

@ -19,8 +19,8 @@ class UserController implements CRUD {
); );
$f3->set('users', $users); $f3->set('users', $users);
$f3->set('content', '../ui/views/user/index.html'); $f3->set('content', 'views/user/index.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
public function editForm($f3){ public function editForm($f3){
@ -37,8 +37,8 @@ class UserController implements CRUD {
$f3->reroute('/users'); $f3->reroute('/users');
} }
$f3->set('edit_user', $rows[0]); $f3->set('edit_user', $rows[0]);
$f3->set('content', '../ui/views/user/edit.html'); $f3->set('content', 'views/user/edit.html');
echo \Template::instance()->render('../ui/templates/layout.html'); echo \Template::instance()->render('templates/layout.html');
} }
public function update($f3){ public function update($f3){

View File

@ -219,5 +219,20 @@ class Ticket extends \DB\SQL\Mapper {
); );
} }
} }
public function getAssignedUser()
{
if(!$this->assigned_to){
return null;
}
$sql = '
SELECT id, username, display_name
FROM users
WHERE id =?
';
$user = $this->db->exec($sql, [$this->assigned_to]);
return $user[0];
}
} }

114
issues.md
View File

@ -1,114 +0,0 @@
# MVP Issues
This issue list defines the work required to bring the `tp_servicedesk` Fat-Free PHP application to a beta-ready MVP for personal workload/project tracking.
---
## 🧩 Ticketing System
- [ ] Display assigned user in ticket view
- [ ] Add user assignment capability in ticket create/edit forms
- [ ] Implement ticket filtering (by status, assignee, project)
- [ ] Improve UI feedback for ticket soft-delete
- [ ] Ensure metadata, attachments, and comments update properly on edit
- [ ] Add tag support for tickets (UI and DB updates)
- [ ] Implement ticket history for status/priority changes
- [ ] Add comment thread display on ticket edit view
- [ ] Update "new ticket" template to match the edit form
- [ ] Enable linking tickets using markdown shortcodes (e.g. `#ticket-id` autocomplete)
---
## 📂 Project Management
- [ ] Implement `ProjectController::create()` and `update()` logic
- [ ] Add CRUD for:
- [ ] `project_tasks` (task list under project)
- [ ] `project_links` (related links/resources)
- [ ] `project_events` (project timeline/log)
- [ ] Show tickets related to a project in the project view page
---
## 📚 Knowledge Base (KB)
- [ ] Display and edit tags for each article
- [ ] Show article creator and last updated info
- [ ] Add search suggestions or recent articles on main KB page
---
## 👤 User Management
- [ ] Implement full CRUD in `Admin\UserController`
- [ ] Add role selection to user creation/edit forms
- [ ] Restrict sensitive actions (ticket edit/delete) to owner or admin
---
## ⚙️ Admin Panel
- [ ] Complete admin routes and views for ticket status management
- [ ] Add dashboard widgets (open tickets count, recent updates, etc.)
- [ ] Create settings/config view to manage global app options
---
## 📦 UI & UX Polish
- [ ] Show success/error alerts for all user actions
- [ ] Apply consistent Bulma styling to forms, buttons, and messages
- [ ] Add loading indicators or skeletons on longer actions
- [ ] Embed `/public/test.md.php` JS markdown editor into edit/create ticket templates
- [ ] Add smart shortcuts to markdown editor:
- [ ] `#` opens ticket linking modal
- [ ] `@` opens user tagging modal
- [ ] `!a` opens hyperlink creation modal
---
## 🧪 Quality Assurance
- [ ] Create fake/test data seeder
- [ ] Add DB integrity checks for tickets, users, and project FK links
- [ ] Manually test:
- [ ] Login/logout
- [ ] Ticket create/edit/delete
- [ ] KB CRUD
- [ ] Attachment upload/download
- [ ] Audit all routes and controllers for authentication and access checks
---
## 🔍 Search & Indexing
- [ ] Improve full-text search to be smarter than `LIKE %{query}%`
- [ ] Add partial, fuzzy, and prioritised relevance to results (e.g. `title > tags > content`)
---
## 📅 Timeline & Activity Views
- [ ] Create timeline view per ticket using:
- [ ] status/priority history
- [ ] comments
- [ ] attachments and other actions
- [ ] Build global timeline dashboard to see activity across system
- [ ] Implement calendar heatmap (e.g. GitHub-style) for activity tracking
- [ ] Add drilldown support from calendar to view specific actions on each day
- [ ] Add detailed log/summary of:
- [ ] ticket creation/updates
- [ ] project creation/updates
- [ ] assignments
- [ ] comments
- [ ] closures
---
## 🔐 Security & Session
- [ ] Add CSRF protection for all POST forms
- [ ] Enforce permission checks on:
- [ ] Ticket edits
- [ ] Comment deletion
- [ ] Attachment deletion
- [ ] Add password reset flow or admin-reset function
---
## 📈 Post-MVP (Optional Enhancements)
- [ ] Ticket due dates and reminders
- [ ] Kanban or Gantt-style project view
- [ ] REST API endpoints
---