Compare commits

..

No commits in common. "4b45d94ebbf1849931452efa4a19ed0f4a7da73e" and "7872049a1cfd465d7c4c78cde0c05c195ac2f76a" have entirely different histories.

18 changed files with 180 additions and 312 deletions

View File

@ -7,59 +7,23 @@
// list all projects
public function index($f3){
$this->check_access($f3);
$db = $f3->get('DB');
// retrieve projects
$projects = $db->exec('SELECT * FROM projects ORDER BY created_at DESC');
$f3->set('projects', $projects);
$f3->set('content', '../ui/views/project/index.html');
echo \Template::instance()->render('../ui/templates/layout.html');
$f3->clear('SESSION.error');
}
// create a new project
public function createForm($f3){
$this->check_access($f3);
$f3->set('content', '../ui/views/project/create.html');
echo \Template::instance()->render('../ui/templates/layout.html');
}
public function create($f3){
}
// show project details including links, tickets, events, tasks
public function view($f3){
$this->check_access($f3);
$project_id = $f3->get('PARAMS.id');
$db = $f3->get('DB');
$result = $db->exec(
'SELECT * FROM projects WHERE id = ? LIMIT 1', [$project_id]
);
$project = $result[0];
$f3->set('project', $project);
$f3->set('content', '../ui/views/project/view.html');
echo \Template::instance()->render('../ui/templates/layout.html');
}
public function view($f3){}
// update project details
public function editForm($f3){
$this->check_access($f3);
$f3->set('content', '../ui/views/project/edit.html');
echo \Template::instance()->render('../ui/templates/layout.html');
}
public function editForm($f3){}
public function update($f3){}
}

View File

@ -37,7 +37,7 @@ class TicketController implements CRUD {
$this->get_custom_fields($f3, $db, $ticket_id);
// render
// $f3->set('js', 'ticket_view.js');
$f3->set('js', 'ticket_view.js');
$f3->set('content', '../ui/views/ticket/view.html');
echo \Template::instance()->render('../ui/templates/layout.html');
@ -216,7 +216,6 @@ class TicketController implements CRUD {
protected function get_ticket_check_edit_permission($f3){
$db = $f3->get('DB');
$ticket_id = $f3->get('PARAMS.id');
@ -245,25 +244,6 @@ class TicketController implements CRUD {
}
protected function get_ticket($f3, $db, $ticket_id){
// new
$db = $f3->get('DB');
$ticket_id = $f3->get('PARAMS.id');
$ticketModel = new Ticket($db);
$ticket = $ticketModel->findById($ticket_id);
if(!$ticket->dry()){
$f3->set('ticket', $ticket);
$f3->set('attachments', $ticket->attachments());
$f3->set('comments', $ticket->comments());
} else {
$f3->error(404, "Ticket not found!");
}
return;
// old:
$result = $db->exec(
'SELECT t.*, u.username as created_by_name
FROM tickets t

View File

@ -16,7 +16,7 @@ class ParsedownHelper extends \Prefab {
}
// return '<pre>'.print_r($args,1).'</pre>';
return '<pre>'.print_r($args,1).'<pre>';
$content = $args[0];
$content_token = \Template::instance()->token($content);

View File

@ -1,21 +0,0 @@
<?php
class Attachment extends \DB\SQL\Mapper {
function __construct($db)
{
parent::__construct($db, 'attachments');
}
public function findWithUserByTicketId($ticket_id){
return $this->db->exec(
'SELECT a.*, u.username
FROM attachments a
LEFT JOIN users u ON u.id = a.uploaded_by
WHERE a.ticket_id = ?
ORDER BY a.created_at DESC',
[$ticket_id]
);
}
}

View File

@ -1,19 +0,0 @@
<?php
class Comment extends \DB\SQL\Mapper {
function __construct($db)
{
parent::__construct($db, 'ticket_comments');
}
public function findWithUserByTicketId($ticket_id){
return $this->db->exec(
'SELECT c.*, u.username AS author_name
FROM ticket_comments c
LEFT JOIN users u ON c.created_by = u.id
WHERE c.ticket_id = ?
ORDER BY c.created_at DESC',
[$ticket_id]
);
}
}

View File

@ -1,22 +0,0 @@
<?php
class Ticket extends \DB\SQL\Mapper {
function __construct($db){
parent::__construct($db, 'tickets');
}
public function findById($id){
$this->load(['id = ?', $id]);
return $this;
}
public function attachments(){
$attachment = new Attachment($this->db);
return $attachment->findWithUserByTicketId($this->id);
}
public function comments(){
$comment = new Comment($this->db);
return $comment->findWithUserByTicketId($this->id);
}
}

View File

@ -43,7 +43,6 @@ $f3->route('GET /dashboard', function($f3){
}
echo 'Welcome to the dashboard' . $f3->get('SESSION.username');
echo '<a href="/logout">logout</a>';
});
// tickets - CRUD (CREATE, READ, UPDATE, DELETE)

View File

@ -42,9 +42,9 @@
<div id="mainNavbar" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="/dashboard">Dashboard</a>
<a class="navbar-item" href="/kb">Knowledge Base</a>
<a class="navbar-item" href="/projects">Projects</a>
<a class="navbar-item" href="/tickets">Tickets</a>
<a class="navbar-item" href="/kb">Knowledge Base</a>
<a class="navbar-item" href="/tags">Tags</a>
</div>
<div class="navbar-end">

View File

@ -3,7 +3,6 @@
<h2 class="title">Attachments</h2>
<div class="block">
<check if="isset( {{@attachments }})">
<check if="count({{@attachments}}) > 0">
<table class="table is-fullwidth is-narrow is-striped is-hoverable">
<thead>
<tr>
@ -29,10 +28,9 @@
</tbody>
</table>
</check>
</check>
<div class="block">
<h3 class="title">Upload attachment</h3>
<form action="/ticket/{{@PARAMS.id}}/attachments/upload" method="POST" enctype="multipart/form-data">
<form action="/ticket/{{@ticket_id}}/attachments/upload" method="POST" enctype="multipart/form-data">
<div class="field has-addons">
<div class="control has-icons-left"><!-- is-expanded -->
<input class="input" type="file" name="attachment" required>
@ -48,4 +46,3 @@
</div>
</div>
</div>
</div>

View File

@ -1,6 +1,18 @@
<hr>
<div class="box" id="comments">
<h2 class="title">Comments</h2>
<div class="block">
<form action="/ticket/{{@PARAMS.id}}/comment" method="POST">
<div class="field">
<label class="label">Add comment:</label>
<div class="control">
<textarea class="textarea" name="comment" rows="4" cols="50"></textarea>
</div>
</div>
<div class="field">
<button class="button is-primary" type="submit">Submit Comment</button>
</div>
</form>
</div>
<check if="{{ !empty(@comments) }}">
<div class="list">
<repeat group="{{ @comments }}" value="{{ @comment}}">
@ -26,17 +38,4 @@
</repeat>
</div>
</check>
<div class="block">
<form action="/ticket/{{@PARAMS.id}}/comment" method="POST">
<div class="field">
<label class="label">Add comment:</label>
<div class="control">
<textarea class="textarea" name="comment" rows="4" cols="50"></textarea>
</div>
</div>
<div class="field is-clearfix">
<button class="button is-primary is-pulled-right" type="submit">Submit Comment</button>
</div>
</form>
</div>
</div>

View File

@ -41,7 +41,7 @@
<check if="{{@articles}}">
<table class="table is-fullwidth is-bordered">
<thead>
<tr class="has-background-info">
<tr>
<th>id</th><th>title</th><th>created_at</th>
<th></th>
</tr>
@ -50,8 +50,8 @@
<tbody>
<repeat group="{{@articles}}" value="{{@article}}">
<tr>
<td>{{@article.id}}</td>
<td><a href="/kb/{{@article.id}}">{{@article.title}}</a></td>
<td><a href="/kb/{{@article.id}}">{{@article.id}}</a></td>
<td>{{@article.title}}</td>
<td>{{@article.created_at}}</td>
<td>
<a href="/kb/{{@article.id}}/edit"><i class="fa fa-edit"></i></a>

View File

@ -1,6 +1,4 @@
<h1 class="title">{{@article.title}}</h1>
<p><a href="/kb/{{ @article.id}}/edit">edit article</a></p>
<hr>
<div class="content">
<parsedown>{{ @article.content | raw }}</parsedown>

View File

@ -1,3 +0,0 @@
<pre>
TODO: create form.
</pre>

View File

@ -1,3 +0,0 @@
<pre>
TODO: edit form
</pre>

View File

@ -1,9 +1,8 @@
<h3 class="title">Projects</h3>
<a href="/project/create">create new project</a>
<hr>
<table class="table is-fullwidth is-hoverable is-bordered">
<thead>
<tr class="has-background-primary">
<tr class="is-primary">
<th>ID</th>
<th>Title</th>
<th>Requester</th>
@ -14,16 +13,122 @@
</tr>
</thead>
<tbody>
<repeat group="{{ @projects }}" value="{{ @p }}">
<tr>
<td>{{ @p.id }}</td>
<td><a href="/project/{{@p.id}}">{{ @p.title }}</a></td>
<td>{{ @p.requester }}</td>
<td>{{ @p.created_by }}</td>
<td>{{ @p.created_at }}</td>
<td>{{ @p.start_date }}</td>
<td>{{ @p.end_date }}</td>
<td>{id}</td>
<td>{title}</td>
<td>{requester}</td>
<td>{created_by}</td>
<td>{created_at}</td>
<td>{start_date}</td>
<td>{end_date}</td>
</tr>
</repeat>
</tbody>
</table>
<hr>
<h3 class="title">Project {NAME}</h3>
<div class="columns">
<div class="column is-two-thirds">
<h3 class="title subtitle">Overview</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="column">
<div class="block">
<h3 class="title subtitle">Links</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
</div>
<hr>
<div class="columns">
<div class="column">
<h3 class="title subtitle">Tickets</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="column">
<h3 class="title subtitle">Tasks</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="column">
<h3 class="title subtitle">Events</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
<hr>
<div class="columns">
<div class="column">
<h3 class="title">Timeline</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
<parsedown inline="true">
---
## View project
A central place to see everything for this project:
- Overview: (title, description, links, start/end dates).
- related tickets (with status and priorities)
- events
- tasks
- timeline combining events, tickets, milestone dates
## Example Workflow
- create a project - `team manager overview`
-- attach relevant links
- add tickets - each new request or issue can be a ticket referencing this project
- add events - quick notes about management meetings, or verbal discussions that don't need ticket overhead
-- meeting on 01 jan to discuss layout
-- teams message on 28 jan clarifying data requirements
- project tasks - for smaller to do items that don't warrant a full ticket
-- identify location of required data, create initial pq connections, build a mockup layout
## Reporting Timelines
- timeline view - merge ticket data with project_events sorted by date - chronological Overview
- status summaries - how many tickets open, on hold, completed
- progress tracking - sumarries or gantt style charts
</parsedown>

View File

@ -1,102 +0,0 @@
<h3 class="title">{{ @project.title }}</h3>
<p><a href="/project/{{ @project.id}}/edit">edit project</a></p>
<hr>
<div class="columns">
<div class="column is-two-thirds">
<h3 class="title subtitle">Overview</h3>
<div class="box">
<parsedown>{{ @project.description }}</parsedown>
</div>
</div>
<div class="column">
<div class="block">
<h3 class="title subtitle">Links</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
</div>
<hr>
<div class="columns">
<div class="column">
<h3 class="title subtitle">Tickets</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="column">
<h3 class="title subtitle">Tasks</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="column">
<h3 class="title subtitle">Events</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
<hr>
<div class="columns">
<div class="column">
<h3 class="title">Timeline</h3>
<div class="skeleton-lines">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
<parsedown inline="true">
---
## View project
A central place to see everything for this project:
- Overview: (title, description, links, start/end dates).
- related tickets (with status and priorities)
- events
- tasks
- timeline combining events, tickets, milestone dates
## Example Workflow
- create a project - `team manager overview`
-- attach relevant links
- add tickets - each new request or issue can be a ticket referencing this project
- add events - quick notes about management meetings, or verbal discussions that don't need ticket overhead
-- meeting on 01 jan to discuss layout
-- teams message on 28 jan clarifying data requirements
- project tasks - for smaller to do items that don't warrant a full ticket
-- identify location of required data, create initial pq connections, build a mockup layout
## Reporting Timelines
- timeline view - merge ticket data with project_events sorted by date - chronological Overview
- status summaries - how many tickets open, on hold, completed
- progress tracking - sumarries or gantt style charts
</parsedown>

View File

@ -11,7 +11,7 @@
<table class="table is-fullwidth is-bordered">
<thead>
<tr class="has-background-warning">
<tr>
<th>id</th><th>title</th>
<th>status</th><th>priority</th><th>created_at</th>
<th></th>
@ -21,8 +21,8 @@
<tbody>
<repeat group="{{@tickets}}" value="{{@ticket}}">
<tr>
<td>{{@ticket.id}}</td>
<td><a href="/ticket/{{@ticket.id}}">{{@ticket.title}}</a></td>
<td><a href="/ticket/{{@ticket.id}}">{{@ticket.id}}</a></td>
<td>{{@ticket.title}}</td>
<td>{{@ticket.status}}</td>
<td>{{@ticket.priority}}</td>
<td>{{@ticket.created_at}}</td>

View File

@ -76,13 +76,9 @@
<hr>
<include href="../ui/views/attachment/index.html">
<include href="../ui/views/comments/view.html">
<!--
<div class="block" id="attachments"></div>
<div class="block" id="comments"></div>
-->
</div>