@foreach($pengajuan->details as $detail)
<div class="card mb-3">
    <div class="card-header">
        {{ $detail->kriteria->nama }}
    </div>
    <div class="card-body">
        <p>Subkriteria: {{ $detail->subkriteria->nama }}</p>
        <p>File Bukti: 
            <a href="{{ asset('storage/'.$detail->file_bukti) }}" target="_blank">
                Lihat Dokumen
            </a>
        </p>
    </div>
</div>
@endforeach

<form action="{{ route('pengajuan.validasi', $pengajuan->id) }}" method="POST">
    @csrf
    <div class="form-group">
        <label>Status Validasi</label>
        <select name="status" class="form-control" required>
            <option value="diterima">Valid</option>
            <option value="ditolak">Tidak Valid</option>
        </select>
    </div>
    
    <div class="form-group" id="alasan-group" style="display:none;">
        <label>Alasan Penolakan</label>
        <textarea name="alasan" class="form-control"></textarea>
    </div>
    
    <button type="submit" class="btn btn-primary">Submit</button>
</form>

<script>
document.querySelector('[name="status"]').addEventListener('change', function() {
    document.getElementById('alasan-group').style.display = 
        this.value === 'ditolak' ? 'block' : 'none';
});
</script>