@extends('admin.layouts.app')
@section('title', 'Payment Methods')
@section('content')
<div class="action-bar">
    <span>{{ $paymentMethods->total() }} payment methods</span>
    <a href="{{ route('admin.payment-methods.create') }}" class="btn btn-primary">+ New Payment Method</a>
</div>
<div class="card">
    <table>
        <tr><th>Logo</th><th>Name</th><th>Slug</th><th>Order</th><th>Active</th><th>Actions</th></tr>
        @foreach($paymentMethods as $pm)
        <tr>
            <td>
                @if($pm->logo)
                    <img src="{{ asset('storage/'.$pm->logo) }}" style="width:40px;height:auto;border-radius:4px" alt="{{ $pm->name }}">
                @else
                    <span class="text-muted">—</span>
                @endif
            </td>
            <td><strong>{{ $pm->name }}</strong></td>
            <td class="text-muted">{{ $pm->slug }}</td>
            <td>{{ $pm->order }}</td>
            <td>{!! $pm->is_active ? '<span style="color:#6fcf97">Yes</span>' : '<span style="color:#e74c3c">No</span>' !!}</td>
            <td class="inline-flex">
                <a href="{{ route('admin.payment-methods.edit', $pm) }}" class="btn btn-primary btn-sm">Edit</a>
                <form action="{{ route('admin.payment-methods.destroy', $pm) }}" method="POST" onsubmit="return confirm('Delete this payment method?')">
                    @csrf @method('DELETE')
                    <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                </form>
            </td>
        </tr>
        @endforeach
    </table>
    <div class="pagination">{{ $paymentMethods->links() }}</div>
</div>
@endsection
