183 lines
9.8 KiB
PHP
183 lines
9.8 KiB
PHP
@use('App\Services\Produktivitas\KelengkapanPetani')
|
|
|
|
@php
|
|
$langkah = [
|
|
1 => ['jenis' => 'skor', 'label' => 'Input Skor'],
|
|
2 => ['jenis' => 'wajib', 'label' => 'Input Wajib'],
|
|
3 => ['jenis' => 'lainnya', 'label' => 'Input Lainnya'],
|
|
];
|
|
@endphp
|
|
|
|
@if (($bagian ?? 'tabel') === 'rincian')
|
|
{{-- ============ Isi kartu verifikasi: profil + 3 langkah pemeriksaan ============ --}}
|
|
@php $skorIndeks = $petani->skor?->skor_kesiapan_adopsi; @endphp
|
|
|
|
<div class="stepper-verifikasi">
|
|
@include('monitoring-verifikasi.petani-monitoring', ['bagian' => 'profil'])
|
|
|
|
<div class="row g-4 mb-6">
|
|
<div class="col-6">
|
|
<label class="form-label">Enumerator</label>
|
|
<input type="text" class="form-control" readonly value="{{ $petani->creator?->name ?? '-' }}">
|
|
</div>
|
|
<div class="col-6">
|
|
<label class="form-label">Skor Indeks</label>
|
|
<input type="text" class="form-control" readonly
|
|
value="{{ is_null($skorIndeks) ? '-' : number_format($skorIndeks, 1, ',', '.') . '/5 · ' . $petani->segmen() }}">
|
|
</div>
|
|
</div>
|
|
|
|
@if ($petani->catatan)
|
|
{{-- Catatan saat terakhir dikembalikan ke Draf --}}
|
|
<div class="alert alert-warning mb-6" role="alert">
|
|
<h6 class="alert-heading mb-1">Catatan sebelumnya</h6>
|
|
<p class="mb-0" style="white-space: pre-line;">{{ $petani->catatan }}</p>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Penanda langkah --}}
|
|
<div class="d-flex justify-content-between gap-2 border-bottom pb-4 mb-6">
|
|
@foreach ($langkah as $n => $l)
|
|
@php $hitung = $ringkasan[$l['jenis']]; @endphp
|
|
<div class="d-flex align-items-center gap-2 langkah-item" data-langkah="{{ $n }}">
|
|
<span class="avatar avatar-sm flex-shrink-0">
|
|
<span @class(['avatar-initial rounded-circle langkah-nomor', 'bg-primary text-white' => $n === 1, 'bg-label-secondary' => $n !== 1])>{{ $n }}</span>
|
|
</span>
|
|
<span class="lh-sm">
|
|
<span class="d-block fw-medium small text-heading">{{ $l['label'] }}</span>
|
|
<small class="text-body-secondary">{{ $hitung['terisi'] }}/{{ $hitung['total'] }}</small>
|
|
</span>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
{{-- Isi tiap langkah: periksa semua isian, lalu klik tombol di bawah --}}
|
|
@foreach ($langkah as $n => $l)
|
|
<form class="pt-0 langkah-pane {{ $n === 1 ? '' : 'd-none' }}" data-langkah="{{ $n }}" onsubmit="return false;">
|
|
@include('monitoring-verifikasi.petani-monitoring', ['bagian' => 'isian', 'rincian' => $rincian[$l['jenis']]])
|
|
|
|
{{-- Langkah terakhir punya tombolnya sendiri di bawah --}}
|
|
@if ($n < count($langkah))
|
|
<div class="d-flex gap-2">
|
|
@if ($n > 1)
|
|
<button type="button" class="btn btn-label-secondary" data-ke-langkah="{{ $n - 1 }}">
|
|
<i class="icon-base ti tabler-arrow-left icon-sm me-1"></i>Kembali
|
|
</button>
|
|
@endif
|
|
<button type="button" class="btn btn-primary flex-grow-1" data-ke-langkah="{{ $n + 1 }}">
|
|
Lengkap<i class="icon-base ti tabler-arrow-right icon-sm ms-1"></i>
|
|
</button>
|
|
</div>
|
|
@endif
|
|
</form>
|
|
@endforeach
|
|
|
|
{{-- Langkah terakhir: Belum Lengkap (kembali ke Draf + catatan) atau Lengkap & Verifikasi --}}
|
|
{{-- Baris 1: Kembali | Belum Lengkap (sama lebar). Baris 2: Lengkap & Verifikasi (penuh). --}}
|
|
<div class="langkah-pane d-none" data-langkah="{{ count($langkah) }}">
|
|
<div class="row g-2 mb-2">
|
|
<div class="col-6">
|
|
<button type="button" class="btn btn-label-secondary w-100" data-ke-langkah="{{ count($langkah) - 1 }}">
|
|
<i class="icon-base ti tabler-arrow-left icon-sm me-1"></i>Kembali
|
|
</button>
|
|
</div>
|
|
<div class="col-6">
|
|
<form method="POST" action="{{ route('monitoring-verifikasi.petani.verifikasi.kembalikan-draf', $petani->id) }}"
|
|
class="form-kembalikan-draf" data-nama="{{ $petani->nama }}"
|
|
data-judul="Data Belum Lengkap" data-pesan="Tuliskan apa yang perlu dilengkapi atau diperbaiki oleh enumerator.">
|
|
@csrf
|
|
@method('PUT')
|
|
<input type="hidden" name="catatan" value="">
|
|
<button type="submit" class="btn btn-label-danger w-100">
|
|
<i class="icon-base ti tabler-file-alert icon-sm me-1"></i>Belum Lengkap
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<form method="POST" action="{{ route('monitoring-verifikasi.petani.verifikasi.update', $petani->id) }}"
|
|
class="form-verifikasi-petani" data-nama="{{ $petani->nama }}">
|
|
@csrf
|
|
@method('PUT')
|
|
<button type="submit" class="btn btn-primary w-100">
|
|
<i class="icon-base ti tabler-rosette-discount-check icon-sm me-1"></i>Lengkap & Verifikasi
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@else
|
|
{{-- ============ Tabel petani berstatus Lengkap; klik di mana saja pada baris → kartu verifikasi ============ --}}
|
|
<div class="monitoring-split">
|
|
<div class="kolom-tabel">
|
|
<form method="GET" action="{{ route('monitoring-verifikasi.petani.verifikasi') }}" class="d-flex justify-content-between align-items-center row gap-3 gap-md-0 mb-4">
|
|
<input type="hidden" name="sub" value="lengkap">
|
|
<div class="col-md-auto">
|
|
<div class="d-flex align-items-center">
|
|
<label class="me-2 text-nowrap">Show</label>
|
|
<select name="per_page" class="form-select form-select-sm w-auto" onchange="this.form.submit()">
|
|
@foreach ($perPage as $n)
|
|
<option value="{{ $n }}" @selected($petaniLengkap->perPage() == $n)>{{ $n }}</option>
|
|
@endforeach
|
|
</select>
|
|
<label class="ms-2 text-nowrap">entries</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-auto">
|
|
<div class="input-group input-group-sm w-auto">
|
|
<input type="text" name="search" class="form-control" placeholder="Cari nama petani..." value="{{ request('search') }}">
|
|
<button type="submit" class="btn btn-outline-primary"><i class="icon-base ti tabler-search"></i></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="table-responsive text-nowrap">
|
|
<table class="table table-hover">
|
|
<thead class="border-top">
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Nama Petani</th>
|
|
<th>Komoditas</th>
|
|
<th>Enumerator</th>
|
|
@foreach ($langkah as $l)
|
|
<th class="text-center">{{ $l['label'] }}</th>
|
|
@endforeach
|
|
<th>Terakhir Diperbarui</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse ($petaniLengkap as $index => $item)
|
|
@php $r = $ringkasan[$item->id]; @endphp
|
|
<tr class="btn-buka-rincian"
|
|
data-url="{{ route('monitoring-verifikasi.petani.verifikasi.show', $item->id) }}"
|
|
data-judul="Verifikasi {{ $item->nama }}" title="Klik untuk memeriksa & memverifikasi">
|
|
<td>{{ $petaniLengkap->firstItem() + $index }}</td>
|
|
<td><span class="text-heading fw-medium">{{ $item->nama }}</span></td>
|
|
<td>{{ $item->komoditas?->nama ?? '-' }}</td>
|
|
<td><span class="text-body-secondary">{{ $item->creator?->name ?? '-' }}</span></td>
|
|
@foreach ($langkah as $l)
|
|
<td class="text-center">
|
|
<span class="badge bg-label-{{ KelengkapanPetani::warna($r[$l['jenis']]) }}">{{ $r[$l['jenis']]['terisi'] }}/{{ $r[$l['jenis']]['total'] }}</span>
|
|
</td>
|
|
@endforeach
|
|
<td>
|
|
<span class="d-block">{{ $item->updated_at?->translatedFormat('d M Y') ?? '-' }}</span>
|
|
<small class="text-body-secondary">{{ $item->updated_at?->format('H:i') }}</small>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="text-center py-4">Belum ada data petani yang ditandai lengkap.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-center justify-content-md-end border-top pt-4">
|
|
{{ $petaniLengkap->links('pagination::bootstrap-5') }}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="kolom-detail" aria-hidden="true"></div>
|
|
</div>
|
|
@endif
|