@extends('layouts.app')

@section('title', 'Lead Forms | SEF Solution')

@section('content')
<div class="admin-page">
    <div class="admin-card">
        <div class="admin-top">
            <div>
                <span class="brand-badge">SEF Solution</span>
                <h1>Lead Form Submission List</h1>
                <p>যারা chatbot form submit করেছে তাদের আলাদা লিস্ট</p>
            </div>
            <div class="top-actions">
                <a href="{{ route('admin.dashboard') }}" class="admin-link">Dashboard</a>
                <a href="{{ route('admin.chats') }}" class="admin-link">Chats</a>
            </div>
        </div>

        <div class="table-wrap">
            <table class="lead-table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Phone</th>
                        <th>Email</th>
                        <th>Business</th>
                        <th>Budget</th>
                        <th>Date</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse($forms as $form)
                        <tr>
                            <td>{{ $form->id }}</td>
                            <td>{{ $form->name ?: 'N/A' }}</td>
                            <td>{{ $form->phone ?: ($form->session->phone ?? 'N/A') }}</td>
                            <td>{{ $form->email ?: 'N/A' }}</td>
                            <td>{{ $form->business_name ?: ($form->business_type ?: 'N/A') }}</td>
                            <td>{{ $form->monthly_budget ?: 'N/A' }}</td>
                            <td>{{ $form->created_at?->format('d M Y, h:i A') }}</td>
                        </tr>
                    @empty
                        <tr><td colspan="7" class="empty-state">এখনও কোনো form submit হয়নি।</td></tr>
                    @endforelse
                </tbody>
            </table>
        </div>

        <div class="pagination-wrap">{{ $forms->links() }}</div>
    </div>
</div>
@endsection
