[Back]
<?php $__env->startSection('content'); ?>
<div class="flex items-center justify-between mb-6">
<h1 class="text-2xl font-bold">Manage Products</h1>
<a href="<?php echo e(route('admin.products.create')); ?>" class="px-4 py-2 rounded bg-black text-white">
+ Add Product
</a>
</div>
<div class="bg-white rounded-xl shadow overflow-hidden">
<table class="w-full text-sm">
<thead class="bg-gray-50">
<tr>
<th class="p-4 text-left">Name</th>
<th class="p-4 text-left">Slug</th>
<th class="p-4 text-left">Price</th>
<th class="p-4 text-left">Active</th>
<th class="p-4 text-right">Actions</th>
</tr>
</thead>
<tbody>
<?php $__empty_1 = true; $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<tr class="border-t">
<td class="p-4 font-medium"><?php echo e($p->name); ?></td>
<td class="p-4 text-gray-600"><?php echo e($p->slug); ?></td>
<td class="p-4">RM <?php echo e(number_format($p->price_cents / 100, 2)); ?></td>
<td class="p-4">
<span class="px-2 py-1 rounded text-xs <?php echo e($p->is_active ? 'bg-green-100' : 'bg-gray-100'); ?>">
<?php echo e($p->is_active ? 'Yes' : 'No'); ?>
</span>
</td>
<td class="p-4 text-right">
<a class="underline" href="<?php echo e(route('products.show', $p->slug)); ?>" target="_blank">View</a>
<a class="underline ml-3" href="<?php echo e(route('admin.products.edit', $p)); ?>">Edit</a>
<form class="inline" method="POST" action="<?php echo e(route('admin.products.destroy', $p)); ?>">
<?php echo csrf_field(); ?>
<?php echo method_field('DELETE'); ?>
<button class="underline text-red-600 ml-3" onclick="return confirm('Delete this product?')">
Delete
</button>
</form>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<tr>
<td class="p-6 text-gray-600" colspan="5">No products found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="mt-6">
<?php echo e($products->links()); ?>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.public', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/fikhri/Project6/landing-fpx/resources/views/admin/products/index.blade.php ENDPATH**/ ?>