@extends('admin.layouts.app')

@section('title', 'Verifikasi Akun Bank')

@section('content')
<div class="bg-white shadow-md rounded-lg overflow-hidden">
    <div class="p-6">
        <h2 class="text-xl font-semibold text-gray-800 mb-4">Daftar Akun Bank Menunggu Verifikasi</h2>
        
        @if (session('success'))
            <div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-4" role="alert">
                <p>{{ session('success') }}</p>
            </div>
        @endif
        
        @if (session('error'))
            <div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-4" role="alert">
                <p>{{ session('error') }}</p>
            </div>
        @endif
        
        @if(empty($bankAccounts))
            <div class="text-center py-8">
                <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
                </svg>
                <h3 class="mt-2 text-sm font-medium text-gray-900">Tidak ada akun bank yang menunggu verifikasi</h3>
                <p class="mt-1 text-sm text-gray-500">Semua akun bank sudah diverifikasi.</p>
            </div>
        @else
            <div class="overflow-x-auto">
                <table class="min-w-full bg-white">
                    <thead class="bg-gray-100">
                        <tr>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nama Penjahit</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Bank</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">No. Rekening</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Atas Nama</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tanggal</th>
                            <th class="py-3 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Aksi</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200">
                        @foreach($bankAccounts as $bankAccount)
                            <tr>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ $bankAccount['id'] }}</td>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ $bankAccount['user']['name'] }}</td>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ $bankAccount['bank_name'] }}</td>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ $bankAccount['account_number'] }}</td>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ $bankAccount['account_holder_name'] }}</td>
                                <td class="py-4 px-4 text-sm">
                                    <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full 
                                        @if($bankAccount['status'] == 'pending') bg-yellow-100 text-yellow-800
                                        @elseif($bankAccount['status'] == 'active') bg-green-100 text-green-800
                                        @elseif($bankAccount['status'] == 'rejected') bg-red-100 text-red-800
                                        @endif">
                                        {{ ucfirst($bankAccount['status']) }}
                                    </span>
                                </td>
                                <td class="py-4 px-4 text-sm text-gray-900">{{ \Carbon\Carbon::parse($bankAccount['created_at'])->format('d M Y') }}</td>
                                <td class="py-4 px-4 text-sm text-gray-900">
                                    @if($bankAccount['status'] == 'pending')
                                        <a href="{{ route('admin.bank-accounts.show-verify', $bankAccount['id']) }}" class="text-blue-600 hover:text-blue-900">Verifikasi</a>
                                    @endif
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        @endif
    </div>
</div>
@endsection 