@extends('admin.layouts.app')

@section('title', __('admin/verifications.title'))

@section('content')
<div class="container-fluid px-4">
    <x-admin.page-header
        :title="__('admin/verifications.title')"
        icon="fas fa-user-check"
    />

    <x-admin.card>
        {{-- Filters --}}
        <div class="row mb-3">
            <div class="col-md-3">
                <label for="statusFilter" class="form-label">{{ __('admin/verifications.filter_status') }}</label>
                <select class="form-select" id="statusFilter">
                    <option value="">{{ __('admin/verifications.filter_all') }}</option>
                    <option value="pending">{{ __('admin/verifications.status_pending') }}</option>
                    <option value="approved">{{ __('admin/verifications.status_approved') }}</option>
                    <option value="rejected">{{ __('admin/verifications.status_rejected') }}</option>
                </select>
            </div>
            <div class="col-md-2 d-flex align-items-end">
                <button type="button" class="btn btn-outline-secondary" id="clearFilters">
                    <i class="fas fa-times"></i> {{ __('admin/verifications.filter_clear') }}
                </button>
            </div>
        </div>

        {{-- DataTable --}}
        <table id="verificationsTable" class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th>{{ __('admin/verifications.col_id') }}</th>
                    <th>{{ __('admin/verifications.col_client') }}</th>
                    <th>{{ __('admin/verifications.col_type') }}</th>
                    <th>{{ __('admin/verifications.col_method') }}</th>
                    <th>{{ __('admin/verifications.col_status') }}</th>
                    <th>{{ __('admin/verifications.col_date') }}</th>
                    <th>{{ __('admin/verifications.col_actions') }}</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </x-admin.card>
</div>
@endsection

@push('scripts')
<script>
window.verificationsConfig = {
    routes: {
        records: '{{ route("api.admin.verifications.records") }}',
        show: '{{ route("admin.verifications.show", ":id") }}',
        approve: '{{ url("/api/v1/admin/verifications") }}',
        reject: '{{ url("/api/v1/admin/verifications") }}'
    },
    translations: {
        status_pending: '{{ __("admin/verifications.status_pending") }}',
        status_approved: '{{ __("admin/verifications.status_approved") }}',
        status_rejected: '{{ __("admin/verifications.status_rejected") }}',
        btn_view: '{{ __("admin/verifications.btn_view") }}',
        btn_approve: '{{ __("admin/verifications.btn_approve") }}',
        btn_reject: '{{ __("admin/verifications.btn_reject") }}',
        approve_confirm: '{{ __("admin/verifications.approve_confirm") }}',
        approved_success: '{{ __("admin/verifications.approved_success") }}',
        rejected_success: '{{ __("admin/verifications.rejected_success") }}',
        reject_reason_prompt: '{{ __("admin/verifications.reject_reason_prompt") }}',
        success: '{{ __("admin/common.success") }}',
        error: '{{ __("admin/common.error") }}'
    }
};
window.permissions = {
    verifications: {
        view: {{ json_encode(auth()->user()->can('view verifications')) }},
        approve: {{ json_encode(auth()->user()->can('approve verifications')) }}
    }
};
</script>
@vite('resources/js/admin/verifications/index.js')
@endpush
