@extends('layouts.admin')

@section('title', __('admin.nav.payment_methods'))

@section('content')
<div class="d-flex justify-content-end mb-4">
    <a href="{{ route('admin.payment-methods.create') }}" class="btn-arena btn-primary">{{ __('admin.actions.create') }}</a>
</div>

<div class="card-arena overflow-hidden">
    <div class="table-responsive">
        <table class="table table-dark table-hover mb-0">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Type</th>
                    <th>Active</th>
                    <th>Sort</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @forelse($methods as $method)
                    <tr>
                        <td>{{ $method->name }}</td>
                        <td>{{ $method->type }}</td>
                        <td>{{ $method->is_active ? 'Yes' : 'No' }}</td>
                        <td>{{ $method->sort_order }}</td>
                        <td class="text-end">
                            <a href="{{ route('admin.payment-methods.edit', $method) }}" class="btn-arena btn-ghost btn-sm">{{ __('admin.actions.edit') }}</a>
                            <form method="POST" action="{{ route('admin.payment-methods.destroy', $method) }}" class="d-inline" onsubmit="return confirm(@json(__('admin.confirm.delete')))">
                                @csrf
                                @method('DELETE')
                                <button class="btn-arena btn-danger btn-sm">{{ __('admin.actions.delete') }}</button>
                            </form>
                        </td>
                    </tr>
                @empty
                    <tr><td colspan="5" class="text-center py-5 text-muted">{{ __('admin.empty.no_results') }}</td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>

<div class="mt-4">{{ $methods->links() }}</div>
@endsection
