2026-02-08 15:16:35 +07:00
|
|
|
<x-app-layout>
|
2026-09-23 12:45:02 +07:00
|
|
|
@php
|
|
|
|
|
$currentSort = request('sort', 'nama_makanan');
|
|
|
|
|
$currentDir = request('direction', 'asc');
|
|
|
|
|
$nextDir = $currentDir === 'asc' ? 'desc' : 'asc';
|
|
|
|
|
|
|
|
|
|
$getSortIcon = function($field) use ($currentSort, $currentDir) {
|
|
|
|
|
if ($currentSort !== $field) return 'fa-sort opacity-20';
|
|
|
|
|
return $currentDir === 'asc' ? 'fa-sort-up text-indigo-600' : 'fa-sort-down text-indigo-600';
|
|
|
|
|
};
|
|
|
|
|
@endphp
|
|
|
|
|
|
2026-02-08 15:16:35 +07:00
|
|
|
<div class="max-w-7xl mx-auto space-y-6 pb-12">
|
2026-09-23 12:45:02 +07:00
|
|
|
{{-- Header --}}
|
2026-02-08 15:16:35 +07:00
|
|
|
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 px-2">
|
|
|
|
|
<div>
|
2026-09-23 12:45:02 +07:00
|
|
|
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1 uppercase">Stok Makanan & Nutrisi</h2>
|
|
|
|
|
<p class="text-[10px] text-slate-400 font-bold uppercase tracking-[0.2em]">Persediaan Makanan • ILY Cattery</p>
|
2026-02-08 15:16:35 +07:00
|
|
|
</div>
|
|
|
|
|
@can('check-access', ['foods', 'create'])
|
2026-09-23 12:45:02 +07:00
|
|
|
<a href="{{ route('inventory.foods.create') }}" class="inline-flex items-center px-6 py-3 bg-indigo-600 hover:bg-indigo-700 text-white text-[10px] font-black rounded-2xl shadow-lg active:scale-95 transition-all">
|
|
|
|
|
<i class="fas fa-plus-circle mr-2"></i> TAMBAH PAKAN
|
|
|
|
|
</a>
|
2026-02-08 15:16:35 +07:00
|
|
|
@endcan
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-09-23 12:45:02 +07:00
|
|
|
{{-- Quick Stats (3 Cards) --}}
|
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 px-2">
|
|
|
|
|
<div class="bg-white border border-slate-200 p-6 rounded-[2rem] shadow-sm">
|
|
|
|
|
<p class="text-[9px] font-black text-slate-400 uppercase tracking-widest">Total Volume Stok</p>
|
|
|
|
|
<h3 class="text-2xl font-black text-slate-800 mt-1">{{ number_format($totalStock, 1) }} <span class="text-xs text-slate-400">UNIT</span></h3>
|
2026-02-08 15:16:35 +07:00
|
|
|
</div>
|
2026-09-23 12:45:02 +07:00
|
|
|
<div class="bg-white border border-slate-200 p-6 rounded-[2rem] shadow-sm border-l-4 border-l-rose-500">
|
|
|
|
|
<p class="text-[9px] font-black text-rose-600 uppercase tracking-widest">Stok Menipis (<= 5)</p>
|
|
|
|
|
<h3 class="text-2xl font-black text-slate-800 mt-1">{{ $lowStockCount }} <span class="text-xs text-slate-400">PRODUK</span></h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bg-indigo-50 border border-indigo-100 p-6 rounded-[2rem] shadow-sm">
|
|
|
|
|
<p class="text-[9px] font-black text-indigo-600 uppercase tracking-widest">Varian Produk</p>
|
|
|
|
|
<h3 class="text-2xl font-black text-indigo-900 mt-1">{{ $totalItems }} <span class="text-xs text-indigo-400">JENIS</span></h3>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{{-- Search & Sorting --}}
|
|
|
|
|
<div class="px-2">
|
|
|
|
|
<form action="{{ route('inventory.foods.index') }}" method="GET" class="relative max-w-md">
|
|
|
|
|
<input type="hidden" name="sort" value="{{ request('sort') }}">
|
|
|
|
|
<input type="hidden" name="direction" value="{{ request('direction') }}">
|
|
|
|
|
<i class="fas fa-search absolute left-4 top-1/2 -translate-y-1/2 text-slate-400 text-xs"></i>
|
|
|
|
|
<input type="text" name="search" value="{{ request('search') }}" placeholder="Cari merk pakan atau kategori..." class="w-full pl-12 pr-4 py-3.5 bg-white border border-slate-200 rounded-2xl text-xs font-bold focus:ring-4 focus:ring-indigo-500/10 transition-all shadow-sm">
|
|
|
|
|
</form>
|
2026-02-08 15:16:35 +07:00
|
|
|
</div>
|
|
|
|
|
|
2026-09-23 12:45:02 +07:00
|
|
|
{{-- Table --}}
|
|
|
|
|
<div class="bg-white border border-slate-200 rounded-[2.5rem] overflow-hidden shadow-sm mx-2">
|
2026-02-08 15:16:35 +07:00
|
|
|
<div class="overflow-x-auto">
|
2026-09-23 12:45:02 +07:00
|
|
|
<table class="w-full text-left">
|
|
|
|
|
<thead class="bg-slate-50 text-[10px] font-black text-slate-400 uppercase tracking-widest border-b border-slate-100">
|
2026-02-08 15:16:35 +07:00
|
|
|
<tr>
|
2026-09-23 12:45:02 +07:00
|
|
|
<th class="px-6 py-5">
|
|
|
|
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'nama_makanan', 'direction' => $nextDir]) }}" class="hover:text-indigo-600 transition-colors flex items-center gap-2">
|
|
|
|
|
Informasi Pakan <i class="fas {{ $getSortIcon('nama_makanan') }}"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</th>
|
|
|
|
|
<th class="px-6 py-5 text-center">
|
|
|
|
|
<a href="{{ request()->fullUrlWithQuery(['sort' => 'qty', 'direction' => $nextDir]) }}" class="hover:text-indigo-600 transition-colors flex items-center justify-center gap-2">
|
|
|
|
|
Stok Tersedia <i class="fas {{ $getSortIcon('qty') }}"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</th>
|
|
|
|
|
<th class="px-6 py-5 text-center">Ditambahkan Pada</th>
|
|
|
|
|
<th class="px-6 py-5 text-right">Aksi</th>
|
2026-02-08 15:16:35 +07:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
2026-09-23 12:45:02 +07:00
|
|
|
<tbody class="divide-y divide-slate-100">
|
2026-02-08 15:16:35 +07:00
|
|
|
@forelse($foods as $f)
|
2026-09-23 12:45:02 +07:00
|
|
|
<tr class="hover:bg-slate-50/50 transition-all">
|
2026-02-08 15:16:35 +07:00
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
<div class="flex items-center gap-4">
|
|
|
|
|
<div class="w-12 h-12 rounded-2xl bg-slate-50 border border-slate-100 overflow-hidden shrink-0 flex items-center justify-center">
|
|
|
|
|
@if($f->foto_produk)
|
|
|
|
|
<img src="{{ asset('storage/' . $f->foto_produk) }}" class="w-full h-full object-cover">
|
|
|
|
|
@else
|
|
|
|
|
<i class="fas fa-bowl-food text-slate-200 text-lg"></i>
|
|
|
|
|
@endif
|
|
|
|
|
</div>
|
2026-09-23 12:45:02 +07:00
|
|
|
<div>
|
|
|
|
|
<div class="text-sm font-black text-slate-800 uppercase tracking-tight">{{ $f->nama_makanan }}</div>
|
|
|
|
|
<span class="text-[8px] font-black text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded border border-indigo-100 uppercase italic mt-1 inline-block">
|
|
|
|
|
{{ $f->kategori ?? ($f->category->name ?? 'Umum') }}
|
2026-02-08 15:16:35 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
2026-09-23 12:45:02 +07:00
|
|
|
<td class="px-6 py-4 text-center">
|
|
|
|
|
<div class="flex flex-col items-center">
|
|
|
|
|
<div class="flex items-baseline gap-1 {{ $f->qty <= 5 ? 'text-rose-600' : 'text-emerald-600' }}">
|
|
|
|
|
<span class="text-sm font-black">{{ (float)$f->qty }}</span>
|
|
|
|
|
<span class="text-[9px] font-bold uppercase">{{ $f->unit ?? 'UNIT' }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
@if($f->qty <= 5)
|
|
|
|
|
<span class="text-[7px] font-black text-rose-400 uppercase tracking-widest animate-pulse mt-1">Low!</span>
|
|
|
|
|
@endif
|
|
|
|
|
</div>
|
2026-02-08 15:16:35 +07:00
|
|
|
</td>
|
2026-09-23 12:45:02 +07:00
|
|
|
<td class="px-6 py-4 text-center text-[10px] font-bold text-slate-400">
|
|
|
|
|
{{ $f->created_at->format('d/m/Y') }}
|
|
|
|
|
</td>
|
|
|
|
|
<td class="px-6 py-4 text-right">
|
|
|
|
|
<div class="flex justify-end gap-2">
|
2026-02-08 15:16:35 +07:00
|
|
|
@can('check-access', ['foods', 'update'])
|
2026-09-23 12:45:02 +07:00
|
|
|
<a href="{{ route('inventory.foods.edit', $f->id) }}" class="w-9 h-9 flex items-center justify-center bg-amber-50 text-amber-600 hover:bg-amber-600 hover:text-white rounded-xl transition-all"><i class="fas fa-edit text-xs"></i></a>
|
2026-02-08 15:16:35 +07:00
|
|
|
@endcan
|
|
|
|
|
@can('check-access', ['foods', 'delete'])
|
2026-09-23 12:45:02 +07:00
|
|
|
<button onclick="confirmDelete({{ $f->id }}, '{{ addslashes($f->nama_makanan) }}')" class="w-9 h-9 flex items-center justify-center bg-rose-50 text-rose-600 hover:bg-rose-600 hover:text-white rounded-xl transition-all"><i class="fas fa-trash-alt text-xs"></i></button>
|
2026-02-08 15:16:35 +07:00
|
|
|
@endcan
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@empty
|
2026-09-23 12:45:02 +07:00
|
|
|
<tr><td colspan="4" class="px-6 py-20 text-center text-slate-300 text-xs italic font-bold uppercase tracking-widest">Pakan tidak ditemukan.</td></tr>
|
2026-02-08 15:16:35 +07:00
|
|
|
@endforelse
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2026-09-23 12:45:02 +07:00
|
|
|
@if($foods->hasPages())
|
|
|
|
|
<div class="p-6 bg-slate-50/50 border-t border-slate-100">{{ $foods->links() }}</div>
|
|
|
|
|
@endif
|
2026-02-08 15:16:35 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</x-app-layout>
|