{{-- resources/views/issue/partials/replies.blade.php --}} {{-- Rendered on initial page load and by the issue.replies JSON endpoint (AJAX send confirmation + background polling). Bubble-chat markup, styled to match the reference messenger UI. --}} @foreach ($replies as $reply) @php $isMe = $reply->reply_by == Auth::id(); $currentDate = \Carbon\Carbon::parse($reply->created_at)->format('Y-m-d'); $prevDate = $loop->index > 0 ? \Carbon\Carbon::parse($replies[$loop->index - 1]->created_at)->format('Y-m-d') : null; $showDate = $currentDate !== $prevDate; $dateObj = \Carbon\Carbon::parse($reply->created_at); $dateLabel = $dateObj->isToday() ? 'Today' : ($dateObj->isYesterday() ? 'Yesterday' : $dateObj->format('l, j F')); $replyText = e($reply->reply); $prefix = ''; $prefixColor = ''; if (str_starts_with($replyText, 'Opening Remark:')) { $prefix = 'Opening Remark:'; $prefixColor = '#22c55e'; } elseif (str_starts_with($replyText, 'Closing Remark:')) { $prefix = 'Closing Remark:'; $prefixColor = '#ef4444'; } $replyTextWithoutPrefix = $prefix ? substr($replyText, strlen($prefix)) : $replyText; @endphp @if($showDate)
{{ $dateLabel }}
@endif
{{ $reply->user->name ?? 'User' }}
@if(!$isMe) {{ isset($reply->user->name) ? explode(' ', trim($reply->user->name))[0] : 'Unknown user' }} @endif
@if ($prefix) {{ $prefix }} @endif {!! nl2br($replyTextWithoutPrefix) !!}
@if(!empty($reply->attachments) && count(json_decode($reply->attachments, true)) > 0) @endif {{ \Carbon\Carbon::parse($reply->created_at)->format('h:i A') }}
@if($isMe)
@endif
@endforeach