<script type="text/javascript">
    $(function () {
        $("#services-table tbody").sortable({
            opacity: 0.6,
            cursor: "move",
            placeholder: "placeholder",
            helper: fixHelper,
            axis: "y",
            update: function() {
                var order = $(this).sortable("serialize");
                $.post(prefix + "services/reorder", order, function(data) {
                });
            }
        });
    });
</script>

<section class="content-header">
    <h1><?= __('Services') ?></h1>

    <div class="actions">
        <a data-ajax class="btn btn-default btn-sm" href="<?= admin_url_to('/services') ?>"><?= __('List') ?></a>
    </div>
</section>

<section class="content">
    <?php if (empty($services)): ?>
        <div class="callout callout-warning">
            <h4>Ops!</h4>
            <p><?= __('No services found') ?></p>
        </div>
    <?php else: ?>

        <div class="box box-default table-responsive">
            <table id="services-table" class="table table-condensed table-hover table-striped">
                <thead>
                    <tr>
                        <th><?= __('Service') ?></th>
                    </tr>
                </thead>

                <tbody>
                    <?php foreach ($services as $root): ?>
                        <tr id="sequence_<?= $root['id'] ?>" class="root">
                            <td colspan="3"><i class="fa fa-bars"></i> <?= $root['name'] ?></td>
                        </tr>
                    <?php endforeach ?>
                </tbody>
            </table>
        </div>
    <?php endif ?>
</section>