<?php echo $__env->make('admin::layouts.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php
use App\Models\Categories;
?>
<main id="main-container">
        <!-- Hero -->
        <div class="bg-body-light">
          <div class="content content-full">
            <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center">
              <h1 class="flex-grow-1 fs-3 fw-semibold my-2 my-sm-3">Banners</h1>
              <nav class="flex-shrink-0 my-2 my-sm-0 ms-sm-3" aria-label="breadcrumb">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item">Dashboard</li>
                  <li class="breadcrumb-item">Product</li>
                  <li class="breadcrumb-item active" aria-current="page">Banners</li>
                </ol>
              </nav>
            </div>
          </div>
        </div>
        <!-- END Hero -->

        <!-- Page Content -->
        <div class="content">
          <!-- Your Block -->
          <div class="block block-rounded">
            <div class="block-header block-header-default">
              <h3 class="block-title">Banners</h3>
            </div>
            <div class="block-content">
            <?php if(Session::has('success')): ?> <div class="alert alert-success mt-2 mb-2"><?php echo e(Session::get('success')); ?></div><?php endif; ?>
            <?php if(Session::has('fail')): ?> <div class="alert alert-danger mt-2 mb-2"><?php echo e(Session::get('fail')); ?></div><?php endif; ?>
            <form class="row" action="" method="POST" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
                   
                  <div class="col-md-6 mb-3">
                    <label class="form-label">URL</label>
                    <input type="text" class="form-control" name="url">
                    <?php if($errors->has("url")): ?> <div class="alert alert-danger mt-2"><?php echo e($errors->first('url')); ?></div><?php endif; ?>
                  </div>

                  <div class="col-md-3 mb-3">
                    <label class="form-label">Order</label>
                    <input type="number" class="form-control" name="order">
                    <?php if($errors->has("order")): ?> <div class="alert alert-danger mt-2"><?php echo e($errors->first('order')); ?></div><?php endif; ?>
                  </div>

                  <div class="col-md-3 mb-3">
                      <label class="form-label">Image</label>
                      <input type="file" class="form-control" name="image" >
                      <?php if($errors->has("image")): ?> <div class="alert alert-danger mt-2"><?php echo e($errors->first('image')); ?></div><?php endif; ?>
                    </div>

                  <div>
                    <button type="submit" class="btn btn-primary">Save</button>
                  </div>
            </form>
            </div>
          </div>


          <div class="block block-rounded">
            <div class="block-header block-header-default">
              <h3 class="block-title">Banners</h3>
            </div>
            <div class="block-content">

            <table class="table table-bordered table-striped table-vcenter js-dataTable-buttons">
                <thead>
                  <tr>
                  <th>Banner</th>
                  <th>Order</th>
                  <th>URL</th>
                  <th>status</th>
                  <th>Actions</th>
                  </tr>
                </thead>
                <tbody>
                <?php foreach($banners as $banner) {
                ?>
                  <tr>
                       <td class="fw-semibold">
                  <img src="<?php echo e(asset('db_files/banners/'.$banner->image.'')); ?>"  class="img-avatar img-avatar96 img-avatar-thumb">
                    </td>
                    <td class="fw-semibold">
                    <?php echo e($banner->order); ?>

                    </td>
                    <td class="fw-semibold">
                    <?php echo e($banner->url); ?>

                    </td>
                    <td class="fw-semibold">
                    <?php if($banner->status == "active") { ?>
                        <span class="badge bg-success">Active</span>
                    <?php } else { ?>
                        <span class="badge bg-danger">Inactive</span>
                    <?php } ?>
                    </td>
                    <td class="">
                        <div class="btn-group">
                        <a href="<?php echo e(url('admin/edit-banner/'.$banner->id.'')); ?>" ><button type="button" class="btn btn-sm btn-alt-primary js-bs-tooltip-enabled" data-bs-toggle="tooltip" aria-label="Edit" data-bs-original-title="Edit">
                            <i class="fa fa-pencil-alt"></i>
                          </button></a>
                          <a href="<?php echo e(url('admin/activate-banner/'.$banner->id.'')); ?>" ><button type="button" class="btn btn-sm btn-alt-success js-bs-tooltip-enabled" data-bs-toggle="tooltip" aria-label="Activate" data-bs-original-title="Activate">
                            <i class="fa fa-check"></i>
                          </button></a>
                          <a href="<?php echo e(url('admin/deactivate-banner/'.$banner->id.'')); ?>" ><button type="button" class="btn btn-sm btn-alt-danger js-bs-tooltip-enabled" data-bs-toggle="tooltip" aria-label="Deactivate" data-bs-original-title="Deactivate">
                            <i class="fa fa-times"></i>
                          </button></a>
                          <a href="<?php echo e(url('admin/delete-banner/'.$banner->id.'')); ?>" onclick="return confirm('Are you sure you want to delete this ?');"><button type="button" class="btn btn-sm btn-alt-danger js-bs-tooltip-enabled" data-bs-toggle="tooltip" aria-label="Deactivate" data-bs-original-title="Deactivate">
                            <i class="fa fa-trash"></i>
                          </button></a>
                        </div>
                      </td>
                  </tr>
                <?php } ?>
                </tbody>
              </table>
            </div>
          </div>
          <!-- END Your Block -->
        </div>
        <!-- END Page Content -->
</main>
<!-- END Main Container -->
<?php echo $__env->make('admin::layouts.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/erpadmin_ori_usr/data/www/erpadmin.orionux.xyz/Modules/Admin/resources/views/product/banners.blade.php ENDPATH**/ ?>