<?php $__env->startSection('title', 'Gestionare categorii'); ?>


<?php $__env->startSection('actions'); ?>
    <a href="<?php echo e(route('admin.categories.create', ['parent_id' => 0])); ?>" class="btn btn-primary m-md">adauga categorie
        primara</a>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
    <div class="bg-success container-priority-save"
         style="display: none; position: fixed; opacity: 0.99; padding: 24px; bottom: 0; left: 0; right: 0; z-index: 9999;">
        <a href="#" class="btn btn-priority-save btn-info btn-lg pull-right">Salveaza</a>
        Salveaza ordinea categoriilor.
    </div>

    <div class="ibox">
        <div class="ibox-content  table-responsive">
            <table class="table table-striped-or-not table-hover">
                <thead>
                <tr>
                    <th>Nume categorie</th>
                    <th>Stare</th>
                    <?php if(!request('show_ids')): ?>
                        <th>Ordine</th>
                        <th class="text-right">Actiuni</th>
                    <?php else: ?>
                        <th class="text-rightf">id</th>
                    <?php endif; ?>
                </tr>
                </thead>
                <tbody>
                <?php echo $__env->make('admin.category.items', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                </tbody>
            </table>
        </div>
    </div>

    <script>
        $('.priority').keyup(function () {
            $('.container-priority-save').slideDown();
        });

        $('.btn-priority-save').click(function (e) {
            var button = $(this);
            button.attr('disabled', true);
            e.preventDefault();
            var formData = new FormData();

            $('input.priority').each(function () {
                formData.append(this.name, this.value);
            });

            $.ajax({
                url: '<?php echo e(route('admin.categories.priority')); ?>',
                data: formData,
                processData: false,
                contentType: false,
                type: 'POST',
                success: function (data) {
                    // alert(data);
                    $('.container-priority-save').slideUp();
                    button.attr('disabled', false);
                    location.reload();
                }
            });


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

<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/superch1/public_html/resources/views/admin/category/index.blade.php ENDPATH**/ ?>