@extends('layouts.app') @section('title', 'Manajemen Template') @section('content')

@isset($kategori) Template Kategori: {{ $kategori->nama }} @else Semua Template @endisset

@if (!isset($kategori)) @endif
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif
@forelse($templates as $key => $template) @empty @endforelse
Nomor Nama Template Kategori Fitur Foto Harga Aksi
{{ ($templates->currentPage() - 1) * $templates->perPage() + $key + 1 }} {{ $template->nama_template }} {{ $template->kategori->nama ?? '-' }}
@forelse($template->fiturs as $f) {{ $f->deskripsi }} @empty - @endforelse
foto
Rp {{ number_format($template->harga, 0, ',', '.') }}
@csrf @method('DELETE')
Belum ada template
@if ($templates->hasPages())
{{-- Tombol Previous --}} @if ($templates->onFirstPage()) Prev @else Prev @endif @php $total = $templates->lastPage(); $current = $templates->currentPage(); @endphp {{-- Selalu tampilkan halaman pertama --}} @if ($current > 2) 1 @if ($current > 3) ... @endif @endif {{-- Hanya tampilkan 3 halaman di tengah --}} @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 ($templates->hasMorePages()) Next @else Next @endif
@endif @if (!isset($kategori)) @endif @foreach ($templates as $template) @endforeach
@endsection