Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions app/app/Http/Controllers/Admin/SupportTicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\PortNumber;
use App\Http\Requests\Admin\SupportTicketRequest;
use App\Helpers\MainHelper;
use App\Helpers\EmailHelper;
use Auth;
use Datatables;
use DB;
Expand Down Expand Up @@ -123,13 +124,24 @@ public function addUpdate(Request $request, SupportTicket $supportticket)
{
$user = Auth::user();
$data = $request->all();
SupportTicketUpdate::create([
$update = SupportTicketUpdate::create([
'comment' => $data['comment'],
'ticket_id' => $supportticket->id,
'user_id' => $user->id,
'direction' => 'STAFF'
]);

$subject = "New support ticket updated";
$emailData = [
'user' => $user,
'ticket' => $supportticket,
'update' => $update,
];

$workspace = Workspace::find($supportticket->workspace_id);
$workspaceCreator = User::find($workspace->creator_id);
EmailHelper::sendEmail($subject, $workspaceCreator->email, 'support_ticket_updated', $emailData);

return response();
}

Expand All @@ -140,16 +152,16 @@ public function addUpdate(Request $request, SupportTicket $supportticket)
*/
public function data(Request $request)
{
$tickets = SupportTicket::select(array('support_tickets.id', 'support_tickets.workspace_id', 'support_tickets.subject', 'support_tickets.priority', 'support_tickets.created_at', 'support_tickets.category_id', 'support_tickets_categories.name'));
$tickets = $tickets->join('support_tickets_categories', 'support_tickets_categories.id', '=', 'support_tickets.category_id');
$tickets->orderBy('created_at', 'DESC');
$tickets = SupportTicket::select(array('support_tickets.id', 'support_tickets.workspace_id', 'support_tickets.subject', 'support_tickets.priority', 'support_tickets_categories.name', 'support_tickets.created_at'));
$tickets = $tickets->leftJoin('support_tickets_categories', 'support_tickets_categories.id', '=', 'support_tickets.category_id');
$tickets->orderBy('support_tickets.created_at', 'DESC');
$workspaceId = $request->get('workspace_id');
if (!empty($workspaceId)) {
$tickets->where('workspace_id', $workspaceId);
$tickets->where('support_tickets.workspace_id', $workspaceId);
}
$ticketId = $request->get('id');
if (!empty($ticketId)) {
$tickets->where('id', $ticketId);
$tickets->where('support_tickets.id', $ticketId);
}

return Datatables::of($tickets)
Expand Down
1 change: 1 addition & 0 deletions app/resources/lang/en/admin/tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'workspace_id' => 'Workspace ID',
'status' => 'Status',
'category_id' => 'Category',
'category' => 'Category',
'assigned_to_id' => 'Assigned to',
'comment' => 'Comment'
];
1 change: 1 addition & 0 deletions app/resources/views/admin/supportticket/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<th>{!! trans("admin/tickets.workspace_id") !!}</th>
<th>{!! trans("admin/tickets.subject") !!}</th>
<th>{!! trans("admin/tickets.priority") !!}</th>
<th>{!! trans("admin/tickets.category") !!}</th>
<th>{!! trans("admin/admin.created_at") !!}</th>
<th>{!! trans("admin/admin.action") !!}</th>
</tr>
Expand Down
13 changes: 12 additions & 1 deletion app/resources/views/emails/support_ticket_updated.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
<td class="feedback-card" bgcolor="#f7f9fc" style="padding: 30px 32px; border-radius: 6px; border: 1px solid #e7edf5;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
<tbody>

<tr>
<td style="font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20px; color: #667085; padding-bottom: 4px;">
Updated by
</td>
</tr>
<tr>
<td style="font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 15px; line-height: 24px; color: #344054; padding-bottom: 18px;">
{{ $user['email'] }}
</td>
</tr>
<tr>
<td style="font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 20px; color: #667085; padding-bottom: 4px;">
Subject
Expand All @@ -38,7 +49,7 @@
</tr>
<tr>
<td style="font-family: Roboto, Arial, Helvetica, sans-serif; font-size: 15px; line-height: 24px; color: #344054; word-break: break-word;">
{!! nl2br(e($update->comments)) !!}
{!! nl2br(e($update->comment)) !!}
</td>
</tr>
</tbody>
Expand Down
Loading