<x-app-layout>
    <x-slot name="header">
        <div class="d-flex align-items-center justify-content-between">
            <div>
                <h2 class="h4 mb-0">MikroTik Static Unmatching List</h2>
            </div>
        </div>
    </x-slot>

    <div class="card shadow-sm border-0">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered table-hover" id="mikrotikStaticUnmatchingTable" style="width:100%">
                    <thead>
                        <tr>
                            <th>Customer ID</th>
                            <th>Customer Name</th>
                            <th>Source</th>
                            <th>Identifier</th>
                            <th>IP Address</th>
                            <th>Remote Address</th>
                            <th>Issue</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>

    @push('scripts')
        <script>
            document.addEventListener('DOMContentLoaded', function () {
                const table = $('#mikrotikStaticUnmatchingTable').DataTable({
                    processing: true,
                    serverSide: true,
                    responsive: true,
                    ajax: '{!! route('admin.mikrotik.static-unmatching.data') !!}',
                    columns: [
                        { data: 'customer_code', name: 'customer_code' },
                        { data: 'customer_name', name: 'customer_name' },
                        { data: 'source', name: 'source' },
                        { data: 'identifier', name: 'identifier' },
                        { data: 'ip_address', name: 'ip_address' },
                        { data: 'remote_address', name: 'remote_address' },
                        { data: 'issue', name: 'issue' },
                    ]
                });
                window.setInterval(() => table.ajax.reload(null, false), 30000);
            });
        </script>
    @endpush
</x-app-layout>
