@extends('layouts.admin')

@section('title', 'Detail Petani')
@section('page-title', 'Detail Calon Petani')

@section('content')
<div class="row">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4>Data Diri</h4>
            </div>
            <div class="card-body">
                <table class="table table-borderless">
                    <tr>
                        <th>Nama Lengkap</th>
                        <td>: {{ $petani->nama_lengkap }}</td>
                    </tr>
                    <tr>
                        <th>Username</th>
                        <td>: {{ $petani->username }}</td>
                    </tr>
                    <tr>
                        <th>No HP</th>
                        <td>: {{ $petani->no_hp }}</td>
                    </tr>
                    <tr>
                        <th>Alamat</th>
                        <td>: {{ $petani->alamat }}</td>
                    </tr>
                    <tr>
                        <th>Nama Usaha</th>
                        <td>: {{ $petani->nama_usaha }}</td>
                    </tr>
                    <tr>
                        <th>Status Saat Ini</th>
                        <td>: 
                            <span class="badge bg-{{ $petani->status_akun == 'menunggu' ? 'warning' : ($petani->status_akun == 'aktif' ? 'success' : 'danger') }}">
                                {{ ucfirst($petani->status_akun) }}
                            </span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4>Aksi Verifikasi</h4>
            </div>
            <div class="card-body">
                <p>Silakan tinjau data di samping. Jika valid, klik Terima.</p>
                
                <form action="{{ url('admin/verifikasi/'.$petani->id.'/approve') }}" method="POST" class="d-inline">
                    @csrf
                    <button type="submit" class="btn btn-success btn-lg w-100 mb-2" onclick="return confirm('Yakin ingin menerima petani ini?')">
                        <i class="bi bi-check-circle"></i> Terima Pendaftaran
                    </button>
                </form>

                <form action="{{ url('admin/verifikasi/'.$petani->id.'/reject') }}" method="POST" class="d-inline">
                    @csrf
                    <button type="submit" class="btn btn-danger btn-lg w-100" onclick="return confirm('Yakin ingin menolak petani ini?')">
                        <i class="bi bi-x-circle"></i> Tolak Pendaftaran
                    </button>
                </form>
                
                <div class="mt-3">
                    <a href="{{ url('admin/verifikasi') }}" class="btn btn-secondary w-100">Kembali</a>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection