Updated the ticket creation form to assign tickets to queues
This commit is contained in:
parent
80a12a86ef
commit
acbe69e9c7
@ -6,6 +6,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
|||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Slim\Routing\RouteContext;
|
use Slim\Routing\RouteContext;
|
||||||
use Slim\Views\Twig;
|
use Slim\Views\Twig;
|
||||||
|
use BitGoblin\Goliath\Models\Queue;
|
||||||
use BitGoblin\Goliath\Models\Ticket;
|
use BitGoblin\Goliath\Models\Ticket;
|
||||||
|
|
||||||
class TicketController extends Controller {
|
class TicketController extends Controller {
|
||||||
@ -20,8 +21,12 @@ class TicketController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCreate(Request $request, Response $response): Response {
|
public function getCreate(Request $request, Response $response): Response {
|
||||||
|
$queues = Queue::all();
|
||||||
|
|
||||||
$view = Twig::fromRequest($request);
|
$view = Twig::fromRequest($request);
|
||||||
return $view->render($response, 'ticket/create.twig');
|
return $view->render($response, 'ticket/create.twig', [
|
||||||
|
'queues' => $queues,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postCreate(Request $request, Response $response): Response {
|
public function postCreate(Request $request, Response $response): Response {
|
||||||
@ -31,6 +36,7 @@ class TicketController extends Controller {
|
|||||||
$ticket->title = $params['ticket_title'];
|
$ticket->title = $params['ticket_title'];
|
||||||
$ticket->body = $params['ticket_body'];
|
$ticket->body = $params['ticket_body'];
|
||||||
$ticket->severity = $params['ticket_severity'];
|
$ticket->severity = $params['ticket_severity'];
|
||||||
|
$ticket->queue_id = $params['ticket_queue'];
|
||||||
$ticket->due_at = $params['ticket_due'];
|
$ticket->due_at = $params['ticket_due'];
|
||||||
|
|
||||||
$ticket->save();
|
$ticket->save();
|
||||||
|
@ -17,11 +17,19 @@
|
|||||||
<label for="ticket_title">Title</label>
|
<label for="ticket_title">Title</label>
|
||||||
<input id="ticket_title" class="u-full-width" type="text" placeholder="My new ticket" name="ticket_title">
|
<input id="ticket_title" class="u-full-width" type="text" placeholder="My new ticket" name="ticket_title">
|
||||||
</div>
|
</div>
|
||||||
<div class="columns three">
|
<div class="two columns">
|
||||||
|
<label for="ticket_queue">Queue</label>
|
||||||
|
<select name="ticket_queue" id="ticket_queue" class="u-full-width">
|
||||||
|
{% for q in queues %}
|
||||||
|
<option value="{{ q.id }}">{{ q.title }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="two columns">
|
||||||
<label for="ticket_due">Due at</label>
|
<label for="ticket_due">Due at</label>
|
||||||
<input id="ticket_due" class="u-full-width" type="datetime-local" name="ticket_due">
|
<input id="ticket_due" class="u-full-width" type="datetime-local" name="ticket_due">
|
||||||
</div>
|
</div>
|
||||||
<div class="three columns">
|
<div class="two columns">
|
||||||
<label for="ticket_severity">Severity level</label>
|
<label for="ticket_severity">Severity level</label>
|
||||||
<select id="ticket_severity" class="u-full-width" name="ticket_severity">
|
<select id="ticket_severity" class="u-full-width" name="ticket_severity">
|
||||||
<option value="low">Low</option>
|
<option value="low">Low</option>
|
||||||
|
Loading…
Reference in New Issue
Block a user