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

<div class="row">
    <div class="col-sm-3">
        <?php echo $__env->make('side_menu', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
    <div class="col-sm-9">
        <div class="row">
            <div class="col-sm-12 add-container">
                <form action="/subcategory/save" method="post" class="add-form">
                    <div class="container">
                        <div class="row">
                            <?php echo csrf_field(); ?>
                            <?php if($errors->any()): ?>
                            <div class="alert alert-danger" role="alert">
                                Please fix the following errors
                            </div>
                            <?php endif; ?>
                            <?php if($selectedSubcategory != null): ?>
                            <input type="hidden" id="selected_subcategory" name="selected_subcategory" value="<?php echo e($selectedSubcategory->sub_category_id); ?>" />
                            <?php endif; ?>
                            <div class="col-sm-9">
                                <div class="form-group">
                                    <label for="sub_category_name">Sub-category Name</label>
                                    <input type="text" class="form-control <?php $__errorArgs = ['sub_category_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="sub_category_name" name="sub_category_name" placeholder="Name" value="<?php if($selectedSubcategory != null): ?><?php echo e($selectedSubcategory->sub_category_name); ?><?php else: ?><?php echo e(old('sub_category_name')); ?><?php endif; ?>">
                                    <?php $__errorArgs = ['sub_category_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-sm-9">
                                <div class="form-group">
                                    <label for="category">Category</label>
                                    <select class="form-control <?php $__errorArgs = ['category'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="category_id" name="category_id">
                                        <option value="">Select Category</option>
                                        <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($selectedSubcategory != null): ?>
                                            <option <?php if($selectedSubcategory->category_id == $category->category_id): ?> selected <?php endif; ?> value="<?php echo e($category->category_id); ?>"><?php echo e($category->category_name); ?></option>
                                        <?php else: ?>
                                            <option value="<?php echo e($category->category_id); ?>"><?php echo e($category->category_name); ?></option>
                                        <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                    <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="invalid-feedback"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-sm-9">
                                <div class="form-group">
                                    <label for="description">Description</label>
                                    <textarea name="description" id="description" class="form-control <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" placeholder="Description"><?php if($selectedSubcategory != null): ?><?php echo e($selectedSubcategory->description); ?><?php else: ?><?php echo e(old('description')); ?><?php endif; ?></textarea>
                                    <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <div class="invalid-feedback"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>
                            </div>
                            <div class="col-sm-9">
                                <button type="submit" class="btn btn-primary bt-margin">Save</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="container">
                <div class="row search-mg">
                    <div class="col-md-12 search-col">
                        <button class="btn float-right search-bt" onclick="searchSubcategories()">Search</button>
                        <input type="text" class="form-control float-right search-txt" id="search-subcategory" name="search-subcategory" placeholder="Search" />
                    </div>
                </div>
                <div class="row t-header">
                    <div class="col-4">Sub-category Name</div>
                    <div class="col-4">Category</div>
                    <div class="col-4"></div>
                </div>
                <div id="subcategories-data">
                    <?php $__currentLoopData = $subcategories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $subcategory): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="row t-content">
                        <div class="col-4">
                            <?php echo e($subcategory->sub_category_name); ?>

                        </div>
                        <div class="col-4">
                            <?php echo e($subcategory->category->category_name); ?>

                        </div>
                        <div class="col-4 edit-butts">
                            <span>
                                <a href="/subcategory/edit/<?php echo e($subcategory->sub_category_id); ?>">
                                    <img src="/images/edit.png" width="15px" alt="Edit" />
                                </a>
                                <button rel="<?php echo e($subcategory->sub_category_id); ?>" class="btn delsubcategory" data-toggle="modal" data-target="#subcategoriesModal">
                                    <img src="/images/delete.png" width="15px" alt="Delete" />
                                </button>
                            </span>
                        </div>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="subcategoriesModal" tabindex="-1" role="dialog" aria-labelledby="subcategoriesModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="subcategoriesModalLabel">Confirm Delete</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    Are you sure you would like to delete the selected sub-category?
                </div>
                <div class="modal-footer">
                    <div class="row" style="width:100%">
                        <div class="col-8">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                        </div>
                        <div class="col-4">
                            <form action="/subcategory/del" method="post">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" id="del-subcategory" name="deletesubcategory" />
                                <button type="submit" class="btn btn-primary">Confirm</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\src-compliance\resources\views/src/sub_categories.blade.php ENDPATH**/ ?>