<?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">Sub Menus</h4>

                              <ol class="breadcrumb m-0">

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

                                  <li class="breadcrumb-item active" aria-current="page">Sub Menus</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">Sub Menus</h4>
                            <a class="btn btn-success btn-rounded pull-right" style="margin-bottom:10px;" type="button"  data-toggle="modal" data-target="#submenumodal">

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

                            </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">Mian Menu</th>
                                            <th scope="col" colspan="2">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                      <?php $__currentLoopData = $submenus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
										  <tr>
										  <td><?php echo e($loop->iteration); ?></td>
											<td><?php echo e($menu->name); ?></td>

                      <td><?php if($menu->menu): ?><?php echo e($menu->menu->name); ?><?php endif; ?></td>
											<td>     <a  data-toggle="modal" data-target="#editmodal" onclick="setvalues('<?php echo e($menu->name); ?>','<?php echo e($menu->id); ?>', '<?php echo e($menu->menu_id); ?>')"  class="btn btn-warning btn-sm" ><i class="fa fa-pencil text-white"></i></a>
                        <a href="<?php echo e(route('admin.deletesubmenu', $menu->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="submenumodal" 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 Sub Menu</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.addsubmenus')); ?>">
      <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>Main Menu</label>
              <select class="form-control" required name="menu_id">
                <?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($m->id); ?>"><?php echo e($m->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </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>











<div class="modal fade" id="editmodal" 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">Edit Submenu</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.editsubmenus')); ?>">
      <div class="modal-body">

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

            <div class="col-md-12">
              <label>Main Menu</label>
              <select class="form-control" required name="menu_id" id="menu_id">
                <?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($m->id); ?>"><?php echo e($m->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </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'); ?>

<script>
function setvalues(name,id,menu)
{

  $("#setname").val(name);
  $("#setid").val(id);
  $("#menu_id").val(menu);
}

</script>
<?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/submenus.blade.php ENDPATH**/ ?>