@php /** @var \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Collection $messages */ $messages = $messages ?? collect(); $users = $users ?? collect(); $responsibleUserIds = array_map('intval', $responsibleUserIds ?? []); $contextKey = $contextKey ?? 'chat'; $title = $title ?? 'Чат'; $submitLabel = $submitLabel ?? 'Отправить'; $canSendNotifications = hasRole('admin,manager'); $notificationValue = old('notification_type', \App\Models\ChatMessage::NOTIFICATION_NONE); $selectedTargetUserIds = collect(old('target_user_ids', [])) ->map(static fn ($id) => (int) $id) ->filter() ->unique() ->values() ->all(); @endphp

{{ $title }}
@forelse($messages as $message)
{{ $message->user?->name ?? 'Пользователь' }} @if($message->notification_type === \App\Models\ChatMessage::NOTIFICATION_USER && $message->targetUser) для {{ $message->targetUser->name }} @elseif($message->notification_type === \App\Models\ChatMessage::NOTIFICATION_RESPONSIBLES) Уведомления: админы/менеджер/бригадир @elseif($message->notification_type === \App\Models\ChatMessage::NOTIFICATION_ALL) Уведомления: выбранные получатели @endif
{{ $message->created_at?->format('d.m.Y H:i') }}
@if(!empty($message->message))
{{ $message->message }}
@endif @if($message->files->isNotEmpty())
@foreach($message->files as $file) @if(\Illuminate\Support\Str::startsWith((string) $file->mime_type, 'image/')) {{ $file->original_name }} @else {{ $file->original_name }} @endif @endforeach
@endif
@empty
Сообщений пока нет.
@endforelse
@csrf
@if(!$canSendNotifications) @endif
Получатели не выбраны
@foreach($selectedTargetUserIds as $selectedTargetUserId) @endforeach
@if($canSendNotifications) @endif
@once @push('scripts') @endpush @endonce