116 lines
5.6 KiB
PHP
116 lines
5.6 KiB
PHP
@extends('admin.layouts.app')
|
|
@section('title', 'Kriteria & Bobot')
|
|
|
|
@section('content')
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h4><i class="bi bi-sliders me-2"></i>Kriteria & Bobot</h4>
|
|
@if(auth()->user()->hasRole('superadmin'))
|
|
@if($isLocked)
|
|
<button class="btn btn-success" disabled title="Terkunci karena ada periode aktif">
|
|
<i class="bi bi-lock-fill me-1"></i> Tambah Kriteria
|
|
</button>
|
|
@else
|
|
<a href="{{ route('admin.kriteria.create') }}" class="btn btn-success">
|
|
<i class="bi bi-plus-circle me-1"></i> Tambah Kriteria
|
|
</a>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<span><i class="bi bi-list-ul me-2"></i>Daftar Kriteria SAW</span>
|
|
<span class="badge {{ abs($totalBobot - 1.00) < 0.001 ? 'bg-success' : 'bg-danger' }}">
|
|
Total Bobot: {{ number_format($totalBobot, 2) }}
|
|
</span>
|
|
</div>
|
|
<div class="card-body">
|
|
@if($isLocked)
|
|
<div class="alert alert-warning">
|
|
<i class="bi bi-lock-fill me-2"></i><strong>Struktur Kriteria Terkunci:</strong> Saat ini terdapat periode seleksi yang sedang <strong>AKTIF</strong>. Untuk mencegah ketidakkonsistenan data penilaian dan perhitungan SAW, penambahan, pengubahan, atau penghapusan kriteria dinonaktifkan sementara.
|
|
</div>
|
|
@endif
|
|
|
|
<div class="alert alert-info">
|
|
<i class="bi bi-info-circle me-2"></i><strong>Keterangan:</strong>
|
|
<ul class="mb-0 mt-2">
|
|
<li><strong>Benefit</strong> — semakin tinggi nilai, semakin baik</li>
|
|
<li><strong>Cost</strong> — semakin rendah nilai, semakin baik</li>
|
|
</ul>
|
|
<p class="mb-0 mt-2">Total bobot semua kriteria harus = <strong>1.00</strong> (saat ini: <strong>{{ number_format($totalBobot, 2) }}</strong>)</p>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th width="80">Kode</th>
|
|
<th>Nama Kriteria</th>
|
|
<th width="120" class="text-center">Jenis</th>
|
|
<th width="120" class="text-center">Bobot</th>
|
|
@if(auth()->user()->hasRole('superadmin'))
|
|
<th width="180" class="text-center">Aksi</th>
|
|
@endif
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($kcriteria = $kriteria as $k)
|
|
<tr>
|
|
<td class="text-center">
|
|
<span class="badge bg-secondary">{{ strtoupper($k->kode) }}</span>
|
|
</td>
|
|
<td>{{ $k->nama }}</td>
|
|
<td class="text-center">
|
|
@if($k->jenis === 'benefit')
|
|
<span class="badge bg-success">Benefit</span>
|
|
@else
|
|
<span class="badge bg-warning text-dark">Cost</span>
|
|
@endif
|
|
</td>
|
|
<td class="text-center fw-bold">{{ number_format($k->bobot, 2) }}</td>
|
|
@if(auth()->user()->hasRole('superadmin'))
|
|
<td class="text-center">
|
|
@if($isLocked)
|
|
<span class="badge bg-secondary py-2 px-3"><i class="bi bi-lock-fill me-1"></i> Terkunci</span>
|
|
@else
|
|
<div class="btn-group btn-group-sm">
|
|
<a href="{{ route('admin.kriteria.edit', $k) }}" class="btn btn-warning">
|
|
<i class="bi bi-pencil"></i> Edit
|
|
</a>
|
|
<form action="{{ route('admin.kriteria.destroy', $k) }}" method="POST" class="d-inline" onsubmit="return confirm('Yakin ingin menghapus kriteria ini? Semua data penilaian terkait kriteria ini akan terhapus!')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-danger">
|
|
<i class="bi bi-trash"></i> Hapus
|
|
</button>
|
|
</form>
|
|
</div>
|
|
@endif
|
|
</td>
|
|
@endif
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="{{ auth()->user()->hasRole('superadmin') ? 5 : 4 }}" class="text-center text-muted">Belum ada kriteria</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
<tfoot class="table-light">
|
|
<tr>
|
|
<td colspan="3" class="text-end fw-bold">Total Bobot:</td>
|
|
<td class="text-center fw-bold">
|
|
<span class="{{ abs($totalBobot - 1.00) < 0.001 ? 'text-success' : 'text-danger' }}">
|
|
{{ number_format($totalBobot, 2) }}
|
|
</span>
|
|
</td>
|
|
@if(auth()->user()->hasRole('superadmin'))
|
|
<td></td>
|
|
@endif
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection |