91 lines
4.6 KiB
PHP
91 lines
4.6 KiB
PHP
@extends('template.admin')
|
|
|
|
@section('content')
|
|
<div class="max-w-6xl mx-auto p-6 bg-white shadow-md rounded-lg">
|
|
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-lg font-semibold text-gray-800 border-b pb-2">Daftar Sub Kriteria</h1>
|
|
<a href="{{ route('sub-kriteria.create') }}"
|
|
class="flex items-center gap-2 bg-[#1e3a8a] text-white px-4 py-2 rounded hover:bg-[#163570] transition">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
|
|
stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4v16m8-8H4" />
|
|
</svg>
|
|
Tambah Sub Kriteria
|
|
</a>
|
|
</div>
|
|
|
|
{{-- Filter berdasarkan Kriteria --}}
|
|
<form method="GET" class="mb-4">
|
|
<div class="flex items-center space-x-4">
|
|
<label for="kriteria_id" class="text-sm text-gray-700 font-medium">Filter Kriteria:</label>
|
|
<select name="kriteria_id" id="kriteria_id" onchange="this.form.submit()"
|
|
class="border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring focus:ring-blue-200">
|
|
<option value="">-- Semua Kriteria --</option>
|
|
@foreach ($allKriteria as $kriteria)
|
|
<option value="{{ $kriteria->id }}" {{ request('kriteria_id') == $kriteria->id ? 'selected' : '' }}>
|
|
{{ $kriteria->nama_kriteria }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</form>
|
|
|
|
@if(session('success'))
|
|
<div class="mb-4 text-green-600">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
|
|
<table class="w-full table-auto border-collapse text-sm text-gray-700">
|
|
<thead>
|
|
<tr class="bg-gray-50">
|
|
<th class="border-b border-gray-200 px-4 py-2 text-left font-medium text-gray-600">#</th>
|
|
<th class="border-b border-gray-200 px-4 py-2 text-left font-medium text-gray-600">Nama Sub Kriteria</th>
|
|
<th class="border-b border-gray-200 px-4 py-2 text-left font-medium text-gray-600">Kriteria</th>
|
|
<th class="border-b border-gray-200 px-4 py-2 text-left font-medium text-gray-600">Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse ($subkriteria as $item)
|
|
<tr class="hover:bg-gray-50 transition-colors duration-150 cursor-pointer">
|
|
<td class="border-b border-gray-100 px-4 py-3">{{ $loop->iteration }}</td>
|
|
<td class="border-b border-gray-100 px-4 py-3">{{ $item->nama_subkriteria }}</td>
|
|
<td class="border-b border-gray-100 px-4 py-3">{{ $item->kriteria->nama_kriteria }}</td>
|
|
<td class="border-b border-gray-100 px-4 py-3 flex space-x-4">
|
|
<a href="{{ route('sub-kriteria.edit', $item->id) }}" class="text-[#1e3a8a] hover:text-[#163570]" title="Edit">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24"
|
|
stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="M11 5H6a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2v-5m-10-7l8 8m-3 0h3v3" />
|
|
</svg>
|
|
</a>
|
|
|
|
<form action="{{ route('sub-kriteria.destroy', $item) }}" method="POST" class="inline"
|
|
onsubmit="return confirm('Yakin ingin menghapus data ini?');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="text-red-600 hover:text-red-800 bg-transparent" title="Hapus">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none"
|
|
viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round"
|
|
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5-4h4m-4 0a2 2 0 00-2 2v2h8V5a2 2 0 00-2-2m-4 0h4" />
|
|
</svg>
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="4" class="text-center py-6 text-gray-400 italic">Belum ada data sub kriteria.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="mt-6">
|
|
{{ $subkriteria->withQueryString()->links() }}
|
|
</div>
|
|
</div>
|
|
@endsection
|