|
|
@@ -0,0 +1,203 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App;
|
|
|
+
|
|
|
+use App\Enums\TicketStatuses;
|
|
|
+use App\Helpers\HtmlHelper;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @var Ticket $ticket
|
|
|
+ */
|
|
|
+
|
|
|
+$core = Core::getInstance();
|
|
|
+$user = $core->getUser();
|
|
|
+
|
|
|
+$comments = $ticket->getComments();
|
|
|
+$ticket_details = array_shift($comments);
|
|
|
+$attachments = $ticket_details->getAttachments();
|
|
|
+$creator = $ticket->getCreator();
|
|
|
+
|
|
|
+$render_data_row = static function(string $title, string $html): void {
|
|
|
+ ?>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-6">
|
|
|
+ <strong><?=htmlspecialchars($title)?></strong>
|
|
|
+ </div>
|
|
|
+ <div class="col-6">
|
|
|
+ <?=$html?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+};
|
|
|
+
|
|
|
+?>
|
|
|
+<div class="card mb-3">
|
|
|
+ <div class="card-header">
|
|
|
+ <?=htmlspecialchars(__("Ticket #%d", $ticket->id))?>
|
|
|
+ <span class="float-end badge bg-primary">
|
|
|
+ <?=htmlspecialchars($ticket->getDisplayStatus())?>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="card-body">
|
|
|
+ <h5>
|
|
|
+ <?=htmlspecialchars($ticket->subject)?>
|
|
|
+ </h5>
|
|
|
+ <div>
|
|
|
+ <i class="fa fa-fw fa-user-circle"></i>
|
|
|
+ <?=htmlspecialchars($creator->getDisplayName())?> (<?=htmlspecialchars($creator->email)?>)
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <i class="fa fa-fw fa-map-marker"></i>
|
|
|
+ <?=htmlspecialchars($ticket->getLocation()->name)?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="card-body border-top">
|
|
|
+ <h5><?=htmlspecialchars(__("Details"))?></h5>
|
|
|
+ <?=$ticket_details->getHtml()?>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ if($attachments) {
|
|
|
+ ?>
|
|
|
+ <div class="card-body border-top">
|
|
|
+ <h5><?=htmlspecialchars(__("Attachments"))?></h5>
|
|
|
+ <?php
|
|
|
+ foreach($attachments as $attachment) {
|
|
|
+ $attachment->renderButton();
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ <div class="card-body border-top">
|
|
|
+ <h5><?=htmlspecialchars(__("Other Details"))?></h5>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-xl">
|
|
|
+ <?php
|
|
|
+ $render_data_row(__("Assigned:"), htmlspecialchars($ticket->getDisplayAssignedTo()));
|
|
|
+ $render_data_row(__("Priority:"), $ticket->getPriorityBadgeHtml());
|
|
|
+ $render_data_row(__("Contact Name:"), htmlspecialchars($ticket->contact_name));
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="col-xl">
|
|
|
+ <?php
|
|
|
+ $render_data_row(__("Updated:"), $user->formatDateTime($ticket->getDateTimeUpdated()));
|
|
|
+ $render_data_row(__("Created:"), $user->formatDateTime($ticket->getDateTimeCreated()));
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<div class="card mb-3">
|
|
|
+ <div class="card-header">
|
|
|
+ <?=htmlspecialchars(__("Add Comment"))?>
|
|
|
+ </div>
|
|
|
+ <div class="card-body">
|
|
|
+ <form method="post" enctype="multipart/form-data">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-lg">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="form-label" for="content"><?=htmlspecialchars(__("Comment"))?></label>
|
|
|
+ <textarea class="form-control" name="content" id="content" rows="4" placeholder="<?=htmlspecialchars(__("Type comment"))?>" required></textarea>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <div class="form-check form-switch">
|
|
|
+ <input class="form-check-input" name="internal" id="internal" type="checkbox" value="1" />
|
|
|
+ <label class="form-check-label" for="internal">
|
|
|
+ <?=htmlspecialchars(__("Internal Comment"))?>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-lg">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="form-label" for="status"><?=htmlspecialchars(__("Status"))?></label>
|
|
|
+ <select name="status" id="status" class="form-control">
|
|
|
+ <?php
|
|
|
+ HtmlHelper::renderOptions(TicketStatuses::options(), $ticket->status);
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="form-label" for="attachments"><?=htmlspecialchars(__("Attachments"))?></label>
|
|
|
+ <input class="form-control" type="file" id="attachments" name="attachments[]" multiple />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <button type="submit" class="btn btn-primary" name="submit" value="1">
|
|
|
+ <?=htmlspecialchars(__("Update Ticket"))?>
|
|
|
+ </button>
|
|
|
+
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+
|
|
|
+<h3>
|
|
|
+ <?=htmlspecialchars(__("All Comments"))?>
|
|
|
+</h3>
|
|
|
+
|
|
|
+<?php
|
|
|
+if(empty($comments)) {
|
|
|
+ ?>
|
|
|
+ <div class="alert alert-info">
|
|
|
+ <i class="fa fa-fw fa-info-circle"></i>
|
|
|
+ <?=htmlspecialchars(__("No comments have been added to this ticket."))?>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+}
|
|
|
+else {
|
|
|
+ foreach(array_reverse($comments) as $comment) {
|
|
|
+ $comment_user = $comment->getUser();
|
|
|
+ $attachments = $comment->getAttachments();
|
|
|
+ ?>
|
|
|
+ <div class="card card-body mb-3">
|
|
|
+ <div class="d-flex">
|
|
|
+ <div class="flex-shrink-0">
|
|
|
+ <img src="<?=htmlspecialchars($comment_user->getAvatarUrl())?>" alt="<?=htmlspecialchars($comment_user->getDisplayName())?>" />
|
|
|
+ </div>
|
|
|
+ <div class="flex-grow-1 ms-3">
|
|
|
+ <div class="float-end">
|
|
|
+ <?php
|
|
|
+ if($comment->internal) {
|
|
|
+ ?>
|
|
|
+ <span class="badge bg-primary">
|
|
|
+ <?=htmlspecialchars(__("Internal Comment"))?>
|
|
|
+ </span>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <i class="fa fa-fw fa-user-circle"></i>
|
|
|
+ <?=htmlspecialchars($comment_user->getDisplayName())?> (<?=htmlspecialchars($comment_user->email)?>)
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <i class="fa fa-fw fa-clock"></i>
|
|
|
+ <?=htmlspecialchars($comment->getDisplayDateTimeCreated())?>
|
|
|
+ </div>
|
|
|
+ <hr />
|
|
|
+ <?=$comment->getHtml()?>
|
|
|
+
|
|
|
+ <?php
|
|
|
+ if($attachments) {
|
|
|
+ ?>
|
|
|
+ <hr />
|
|
|
+ <h5><?=htmlspecialchars(__("Attachments"))?></h5>
|
|
|
+ <?php
|
|
|
+ foreach($attachments as $attachment) {
|
|
|
+ $attachment->renderButton();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+}
|