91 lines
6.0 KiB
PHP
91 lines
6.0 KiB
PHP
<x-filament-panels::page>
|
|
<div class="md:grid grid-cols-4 flex flex-col gap-4" wire:poll.5s>
|
|
<div class="md:col-span-3">
|
|
<div class="flex flex-col gap-4 max-h-[60vh] overflow-y-auto pr-4">
|
|
@foreach ($this->record->messages()->with('user')->get() as $index => $message)
|
|
<div
|
|
class="bg-background-secondary hover:bg-background-secondary/80 border border-neutral p-4 rounded-lg w-full max-w-[80%] {{ $message->user_id === $this->record->user_id ? 'ml-auto' : 'mr-auto' }}"
|
|
@if ($loop->last) x-data x-init="$el.scrollIntoView()" @endif>
|
|
<div class="flex justify-between">
|
|
<div>
|
|
<a class="text-lg font-semibold hover:underline"
|
|
href="{{ App\Admin\Resources\UserResource::getUrl('edit', ['record' => $message->user]) }}">
|
|
{{ $message->user->name }}
|
|
</a>
|
|
</div>
|
|
<div>
|
|
@can('delete', $message)
|
|
<button wire:click="deleteMessage({{ $message->id }})"
|
|
class="dark:text-danger-300 text-danger-600 p-0">
|
|
Delete
|
|
</button>
|
|
@endcan
|
|
</div>
|
|
</div>
|
|
<p class="text-sm text-gray-500">{{ $message->created_at->diffForHumans() }}</p>
|
|
<div class="mt-2 prose dark:prose-invert" style="word-break: break-all;">{!! Str::markdown(e($message->message), [
|
|
'allow_unsafe_links' => false,
|
|
'renderer' => [
|
|
'soft_break' => "<br>"
|
|
]
|
|
]) !!}</div>
|
|
|
|
{{-- Display Attachments --}}
|
|
@if($message->attachments && count($message->attachments) > 0)
|
|
<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">
|
|
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-3 flex items-center gap-2">
|
|
<x-heroicon-o-paper-clip class="w-4 h-4" />
|
|
Attachments ({{ count($message->attachments) }})
|
|
</p>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
|
@foreach($message->attachments as $attachment)
|
|
<div class="flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700">
|
|
{{-- Thumbnail --}}
|
|
<div class="flex-shrink-0 w-16 h-16 rounded-md overflow-hidden bg-gray-100 dark:bg-gray-700">
|
|
<img src="{{ $attachment['url'] }}" alt="{{ $attachment['name'] }}" class="w-full h-full object-cover">
|
|
</div>
|
|
|
|
{{-- File Info & Actions --}}
|
|
<div class="flex-1 min-w-0">
|
|
<p class="text-sm font-medium text-gray-900 dark:text-gray-100 truncate" title="{{ $attachment['name'] }}">
|
|
{{ $attachment['name'] }}
|
|
</p>
|
|
<div class="mt-2 flex items-center gap-2">
|
|
<a href="{{ $attachment['url'] }}" target="_blank"
|
|
class="inline-flex items-center gap-1 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300">
|
|
<x-heroicon-o-eye class="w-4 h-4" />
|
|
View
|
|
</a>
|
|
<span class="text-gray-300 dark:text-gray-600">|</span>
|
|
<a href="{{ $attachment['url'] }}" download="{{ $attachment['name'] }}"
|
|
class="inline-flex items-center gap-1 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300">
|
|
<x-heroicon-o-arrow-down-tray class="w-4 h-4" />
|
|
Download
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
<!-- Reply Form -->
|
|
<div class="mt-4">
|
|
<x-filament-panels::form id="form"
|
|
:wire:key="$this->getId() . '.forms.' . $this->getFormStatePath()" wire:submit="save">
|
|
|
|
{{ $this->form }}
|
|
|
|
<x-filament-panels::form.actions :actions="$this->getCachedFormActions()" :full-width="$this->hasFullWidthFormActions()" />
|
|
</x-filament-panels::form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="md:order-last order-first w-full col-span-3 sm:col-auto">{{ $this->infolist }}</div>
|
|
|
|
</div>
|
|
</x-filament-panels::page>
|