diff --git a/backend/app/Http/Controllers/TemplateController.php b/backend/app/Http/Controllers/TemplateController.php index 410ffd9..d76b395 100644 --- a/backend/app/Http/Controllers/TemplateController.php +++ b/backend/app/Http/Controllers/TemplateController.php @@ -56,6 +56,7 @@ public function store(Request $request) return redirect()->route('templates.index')->with('success', 'Template berhasil ditambahkan!'); } + public function update(Request $request, Template $template) { $data = $request->validate([ diff --git a/backend/resources/views/admin/dashboard.blade.php b/backend/resources/views/admin/dashboard.blade.php index cdff7ce..d048d77 100644 --- a/backend/resources/views/admin/dashboard.blade.php +++ b/backend/resources/views/admin/dashboard.blade.php @@ -1,157 +1,232 @@ @extends('layouts.app') -@section('title', 'Manajemen Template') +@section('title', 'Halaman Dasbor') @section('content') -
-
-

Manajemen Template

- +
+ +
+

Halaman Dasbor

+
+
+ + {{ $today }} +
+
- -
-
- - + +
+
+
+
Kategori
+

{{ $totalKategori }}

+
+
+ +
+
+
+
+
Template
+

{{ $totalTemplate }}

+
+
+ +
+
+
+
+
Pelanggan
+

{{ $totalPelanggan }}

+
+
+ +
+
+
+ + +
+
+

Pelanggan Terbaru

+
+ - - - - - - + + + + + + + + + - @forelse($templates as $index => $template) + @forelse($recentPelanggan as $index => $pelanggan) - - - - - - + + + + + + + @empty - + @endforelse
NomorNama TemplateKategoriHargaFiturAksiNomorNamaTemplateKategoriEmailNo. TeleponHargaTanggal PemesananAksi
{{ $templates->firstItem() + $index }}{{ $template->nama_template }}{{ $template->kategori->nama_kategori ?? '-' }}Rp {{ number_format($template->harga, 0, ',', '.') }} - @foreach ($template->fiturs as $fitur) - {{ $fitur->nama_fitur }} - @endforeach + + {{ $recentPelanggan->firstItem() + $index }} - - - - - - -
- @csrf - @method('DELETE') -
{{ $pelanggan->nama_pemesan }}{{ $pelanggan->nama_template }}{{ $pelanggan->kategori ?? '-' }}{{ $pelanggan->email }}{{ $pelanggan->no_tlpn ?? '-' }} + Rp {{ number_format($pelanggan->harga, 0, ',', '.') }} + + {{ \Carbon\Carbon::parse($pelanggan->created_at)->format('d M Y') }} + +
+ + Detail + + - +
Belum ada template + Belum ada data pelanggan. +
-
- {{ $templates->links() }} + +
+
+ {{-- Tombol Previous --}} + @if ($recentPelanggan->onFirstPage()) + Prev + @else + Prev + @endif + + @php + $total = $recentPelanggan->lastPage(); + $current = $recentPelanggan->currentPage(); + @endphp + + {{-- Selalu tampilkan halaman pertama --}} + @if ($current > 2) + 1 + @if ($current > 3) + ... + @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) + {{ $i }} + @else + {{ $i }} + @endif + @endfor + + {{-- Selalu tampilkan halaman terakhir --}} + @if ($current < $total - 1) + @if ($current < $total - 2) + ... + @endif + {{ $total }} + @endif + + {{-- Tombol Next --}} + @if ($recentPelanggan->hasMorePages()) + Next + @else + Next + @endif +
-
- -