refactor(routes): hapus route destroy untuk jenis lampiran
- Menghapus route untuk menghapus jenis lampiran dari file routes/web.php. - Memperbarui query pada PenilaianController untuk memuat relasi lampiran dokumen dan jenis lampiran.
This commit is contained in:
@@ -437,10 +437,10 @@ class PenilaianController extends Controller
|
||||
$header = $headers[$type] ?? 'Pelaporan';
|
||||
$authorization = null;
|
||||
if ($header === 'SLA') {
|
||||
$authorization = Authorization::with(['user'])->find($id);
|
||||
$permohonan = Permohonan::find($authorization->permohonan_id);
|
||||
$authorization = Authorization::with(['user','permohonan.lampiranDokumen.jenisLampiran'])->find($id);
|
||||
$permohonan = Permohonan::with(['lampiranDokumen.jenisLampiran'])->find($authorization->permohonan_id);
|
||||
} else {
|
||||
$permohonan = Permohonan::find($id);
|
||||
$permohonan = Permohonan::with(['lampiranDokumen.jenisLampiran'])->find($id);
|
||||
}
|
||||
if ($header === 'SLA') {
|
||||
return view('lpj::penilaian.otorisator.sla', compact('permohonan', 'header', 'authorization'));
|
||||
|
||||
@@ -199,12 +199,30 @@
|
||||
(Auth::user()->hasAnyRole(['administrator', 'senior-officer']) &&
|
||||
$authorization->approve_so != null &&
|
||||
$authorization->approve_eo != null) ||
|
||||
$authorization->approve_dd != null)
|
||||
$authorization->approve_dd != null
|
||||
)
|
||||
@php
|
||||
$memoDeviasiExists = false;
|
||||
if ($authorization->permohonan && $authorization->permohonan->lampiranDokumen) {
|
||||
$memoDeviasiExists = $authorization->permohonan->lampiranDokumen()
|
||||
->whereHas('jenisLampiran', function($query) {
|
||||
$query->where('nama', 'memo-deviasi');
|
||||
})
|
||||
->exists();
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if ($memoDeviasiExists)
|
||||
<button onclick="otorisatorData({{ $authorization->id }}, 'UNFREZE')" type="button"
|
||||
class="btn btn-primary">
|
||||
<i class="ki-filled ki-double-check"></i>
|
||||
Otorisasi Un{{ $header ?? '' }}
|
||||
</button>
|
||||
@else
|
||||
<span class="badge badge-warning">
|
||||
Memo Deviasi Belum Ada
|
||||
</span>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,6 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::get('datatables', [JenisLampiranController::class, 'dataForDatatables'])->name('datatables');
|
||||
Route::get('export', [JenisLampiranController::class, 'export'])->name('export');
|
||||
});
|
||||
Route::delete('jenis-lampiran/{id}', [JenisLampiranController::class, 'destroy'])->name('jenis-lampiran.destroy');
|
||||
Route::resource('jenis-lampiran', JenisLampiranController::class);
|
||||
|
||||
Route::name('custom-field.')->prefix('custom-field')->group(function () {
|
||||
|
||||
Reference in New Issue
Block a user