@extends('backend.master')

@section('title', 'Bank Methods')

@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
    <h1 class="h4">Bank Methods</h1>
    <a href="{{ route('admin.deposit-methods.bank.create') }}" class="btn btn-primary btn-sm">
        <i class="bi bi-plus-lg"></i> নতুন Bank যোগ করুন
    </a>
</div>

@if(session('success'))
    <div class="alert alert-success">{{ session('success') }}</div>
@endif

<table class="table table-bordered table-striped align-middle">
    <thead>
        <tr>
            <th>#</th>
            <th>Logo</th>
            <th>Bank Name</th>
            <th>Slug</th>
            <th>Account Number</th>
            <th>Account Holder</th>
            <th>Branch</th>
            <th>Sort</th>
            <th>Status</th>
            <th width="120">Action</th>
        </tr>
    </thead>
    <tbody>
        @forelse($methods as $method)
            <tr>
                <td>{{ $method->id }}</td>
                <td>
                    @if($method->logo)
                        <img src="{{ asset('storage/'.$method->logo) }}" alt="" width="40">
                    @endif
                </td>
                <td>{{ $method->bank_name }}</td>
                <td>{{ $method->slug }}</td>
                <td>{{ $method->account_number }}</td>
                <td>{{ $method->account_holder }}</td>
                <td>{{ $method->branch_name }}</td>
                <td>{{ $method->sort_order }}</td>
                <td>
                    @if($method->status)
                        <span class="badge bg-success">Active</span>
                    @else
                        <span class="badge bg-secondary">Inactive</span>
                    @endif
                </td>
                <td>
                    <a href="{{ route('admin.deposit-methods.bank.edit', $method) }}" class="btn btn-sm btn-outline-primary">
                        Edit
                    </a>
                    <form action="{{ route('admin.deposit-methods.bank.destroy', $method) }}" method="POST"
                          style="display:inline-block"
                          onsubmit="return confirm('ডিলিট করতে চান?');">
                        @csrf
                        @method('DELETE')
                        <button class="btn btn-sm btn-outline-danger">Del</button>
                    </form>
                </td>
            </tr>
        @empty
            <tr><td colspan="10" class="text-center">কোনো Bank method নেই।</td></tr>
        @endforelse
    </tbody>
</table>
@endsection
