@extends('layouts.app') @section('content')
Bulk SMS Composer
{{-- Status Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Display Failed Sends Summary (New) --}} @if(session('failedSendsSummary') && count(session('failedSendsSummary')) > 0)

Warning: Some SMS sending jobs could not be queued:

    @foreach(session('failedSendsSummary') as $failed)
  • Phone Number: {{ $failed['phone'] ?? 'N/A' }}
    Reason: {{ $failed['reason'] ?? 'Unknown' }}
    @if(isset($failed['message'])) Message: "{{ Str::limit($failed['message'], 50) }}" @endif
  • @endforeach
@csrf
@endif {{-- Step 1: Upload CSV File --}} @if(empty($headers))
@csrf
@else {{-- Step 2: Compose & Send SMS - Only if there's clean data --}} @if(!empty($cleanData) && count($cleanData) > 0)

You have [ {{ count($cleanData) }} ] valid phone numbers ready for SMS sending. Do you wish to proceed?

@csrf {{-- Pass only the clean CSV data --}}
{{-- Initial text input and field select --}}
{{-- Real-time Message Preview --}}
@endif
{{-- Display Clean Data --}} @if(!empty($cleanData) && count($cleanData) > 0)
Preview Valid CSV Data ({{ count($cleanData) }} rows)
@foreach($headers as $h) @endforeach @foreach($cleanData as $row) @foreach($row as $cell) @endforeach @endforeach
{{ $h }}
{{ $cell }}
@endif {{-- Display Problematic Data --}} @if(!empty($problematicData) && count($problematicData) > 0)
Problematic CSV Data ({{ count($problematicData) }} rows)

The following rows contain invalid phone numbers or missing data. You can download this data to correct it.

@csrf
@foreach($headers as $h) @endforeach @foreach($problematicData as $row) @foreach($row['data'] as $cell) @endforeach @endforeach
{{ $h }}Reason
{{ $cell }}{{ $row['reason'] }}
@endif @endif
{{-- JavaScript for dynamic SMS builder --}} {{-- DataTables initializations --}} @if(!empty($problematicData) && count($problematicData) > 0) @endif @endsection