This commit is contained in:
Muzakki Parsaoran Siregar 2025-10-03 10:41:35 +07:00
parent 982bd80e8f
commit a79a804b68
9 changed files with 338 additions and 428 deletions

View File

@ -3,29 +3,13 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Kategori;
use App\Models\Template;
use App\Models\Pelanggan;
use Carbon\Carbon;
class DashboardController extends Controller
{
public function index()
{
$totalKategori = Kategori::count();
$totalTemplate = Template::count();
$totalPelanggan = Pelanggan::count();
$today = Carbon::now()->translatedFormat('l, d F Y');
// ambil 5 pelanggan terbaru
$recentPelanggan = Pelanggan::latest()->paginate(5);
return view('admin.dashboard', compact(
'totalKategori',
'totalTemplate',
'totalPelanggan',
'today',
'recentPelanggan'
));
// Karena jumlah kategori, template, dan pelanggan statis,
// maka kita tidak perlu query database di sini.
return view('admin.dashboard');
}
}

View File

@ -11,13 +11,13 @@ class TemplateController extends Controller
public function index()
{
$templates = Template::with('kategori')->get();
return view('admin.templates.index', compact('templates'));
return view('admin.template.index', compact('templates'));
}
// Form edit (untuk ubah harga / nama dsb)
public function edit(Template $template)
{
return view('admin.templates.edit', compact('template'));
return view('admin.template.edit', compact('template'));
}
// Update template (ubah harga / nama / paket)
@ -31,7 +31,7 @@ class TemplateController extends Controller
$template->update($validated);
return redirect()->route('admin.templates.index')
return redirect()->route('admin.template.index')
->with('success', 'Template berhasil diperbarui!');
}
}

View File

@ -1,232 +1,109 @@
@extends('layouts.app')
<!doctype html>
<html lang="id">
@section('title', 'Halaman Dasbor')
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login Admin</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: #ffffff;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
@section('content')
<div class="container mx-auto py-4">
<!-- Header -->
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Halaman Dasbor</h3>
<div class="flex items-center gap-3">
<div class="bg-blue-100 text-blue-600 px-3 py-2 rounded-lg flex items-center gap-2 text-sm">
<i class="bi bi-clock-history"></i>
{{ $today }}
</div>
</div>
.login-card {
background: #EFEFEF;
border-radius: 15px;
box-shadow: 0 0 25px rgb(0, 123, 255);
width: 100%;
max-width: 400px; /* batas lebar maksimum */
padding: 30px;
}
.login-logo {
display: block;
margin: 0 auto 15px;
max-width: 130px;
}
.btn-login {
background-color: #3bb9ff;
border: none;
border-radius: 8px;
}
.btn-login:hover {
background-color: #1a8edb;
}
.form-control {
border-radius: 10px;
}
/* Responsive padding */
@media (max-width: 576px) {
.login-card {
padding: 20px;
margin: 10px;
}
.login-logo {
max-width: 100px;
}
h4 {
font-size: 1.2rem;
}
p {
font-size: 0.9rem;
}
}
</style>
</head>
<body>
<div class="login-card">
<div class="text-center mb-3">
<!-- Logo -->
<img src="{{ asset('images/logo.png') }}" alt="Logo" class="login-logo">
</div>
<!-- Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Kategori</h5>
<h3 class="font-bold text-xl">{{ $totalKategori }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-diagram-3"></i>
</div>
<h4 class="text-center mb-2 fw-bold">SELAMAT DATANG</h4>
<p class="text-center text-muted mb-4">Silakan masukkan email dan password anda.</p>
@if ($errors->any())
<div class="alert alert-danger">
{{ $errors->first() }}
</div>
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Template</h5>
<h3 class="font-bold text-xl">{{ $totalTemplate }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-card-list"></i>
</div>
@endif
<form action="{{ route('admin.login.post') }}" method="POST">
@csrf
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="email" name="email" value="{{ old('email') }}" class="form-control"
placeholder="Masukkan nama Anda" required autofocus>
</div>
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Pelanggan</h5>
<h3 class="font-bold text-xl">{{ $totalPelanggan }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-person"></i>
</div>
<div class="mb-3">
<label class="form-label">Kata Sandi</label>
<input type="password" name="password" class="form-control"
placeholder="Masukkan kata sandi Anda" required>
</div>
</div>
<!-- Recent Pelanggan -->
<div class="bg-white rounded-lg shadow-sm mt-6">
<div class="p-4 overflow-x-auto">
<h4 class="text-lg font-bold mb-3">Pelanggan Terbaru</h4>
<table class="w-full text-left border-collapse border border-gray-300">
<thead class="bg-gray-100">
<tr>
<th class="p-2 border border-gray-300 text-center w-16">Nomor</th>
<th class="p-2 border border-gray-300 text-center">Nama</th>
<th class="p-2 border border-gray-300 text-center">Template</th>
<th class="p-2 border border-gray-300 text-center">Kategori</th>
<th class="p-2 border border-gray-300 text-center">Email</th>
<th class="p-2 border border-gray-300 text-center">No. Telepon</th>
<th class="p-2 border border-gray-300 text-center">Harga</th>
<th class="p-2 border border-gray-300 text-center">Tanggal Pemesanan</th>
<th class="p-2 border border-gray-300 text-center">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($recentPelanggan as $index => $pelanggan)
<tr>
<td class="p-2 py-4 border border-gray-300 text-center">
{{ $recentPelanggan->firstItem() + $index }}
</td>
<td class="p-2 py-4 border border-gray-300 truncate">{{ $pelanggan->nama_pemesan }}</td>
<td class="p-2 py-4 border border-gray-300 truncate">{{ $pelanggan->nama_template }}</td>
<td class="p-2 py-4 border border-gray-300 truncate">{{ $pelanggan->kategori ?? '-' }}</td>
<td class="p-2 py-4 border border-gray-300 truncate">{{ $pelanggan->email }}</td>
<td class="p-2 py-4 border border-gray-300 truncate">{{ $pelanggan->no_tlpn ?? '-' }}</td>
<td class="py-3 px-2 border border-gray-300 text-center">
Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}
</td>
<td class="py-3 px-2 border border-gray-300 text-center">
{{ \Carbon\Carbon::parse($pelanggan->created_at)->format('d M Y') }}
</td>
<td class="p-2 border border-gray-300 text-center">
<div class="flex justify-center space-x-2">
<a href="{{ route('admin.pelanggan.show', $pelanggan->id) }}"
class="text-blue-600 hover:underline flex items-center">
<i class="bi bi-eye mr-1"></i> Detail
</a>
<button class="text-red-600 hover:underline flex items-center openDeleteModalBtn"
data-id="{{ $pelanggan->id }}">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="p-2 text-center text-gray-500 border border-gray-300">
Belum ada data pelanggan.
</td>
</tr>
@endforelse
</tbody>
</table>
<!-- Pagination -->
<div class="p-4 flex justify-center">
<div class="flex space-x-1">
{{-- Tombol Previous --}}
@if ($recentPelanggan->onFirstPage())
<span class="px-3 py-1 rounded-lg bg-gray-200 text-gray-500 cursor-not-allowed">Prev</span>
@else
<a href="{{ $recentPelanggan->previousPageUrl() }}"
class="px-3 py-1 rounded-lg bg-gray-200 text-gray-700 hover:bg-gray-300">Prev</a>
@endif
@php
$total = $recentPelanggan->lastPage();
$current = $recentPelanggan->currentPage();
@endphp
{{-- Selalu tampilkan halaman pertama --}}
@if ($current > 2)
<a href="{{ $recentPelanggan->url(1) }}"
class="px-3 py-1 rounded-lg bg-gray-200 text-gray-700 hover:bg-blue-100">1</a>
@if ($current > 3)
<span class="px-3 py-1 text-gray-500">...</span>
@endif
@endif
{{-- Hanya tampilkan 3 halaman di tengah (current-1, current, current+1) --}}
@for ($i = max(1, $current - 1); $i <= min($total, $current + 1); $i++)
@if ($i == $current)
<span
class="px-3 py-1 rounded-lg bg-blue-600 text-white font-semibold">{{ $i }}</span>
@else
<a href="{{ $recentPelanggan->url($i) }}"
class="px-3 py-1 rounded-lg bg-gray-200 text-gray-700 hover:bg-blue-100">{{ $i }}</a>
@endif
@endfor
{{-- Selalu tampilkan halaman terakhir --}}
@if ($current < $total - 1)
@if ($current < $total - 2)
<span class="px-3 py-1 text-gray-500">...</span>
@endif
<a href="{{ $recentPelanggan->url($total) }}"
class="px-3 py-1 rounded-lg bg-gray-200 text-gray-700 hover:bg-blue-100">{{ $total }}</a>
@endif
{{-- Tombol Next --}}
@if ($recentPelanggan->hasMorePages())
<a href="{{ $recentPelanggan->nextPageUrl() }}"
class="px-3 py-1 rounded-lg bg-gray-200 text-gray-700 hover:bg-gray-300">Next</a>
@else
<span class="px-3 py-1 rounded-lg bg-gray-200 text-gray-500 cursor-not-allowed">Next</span>
@endif
</div>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember">
<label class="form-check-label" for="remember">Ingat saya</label>
</div>
<a href="#" class="text-decoration-none mt-2 mt-sm-0">Lupa kata sandi</a>
</div>
</div>
<button type="submit" class="btn btn-login text-white w-100">Login</button>
</form>
</div>
</body>
<!-- Modal Hapus Pelanggan -->
@foreach ($recentPelanggan as $pelanggan)
<div id="modalDelete{{ $pelanggan->id }}" class="fixed inset-0 hidden items-center justify-center z-50">
<div class="absolute inset-0 bg-black opacity-50 closeDeleteOverlay" data-id="{{ $pelanggan->id }}"></div>
<div class="bg-white rounded-lg shadow-lg w-full max-w-md z-50 overflow-hidden">
<div class="p-4 border-b">
<h5 class="text-lg font-medium">Hapus Pelanggan</h5>
</div>
<div class="p-4">
<p>Apakah Anda yakin ingin menghapus pelanggan <strong>{{ $pelanggan->nama_pemesan }}</strong>?</p>
</div>
<div class="p-4 border-t flex justify-end space-x-2">
<button type="button" class="bg-gray-300 text-black px-3 py-1 rounded closeDeleteBtn"
data-id="{{ $pelanggan->id }}">Batal</button>
<form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST"
class="inline">
@csrf
@method('DELETE')
<button class="bg-red-600 text-white px-3 py-1 rounded">Hapus</button>
</form>
</div>
</div>
</div>
@endforeach
<script>
document.addEventListener('DOMContentLoaded', () => {
const openDeleteBtns = document.querySelectorAll('.openDeleteModalBtn');
const closeDeleteBtns = document.querySelectorAll('.closeDeleteBtn');
const closeDeleteOverlays = document.querySelectorAll('.closeDeleteOverlay');
openDeleteBtns.forEach(btn => {
btn.addEventListener('click', () => {
const id = btn.dataset.id;
const modal = document.getElementById('modalDelete' + id);
if (modal) {
modal.classList.remove('hidden');
modal.classList.add('flex');
}
});
});
closeDeleteBtns.forEach(btn => {
btn.addEventListener('click', () => {
const id = btn.dataset.id;
const modal = document.getElementById('modalDelete' + id);
if (modal) {
modal.classList.add('hidden');
modal.classList.remove('flex');
}
});
});
closeDeleteOverlays.forEach(overlay => {
overlay.addEventListener('click', () => {
const id = overlay.dataset.id;
const modal = document.getElementById('modalDelete' + id);
if (modal) {
modal.classList.add('hidden');
modal.classList.remove('flex');
}
});
});
});
</script>
@endsection
</html>

View File

@ -10,7 +10,7 @@
<div class="flex items-center gap-3">
<div class="bg-blue-100 text-blue-600 px-3 py-2 rounded-lg flex items-center gap-2 text-sm">
<i class="bi bi-clock-history"></i>
02 Okt 2025
{{ \Carbon\Carbon::now()->translatedFormat('d M Y') }}
</div>
</div>
</div>

View File

@ -3,54 +3,79 @@
@section('title', 'Manajemen Kategori')
@section('content')
<div class="container mt-4">
<h2 class="mb-3">Daftar Kategori</h2>
<a href="{{ route('admin.kategori.create') }}" class="btn btn-primary mb-3">+ Tambah Kategori</a>
<div class="container mx-auto py-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Daftar Kategori</h2>
<a href="{{ route('admin.kategori.create') }}"
class="bg-blue-600 text-white px-4 py-2 rounded-lg shadow hover:bg-blue-700 flex items-center">
<i class="bi bi-plus-lg mr-1"></i> Tambah Kategori
</a>
</div>
<!-- Flash Message -->
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
<div class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
{{ session('success') }}
</div>
@endif
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>Nama</th>
<th>Deskripsi</th>
<th>Foto</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@forelse($kategori as $index => $kat)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $kat->nama }}</td>
<td>{{ $kat->deskripsi }}</td>
<td>
@if($kat->foto)
<img src="{{ asset('storage/'.$kat->foto) }}" width="80" class="img-thumbnail">
@else
<span class="text-muted">Tidak ada</span>
@endif
</td>
<td>
<a href="{{ route('admin.kategori.edit', $kat->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ route('admin.kategori.destroy', $kat->id) }}" method="POST" class="d-inline"
onsubmit="return confirm('Yakin ingin menghapus kategori ini?')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="text-center">Belum ada kategori.</td>
</tr>
@endforelse
</tbody>
</table>
<!-- Tabel -->
<div class="bg-white rounded-lg shadow overflow-x-auto">
<table class="w-full border border-gray-200 text-left border-collapse">
<thead class="bg-gray-100">
<tr>
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">#</th>
<th class="px-3 py-2 border border-gray-200">Nama</th>
<th class="px-3 py-2 border border-gray-200">Deskripsi</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[100px]">Foto</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[150px]">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($kategori as $index => $kat)
<tr class="hover:bg-gray-50">
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $kat->nama }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $kat->deskripsi ?? '-' }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
@if($kat->foto)
<div class="w-16 h-16 mx-auto rounded overflow-hidden bg-gray-100 flex items-center justify-center">
<img src="{{ asset('storage/'.$kat->foto) }}"
class="max-w-full max-h-full object-contain">
</div>
@else
<span class="text-gray-400 text-sm">Tidak ada</span>
@endif
</td>
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center gap-2">
<a href="{{ route('admin.kategori.edit', $kat->id) }}"
class="px-3 py-1 rounded bg-yellow-500 text-white text-sm hover:bg-yellow-600 flex items-center">
<i class="bi bi-pencil mr-1"></i> Edit
</a>
<form action="{{ route('admin.kategori.destroy', $kat->id) }}"
method="POST"
onsubmit="return confirm('Yakin ingin menghapus kategori ini?')">
@csrf
@method('DELETE')
<button type="submit"
class="px-3 py-1 rounded bg-red-600 text-white text-sm hover:bg-red-700 flex items-center">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5"
class="px-3 py-4 text-center text-gray-500 border border-gray-200">
Belum ada kategori.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -0,0 +1,67 @@
@extends('layouts.app')
@section('title', 'Edit Template')
@section('content')
<div class="container mt-4">
<h2>Edit Template</h2>
{{-- Alert sukses / error --}}
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
@if($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach($errors->all() as $err)
<li>{{ $err }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('admin.template.update', $template->id) }}" method="POST">
@csrf
@method('PUT')
{{-- Nama Template --}}
<div class="mb-3">
<label for="nama_template" class="form-label">Nama Template</label>
<input type="text" name="nama_template" id="nama_template"
class="form-control @error('nama_template') is-invalid @enderror"
value="{{ old('nama_template', $template->nama_template) }}" required>
@error('nama_template')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
{{-- Harga --}}
<div class="mb-3">
<label for="harga" class="form-label">Harga</label>
<input type="number" name="harga" id="harga"
class="form-control @error('harga') is-invalid @enderror"
value="{{ old('harga', $template->harga) }}" required>
@error('harga')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
{{-- Paket --}}
<div class="mb-3">
<label for="paket" class="form-label">Paket</label>
<select name="paket" id="paket" class="form-select @error('paket') is-invalid @enderror" required>
<option value="starter" {{ old('paket', $template->paket) == 'starter' ? 'selected' : '' }}>Starter</option>
<option value="basic" {{ old('paket', $template->paket) == 'basic' ? 'selected' : '' }}>Basic</option>
<option value="premium" {{ old('paket', $template->paket) == 'premium' ? 'selected' : '' }}>Premium</option>
</select>
@error('paket')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
{{-- Tombol --}}
<button type="submit" class="btn btn-primary">Simpan Perubahan</button>
<a href="{{ route('admin.template.index') }}" class="btn btn-secondary">Batal</a>
</form>
</div>
@endsection

View File

@ -3,37 +3,58 @@
@section('title', 'Manajemen Template')
@section('content')
<div class="container mt-4">
<h2>Daftar Template</h2>
<a href="{{ route('admin.templates.create') }}" class="btn btn-primary mb-3">+ Tambah Template</a>
<div class="container mx-auto py-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Daftar Template</h2>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>Nama</th>
<th>Kategori</th>
<th>Paket</th>
<th>Harga</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach($templates as $t)
<tr>
<td>{{ $t->nama_template }}</td>
<td>{{ $t->kategori->nama ?? '-' }}</td>
<td>{{ ucfirst($t->paket) }}</td>
<td>Rp {{ number_format($t->harga,0,',','.') }}</td>
<td>
<a href="{{ route('admin.templates.edit',$t->id) }}" class="btn btn-sm btn-warning">Edit</a>
<form action="{{ route('admin.templates.destroy',$t->id) }}" method="POST" class="d-inline">
@csrf @method('DELETE')
<button class="btn btn-sm btn-danger" onclick="return confirm('Yakin hapus?')">Hapus</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
<!-- Flash Message -->
@if(session('success'))
<div class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
{{ session('success') }}
</div>
@endif
<!-- Tabel -->
<div class="bg-white rounded-lg shadow overflow-x-auto">
<table class="w-full border border-gray-200 text-left border-collapse">
<thead class="bg-gray-100">
<tr>
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">#</th>
<th class="px-3 py-2 border border-gray-200">Nama</th>
<th class="px-3 py-2 border border-gray-200">Kategori</th>
<th class="px-3 py-2 border border-gray-200">Paket</th>
<th class="px-3 py-2 border border-gray-200">Harga</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[120px]">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($templates as $index => $t)
<tr class="hover:bg-gray-50">
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $t->nama_template }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $t->kategori->nama ?? '-' }}</td>
<td class="px-3 py-2 border border-gray-200">{{ ucfirst($t->paket) }}</td>
<td class="px-3 py-2 border border-gray-200">Rp {{ number_format($t->harga,0,',','.') }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center gap-2">
<a href="{{ route('admin.template.edit', $t->id) }}"
class="px-3 py-1 rounded bg-yellow-500 text-white text-sm hover:bg-yellow-600 flex items-center">
<i class="bi bi-pencil mr-1"></i> Edit
</a>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6"
class="px-3 py-4 text-center text-gray-500 border border-gray-200">
Belum ada template.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Admin Panel</title>
<title>@yield('title', 'Admin Panel')</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<style>
@ -12,8 +12,6 @@
background-color: #f1f5f9;
font-family: 'Poppins', sans-serif;
}
/* Sidebar */
.sidebar {
width: 250px;
height: 100vh;
@ -27,90 +25,43 @@
justify-content: space-between;
transition: all 0.3s ease;
}
.submenu {
display: none;
}
.submenu.show {
display: block;
}
</style>
</head>
<body class="flex">
<!-- Sidebar -->
<div class="sidebar flex flex-col">
<div class="text-center py-4 border-b">
<img src="https://via.placeholder.com/150x50.png?text=Logo" alt="Logo" class="mx-auto mb-2" style="max-height: 80px;">
<img src="https://via.placeholder.com/150x50.png?text=Logo" alt="Logo" class="mx-auto mb-2"
style="max-height: 80px;">
</div>
<div class="flex-1 overflow-y-auto">
<p class="text-gray-500 uppercase text-xs font-semibold px-3 mt-4 mb-2">Menu Utama</p>
<ul class="px-2 space-y-1">
<li>
<a href="#" class="flex items-center py-2 px-3 rounded hover:bg-blue-50 bg-blue-100 text-blue-600">
<a href="{{ route('admin.dashboard') }}"
class="flex items-center py-2 px-3 rounded hover:bg-blue-50 {{ request()->routeIs('admin.dashboard') ? 'bg-blue-100 text-blue-600' : 'text-gray-700' }}">
<i class="bi bi-house-door me-2"></i> Dasbor
</a>
</li>
<li>
<a href="#" class="flex items-center py-2 px-3 rounded hover:bg-blue-50 text-gray-700">
<a href="{{ route('admin.kategori.index') }}"
class="flex items-center py-2 px-3 rounded hover:bg-blue-50 {{ request()->routeIs('admin.kategori.*') ? 'bg-blue-100 text-blue-600' : 'text-gray-700' }}">
<i class="bi bi-diagram-3 me-2"></i> Kategori
</a>
</li>
<li>
<button class="w-full flex items-center justify-between py-2 px-3 text-gray-700 rounded hover:bg-blue-50" id="manajemenFiturBtn">
<span><i class="bi bi-grid me-2"></i>Manajemen Fitur</span>
<i class="bi bi-chevron-down transition-transform" id="manajemenFiturIcon"></i>
</button>
<ul class="submenu pl-6 space-y-1 mt-2" id="manajemenFiturSubmenu">
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Kategori Fitur
</a>
</li>
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Fitur
</a>
</li>
</ul>
</li>
<li>
<button class="w-full flex items-center justify-between py-2 px-3 text-gray-700 rounded hover:bg-blue-50" id="templatBtn">
<span><i class="bi bi-card-list me-2"></i>Manajemen Templat</span>
<i class="bi bi-chevron-down transition-transform" id="templatIcon"></i>
</button>
<ul class="submenu pl-6 space-y-1" id="templatSubmenu">
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Semua Template
</a>
</li>
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Undangan Pernikahan
</a>
</li>
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Kartu Ulang Tahun
</a>
</li>
<li>
<a href="#" class="block py-2 px-2 rounded text-gray-500 hover:text-blue-600 hover:bg-blue-50">
Poster Acara
</a>
</li>
</ul>
<a href="{{ route('admin.template.index') }}"
class="flex items-center py-2 px-3 rounded hover:bg-blue-50 {{ request()->routeIs('admin.template.*') ? 'bg-blue-100 text-blue-600' : 'text-gray-700' }}">
<i class="bi bi-diagram-3 me-2"></i> Template
</a>
</li>
<li>
<a href="#" class="flex items-center py-2 px-3 rounded hover:bg-blue-50 text-gray-700">
<i class="bi bi-people me-2"></i> Pelanggan
</a>
</li>
<li>
<a href="#" class="flex items-center py-2 px-3 rounded hover:bg-blue-50 text-gray-700">
<i class="bi bi-chat-dots me-2"></i> Ulasan
@ -121,44 +72,21 @@
<p class="text-gray-500 uppercase text-xs font-semibold px-3 mt-4 mb-2">Akun</p>
<ul class="px-2 space-y-1">
<li>
<a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" class="flex items-center py-2 px-3 text-red-600 font-semibold hover:bg-red-50 rounded">
<a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
class="flex items-center py-2 px-3 text-red-600 font-semibold hover:bg-red-50 rounded">
<i class="bi bi-box-arrow-right me-2"></i> Keluar
</a>
<form id="logout-form" action="#" method="POST" class="hidden">
</form>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="hidden">
@csrf
</form>
</li>
</ul>
</div>
</div>
<!-- Konten Utama -->
<div class="flex-1 ml-[250px] p-6">
<h1 class="text-2xl font-bold mb-4">Dasbor</h1>
<div class="bg-white p-6 rounded-lg shadow">
<p>Selamat datang di panel admin. Ini adalah area konten utama.</p>
</div>
@yield('content')
</div>
<script>
// Dropdown Templat
const templatBtn = document.getElementById('templatBtn');
const templatSubmenu = document.getElementById('templatSubmenu');
const templatIcon = document.getElementById('templatIcon');
templatBtn.addEventListener('click', () => {
templatSubmenu.classList.toggle('show');
templatIcon.classList.toggle('rotate-180');
});
// Dropdown Manajemen Fitur
const manajemenFiturBtn = document.getElementById('manajemenFiturBtn');
const manajemenFiturSubmenu = document.getElementById('manajemenFiturSubmenu');
const manajemenFiturIcon = document.getElementById('manajemenFiturIcon');
manajemenFiturBtn.addEventListener('click', () => {
manajemenFiturSubmenu.classList.toggle('show');
manajemenFiturIcon.classList.toggle('rotate-180');
});
</script>
</body>
</html>

View File

@ -3,25 +3,26 @@
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AdminAuthController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\KategoriController;
use App\Http\Controllers\TemplateController;
use Illuminate\Support\Facades\Auth;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
// logout umum
Route::post('/logout', function () {
Auth::logout();
request()->session()->invalidate();
request()->session()->regenerateToken();
return redirect()->route('admin.login');
})->name('logout');
// Redirect root "/" ke halaman login admin
// redirect root ke login admin
Route::get('/', function () {
return redirect()->route('admin.login');
});
// Admin Auth
// Admin routes
Route::prefix('admin')->name('admin.')->group(function () {
// Auth
Route::middleware('guest:admin')->group(function () {
Route::get('/login', [AdminAuthController::class, 'showLogin'])->name('login');
Route::post('/login', [AdminAuthController::class, 'login'])->name('login.post');
@ -29,10 +30,17 @@ Route::prefix('admin')->name('admin.')->group(function () {
Route::middleware('auth:admin')->group(function () {
Route::get('/dashboard', function () {
return view('admin.dashboard');
})->name('dashboard');
return view('admin.dashboard');
})->name('dashboard');
Route::post('/logout', [AdminAuthController::class, 'logout'])->name('logout');
// Resource routes
Route::resource('kategori', KategoriController::class);
// Template routes (index, edit, update)
Route::get('/template', [TemplateController::class, 'index'])->name('template.index');
Route::get('/template/{template}/edit', [TemplateController::class, 'edit'])->name('template.edit');
Route::put('/template/{template}', [TemplateController::class, 'update'])->name('template.update');
});
});