@extends('layouts.app')

@section('page_title', 'Terms and Privacy')

@section('content')
    <div id="terms-and-privacy-table">
        @if (session('success'))
            <div class="alert alert-success alert-dismissible fade show" role="alert">
                {{ session('success') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        @endif
        @if (session('error'))
            <div class="alert alert-danger alert-dismissible fade show" role="alert">
                {{ session('error') }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        @endif
        @include('components.terms-component', [
            'pageTitle' => 'Terms and Privacy',
            'data' => $termsAndPrivacy ?? [],
            'columns' => [
                ['name' => 'Title', 'key' => 'title', 'sortable' => true],
                ['name' => 'Details', 'key' => 'details', 'sortable' => true],
                ['name' => 'Type', 'key' => 'type', 'sortable' => true],
            ],
            'actions' => [ 'view', 'delete'],
            'showAddButton' => true,
            'addButtonUrl' => route('terms-and-privacy.create'),
            'showCheckboxes' => true,
            'showBatchDelete' => true,
            'showEditModal' => false,
            'showViewModal' => false,
            'currentPage' => $currentPage ?? 1,
            'lastPage' => $lastPage ?? 1,
            'total' => $total ?? 0,
        ])
        <div id="no-data-message" style="display: {{ empty($termsAndPrivacy ?? []) ? 'block' : 'none' }}; text-align: center; margin-top: 20px;">
            <p>No terms or privacy records found.</p>
        </div>
    </div>
@endsection