

<?php $__env->startSection('content'); ?>
<div class="container-xxl flex-grow-1 container-p-y">
    <div class="card shadow-sm">
        <div class="card-header  text-white d-flex justify-content-between align-items-center">
            <h5 class="mb-0 " ><i class="fas fa-tags me-2"></i>Brands</h5>
            <a href="<?php echo e(route('brands.create')); ?>" class="btn  btn-primary btn-sm">
                <i class="fas fa-plus me-1"></i> Add Brand
            </a>
        </div>

        <div class="card-body">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
                <div class="alert alert-success alert-dismissible fade show" role="alert">
                    <?php echo e(session('success')); ?>

                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <div class="table-responsive">
               <table <?php if($brands->count() > 0): ?> id="bookings-table"  <?php endif; ?> class="table table-bordered align-middle text-center">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Logo</th>
                            <th>Name</th>
                            <th>Slug</th>
                            <th>Status</th>
                            <th>Products</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($brand->id); ?></td>
                                <td>
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($brand->logo): ?>
                                        <img src="<?php echo e(asset('uploads/brands/' . $brand->logo)); ?>" 
                                             alt="<?php echo e($brand->name); ?>" 
                                             class="rounded" 
                                             width="50" 
                                             height="50">
                                    <?php else: ?>
                                        <div class="bg-secondary rounded d-flex align-items-center justify-content-center" 
                                             style="width: 50px; height: 50px;">
                                            <i class="fas fa-tag text-white"></i>
                                        </div>
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </td>
                                <td>
                                    <strong><?php echo e($brand->name); ?></strong>
                                </td>
                                <td>
                                    <code class="text-primary bg-light px-2 py-1 rounded"><?php echo e($brand->slug); ?></code>
                                </td>
                                <td>
                                    <span class="badge bg-<?php echo e($brand->is_active ? 'success' : 'danger'); ?>">
                                        <?php echo e($brand->is_active ? 'Active' : 'Inactive'); ?>

                                    </span>
                                </td>
                                <td>
                                    <span class="badge bg-info">
                                        <?php echo e($brand->products->count()); ?> Products
                                    </span>
                                </td>
                                <td>
                                   <div class="btn-group" role="group">
                                        
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('view brands')): ?>
                                        <a href="<?php echo e(route('brands.show', $brand)); ?>" 
                                        class="btn btn-sm btn-info" 
                                        title="View">
                                            <i class="fas fa-eye"></i>
                                        </a>
                                        <?php endif; ?>

                                        
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update brands')): ?>
                                        <a href="<?php echo e(route('brands.edit', $brand)); ?>" 
                                        class="btn btn-sm btn-warning" 
                                        title="Edit">
                                            <i class="fas fa-edit"></i>
                                        </a>
                                        <?php endif; ?>

                                        
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete brands')): ?>
                                        <form action="<?php echo e(route('brands.destroy', $brand)); ?>" 
                                            method="POST" 
                                            class="d-inline"
                                            onsubmit="return confirm('Are you sure you want to delete this brand?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-danger" title="Delete">
                                                <i class="fas fa-trash"></i>
                                            </button>
                                        </form>
                                        <?php endif; ?>
                                    </div>

                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="7" class="text-center">No brands found.</td>
                            </tr>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </tbody>
                </table>
            </div>

            
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startPush('script'); ?>
<script>
$(document).ready(function () {
    $('#bookings-table').DataTable({
        responsive: false,
        scrollX: true,
        pageLength: 10,
        lengthMenu: [5, 10, 25, 50, 100],
        order: [[0, 'asc']],
        columnDefs: [
            { orderable: false, targets: -1 } // disable sorting for last column
        ]
    });
});
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\xampp\htdocs\G_desizn\mfmsqatar\resources\views/brands/index.blade.php ENDPATH**/ ?>