HOME


Mini Shell 1.0
DIR: /home/islapiiu/sites/thegarder/admin/
Upload File :
Current File : /home/islapiiu/sites/thegarder/admin/arrange-services.php
<?php
include './header.php';

if (isset($_POST['save-date'])) {

    foreach ($_POST['sort'] as $key => $img) {
        $key = $key + 1;
        $sql = "UPDATE `services` SET `sort` = '" . $key . "'  WHERE id = '" . $img . "'";

        $db = new DB();

        $db->readQuery($sql);
    }
}
?>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 

<script>
    $(function () {
        $("#sortable").sortable();
        $("#sortable").disableSelection();
    });
</script>

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">Arrange Services : </h3>
    </div>
    <div class="panel-body">
        <section class="albums mt100">
            <form method="post">
                <div class="container-fluid">
                    <div class="row album-list fadeIn appear"> 

                        <div class="col-sm-5">
                            <ul id="sortable" class="list-group">
                                <?php
                                $services = getServices();

                                foreach ($services as $key => $service) {
                                    ?> 

                                    <li class="list-group-item col-sm-12">
                                        <span>(<?php echo $key + 1; ?>)</span> 
                                        <b>
                                            <?php echo $service["name"]; ?>
                                        </b>
                                        <input type="hidden" name="sort[]"  value="<?php echo $service["id"]; ?>" class="sort-input"/> 
                                    </li>

                                    <?php
                                }
                                ?>
                            </ul>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12 text-center" style="margin-top: 19px;">
                            <input type="submit" class="btn btn-info" id="btn-submit" value="Save Photos" name="save-date">
                        </div>
                    </div>
                </div>
            </form>
        </section>


    </div>
</div>
<style>
    #sortable {  
        list-style-type: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    #sortable li {
        float: left;
        padding: 2px;
        margin: 3px;
        cursor: move;
    } 
    .number-class{
        position: absolute; 
        background-color: white;
        padding: 0px 2px 0px 1px;
        border: solid 1px #8E8E8E;
        border-radius: 3px;
        margin: 1px;
        font-size: 12px;
    }
    .villas-title{
        margin: 2px 0px 2px 1px;
        font-weight: 600;
        color: black;
    } 
</style>
<?php
include './footer.php';
?>