Files
ilycats/storage/framework/views/94f40c1860b8dc889fa0c7940a0c1dd3.php
T
2026-09-23 12:45:02 +07:00

241 lines
16 KiB
PHP

<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php
// Helper untuk logika sorting
$currentSort = request('sort', 'nama_obat');
$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';
};
?>
<div class="space-y-6 pb-12">
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div>
<h2 class="text-2xl font-black text-slate-800 tracking-tight leading-none mb-1 uppercase">Inventori Obat & Vitamin</h2>
<p class="text-[10px] text-slate-400 font-bold uppercase tracking-[0.2em]">Persediaan Obat & Vitamin • ILY Cattery</p>
</div>
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access', ['medicines', 'create'])): ?>
<a href="<?php echo e(route('inventory.medicines.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 shadow-indigo-100 transition-all active:scale-95">
<i class="fas fa-plus-circle mr-2"></i> TAMBAH OBAT / VITAMIN
</a>
<?php endif; ?>
</div>
<div class="grid grid-cols-1 lg:grid-cols-12 gap-4 items-center">
<div class="lg:col-span-4">
<form action="<?php echo e(route('inventory.medicines.index')); ?>" method="GET" class="relative">
<input type="hidden" name="sort" value="<?php echo e(request('sort')); ?>">
<input type="hidden" name="direction" value="<?php echo e(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="<?php echo e(request('search')); ?>"
placeholder="Cari nama obat, kategori, atau deskripsi..."
class="w-full pl-12 pr-4 py-3 bg-white border border-slate-200 rounded-2xl text-xs font-bold focus:ring-4 focus:ring-indigo-500/10 focus:border-indigo-500 transition-all shadow-sm">
</form>
</div>
<div class="lg:col-span-8">
<?php if(auth()->user()->role === 'admin'): ?>
<div class="bg-indigo-50/50 border border-indigo-100 rounded-2xl p-2 px-4 shadow-sm">
<div class="flex items-center justify-between gap-4">
<div class="flex items-center gap-3">
<i class="fas fa-file-excel text-indigo-600"></i>
<span class="text-[10px] font-black text-indigo-900 uppercase">Batch Import</span>
</div>
<div class="flex items-center gap-2">
<a href="<?php echo e(route('inventory.medicines.template')); ?>" class="px-3 py-1.5 bg-white border border-indigo-200 text-indigo-600 text-[9px] font-black rounded-lg hover:bg-indigo-100">TEMPLATE</a>
<form action="<?php echo e(route('inventory.medicines.batch')); ?>" method="POST" enctype="multipart/form-data" class="flex items-center gap-2">
<?php echo csrf_field(); ?>
<input type="file" name="file_excel" class="text-[9px] w-32 border-none bg-transparent">
<button type="submit" class="px-3 py-1.5 bg-indigo-600 text-white text-[9px] font-black rounded-lg uppercase">Unggah</button>
</form>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="bg-white border border-slate-200 rounded-[2.5rem] overflow-hidden shadow-sm">
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead class="bg-slate-50 text-[10px] font-black text-slate-400 uppercase tracking-widest border-b border-slate-100">
<tr>
<th class="px-6 py-5">
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'nama_obat', 'direction' => $nextDir])); ?>" class="flex items-center gap-2 hover:text-indigo-600 transition-colors">
Informasi Produk <i class="fas <?php echo e($getSortIcon('nama_obat')); ?>"></i>
</a>
</th>
<th class="px-4 py-5 text-center">
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'kategori', 'direction' => $nextDir])); ?>" class="flex items-center justify-center gap-2 hover:text-indigo-600 transition-colors">
Kategori <i class="fas <?php echo e($getSortIcon('kategori')); ?>"></i>
</a>
</th>
<th class="px-4 py-5 text-center">
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'stok', 'direction' => $nextDir])); ?>" class="flex items-center justify-center gap-2 hover:text-indigo-600 transition-colors">
Stok Tersisa <i class="fas <?php echo e($getSortIcon('stok')); ?>"></i>
</a>
</th>
<th class="px-4 py-5 text-center">
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'expired_at', 'direction' => $nextDir])); ?>" class="flex items-center justify-center gap-2 hover:text-indigo-600 transition-colors">
Kadaluarsa <i class="fas <?php echo e($getSortIcon('expired_at')); ?>"></i>
</a>
</th>
<th class="px-6 py-5 text-right">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100 font-medium text-slate-700">
<?php $__empty_1 = true; $__currentLoopData = $medicines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr class="hover:bg-slate-50/80 transition-all group">
<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 shadow-sm">
<?php if($m->foto_produk): ?>
<img src="<?php echo e(asset('storage/' . $m->foto_produk)); ?>" class="w-full h-full object-cover">
<?php else: ?>
<i class="fas fa-pills text-slate-200 text-lg"></i>
<?php endif; ?>
</div>
<div class="min-w-0">
<div class="text-sm font-black text-slate-800 truncate uppercase tracking-tight"><?php echo e($m->nama_obat); ?></div>
<div class="text-[9px] font-bold text-slate-400 mt-0.5 italic"><?php echo e(Str::limit($m->keterangan, 40)); ?></div>
</div>
</div>
</td>
<td class="px-4 py-4 text-center">
<span class="px-2.5 py-1 bg-indigo-50 text-indigo-600 rounded-lg text-[9px] font-black uppercase border border-indigo-100 shadow-sm">
<?php echo e($m->kategori ?? 'Umum'); ?>
</span>
</td>
<td class="px-4 py-4 text-center">
<div class="flex flex-col items-center">
<div class="flex items-baseline gap-1 <?php echo e($m->qty <= 5 ? 'text-rose-600' : 'text-emerald-600'); ?>">
<span class="text-sm font-black"><?php echo e((float)$m->qty); ?></span>
<span class="text-[9px] font-bold uppercase"><?php echo e($m->unit ?? 'Unit'); ?></span>
</div>
<?php if($m->qty <= 5): ?>
<div class="flex items-center gap-1 mt-1 text-rose-400 animate-pulse">
<i class="fas fa-exclamation-triangle text-[7px]"></i>
<span class="text-[7px] font-black uppercase tracking-widest">Restock!</span>
</div>
<?php endif; ?>
</div>
</td>
<td class="px-4 py-4 text-center">
<?php if($m->expired_at): ?>
<?php $isExpired = $m->expired_at->isPast(); ?>
<div class="flex flex-col items-center">
<span class="text-[10px] font-black <?php echo e($isExpired ? 'text-rose-600' : 'text-slate-600'); ?>">
<?php echo e($m->expired_at->format('d M Y')); ?>
</span>
<?php if($isExpired): ?>
<span class="text-[7px] font-black text-rose-400 uppercase tracking-tighter">Kadaluarsa!</span>
<?php endif; ?>
</div>
<?php else: ?>
<span class="text-slate-300 text-[9px] font-bold italic">-</span>
<?php endif; ?>
</td>
<td class="px-6 py-4 text-right">
<div class="flex justify-end gap-2">
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access', ['medicines', 'update'])): ?>
<a href="<?php echo e(route('inventory.medicines.edit', $m->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 shadow-sm"
title="Edit Obat">
<i class="fas fa-edit text-xs"></i>
</a>
<?php endif; ?>
<?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('check-access', ['medicines', 'delete'])): ?>
<button type="button"
onclick="confirmDeleteObat(<?php echo e($m->id); ?>, '<?php echo e(addslashes($m->nama_obat)); ?>')"
class="w-9 h-9 flex items-center justify-center bg-rose-50 text-rose-600 hover:bg-rose-500 hover:text-white rounded-xl transition-all shadow-sm"
title="Hapus Obat">
<i class="fas fa-trash-alt text-xs"></i>
</button>
<form id="delete-medicine-<?php echo e($m->id); ?>" action="<?php echo e(route('inventory.medicines.destroy', $m->id)); ?>" method="POST" class="hidden">
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
</form>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
<td colspan="5" class="px-6 py-24 text-center">
<div class="flex flex-col items-center">
<i class="fas fa-pills text-5xl text-slate-100 mb-4"></i>
<h3 class="text-slate-400 font-black uppercase text-xs tracking-[0.4em]">Obat Tidak Ditemukan</h3>
<p class="text-slate-300 text-[10px] font-bold mt-2 uppercase italic">Coba gunakan kata kunci pencarian lain</p>
</div>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php if($medicines->hasPages()): ?>
<div class="p-8 border-t border-slate-100 bg-slate-50/30">
<?php echo e($medicines->links()); ?>
</div>
<?php endif; ?>
</div>
</div>
<?php $__env->startPush('scripts'); ?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
function confirmDeleteObat(id, name) {
Swal.fire({
title: 'Hapus Obat?',
text: `Apakah Anda yakin ingin menghapus "${name}"? Tindakan ini permanen.`,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#f43f5e',
cancelButtonColor: '#64748b',
confirmButtonText: 'Ya, Hapus!',
cancelButtonText: 'Batal',
customClass: { popup: 'rounded-[2rem]' }
}).then((result) => {
if (result.isConfirmed) {
document.getElementById('delete-medicine-' + id).submit();
}
});
}
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH /home/u806112658/domains/earrinasia.com/ilycats/resources/views/pages/inventory/medicines/index.blade.php ENDPATH**/ ?>