<!-- **********************************************************************************************************************************************************
    MAIN CONTENT
    *********************************************************************************************************************************************************** -->
<!--main content start-->
<section id="main-content">
    <section class="wrapper">
        <div class="row mt">
            <div class="col-lg-12">
                <div class="form-panel">
                    <h4 class="mb"><i class="fa fa-angle-right"></i>Change Order Slider</h4>
                    <section id="unseen">
                        <div id="pesan"></div>
                        <table class="table table-bordered table-striped table-condensed">
                            <thead>
                                <tr>
                                    <th>Title Picture</th>
                                    <th>Picture</th>
                                    <th>No Urut</th>
                                    <th>&nbsp;</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                foreach ($data_slider->result() as $slid) {
                                    ?>
                                    <tr>
                                        <td><?= $slid->title ?></td>
                                        <td><?= $slid->picture ?></td>
                                        <td class="numeric">
                                            <input type="text" value="<?= $slid->no_urut ?>" name="order" id="order_<?= $slid->id ?>">
                                        </td>
                                        <td class="numeric">
                                            <button type="button" class="btn btn-primary btn-xs" onclick="return changeOrder('<?= $slid->id ?>')">Update</button>
                                        </td>
                                    </tr>
                                    <?php
                                }
                                ?>
                            </tbody>
                        </table>
                        <a href="<?= base_url() ?>admin/slider_toko">
                            <button type="button" class="btn btn-default"><i class="fa fa-arrow-left"></i> Back Main Menu</button>
                        </a>
                    </section>
                    <div style="clear: both"></div>
                </div>
            </div>
        </div><!--row -->
    </section>
</section>
<script>
    function changeOrder(id) {
        var order = $("#order_"+id).val();
        $.ajax({
            type: "POST",
            data: "id=" + id + "&order=" + order,
            url: "<?= base_url() ?>admin/slider_toko/updateOrder",
            success: function(data) {
                $("#unseen").load();
                $("#pesan").html(data);
            }
        });
    }
</script>
