From c9987f5fc2a2db98c8b0223bc425d5d98b0591ba Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Mon, 22 Jun 2026 11:26:17 +0100 Subject: [PATCH] fixed ticket display --- .../views/livewire/ticket-show.blade.php | 925 +++++++++++++++++- 1 file changed, 885 insertions(+), 40 deletions(-) diff --git a/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php b/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php index 822dd2a9..c395ec8d 100644 --- a/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php +++ b/Modules/Helpdesk/Resources/views/livewire/ticket-show.blade.php @@ -1,48 +1,893 @@ -{{-- FULL FILE REPLACEMENT NOTE +@php + use Illuminate\Support\Str; -Use your reverted ticket-show.blade.php and replace only the SLA metrics count card block with the block below. + $currentUser = auth()->user(); + $currentCompany = $currentUser?->company; + $canSeeInternalNotes = (bool) ($currentCompany?->is_system_company ?? false) + || Str::lower((string) ($currentCompany?->slug ?? '')) === 'mpba-limited' + || Str::contains(Str::lower((string) ($currentCompany?->name ?? '')), 'mpba'); + $visibleCommentCount = $ticket->comments->count(); +@endphp -Reason: -- The component replacement sets $ticket->public_replies_count and $ticket->time_spent_minutes safely. -- This Blade block does not introduce new undefined variables. -- Public replies and minutes logged are colour coded. -- Soft-deleted/tombstoned comments are excluded in TicketShow.php before the counts are assigned. +
+
+
+
+
+
+ {{ $ticket->reference }} + {{ $ticket->status->name }} + {{ $ticket->priority->name }} +
-Replace this original block: +

{{ $ticket->subject }}

-
-
-
{{ $ticket->public_replies_count }}
-
Public replies
+

+ Raised by {{ $ticket->owner?->name ?? 'Unknown user' }} · Assigned to {{ $ticket->agent?->name ?? 'Unassigned' }} +

+
+ +
+ + + Back + + + @can('update', $ticket) + + + Edit + + @endcan +
+
+
-
-
{{ $ticket->time_spent_minutes }}
-
Minutes logged
-
-
- -With this: ---}} - -
-
-
- {{ $ticket->public_replies_count }} -
- -
- Public replies -
-
- -
-
- {{ $ticket->time_spent_minutes }} -
- -
- Minutes logged -
+
+
+
+
+
+
+ + + + +
+

Ticket document

+

Request details

+

Original request content recorded against this helpdesk ticket.

+
+
+ + + + {{ $ticket->reference }} + +
+
+ +
+
+
+ {!! $ticket->body !!} +
+
+
+
+ +
+ +
+ + + + +
+

Attachments

+

Supporting files

+
+
+ + + + {{ $ticket->attachments->count() }} file{{ $ticket->attachments->count() === 1 ? '' : 's' }} + + +
+ +
+ @can('update', $ticket) +
+ @csrf + +
+
+

Add files

+

No files selected

+
+ +
+ + + +
+
+ + @error('attachments') +

{{ $message }}

+ @enderror + + @error('attachments.*') +

{{ $message }}

+ @enderror +
+ @endcan + + @if ($ticket->attachments->isEmpty()) +
+ No supporting files have been attached yet. +
+ @else + + @endif +
+
+ +
+
+ +
+ + + + +
+

Conversation

+

Document responses

+
+
+ + + {{ $visibleCommentCount }} item{{ $visibleCommentCount === 1 ? '' : 's' }} + + +
+ +
+
+ + + +
+ + + +
+
+ + @if ($ticket->comments->isNotEmpty()) + @include('helpdesk::partials.comment-thread', ['comments' => $ticket->comments, 'level' => 0, 'ticket' => $ticket, 'canSeeInternalNotes' => $canSeeInternalNotes]) + @else +
+ No responses yet. +
+ @endif +
+
+
+ +
+ @csrf + +
+
+ + + + +
+

Response document

+

Add reply

+

Create a response, internal MPBA note or threaded document reply.

+
+
+
+ +
+ @if (session('ticket-comment-added')) +
+ {{ session('ticket-comment-added') }} +
+ @endif + + @if ($errors->any()) +
+ {{ $errors->first() }} +
+ @endif + + @php + $cannedResponseBodies = $cannedResponses->mapWithKeys(function ($response) use ($ticket, $currentUser) { + $body = (string) $response->body; + + $body = strtr($body, [ + '{{ ticket.reference }}' => e((string) ($ticket->reference ?? '')), + '{{ ticket.subject }}' => e((string) ($ticket->subject ?? '')), + '{{ ticket.status }}' => e((string) ($ticket->status?->name ?? '')), + '{{ ticket.priority }}' => e((string) ($ticket->priority?->name ?? '')), + '{{ ticket.category }}' => e((string) ($ticket->category?->name ?? '')), + '{{ ticket.project }}' => e((string) ($ticket->project?->title ?? '')), + '{{ ticket.team }}' => e((string) ($ticket->team?->name ?? '')), + '{{ requester.name }}' => e((string) ($ticket->owner?->name ?? $ticket->user?->name ?? '')), + '{{ agent.name }}' => e((string) ($ticket->agent?->name ?? $currentUser?->name ?? '')), + '{{ actor.name }}' => e((string) ($currentUser?->name ?? '')), + '{{ ticket.url }}' => e(route('helpdesk.tickets.show', ['ticket' => $ticket->getKey()])), + ]); + + $body = html_entity_decode($body, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + $body = preg_replace('/<\s*(script|style)[^>]*>.*?<\s*\/\s*\1\s*>/is', '', $body) ?: ''; + $body = preg_replace('/\s+on[a-z]+\s*=\s*("[^"]*"|\'[^\']*\'|[^\s>]+)/i', '', $body) ?: ''; + $body = preg_replace('/javascript\s*:/i', '', $body) ?: ''; + $body = strip_tags($body, '


+ + + +
+ +