101 lines
7.2 KiB
PHP
101 lines
7.2 KiB
PHP
@extends('layouts.admin-app')
|
|
|
|
@section('page-title', '📰 Manajemen Artikel')
|
|
@section('page-subtitle', 'Kelola artikel edukasi')
|
|
|
|
@section('content')
|
|
@if (session('success'))
|
|
<div class="mb-6 bg-green-100 border-l-4 border-green-500 text-green-700 p-4 rounded-lg flex items-center">
|
|
<svg class="w-6 h-6 mr-3" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span class="font-semibold">{{ session('success') }}</span>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="bg-white rounded-2xl shadow-lg">
|
|
<div class="p-8">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<div class="flex items-center">
|
|
<div class="bg-gradient-to-r from-yellow-500 to-yellow-600 rounded-xl p-3 mr-4">
|
|
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"></path>
|
|
</svg>
|
|
</div>
|
|
<h3 class="text-xl font-bold text-gray-800">Daftar Artikel Edukasi</h3>
|
|
</div>
|
|
<a href="{{ route('admin.artikel.create') }}" class="flex items-center px-5 py-3 bg-gradient-to-r from-yellow-500 to-yellow-600 text-white font-bold rounded-xl hover:from-yellow-600 hover:to-yellow-700 transition-all shadow-lg hover:shadow-xl transform hover:scale-105">
|
|
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
|
|
</svg>
|
|
Tambah Artikel
|
|
</a>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto rounded-xl border border-gray-200">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-gray-600 uppercase">No</th>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-gray-600 uppercase">Judul</th>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-gray-600 uppercase">Kategori</th>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-gray-600 uppercase">Penulis</th>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-gray-600 uppercase">Tanggal</th>
|
|
<th class="px-6 py-4 text-center text-xs font-bold text-gray-600 uppercase">Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
@forelse ($artikels as $index => $artikel)
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-6 py-4 text-sm">{{ $artikels->firstItem() + $index }}</td>
|
|
<td class="px-6 py-4">
|
|
<div class="text-sm font-semibold text-gray-900">{{ $artikel->judul }}</div>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<span class="px-3 py-1 text-xs font-bold rounded-full bg-yellow-100 text-yellow-800">
|
|
{{ $artikel->kategori }}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-600">{{ $artikel->penulis ?? 'Admin' }}</td>
|
|
<td class="px-6 py-4 text-sm text-gray-600">{{ $artikel->created_at->format('d M Y') }}</td>
|
|
<td class="px-6 py-4 text-center">
|
|
<div class="flex justify-center space-x-2">
|
|
<a href="{{ route('admin.artikel.edit', $artikel) }}" class="inline-flex items-center px-3 py-2 bg-blue-500 text-white text-xs font-semibold rounded-lg hover:bg-blue-600 transition">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
|
</svg>
|
|
Edit
|
|
</a>
|
|
<form action="{{ route('admin.artikel.destroy', $artikel) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus artikel ini?')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="inline-flex items-center px-3 py-2 bg-red-500 text-white text-xs font-semibold rounded-lg hover:bg-red-600 transition">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
|
|
</svg>
|
|
Hapus
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="px-6 py-12 text-center">
|
|
<div class="text-gray-400">
|
|
<svg class="w-16 h-16 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"></path>
|
|
</svg>
|
|
<p class="text-xl font-semibold mb-2">Belum ada artikel</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-6">{{ $artikels->links() }}</div>
|
|
</div>
|
|
</div>
|
|
@endsection |