@extends('layouts.master')
@section('page-title') 
    {{ $page_title }}
@endsection
@section('page-css')
@endsection
@section('content')
        <section class="traffic-hero mb-4">
            <div class="row g-4 align-items-end">
                <div class="col-lg-8">
                    <div class="text-uppercase small fw-semibold opacity-75 mb-2">SMS Traffic Monitoring</div>
                    <!-- <h1 class="display-6 fw-semibold mb-3">Track every message your team sends.</h1>
                    <p class="fs-5 opacity-75 mb-0">
                        Search sent SMS, review delivery outcomes, inspect failed attempts, and give clients a fast audit trail for every campaign.
                    </p> -->
                </div>
                <div class="col-lg-4">
                    <!-- <div class="row g-3">
                        <div class="col-6">
                            <div class="rounded-4 p-3 bg-white bg-opacity-10">
                                <div class="small opacity-75">Campaigns</div>
                                <div class="h3 mb-0">18</div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="rounded-4 p-3 bg-white bg-opacity-10">
                                <div class="small opacity-75">Countries</div>
                                <div class="h3 mb-0">7</div>
                            </div>
                        </div>
                    </div> -->
                </div>
            </div>
        </section>

        <!-- <section class="row g-4 mb-4">
            <div class="col-sm-6 col-xl-3">
                <article class="traffic-card">
                    <div class="d-flex align-items-start justify-content-between mb-3">
                        <div class="icon-wrap"><i class="bi bi-send-check"></i></div>
                        <span class="small text-success fw-semibold">+12.6%</span>
                    </div>
                    <div class="muted-label mb-2">Messages sent today</div>
                    <div class="h3 mb-2">186,420</div>
                    <div class="mini-chart"><span style="width: 82%;"></span></div>
                </article>
            </div>
            <div class="col-sm-6 col-xl-3">
                <article class="traffic-card">
                    <div class="d-flex align-items-start justify-content-between mb-3">
                        <div class="icon-wrap"><i class="bi bi-check2-circle"></i></div>
                        <span class="small text-success fw-semibold">98.4%</span>
                    </div>
                    <div class="muted-label mb-2">Delivery success</div>
                    <div class="h3 mb-2">183,372</div>
                    <div class="mini-chart"><span style="width: 98%;"></span></div>
                </article>
            </div>
            <div class="col-sm-6 col-xl-3">
                <article class="traffic-card">
                    <div class="d-flex align-items-start justify-content-between mb-3">
                        <div class="icon-wrap"><i class="bi bi-exclamation-triangle"></i></div>
                        <span class="small text-warning fw-semibold">1.1%</span>
                    </div>
                    <div class="muted-label mb-2">Pending or queued</div>
                    <div class="h3 mb-2">2,074</div>
                    <div class="mini-chart"><span style="width: 34%;"></span></div>
                </article>
            </div>
            <div class="col-sm-6 col-xl-3">
                <article class="traffic-card">
                    <div class="d-flex align-items-start justify-content-between mb-3">
                        <div class="icon-wrap"><i class="bi bi-x-octagon"></i></div>
                        <span class="small text-danger fw-semibold">0.5%</span>
                    </div>
                    <div class="muted-label mb-2">Failed messages</div>
                    <div class="h3 mb-2">974</div>
                    <div class="mini-chart"><span style="width: 18%;"></span></div>
                </article>
            </div>
        </section> -->

        <section class="row g-4">
            <div class="col-xl-9">
                <div class="filter-card mb-4">
                    <div class="d-flex flex-column flex-lg-row align-items-lg-center justify-content-between gap-3 mb-3">
                        <div>
                            <h2 class="h4 mb-1">Sent SMS list</h2>
                            <!-- <p class="text-secondary mb-0">Filter messages by date, sender, recipient, or delivery state.</p> -->
                        </div>
                        <!-- <div class="d-flex flex-wrap gap-2">
                            <button class="btn btn-ghost px-4"><i class="bi bi-download me-2"></i>Export CSV</button>
                            <button class="btn btn-click px-4"><i class="bi bi-funnel me-2"></i>Apply filters</button>
                        </div> -->
                    </div>

                    <div class="row g-3">
                        <!-- <div class="col-md-6 col-lg-3">
                            <label for="range" class="form-label fw-semibold">Date range</label>
                            <select id="range" class="form-select">
                                <option>Today</option>
                                <option>Last 7 days</option>
                                <option>Last 30 days</option>
                            </select>
                        </div>
                        <div class="col-md-6 col-lg-3">
                            <label for="senderId" class="form-label fw-semibold">Sender ID</label>
                            <select id="senderId" class="form-select">
                                <option>CLICKOTP</option>
                                <option>CLICKINFO</option>
                                <option>ACMEBANK</option>
                            </select>
                        </div>
                        <div class="col-md-6 col-lg-3">
                            <label for="status" class="form-label fw-semibold">Status</label>
                            <select id="status" class="form-select">
                                <option>All statuses</option>
                                <option>Delivered</option>
                                <option>Pending</option>
                                <option>Failed</option>
                            </select>
                        </div> -->
                        <div class="col-md-12">
                            <div class="float-end">
                                
                            
                                <label for="search" class="form-label fw-semibold">Search</label>
                                <input id="search" type="text" class="form-control" placeholder="Phone, sender ID, text">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="traffic-table-card">
                    <div class="table-responsive">
                        <table class="table align-middle mb-0">
                            <thead>
                                <tr>
                                    <th scope="col">Message ID</th>
                                    <th scope="col">Recipient</th>
                                    <th scope="col">Content</th>
                                    <th scope="col">Sender ID</th>
                                    <th scope="col">Date Created</th>
                                    <th scope="col">Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                @if(count($traffic_arr->content) > 0)
                                    @foreach($traffic_arr->content as $row)
                                        <tr>
                                            <td class="fw-semibold">{{ $row->refId}}</td>
                                            <td class="recipient-cell">
                                                <div class="fw-semibold">{{ $row->to}}</div>
                                                <!-- <div class="text-secondary small">Ghana</div> -->
                                            </td>
                                            <td>{{ $row->message }}</td>
                                            <td><span class="channel-badge">{{ $row->from }}</span></td>
                                            <td>
                                                {{ \Carbon\Carbon::parse($row->createdAt)->format('Y-m-d H:i:s') }}
                                            </td>
                                            <td><span class="status-badge status-delivered">{{ $row->deliveryStatus }}</span></td>
                                        </tr>
                                 @endforeach
                                 @else
                                 <tr>
                                     <td colspan="6" class="text-center">No records</td>
                                 </tr>
                                @endif
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-xl-3">
                

                <aside class="detail-card">
                    <h2 class="h5 mb-3">Recent activity</h2>

                    <div class="timeline-item pt-0 mt-0 border-0">
                        <div class="fw-semibold">Sender ID approved</div>
                        <div class="muted-label">CLICKINFO added </div>
                        <div class="small text-secondary mt-1">09:04</div>
                    </div>
                    <div class="timeline-item">
                        <div class="fw-semibold">Campaign completed</div>
                        <div class="muted-label">[campaign name] batch finished</div>
                        <div class="small text-secondary mt-1">08:41</div>
                    </div>
                </aside>
            </div>
        </section>
@endsection
@section('page-js')
    <script>
        
    </script>

@endsection