initial commit
This commit is contained in:
@@ -1,182 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
@php
|
||||
// Optimasi: Gunakan try-catch agar jika tabel settings belum dimigrasi, app tidak crash
|
||||
try {
|
||||
$settings = \App\Models\Setting::whereIn('key', ['app_name', 'app_slogan', 'app_favicon', 'app_version'])
|
||||
->pluck('value', 'key');
|
||||
} catch (\Exception $e) {
|
||||
$settings = collect();
|
||||
}
|
||||
|
||||
$appName = $settings['app_name'] ?? config('app.name', 'Ily Cattery');
|
||||
$appSlogan = $settings['app_slogan'] ?? 'Dedikasi untuk Kesehatan dan Kebahagiaan Anabul';
|
||||
$appVersion = $settings['app_version'] ?? 'v1.0.0';
|
||||
$favicon = $settings['app_favicon'] ?? null;
|
||||
@endphp
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="{{ $favicon ? Storage::url($favicon) : asset('favicon.ico') }}">
|
||||
|
||||
<title>{{ $appName }}</title>
|
||||
|
||||
{{-- Fonts & Icons --}}
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600,800,900&display=swap" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
|
||||
{{-- Scripts & Styles --}}
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
|
||||
@stack('styles')
|
||||
|
||||
<style>
|
||||
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
|
||||
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }
|
||||
[x-cloak] { display: none !important; }
|
||||
|
||||
/* Animasi Fade In untuk Main Content */
|
||||
.page-fade-in { animation: fadeIn 0.4s ease-out; }
|
||||
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
|
||||
</style>
|
||||
</head>
|
||||
<body class="font-sans antialiased text-slate-900 bg-slate-50 h-full overflow-hidden">
|
||||
|
||||
<div class="flex h-screen overflow-hidden">
|
||||
|
||||
{{-- Sidebar Navigation --}}
|
||||
@include('layouts.navigation-sidebar')
|
||||
|
||||
<div class="flex-1 flex flex-col min-w-0 bg-slate-50 relative">
|
||||
|
||||
{{-- Top Navigation --}}
|
||||
@include('layouts.navigation')
|
||||
|
||||
{{-- Main Content Area --}}
|
||||
<main class="flex-1 overflow-y-auto custom-scrollbar flex flex-col">
|
||||
<div class="max-w-7xl mx-auto w-full p-4 md:p-8 flex-grow page-fade-in">
|
||||
|
||||
{{-- Notifikasi Error/Validasi (Hanya muncul jika bukan AJAX) --}}
|
||||
@if ($errors->any())
|
||||
<div x-data="{ show: true }" x-show="show" x-cloak
|
||||
class="mb-6 p-4 bg-rose-50 border-2 border-rose-100 text-rose-700 rounded-3xl flex items-start shadow-sm transition-all">
|
||||
<i class="fas fa-exclamation-circle mt-0.5 mr-3 text-lg"></i>
|
||||
<div>
|
||||
<h4 class="text-[11px] font-black uppercase tracking-widest mb-1">Terjadi Kesalahan Input:</h4>
|
||||
<ul class="list-disc list-inside text-[10px] font-bold opacity-80">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
<button @click="show = false" class="ml-auto text-rose-300 hover:text-rose-500"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Main Slot (Halaman Konten Anda) --}}
|
||||
{{ $slot }}
|
||||
|
||||
</div>
|
||||
|
||||
{{-- Footer --}}
|
||||
<footer class="w-full py-8 border-t border-slate-100 mt-auto bg-white/50 backdrop-blur-md">
|
||||
<div class="max-w-7xl mx-auto px-8 text-center">
|
||||
<p class="text-[10px] font-black text-slate-400 uppercase tracking-[0.3em] mb-1">
|
||||
{{ $appName }}
|
||||
</p>
|
||||
<p class="text-[9px] text-slate-300 font-bold tracking-widest italic uppercase">
|
||||
{{ $appSlogan }} — {{ $appVersion }}
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
<html lang="id" class="h-full">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
@php
|
||||
$appName = \App\Models\Setting::where('key','app_name')->value('value') ?? config('app.name','ILY Cattery');
|
||||
$favicon = \App\Models\Setting::where('key','app_favicon')->value('value');
|
||||
@endphp
|
||||
<title>{{ $appName }}</title>
|
||||
<link rel="icon" href="{{ $favicon ? Storage::url($favicon) : asset('favicon.ico') }}">
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=inter:400,500,600,700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
@vite(['resources/css/app.css','resources/js/app.js'])
|
||||
@stack('styles')
|
||||
<style>[x-cloak]{display:none!important}</style>
|
||||
</head>
|
||||
<body class="h-full bg-slate-50 font-sans text-slate-800 antialiased" x-data="{sidebarOpen: window.innerWidth >= 1024}" @resize.window="if(window.innerWidth>=1024) sidebarOpen=true">
|
||||
<div class="flex min-h-screen">
|
||||
@include('layouts.navigation-sidebar')
|
||||
<div class="flex min-w-0 flex-1 flex-col">
|
||||
@include('layouts.navigation')
|
||||
<main class="flex-1 overflow-y-auto">
|
||||
<div class="mx-auto w-full max-w-[1500px] p-4 md:p-6 lg:p-8">
|
||||
@if($errors->any())
|
||||
<div class="mb-5 border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700"><p class="font-semibold">Periksa kembali data yang diisi.</p><ul class="mt-1 list-disc pl-5">@foreach($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul></div>
|
||||
@endif
|
||||
@if(session('success'))<div class="mb-5 border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-700">{{ session('success') }}</div>@endif
|
||||
@if(session('error'))<div class="mb-5 border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700">{{ session('error') }}</div>@endif
|
||||
@if(session('warning'))<div class="mb-5 border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700">{{ session('warning') }}</div>@endif
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{{-- SWEETALERT 2 INTEGRATION --}}
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// 1. KONFIGURASI TOAST
|
||||
const IlyToast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
timer: 3500,
|
||||
timerProgressBar: true,
|
||||
didOpen: (toast) => {
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
},
|
||||
customClass: {
|
||||
popup: 'rounded-2xl shadow-2xl border border-slate-50 p-4',
|
||||
title: 'text-[11px] font-black uppercase tracking-widest ml-2'
|
||||
}
|
||||
});
|
||||
|
||||
// 2. FUNGSI GLOBAL TOAST (Bisa dipanggil di file JS manapun)
|
||||
window.showToast = function(message, icon = 'success') {
|
||||
IlyToast.fire({
|
||||
icon: icon,
|
||||
title: message,
|
||||
iconColor: icon === 'success' ? '#4f46e5' : '#e11d48',
|
||||
});
|
||||
}
|
||||
|
||||
// 3. AUTO-TRIGGER FLASH MESSAGE
|
||||
@if(session('success'))
|
||||
showToast("{{ session('success') }}", 'success');
|
||||
@endif
|
||||
|
||||
@if(session('error'))
|
||||
showToast("{{ session('error') }}", 'error');
|
||||
@endif
|
||||
|
||||
// 4. FUNGSI GLOBAL KONFIRMASI DELETE (Universal)
|
||||
// Mendukung pemanggilan via ID Form (confirmDelete('formId', 'Nama'))
|
||||
// Atau pemanggilan via Element (confirmDelete(this, 'Nama'))
|
||||
window.confirmDelete = function(target, itemName = 'Data ini') {
|
||||
const finalName = itemName || 'Data terpilih';
|
||||
|
||||
Swal.fire({
|
||||
title: 'HAPUS DATA?',
|
||||
html: "<div class='text-sm text-slate-500 font-medium'>Anda akan menghapus:<br><b class='text-slate-800 uppercase tracking-tighter'>" + finalName + "</b><br><br><span class='text-rose-500 font-bold italic'>Peringatan: Data yang dihapus tidak dapat dipulihkan!</span></div>",
|
||||
icon: 'warning',
|
||||
iconColor: '#e11d48',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#e11d48',
|
||||
cancelButtonColor: '#f1f5f9',
|
||||
confirmButtonText: 'YA, HAPUS PERMANEN',
|
||||
cancelButtonText: 'BATAL',
|
||||
reverseButtons: true,
|
||||
customClass: {
|
||||
popup: 'rounded-[2.5rem] p-10 border-none shadow-2xl',
|
||||
confirmButton: 'rounded-2xl font-black uppercase text-[10px] px-8 py-4 ml-3 tracking-widest shadow-lg shadow-rose-100',
|
||||
cancelButton: 'rounded-2xl font-black uppercase text-[10px] px-8 py-4 text-slate-500 tracking-widest'
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Logic: Jika target adalah string, cari by ID. Jika object, cari closest form.
|
||||
if (typeof target === 'string') {
|
||||
const form = document.getElementById(target);
|
||||
if(form) form.submit();
|
||||
} else {
|
||||
const form = target.closest('form');
|
||||
if(form) form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
window.confirmDelete=function(target,itemName='data ini'){
|
||||
Swal.fire({title:'Hapus data?',text:`${itemName} akan dihapus.`,icon:'warning',showCancelButton:true,confirmButtonText:'Hapus',cancelButtonText:'Batal',confirmButtonColor:'#e11d48'}).then(r=>{if(r.isConfirmed){if(typeof target==='string')document.getElementById(target)?.submit();else target.closest('form')?.submit();}})
|
||||
}
|
||||
</script>
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,167 +1,97 @@
|
||||
<aside class="w-72 bg-white border-r border-slate-200 hidden lg:flex flex-col sticky top-0 h-screen transition-all shadow-sm">
|
||||
|
||||
@php
|
||||
$appSettings = \Illuminate\Support\Facades\Cache::remember('app_sidebar_settings', 3600, function() {
|
||||
return \App\Models\Setting::whereIn('key', ['app_logo', 'app_name'])->pluck('value', 'key');
|
||||
});
|
||||
$appName = $appSettings['app_name'] ?? 'Ily Cattery';
|
||||
@php
|
||||
$appName = \App\Models\Setting::where('key', 'app_name')->value('value') ?? 'ILY Cattery';
|
||||
$appLogo = \App\Models\Setting::where('key', 'app_logo')->value('value');
|
||||
$lowObatsCount = \App\Models\Medicine::where('qty', '<', 5)->count();
|
||||
$lowMakananCount = \App\Models\Food::where('qty', '<', 5)->count();
|
||||
@endphp
|
||||
|
||||
$lowMedicinesCount = \App\Models\Medicine::where('qty', '<', 5)->count();
|
||||
$lowFoodsCount = \App\Models\Food::where('qty', '<', 5)->count();
|
||||
@endphp
|
||||
|
||||
{{-- Brand Header --}}
|
||||
<div class="p-8 flex items-center gap-4">
|
||||
<div class="w-12 h-12 bg-indigo-600 rounded-[1.25rem] flex items-center justify-center shadow-xl shadow-indigo-100">
|
||||
<i class="fas fa-cat text-white text-xl"></i>
|
||||
</div>
|
||||
<div x-show="sidebarOpen" x-cloak @click="sidebarOpen=false" class="fixed inset-0 z-30 bg-slate-900/30 lg:hidden"></div>
|
||||
<aside :class="sidebarOpen ? 'translate-x-0' : '-translate-x-full lg:translate-x-0'"
|
||||
class="fixed inset-y-0 left-0 z-40 flex w-64 shrink-0 flex-col border-r border-slate-200 bg-white transition-transform duration-200 lg:static lg:z-auto">
|
||||
<div class="flex h-16 items-center gap-3 border-b border-slate-200 px-5">
|
||||
@if($appLogo)
|
||||
<img src="{{ Storage::url($appLogo) }}" alt="Logo {{ $appName }}" class="h-9 w-9 rounded-lg object-contain">
|
||||
@else
|
||||
<div class="flex h-9 w-9 items-center justify-center rounded-lg bg-indigo-600 text-white"><i class="fas fa-cat"></i></div>
|
||||
@endif
|
||||
<div class="min-w-0">
|
||||
<h1 class="text-sm font-black text-slate-800 uppercase tracking-tighter truncate leading-none mb-1">{{ $appName }}</h1>
|
||||
<p class="text-[9px] font-black text-slate-400 uppercase tracking-[0.2em] leading-none">Management System</p>
|
||||
<div class="truncate text-sm font-bold text-slate-900">{{ $appName }}</div>
|
||||
<div class="text-xs text-slate-500">Manajemen cattery</div>
|
||||
</div>
|
||||
<button @click="sidebarOpen=false" class="ml-auto p-2 text-slate-400 lg:hidden" aria-label="Tutup menu"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
|
||||
{{-- Navigation Links --}}
|
||||
<nav class="flex-1 px-4 space-y-1 overflow-y-auto custom-scrollbar">
|
||||
|
||||
<x-sidebar-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" icon="fa-th-large">
|
||||
Dashboard
|
||||
</x-sidebar-link>
|
||||
<nav class="flex-1 overflow-y-auto px-3 py-4">
|
||||
<div class="space-y-1">
|
||||
<x-sidebar-link :href="route('dashboard')" :active="request()->routeIs('dashboard') && !request()->boolean('weight_focus')" icon="fa-house" tone="indigo">Beranda</x-sidebar-link>
|
||||
<x-sidebar-link :href="route('dashboard', ['weight_focus' => 1]) . '#pemantauan-berat'" :active="request()->routeIs('dashboard') && request()->boolean('weight_focus')" icon="fa-weight-scale" tone="blue">Berat badan</x-sidebar-link>
|
||||
</div>
|
||||
|
||||
{{-- OPERASIONAL --}}
|
||||
@if(Gate::allows('check-access', ['cats', 'read']) || Gate::allows('check-access', ['matting', 'read']))
|
||||
<div class="pt-6 pb-2 px-5 text-[9px] font-black text-slate-400 uppercase tracking-[0.3em] flex items-center gap-3">
|
||||
<span>Operasional</span>
|
||||
<div class="h-px bg-slate-100 flex-1"></div>
|
||||
@if(Gate::allows('check-access', ['cats','read']) || Gate::allows('check-access', ['matting','read']) || Gate::allows('check-access', ['treatments','read']))
|
||||
<div class="mt-6">
|
||||
<p class="px-3 pb-2 text-xs font-semibold text-slate-400">Operasional</p>
|
||||
<div class="space-y-1">
|
||||
@can('check-access', ['cats','read'])
|
||||
<x-sidebar-link :href="route('cats.index')" :active="request()->routeIs('cats.*')" icon="fa-cat" tone="sky">Data kucing</x-sidebar-link>
|
||||
@endcan
|
||||
@can('check-access', ['matting','read'])
|
||||
<x-sidebar-link :href="route('matting.index')" :active="request()->routeIs('matting.*')" icon="fa-paw" tone="rose">Perkawinan & pembiakan</x-sidebar-link>
|
||||
@endcan
|
||||
@can('check-access', ['treatments','read'])
|
||||
<x-sidebar-link :href="route('treatments.index')" :active="request()->routeIs('treatments.*')" icon="fa-notes-medical" tone="emerald">Rekam medis</x-sidebar-link>
|
||||
@endcan
|
||||
@can('check-access', ['medical_insights','read'])
|
||||
<x-sidebar-link :href="route('medical.dashboard')" :active="request()->routeIs('medical.dashboard')" icon="fa-heart-pulse" tone="rose">Ringkasan kesehatan</x-sidebar-link>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
@can('check-access', ['cats', 'read'])
|
||||
<x-sidebar-link :href="route('cats.index')" :active="request()->routeIs('cats.*')" icon="fa-paw">
|
||||
Data Kucing
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['matting', 'read'])
|
||||
<x-sidebar-link :href="route('matting.index')" :active="request()->routeIs('matting.*')" icon="fa-venus-mars">
|
||||
<span class="flex-1">Matting Cat</span>
|
||||
<span class="text-[8px] bg-emerald-100 text-emerald-600 px-1.5 py-0.5 rounded font-black uppercase italic">Breeding</span>
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- LOGISTIK (CONTOH DROPDOWN) --}}
|
||||
@if(Gate::allows('check-access', ['medicines', 'read']) || Gate::allows('check-access', ['foods', 'read']) || Gate::allows('check-access', ['supplies', 'read']) || Gate::allows('check-access', ['categories', 'read']))
|
||||
<div class="pt-6 pb-2 px-5 text-[9px] font-black text-slate-400 uppercase tracking-[0.3em] flex items-center gap-3">
|
||||
<span>Inventori</span>
|
||||
<div class="h-px bg-slate-100 flex-1"></div>
|
||||
@if(Gate::allows('check-access', ['medicines','read']) || Gate::allows('check-access', ['foods','read']) || Gate::allows('check-access', ['supplies','read']) || Gate::allows('check-access', ['categories','read']))
|
||||
<div class="mt-6">
|
||||
<div class="flex items-center justify-between px-3 pb-2">
|
||||
<p class="text-xs font-semibold text-slate-400">Inventori</p>
|
||||
@if(($lowObatsCount+$lowMakananCount)>0)<span class="rounded bg-rose-50 px-1.5 py-0.5 text-xs font-semibold text-rose-600">{{ $lowObatsCount+$lowMakananCount }}</span>@endif
|
||||
</div>
|
||||
|
||||
{{-- Parent Dropdown Logistik --}}
|
||||
<div x-data="{ open: {{ request()->routeIs('inventory.*') || request()->routeIs('categories.*') ? 'true' : 'false' }} }">
|
||||
<button @click="open = !open"
|
||||
class="w-full flex items-center gap-3 px-5 py-3 text-xs font-bold rounded-2xl transition-all {{ request()->routeIs('inventory.*') ? 'bg-indigo-50 text-indigo-600' : 'text-slate-500 hover:bg-slate-50' }}">
|
||||
<i class="fas fa-box-open w-5 text-center"></i>
|
||||
<span class="flex-1 text-left">Gudang Logistik</span>
|
||||
<i class="fas fa-chevron-down text-[10px] transition-transform duration-200" :class="open ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
|
||||
{{-- Sub-menu Items --}}
|
||||
<div x-show="open" x-cloak x-collapse class="mt-1 ml-4 pl-4 border-l border-slate-100 space-y-1">
|
||||
@can('check-access', ['medicines', 'read'])
|
||||
<x-sidebar-link :href="route('inventory.medicines.index')" :active="request()->routeIs('inventory.medicines.*')" icon="fa-pills">
|
||||
<span class="flex-1">Obat & Vitamin</span>
|
||||
@if($lowMedicinesCount > 0)
|
||||
<span class="bg-rose-500 text-white text-[9px] font-black px-2 py-0.5 rounded-lg animate-pulse">{{ $lowMedicinesCount }}</span>
|
||||
@endif
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['foods', 'read'])
|
||||
<x-sidebar-link :href="route('inventory.foods.index')" :active="request()->routeIs('inventory.foods.*')" icon="fa-bowl-food">
|
||||
<span class="flex-1">Stok Makanan</span>
|
||||
@if($lowFoodsCount > 0)
|
||||
<span class="bg-rose-500 text-white text-[9px] font-black px-2 py-0.5 rounded-lg">{{ $lowFoodsCount }}</span>
|
||||
@endif
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['supplies', 'read'])
|
||||
<x-sidebar-link :href="route('inventory.supplies.index')" :active="request()->routeIs('inventory.supplies.*')" icon="fa-box-archive">
|
||||
Perlengkapan
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['categories', 'read'])
|
||||
<x-sidebar-link :href="route('categories.index')" :active="request()->routeIs('categories.*')" icon="fa-tags">
|
||||
Master Kategori
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
@can('check-access', ['medicines','read'])<x-sidebar-link :href="route('inventory.medicines.index')" :active="request()->routeIs('inventory.medicines.*')" icon="fa-pills" tone="violet">Obat & vitamin</x-sidebar-link>@endcan
|
||||
@can('check-access', ['foods','read'])<x-sidebar-link :href="route('inventory.foods.index')" :active="request()->routeIs('inventory.foods.*')" icon="fa-bowl-food" tone="amber">Makanan</x-sidebar-link>@endcan
|
||||
@can('check-access', ['supplies','read'])<x-sidebar-link :href="route('inventory.supplies.index')" :active="request()->routeIs('inventory.supplies.*')" icon="fa-box-open" tone="cyan">Perlengkapan</x-sidebar-link>@endcan
|
||||
@can('check-access', ['categories','read'])<x-sidebar-link :href="route('categories.index')" :active="request()->routeIs('categories.*')" icon="fa-tags" tone="slate">Kategori</x-sidebar-link>@endcan
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- INTELLIGENCE --}}
|
||||
@if(Gate::allows('check-access', ['reports', 'read']) || Gate::allows('check-access', ['matting_reports', 'read']))
|
||||
<div class="pt-6 pb-2 px-5 text-[9px] font-black text-indigo-500 uppercase tracking-[0.3em] flex items-center gap-3">
|
||||
<span>Intelligence</span>
|
||||
<div class="h-px bg-indigo-50 flex-1"></div>
|
||||
@if(Gate::allows('check-access', ['reports','read']) || Gate::allows('check-access', ['matting_reports','read']))
|
||||
<div class="mt-6">
|
||||
<p class="px-3 pb-2 text-xs font-semibold text-slate-400">Laporan</p>
|
||||
<div class="space-y-1">
|
||||
@can('check-access', ['reports','read'])<x-sidebar-link :href="route('admin.reports.index')" :active="request()->routeIs('admin.reports.index')" icon="fa-chart-line" tone="blue">Pusat laporan</x-sidebar-link>@endcan
|
||||
@can('check-access', ['matting_reports','read'])<x-sidebar-link :href="route('admin.reports.matting.index')" :active="request()->routeIs('admin.reports.matting.*')" icon="fa-file-lines" tone="rose">Laporan pembiakan</x-sidebar-link>@endcan
|
||||
</div>
|
||||
|
||||
@can('check-access', ['reports', 'read'])
|
||||
<x-sidebar-link :href="route('admin.reports.index')" :active="request()->routeIs('admin.reports.index')" icon="fa-chart-line">
|
||||
Pusat Laporan
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['matting_reports', 'read'])
|
||||
<x-sidebar-link :href="route('admin.reports.matting.index')" :active="request()->routeIs('admin.reports.matting')" icon="fa-file-medical">
|
||||
<span class="flex-1">Laporan Breeding</span>
|
||||
<span class="text-[8px] bg-rose-100 text-rose-600 px-1.5 py-0.5 rounded font-black uppercase shadow-sm">Special</span>
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- KONFIGURASI (DROPDOWN) --}}
|
||||
@if(Gate::allows('check-access', ['users', 'read']) || Gate::allows('check-access', ['roles', 'read']) || Gate::allows('check-access', ['logs', 'read']) || Gate::allows('check-access', ['settings', 'read']))
|
||||
<div class="pt-8 pb-2 px-5 text-[9px] font-black text-rose-500 uppercase tracking-[0.3em] flex items-center gap-3">
|
||||
<span>Konfigurasi</span>
|
||||
<div class="h-px bg-rose-50 flex-1"></div>
|
||||
</div>
|
||||
|
||||
<div x-data="{ open: {{ request()->routeIs('admin.users.*') || request()->routeIs('admin.roles.*') || request()->routeIs('admin.settings.*') ? 'true' : 'false' }} }">
|
||||
<button @click="open = !open"
|
||||
class="w-full flex items-center gap-3 px-5 py-3 text-xs font-bold rounded-2xl transition-all {{ request()->routeIs('admin.*') ? 'bg-rose-50 text-rose-600' : 'text-slate-500 hover:bg-slate-50' }}">
|
||||
<i class="fas fa-cog w-5 text-center"></i>
|
||||
<span class="flex-1 text-left">Sistem Control</span>
|
||||
<i class="fas fa-chevron-down text-[10px] transition-transform duration-200" :class="open ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
|
||||
<div x-show="open" x-cloak x-collapse class="mt-1 ml-4 pl-4 border-l border-rose-100 space-y-1">
|
||||
@can('check-access', ['users', 'read'])
|
||||
<x-sidebar-link :href="route('admin.users.index')" :active="request()->routeIs('admin.users.*')" icon="fa-users-cog">
|
||||
Manajemen User
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['roles', 'read'])
|
||||
<x-sidebar-link :href="route('admin.roles.index')" :active="request()->routeIs('admin.roles.*')" icon="fa-user-shield">
|
||||
Role Management
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['logs', 'read'])
|
||||
<x-sidebar-link :href="route('admin.logs.index')" :active="request()->routeIs('admin.logs.*')" icon="fa-history">
|
||||
Log Audit
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
|
||||
@can('check-access', ['settings', 'read'])
|
||||
<x-sidebar-link :href="route('admin.settings.index')" :active="request()->routeIs('admin.settings.*')" icon="fa-sliders-h">
|
||||
Pengaturan Sistem
|
||||
</x-sidebar-link>
|
||||
@endcan
|
||||
</div>
|
||||
@if(Gate::allows('check-access', ['users','read']) || Gate::allows('check-access', ['roles','read']) || Gate::allows('check-access', ['logs','read']) || Gate::allows('check-access', ['settings','read']))
|
||||
<div class="mt-6">
|
||||
<p class="px-3 pb-2 text-xs font-semibold text-slate-400">Administrasi</p>
|
||||
<div class="space-y-1">
|
||||
@can('check-access', ['users','read'])<x-sidebar-link :href="route('admin.users.index')" :active="request()->routeIs('admin.users.*')" icon="fa-user-group" tone="sky">Pengguna</x-sidebar-link>@endcan
|
||||
@can('check-access', ['roles','read'])<x-sidebar-link :href="route('admin.roles.index')" :active="request()->routeIs('admin.roles.*')" icon="fa-shield-halved" tone="violet">Hak akses</x-sidebar-link>@endcan
|
||||
@can('check-access', ['logs','read'])<x-sidebar-link :href="route('admin.logs.index')" :active="request()->routeIs('admin.logs.*')" icon="fa-clock-rotate-left" tone="amber">Jejak aktivitas</x-sidebar-link>@endcan
|
||||
@can('check-access', ['settings','read'])<x-sidebar-link :href="route('admin.settings.index')" :active="request()->routeIs('admin.settings.*')" icon="fa-gear" tone="slate">Pengaturan</x-sidebar-link>@endcan
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<div class="border-t border-slate-200 p-4">
|
||||
<div class="mb-3 flex items-center gap-3 px-1">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-full bg-slate-100 text-xs font-bold text-slate-700">{{ strtoupper(substr(auth()->user()->name,0,1)) }}</div>
|
||||
<div class="min-w-0"><p class="truncate text-sm font-semibold text-slate-800">{{ auth()->user()->name }}</p><p class="truncate text-xs text-slate-500">{{ auth()->user()->roleModel?->name ?? auth()->user()->getRawOriginal('role') ?? 'Pengguna' }}</p></div>
|
||||
</div>
|
||||
<form method="POST" action="{{ route('logout') }}">@csrf
|
||||
<button class="flex w-full items-center gap-3 px-3 py-2 text-sm font-medium text-slate-600 hover:bg-slate-50 hover:text-rose-600"><i class="fas fa-right-from-bracket w-5"></i>Keluar</button>
|
||||
</form>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -1,210 +1,12 @@
|
||||
<nav x-data="{ open: false }" class="bg-white/80 backdrop-blur-md border-b border-slate-100 sticky top-0 z-50 shadow-sm">
|
||||
@php
|
||||
$appLogo = \App\Models\Setting::where('key', 'app_logo')->value('value');
|
||||
$appName = \App\Models\Setting::where('key', 'app_name')->value('value') ?? 'ILY Aregau';
|
||||
@endphp
|
||||
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-20">
|
||||
<div class="flex">
|
||||
{{-- Logo Section --}}
|
||||
<div class="shrink-0 flex items-center">
|
||||
<a href="{{ route('dashboard') }}" class="flex items-center gap-4 group">
|
||||
<div class="flex items-center justify-center transition-transform duration-300 group-hover:scale-105">
|
||||
@if($appLogo)
|
||||
<img src="{{ Storage::url($appLogo) }}" alt="Logo {{ $appName }}" class="h-16 w-auto max-w-[200px] object-contain object-left">
|
||||
@else
|
||||
<div class="w-10 h-10 bg-indigo-600 rounded-xl flex items-center justify-center text-white font-black text-xs shadow-lg">
|
||||
{{ strtoupper(substr($appName, 0, 2)) }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="hidden md:flex flex-col border-l-2 border-slate-100 pl-4">
|
||||
<span class="text-base font-black text-slate-800 uppercase tracking-tighter leading-none">{{ $appName }}</span>
|
||||
<span class="text-[9px] font-bold text-indigo-600 uppercase tracking-[0.2em] mt-1 italic">Cattery Management</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- MENU DESKTOP (USER PROFILE DROPDOWN) --}}
|
||||
<div class="hidden lg:flex lg:items-center lg:ms-6">
|
||||
<x-dropdown align="right" width="48">
|
||||
<x-slot name="trigger">
|
||||
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-black rounded-xl text-slate-500 bg-slate-50 hover:text-indigo-600 hover:bg-indigo-50 transition ease-in-out duration-150">
|
||||
<div class="w-8 h-8 bg-indigo-600 text-white rounded-lg flex items-center justify-center text-[10px] mr-2 shadow-sm">
|
||||
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
|
||||
</div>
|
||||
<div>{{ Auth::user()->name }}</div>
|
||||
<div class="ms-1">
|
||||
<svg class="fill-current h-4 w-4" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="content">
|
||||
<div class="px-4 py-2 border-b border-slate-50">
|
||||
<p class="text-[10px] font-black text-slate-800 uppercase tracking-tighter">{{ Auth::user()->name }}</p>
|
||||
<p class="text-[8px] font-bold text-slate-400 truncate">{{ Auth::user()->email }}</p>
|
||||
</div>
|
||||
<x-dropdown-link :href="route('profile.edit')" class="text-[10px] font-bold uppercase tracking-widest">
|
||||
<i class="fas fa-user-circle mr-2 opacity-50"></i> {{ __('My Profile') }}
|
||||
</x-dropdown-link>
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<x-dropdown-link :href="route('logout')" class="text-[10px] font-black uppercase tracking-widest text-rose-500"
|
||||
onclick="event.preventDefault(); this.closest('form').submit();">
|
||||
<i class="fas fa-sign-out-alt mr-2"></i> {{ __('Log Out') }}
|
||||
</x-dropdown-link>
|
||||
</form>
|
||||
</x-slot>
|
||||
</x-dropdown>
|
||||
</div>
|
||||
|
||||
{{-- Hamburger Button (Hanya Mobile) --}}
|
||||
<div class="-me-2 flex items-center lg:hidden">
|
||||
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-xl text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-all duration-200 focus:outline-none">
|
||||
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
|
||||
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
||||
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<header class="sticky top-0 z-20 flex h-16 items-center justify-between border-b border-slate-200 bg-white px-4 md:px-6">
|
||||
<div class="flex items-center gap-3">
|
||||
<button @click="sidebarOpen=true" class="p-2 text-slate-600 lg:hidden" aria-label="Buka menu"><i class="fas fa-bars"></i></button>
|
||||
<div>
|
||||
<p class="text-sm font-semibold text-slate-900">{{ \App\Models\Setting::where('key','app_name')->value('value') ?? 'ILY Cattery' }}</p>
|
||||
<p class="hidden text-xs text-slate-500 sm:block">Data cattery, pembiakan, kesehatan, dan persediaan</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- MOBILE MENU ACCORDION --}}
|
||||
<div x-show="open"
|
||||
x-cloak
|
||||
x-data="{ activeMenu: 'dashboard' }"
|
||||
x-transition:enter="transition ease-out duration-200"
|
||||
x-transition:enter-start="opacity-0 -translate-y-4"
|
||||
x-transition:enter-end="opacity-100 translate-y-0"
|
||||
class="lg:hidden bg-white border-t border-slate-100 shadow-xl overflow-y-auto max-h-[85vh]">
|
||||
|
||||
<div class="pt-2 pb-3 space-y-0.5 px-3">
|
||||
{{-- 1. DASHBOARD --}}
|
||||
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" class="rounded-lg font-black text-[8.5px] uppercase tracking-widest py-2">
|
||||
<i class="fas fa-th-large mr-2 w-4"></i> Dashboard
|
||||
</x-responsive-nav-link>
|
||||
|
||||
{{-- 2. CATTERY & MEDICAL --}}
|
||||
<div class="border-t border-slate-50">
|
||||
<button @click="activeMenu = activeMenu === 'cattery' ? '' : 'cattery'" class="w-full flex justify-between items-center px-3 py-2.5 text-[7px] font-black text-slate-400 uppercase tracking-[0.2em]">
|
||||
<span>Cattery & Medical</span>
|
||||
<i class="fas fa-chevron-down transition-transform" :class="activeMenu === 'cattery' ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
<div x-show="activeMenu === 'cattery'" x-collapse class="bg-slate-50/50 rounded-lg">
|
||||
<x-responsive-nav-link :href="route('cats.index')" :active="request()->routeIs('cats.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-cat mr-2 w-4"></i> Data Kucing
|
||||
</x-responsive-nav-link>
|
||||
<x-responsive-nav-link :href="route('matting.index')" :active="request()->routeIs('matting.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-heart mr-2 w-4"></i> Breeding
|
||||
</x-responsive-nav-link>
|
||||
<x-responsive-nav-link :href="route('treatments.index')" :active="request()->routeIs('treatments.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-notes-medical mr-2 w-4"></i> Rekam Medis
|
||||
</x-responsive-nav-link>
|
||||
@if(Route::has('medical.dashboard'))
|
||||
<x-responsive-nav-link :href="route('medical.dashboard')" :active="request()->routeIs('medical.dashboard')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-microscope mr-2 w-4"></i> Medical Insight
|
||||
</x-responsive-nav-link>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 3. LOGISTIK & MASTER --}}
|
||||
<div class="border-t border-slate-50">
|
||||
<button @click="activeMenu = activeMenu === 'logistik' ? '' : 'logistik'" class="w-full flex justify-between items-center px-3 py-2.5 text-[7px] font-black text-slate-400 uppercase tracking-[0.2em]">
|
||||
<span>Logistik & Master</span>
|
||||
<i class="fas fa-chevron-down transition-transform" :class="activeMenu === 'logistik' ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
<div x-show="activeMenu === 'logistik'" x-collapse class="bg-slate-50/50 rounded-lg">
|
||||
@if(Route::has('categories.index'))
|
||||
<x-responsive-nav-link :href="route('categories.index')" :active="request()->routeIs('categories.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-tags mr-2 w-4"></i> Master Kategori
|
||||
</x-responsive-nav-link>
|
||||
@endif
|
||||
<x-responsive-nav-link :href="route('inventory.medicines.index')" :active="request()->routeIs('inventory.medicines.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-pills mr-2 w-4"></i> Obat-obatan
|
||||
</x-responsive-nav-link>
|
||||
<x-responsive-nav-link :href="route('inventory.foods.index')" :active="request()->routeIs('inventory.foods.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-utensils mr-2 w-4"></i> Makanan
|
||||
</x-responsive-nav-link>
|
||||
<x-responsive-nav-link :href="route('inventory.supplies.index')" :active="request()->routeIs('inventory.supplies.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-boxes mr-2 w-4"></i> Perlengkapan
|
||||
</x-responsive-nav-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 4. PUSAT LAPORAN --}}
|
||||
<div class="border-t border-slate-50">
|
||||
<button @click="activeMenu = activeMenu === 'reports' ? '' : 'reports'" class="w-full flex justify-between items-center px-3 py-2.5 text-[7px] font-black text-slate-400 uppercase tracking-[0.2em]">
|
||||
<span>Pusat Laporan</span>
|
||||
<i class="fas fa-chevron-down transition-transform" :class="activeMenu === 'reports' ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
<div x-show="activeMenu === 'reports'" x-collapse class="bg-slate-50/50 rounded-lg">
|
||||
<x-responsive-nav-link :href="route('admin.reports.index')" :active="request()->routeIs('admin.reports.index')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-chart-pie mr-2 w-4"></i> Intelligence Center
|
||||
</x-responsive-nav-link>
|
||||
<x-responsive-nav-link :href="route('admin.reports.matting.index')" :active="request()->routeIs('admin.reports.matting.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-scroll mr-2 w-4"></i> Laporan Breeding
|
||||
</x-responsive-nav-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 5. KONFIGURASI --}}
|
||||
@if(Auth::user()->role === 'admin')
|
||||
<div class="border-t border-slate-50">
|
||||
<button @click="activeMenu = activeMenu === 'config' ? '' : 'config'" class="w-full flex justify-between items-center px-3 py-2.5 text-[7px] font-black text-slate-400 uppercase tracking-[0.2em]">
|
||||
<span>Konfigurasi & Sistem</span>
|
||||
<i class="fas fa-chevron-down transition-transform" :class="activeMenu === 'config' ? 'rotate-180' : ''"></i>
|
||||
</button>
|
||||
<div x-show="activeMenu === 'config'" x-collapse class="bg-slate-50/50 rounded-lg">
|
||||
<x-responsive-nav-link :href="route('admin.users.index')" :active="request()->routeIs('admin.users.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-user-shield mr-2 w-4"></i> Management User
|
||||
</x-responsive-nav-link>
|
||||
@if(Route::has('admin.roles.index'))
|
||||
<x-responsive-nav-link :href="route('admin.roles.index')" :active="request()->routeIs('admin.roles.*')" class="text-[8.5px] font-bold py-2">
|
||||
<i class="fas fa-key mr-2 w-4"></i> Role Management
|
||||
</x-responsive-nav-link>
|
||||
@endif
|
||||
@if(Route::has('admin.logs.index'))
|
||||
<x-responsive-nav-link :href="route('admin.logs.index')" :active="request()->routeIs('admin.logs.*')" class="text-[8.5px] font-bold py-2 text-amber-600">
|
||||
<i class="fas fa-history mr-2 w-4"></i> Log Audit
|
||||
</x-responsive-nav-link>
|
||||
@endif
|
||||
<x-responsive-nav-link :href="route('admin.settings.index')" :active="request()->routeIs('admin.settings.*')" class="text-[8.5px] font-black py-2 text-rose-500 border-t border-slate-100">
|
||||
<i class="fas fa-cogs mr-2 w-4"></i> Pengaturan Sistem
|
||||
</x-responsive-nav-link>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- USER INFO & LOGOUT (MOBILE) --}}
|
||||
<div class="pt-4 pb-8 border-t border-slate-100 bg-slate-50/50">
|
||||
<div class="flex items-center px-6 gap-3 mb-4 text-left">
|
||||
<div class="w-10 h-10 bg-indigo-600 text-white rounded-xl flex items-center justify-center font-black text-[12px] shadow-md">
|
||||
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<div class="font-black text-[10px] text-slate-800 uppercase leading-none">{{ Auth::user()->name }}</div>
|
||||
<div class="font-bold text-[8px] text-slate-400 truncate mt-1">{{ Auth::user()->email }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4 space-y-1">
|
||||
<x-responsive-nav-link :href="route('profile.edit')" class="rounded-xl font-bold text-[9px] uppercase tracking-widest py-2.5">
|
||||
<i class="fas fa-user-circle mr-3 w-4"></i> Edit Profile
|
||||
</x-responsive-nav-link>
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit" class="w-full flex items-center justify-center gap-2 rounded-xl font-black text-[9px] uppercase tracking-widest text-rose-500 py-3 bg-white border border-rose-100 shadow-sm transition-all active:scale-95">
|
||||
<i class="fas fa-sign-out-alt"></i> Keluar Aplikasi
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('profile.edit') }}" class="flex items-center gap-2 px-3 py-2 text-sm font-medium text-slate-600 hover:bg-slate-50 hover:text-slate-900"><i class="fas fa-user-circle text-slate-400"></i><span class="hidden sm:inline">Profil</span></a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user