@extends('layouts.app') @section('page-title', __('Bot Batch Details')) @section('content')
Batch Details: {{ $batch->batch_id }} @if($isRatingBatch) Rating Batch @endif
Back

Sent By: {{ $batch->user ? $batch->user->first_name . ' ' . $batch->user->last_name : 'N/A' }}

Created: {{ $batch->created_at->format('Y-m-d H:i:s') }}

Updated: {{ $batch->updated_at->format('Y-m-d H:i:s') }}

Status: {{ ucfirst($batch->status) }}

@if($isRatingBatch && isset($batch->filters['rating_config']))

Rating Type: {{ ucfirst($batch->filters['rating_config']['rating_type'] ?? 'N/A') }}

Allow Comments: {{ ($batch->filters['rating_config']['allow_comment'] ?? false) ? 'Yes' : 'No' }}

Allow Skip: {{ ($batch->filters['rating_config']['allow_skip'] ?? false) ? 'Yes' : 'No' }}

@endif
@if($isRatingBatch) @php $ratingType = $batch->filters['rating_config']['rating_type'] ?? 'thumbs'; @endphp @if($ratingType === 'scale')
Scale Rating Distribution (1-5)
@else
Thumbs Rating Distribution
@endif @else
Delivery Progress
@endif

{{ $batch->messages->where('status', 0)->count() }}

Queued

{{ $batch->sent_count }}

Sent by Bot

{{ $batch->messages->where('status', 3)->count() }}

Delivered

{{ $batch->messages->where('status', 4)->count() }}

Undelivered

{{ $batch->failed_count }}

Failed

{{ $batch->total_count }}

Total

@if($isRatingBatch)

{{ $ratedPhones->count() }}

Total Responses

{{ $batch->total_count > 0 ? number_format(($ratedPhones->count() / $batch->total_count) * 100, 1) : 0 }}%

Response Rate

@if($ratings->whereNotNull('rating_score')->count() > 0)

{{ number_format($ratings->avg('rating_score'), 2) }}

Average Score

@for($i = 1; $i <= 5; $i++) @endfor
@endif

{{ $ratings->where('thumb_rating', 'up')->count() }} / {{ $ratings->where('thumb_rating', 'down')->count() }}

/

@endif
@if($isRatingBatch)
@endif
@if($isRatingBatch) @endif @forelse($batch->messages as $index => $message) @if($isRatingBatch) @endif @empty @endforelse
# Name Phone Message Status Bot Status Rating Status Date
{{ $index + 1 }} {{ $message->name ?? '-' }} {{ $message->phone }} {{ Str::limit($message->message, 50) }} @php $statusBadgeMap = [ 0 => ['class' => 'secondary', 'text' => 'Queued', 'icon' => 'clock'], 1 => ['class' => 'success', 'text' => 'Sent', 'icon' => 'paper-plane'], 2 => ['class' => 'danger', 'text' => 'Failed', 'icon' => 'times-circle'], 3 => ['class' => 'primary', 'text' => 'Delivered', 'icon' => 'check-circle'], 4 => ['class' => 'warning', 'text' => 'Undelivered', 'icon' => 'exclamation-circle'], ]; $statusInfo = $statusBadgeMap[$message->status] ?? ['class' => 'secondary', 'text' => 'Unknown', 'icon' => 'question']; @endphp {{ $statusInfo['text'] }} @if($message->status_message) {{ $message->status_message }} @else Pending @endif @if($ratedPhones->contains($message->phone)) Rated @else Pending @endif {{ $message->date ? $message->date->format('Y-m-d H:i') : ($message->created_at ? $message->created_at->format('Y-m-d H:i') : '-') }}

No messages found in this batch.

@if($isRatingBatch)
@forelse($ratings as $rating) @empty @endforelse
Phone Rating Type Score Thumb Comment Date
{{ $rating->phone_number }} {{ ucfirst($rating->rating_type) }} @if($rating->rating_score)
@for($i = 1; $i <= 5; $i++) @endfor
@else - @endif
@if($rating->thumb_rating) @if($rating->thumb_rating == 'up') Up @else Down @endif @else - @endif @if($rating->comment) {{ Str::limit($rating->comment, 30) }} @else - @endif {{ $rating->created_at->format('Y-m-d H:i') }}

No ratings received yet.

These recipients have not yet responded with a rating.
@php $unratedMessages = $batch->messages->whereIn('phone', $unratedPhones); @endphp @forelse($unratedMessages as $index => $message) @empty @endforelse
# Phone Name Status Sent At
{{ $index + 1 }} {{ $message->phone }} {{ $message->name ?? '-' }} {{ $message->status_description }} {{ $message->sent_at ? $message->sent_at->format('Y-m-d H:i') : '-' }}

All recipients have provided ratings!

@endif
@push('scripts') @endpush @push('styles') @endpush @endsection