
<?php $__env->startSection('title'); ?>
    Admin | Sub Menu Setup
<?php $__env->stopSection(); ?>

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

    <style type="text/css">

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

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

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

<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <div class="row justify-content-center">
            <?php echo $__env->make('back.parts.message', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <div class="col-lg-4">
                <div class="card mb-4">
                    <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                        <h6 class="m-0 font-weight-bold text-primary">Add Sub Menu</h6>
                    </div>
                    <div class="card-body">
                        <form role="form" method="post" action="<?php echo e(route('submenu.store')); ?>"
                              enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>

                            <div class="form-group">
                                <label for="menu">Menu <span class="text-danger">*</span></label>
                                <select class="form-control select2-single" name="menu_id" required>
                                    <option value="">--Select Menu---</option>
                                    <?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $menu): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($menu->id); ?>"><?php echo e($menu->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                <span class="text-danger"><?php echo e($errors->has('menu_id') ? $errors->first('menu_id'):''); ?></span>

                            </div>

                            <div class="form-group">
                                <label for="name">Name <span class="text-danger">*</span></label>
                                <input class=" form-control" name="name" placeholder="Name" type="text"
                                       required>
                                <span class="text-danger"><?php echo e($errors->has('name') ? $errors->first('name'):''); ?></span>

                            </div>

                            <div class="form-group">
                                <label for="url">URL <span class="text-danger">*</span></label>
                                <input class=" form-control" name="url" placeholder="URL" type="text"
                                       required>
                                <span class="text-danger"><?php echo e($errors->has('url') ? $errors->first('url'):''); ?></span>

                            </div>

                            <div class="form-group">
                                <label for="possition">Position <span class="text-danger"></span></label>
                                <input class="form-control" type="number" id="position" name="position"
                                       placeholder="Position" autocomplete="off">
                                <span class="text-danger"><?php echo e($errors->has('position') ? $errors->first('position'):''); ?></span>

                            </div>
                            <button type="submit" class="float-right btn btn-primary">Create</button>
                        </form>
                    </div>
                </div>
            </div> <!--col-6-->

            <div class="col-lg-8">
                <div class="card mb-4">
                    <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                        <h6 class="m-0 font-weight-bold text-primary">All Sub Menu</h6>
                    </div>
                    <div class="table-responsive">
                        <table class="table align-items-center table-flush">
                            <thead class="thead-light">
                            <tr>
                                <th>Parent</th>
                                <th>Name</th>
                                <th>URL</th>
                                <th class="text-center">Position</th>
                                <th class="col__action__body">Action</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $items = \App\Models\SubMenu::orderby('menu_id', 'ASC')->orderBy('position', 'ASC')->Paginate(30); ?>
                            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($row->menu->name); ?></td>
                                    <td><?php echo e($row->name); ?></td>
                                    <td><?php echo e($row->url); ?></td>
                                    <td class="text-center"><?php echo e($row->position); ?></td>
                                    <td class="col__action__body">
                                        <a title="edit" href="<?php echo e(route('submenu.edit', ['id' => $row->id])); ?>"
                                           class="btn btn-info btn-sm">Edit</a>
                                        <div style="display: inline-block;">
                                            <form method="POST"
                                                  action="<?php echo e(route('submenu.delete', ['id' => $row->id])); ?>">
                                                <?php echo csrf_field(); ?>
                                                <input name="_method" type="hidden" value="DELETE">
                                                <button type="submit"
                                                        class="btn btn-danger btn-sm delete_confirm"
                                                        data-toggle="tooltip" title='Delete'>Delete</button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                        <div class="pagination px-3 pb-2">
                            <?php echo e($items->links()); ?>

                        </div>
                    </div>
                </div>
            </div> <!--col-6-->

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

<?php echo $__env->make('layouts.backend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/HoteliersBD2/resources/views/back/sub_menu/submenu_create.blade.php ENDPATH**/ ?>