Initial commit: Struktur aplikasi ilycats

This commit is contained in:
Dwi F Sukmana
2026-02-08 15:16:35 +07:00
commit 0921901aed
235 changed files with 29016 additions and 0 deletions
+182
View File
@@ -0,0 +1,182 @@
<!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>
</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>
+23
View File
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $title ?? config('app.name', 'Laravel') }}</title>
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600,900&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans text-gray-900 antialiased bg-white">
{{--
Wrapper Utama:
Sekarang kita hilangkan 'max-w-md' dan 'shadow' bawaan Breeze
agar halaman login bisa mengatur lebarnya sendiri secara fleksibel.
--}}
<div class="min-h-screen flex flex-col">
{{ $slot }}
</div>
</body>
</html>
@@ -0,0 +1,165 @@
<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';
// Hitung stok kritis untuk badge (TETAP UTUH)
$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 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>
</div>
{{-- Navigation Links --}}
<nav class="flex-1 px-4 space-y-1 overflow-y-auto custom-scrollbar">
{{-- Dashboard biasanya dapat diakses oleh semua user terautentikasi --}}
<x-sidebar-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" icon="fa-th-large">
Dashboard
</x-sidebar-link>
{{-- 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>
</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
@endif
{{-- KESEHATAN --}}
@if(Gate::allows('check-access', ['medical_insights', 'read']) || Gate::allows('check-access', ['treatments', '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>Kesehatan</span>
<div class="h-px bg-slate-100 flex-1"></div>
</div>
@can('check-access', ['medical_insights', 'read'])
<x-sidebar-link :href="route('medical.dashboard')" :active="request()->routeIs('medical.dashboard')" icon="fa-chart-pie">
Medical Insight
</x-sidebar-link>
@endcan
@can('check-access', ['treatments', 'read'])
<x-sidebar-link :href="route('treatments.index')" :active="request()->routeIs('treatments.*')" icon="fa-notes-medical">
Rekam Medis
</x-sidebar-link>
@endcan
@endif
{{-- LOGISTIK --}}
@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>Logistik</span>
<div class="h-px bg-slate-100 flex-1"></div>
</div>
@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
@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>
</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
@endif
{{-- KONFIGURASI (Hanya tampil untuk yang memiliki akses ke modul-modul ini) --}}
@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>
@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
@endif
</nav>
</aside>
@@ -0,0 +1,128 @@
<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
// Mengambil data branding dari database
$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">
<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-12 h-12 bg-indigo-600 rounded-xl flex items-center justify-center text-white font-black text-sm 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-lg font-black text-slate-800 uppercase tracking-tighter leading-none">{{ $appName }}</span>
<span class="text-[10px] font-bold text-indigo-600 uppercase tracking-[0.2em] mt-1 italic">Cattery Management</span>
</div>
</a>
</div>
<div class="hidden space-x-2 sm:-my-px sm:ms-10 sm:flex items-center">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" class="text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl transition-all duration-200">
<i class="fas fa-th-large mr-2 opacity-50 group-hover:opacity-100"></i> {{ __('Dashboard') }}
</x-nav-link>
@if(Auth::user()->role === 'admin')
<x-nav-link :href="route('admin.settings.index')" :active="request()->routeIs('admin.settings.*')" class="text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl text-rose-500 hover:text-rose-600 transition-all duration-200">
<i class="fas fa-cog mr-2 opacity-50"></i> {{ __('Settings') }}
</x-nav-link>
@endif
</div>
</div>
<div class="hidden sm:flex sm:items-center sm:ms-6">
<x-dropdown align="right" width="56">
<x-slot name="trigger">
<button class="inline-flex items-center gap-3 px-4 py-2 border-2 border-slate-50 text-xs leading-4 font-bold rounded-2xl text-slate-500 bg-slate-50/50 hover:bg-white hover:border-indigo-100 hover:text-indigo-600 focus:outline-none transition-all duration-200 shadow-sm active:scale-95">
<div class="w-7 h-7 bg-indigo-100 text-indigo-600 rounded-lg flex items-center justify-center font-black ring-2 ring-white">
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
</div>
<div class="uppercase tracking-tighter">{{ Auth::user()->name }}</div>
<i class="fas fa-chevron-down text-[10px] ml-1 opacity-30"></i>
</button>
</x-slot>
<x-slot name="content">
<div class="px-4 py-3 border-b border-slate-50">
<p class="text-[8px] font-black text-slate-400 uppercase tracking-widest">Signed in as</p>
<p class="text-xs font-bold text-slate-800 truncate">{{ Auth::user()->email }}</p>
</div>
<x-dropdown-link :href="route('profile.edit')" class="text-xs font-bold py-3 hover:bg-indigo-50 transition-colors">
<i class="fas fa-user-circle mr-2 opacity-40"></i> {{ __('My Profile') }}
</x-dropdown-link>
<div class="h-px bg-slate-50 my-1"></div>
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-dropdown-link :href="route('logout')" class="text-xs font-bold py-3 text-rose-500 hover:bg-rose-50 transition-colors" onclick="event.preventDefault(); this.closest('form').submit();">
<i class="fas fa-sign-out-alt mr-2 opacity-40"></i> {{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
</div>
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2.5 rounded-xl text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-all duration-200 active:scale-90">
<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>
</div>
</div>
<div x-show="open"
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="hidden sm:hidden bg-white border-t border-slate-100">
<div class="pt-2 pb-3 space-y-1 px-4">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" class="rounded-xl font-black text-[10px] uppercase tracking-widest py-3">
<i class="fas fa-th-large mr-3"></i> {{ __('Dashboard') }}
</x-responsive-nav-link>
@if(Auth::user()->role === 'admin')
<x-responsive-nav-link :href="route('admin.settings.index')" :active="request()->routeIs('admin.settings.*')" class="rounded-xl font-black text-[10px] uppercase tracking-widest text-rose-500 py-3">
<i class="fas fa-cog mr-3"></i> {{ __('System Settings') }}
</x-responsive-nav-link>
@endif
</div>
<div class="pt-4 pb-4 border-t border-slate-100 bg-slate-50/50">
<div class="flex items-center px-6 gap-4">
<div class="w-12 h-12 bg-indigo-600 text-white rounded-2xl flex items-center justify-center font-black shadow-lg shadow-indigo-100 ring-4 ring-white">
{{ strtoupper(substr(Auth::user()->name, 0, 1)) }}
</div>
<div class="overflow-hidden">
<div class="font-black text-sm text-slate-800 uppercase tracking-tighter">{{ Auth::user()->name }}</div>
<div class="font-bold text-[10px] text-slate-400 truncate">{{ Auth::user()->email }}</div>
</div>
</div>
<div class="mt-4 space-y-1 px-4">
<x-responsive-nav-link :href="route('profile.edit')" class="rounded-xl font-bold text-xs uppercase tracking-widest py-3">
<i class="fas fa-user-circle mr-3"></i> {{ __('Profile Settings') }}
</x-responsive-nav-link>
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-responsive-nav-link :href="route('logout')" class="rounded-xl font-black text-xs uppercase tracking-widest text-rose-500 py-3" onclick="event.preventDefault(); this.closest('form').submit();">
<i class="fas fa-sign-out-alt mr-3"></i> {{ __('Sign Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
</div>
</nav>