@php use Illuminate\Support\Facades\Schema; use Modules\Helpdesk\Models\TicketTimeLog; $ticketTimeLogTable = (new TicketTimeLog())->getTable(); $hasEndedAtColumn = Schema::hasColumn($ticketTimeLogTable, 'ended_at'); $hasStoppedAtColumn = Schema::hasColumn($ticketTimeLogTable, 'stopped_at'); $hasFinishedAtColumn = Schema::hasColumn($ticketTimeLogTable, 'finished_at'); $hasUserIdColumn = Schema::hasColumn($ticketTimeLogTable, 'user_id'); $runningTimerQuery = TicketTimeLog::query() ->where('ticket_id', $ticket->getKey()) ->whereNotNull('started_at') ->orderByDesc('started_at'); if ($hasUserIdColumn) { $runningTimerQuery->where('user_id', auth()->id()); } if ($hasEndedAtColumn) { $runningTimerQuery->whereNull('ended_at'); } if ($hasStoppedAtColumn) { $runningTimerQuery->whereNull('stopped_at'); } if ($hasFinishedAtColumn) { $runningTimerQuery->whereNull('finished_at'); } $runningTimer = ($hasEndedAtColumn || $hasStoppedAtColumn || $hasFinishedAtColumn) ? $runningTimerQuery->first() : null; $runningTimerStartedAt = $runningTimer?->started_at; $runningTimerElapsedSeconds = $runningTimerStartedAt ? max(0, now()->diffInSeconds($runningTimerStartedAt)) : 0; $runningTimerElapsedDisplay = gmdate('H:i:s', $runningTimerElapsedSeconds); $hasRunningTimer = $runningTimerStartedAt !== null; @endphp @can('update', $ticket)

Ticket controls

Log time, assignment, status and priority

Running {{ $runningTimerElapsedDisplay }}
@if (session('ticket-action-updated'))
{{ session('ticket-action-updated') }}
@endif @if ($hasRunningTimer)

Timer running

Started {{ $runningTimerStartedAt->format('d M Y H:i:s') }}

{{ $runningTimerElapsedDisplay }}

Elapsed

@endif
@include('helpdesk::partials.ticket-time-timer', [ 'ticket' => $ticket, ])
@csrf
@error('minutes')

{{ $message }}

@enderror @error('description')

{{ $message }}

@enderror
@csrf @error('agent_id')

{{ $message }}

@enderror
@csrf @error('status_id')

{{ $message }}

@enderror
@csrf @error('priority_id')

{{ $message }}

@enderror
@endcan