<?php $__env->startSection('styles'); ?>

<?php $__env->stopSection(); ?>



<?php $__env->startSection('content'); ?>

<!-- ============================================================== -->

<!-- Start right Content here -->

<!-- ============================================================== -->


<div class="content-page">

    <!-- Start content -->

    <div class="content">

        <div class="container-fluid">

          <div class="row">

              <div class="col-sm-12">

                  <div class="page-title-box">

                      <div class="row align-items-center">

                          <div class="col-md-8">

                              <h4 class="page-title mb-0">Products</h4>

                              <ol class="breadcrumb m-0">

                                  <li class="breadcrumb-item"><a href="#">Dashboard</a></li>

                                  <li class="breadcrumb-item active" aria-current="page">Products</li>

                              </ol>

                          </div>

                          <div class="col-md-4">

                              <div class="float-right d-none d-md-block">

                                  <div class="dropdown">





                                  </div>

                              </div>

                          </div>

                      </div>



                  </div>

              </div>

          </div>

          <!-- end row -->

            <div class="row">

                <div class="col-lg-12">

                    <div class="card">

                        <div class="card-body">

                            <h4 class="mt-0 header-title">Products</h4>
                            <a class="btn btn-success btn-rounded pull-right" style="margin-bottom:10px;" type="button"  data-toggle="modal" data-target="#productmodal">

                                <i class="fa fa-plus"></i> Add New Products

                            </a>
                            <div class="table-responsive mt-4">

                                <table class="table  table-striped table-hover mb-0">

                                    <thead>
                                        <tr>
                                            <th scope="col">(#)</th>
                                            <th scope="col">Name</th>
                                            <th scope="col">Menu</th>
                                            <th scope="col">Brand</th>
                                            <th scope="col">Details</th>
                                            <th scope="col">Description</th>
                                            <th scope="col">Actual Price (PKR)</th>
                                            <th scope="col">Price (PKR)</th>
                                            <th scope="col">Instock</th>
                                            <th scope="col">Pic 1</th>
                                            <th scope="col">Pic 2</th>
                                            <th scope="col">Pic 3</th>
                                            <th scope="col">Pic 4</th>
                                            <th scope="col" colspan="2">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                      <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
										  <tr>
										  <td><?php echo e($loop->iteration); ?></td>
											<td><?php echo e($p->name); ?></td>
                      <td><?php if($p->submenu && $p->menu): ?><?php echo e($p->menu->name); ?> ==> <?php echo e($p->submenu->name); ?> <?php endif; ?></td>
                      <td><?php if($p->brand ): ?><?php echo e($p->brand->name); ?> <?php endif; ?></td>
                      <td><?php echo e($p->details); ?></td>
                      <td><?php echo e($p->description); ?></td>
                      <td><?php echo e($p->actual_price); ?></td>
                      <td><?php echo e($p->price); ?></td>

                      <td><?php if($p->stock == 1): ?> <label class="fa fa-success">Available</label> <?php else: ?> <label class="fa fa-dange">Out of Stock</label> <?php endif; ?></td>
                      <td><img alt="no" style="width:100%" src="<?php echo e(asset('storage/products/'.$p->image1)); ?>"></img></td>
                      <td><img alt="no" style="width:100%" src="<?php echo e(asset('storage/products/'.$p->image2)); ?>"></img></td>
                      <td><img alt="no" style="width:100%" src="<?php echo e(asset('storage/products/'.$p->image3)); ?>"></img></td>
                      <td><img alt="no" style="width:100%" src="<?php echo e(asset('storage/products/'.$p->image4)); ?>"></img></td>
											<td>
                      <a href="<?php echo e(route('admin.showproducts', $p->id)); ?>"  class="btn btn-warning btn-sm" ><i class="fa fa-pencil text-white"></i></a>
                      <a href="<?php echo e(route('admin.deleteproducts', $p->id)); ?>"  class="btn btn-danger btn-sm" ><i class="fa fa-trash text-white"></i></a>

                      </td>
										</tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>







                                    </tbody>

                                </table>



                            </div>


                        </div>

                    </div>

                </div>

            </div>

            <!-- end row -->


        </div> <!-- container-fluid -->



    </div> <!-- content -->



    <footer class="footer">

        © 2020 - 2021  Mommy Kloset

    </footer>

</div>





<!-- ============================================================== -->

<!-- End Right content here -->

<!-- ============================================================== -->

<div class="modal fade" id="productmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add Products</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form method="post" action="<?php echo e(route('admin.addproducts')); ?>" enctype="multipart/form-data">
      <div class="modal-body">

          <div class="row">
            <div class="col-md-12">
              <label>Name</label>
              <input type="text" name="name" required class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Brand</label>
              <select class="form-control" required name="brand_id">
                <?php $__currentLoopData = $brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($b->id); ?>"><?php echo e($b->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </select>
            </div>
            <div class="col-md-12">
              <label>Menu</label>
              <select class="form-control" required name="menu_id">
                <?php $__currentLoopData = $submenus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if($m->menu): ?>
                  <option value="<?php echo e($m->id); ?>"><?php echo e($m->menu->name); ?>  ==> <?php echo e($m->name); ?></option>
                  <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </select>
            </div>

            <div class="col-md-12">
              <label>Actual Price</label>
              <input type="number" name="actual_price" required class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Sale %</label>
              <input type="number" name="sale" value="0" required class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Price</label>
              <input type="number" name="price" required class="form-control"/>
            </div>





            <div class="col-md-12">
              <label>Details</label>
              <input type="text" name="details" required class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Description</label>
              <textarea type="text" name="description" required class="form-control"></textarea>
            </div>


            <div class="col-md-12">
              <label>Image 1</label>
              <input type="file" name="image1" required class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Image 2</label>
              <input type="file" name="image2"  class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Image 3</label>
              <input type="file" name="image3"  class="form-control"/>
            </div>

            <div class="col-md-12">
              <label>Image 4</label>
              <input type="file" name="image4"  class="form-control"/>
            </div>


            <div class="col-md-12">
              <label>In Stock</label>
              <select class="form-control" required name="stock">
                  <option value="1">Yes</option>
                  <option value="0">No</option>
              </select>
            </div>



          </div>


      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary">Save changes</button>
      </div>
      <?php echo e(csrf_field()); ?>

      </form>
    </div>
  </div>
</div>

<?php $__env->stopSection(); ?>



<?php $__env->startSection('scripts'); ?>


<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\freelance\mommy\resources\views/admin/products.blade.php ENDPATH**/ ?>