<link rel="stylesheet" href="<?php echo base_url(); ?>public/static/backend/css/layouts/view.css?v=<?= rand(10000, 100000) ?>">
<link rel="stylesheet" href="<?php echo base_url(); ?>public/static/backend/css/drag_list.css">

<!-- Page Breadcrumb -->
<div class="page-breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="<?= base_url('back/dashboard'); ?>" style="color: #797979">主頁</a>
        </li>
        <li class="active" style="color: #ef4130">成功個案設定</li>
    </ul>
</div>
<!-- /Page Breadcrumb -->
<!-- Page Header -->
<div class="page-header position-relative">
    <div class="header-title">
        <h1>
            成功個案設定
        </h1>
    </div>
    <!--Header Buttons-->
    <div class="header-buttons">
        <a class="sidebar-toggler" href="#">
            <i class="glyphicon glyphicon-resize-horizontal"></i>
        </a>
        <a class="refresh" id="refresh-toggler" href="#">
            <i class="glyphicon glyphicon-refresh"></i>
        </a>
        <a class="fullscreen" id="fullscreen-toggler" href="#">
            <i class="glyphicon glyphicon-fullscreen"></i>
        </a>
    </div>
    <!--Header Buttons End-->
</div>
<!-- /Page Header -->
<!-- Page Body -->
<div class="page-body">
    <div class="container-fluid py-2" style="min-height:80vh;">
        <!-- <h2 style="color:#7d4495;">正在架設中...敬請期待!</h2> -->

        <!-- dashboard -->
        <div class="row">
            <!-- column -->

            <div class="col">
                <!-- end dashboard -->

                <!-- body table -->
                <!-- add button -->
                <div style="" class="menubar2  p-2">
                    <a href="/backend/success_cases/edit" class="btn btn-success">
                        新增</a>
                </div>

                <!-- end add button -->

                <!-- drag table test -->
                <section class="box-typical">

                    <div class="fixed-table-toolbar">
                        <div class="bars pull-left">
                            <div id="toolbar"><strong>成功個案設定</strong></div>
                        </div>
                        <div class="pull-right search"></div>
                    </div>

                    <div id="info" class="content">(Drag the <span style="color:red">red square</span> to re-arrange the
                        order.)
                    </div>
                    <!-- test drag table -->
                    <table width="100%" border="1" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC" class="content">
                        <tbody>
                            <tr bgcolor="#EEEEEE">
                                <td width="30" align="center"></td>
                                <td width="100">顯示次序</td>
                                <td width="200">ID</td>
                                <td width="200">內容</td>
                                <td width="200">圖片</td>
                                <td width="50" align="center">在菜單顯示</td>
                               
                                <td width="50"></td>
                                <td width="50"></td>
                            </tr>
                        </tbody>
                    </table>
                    <ul id="content-list" class="ui-sortable">


                        <?php
                        foreach ($cases as $contentrow) {

                        ?>
                            <li id="listItem_<?php echo $contentrow->id; ?>" class="border border-secondary my-2">
                                <table width="100%" border="1" cellpadding="2" cellspacing="1" bgcolor="#cccccc" class="content" style="background: rgb(255, 182, 182);">
                                    <tbody>
                                        <tr bgcolor="#FFFFFF" id="<?php echo $contentrow->id; ?>">
                                            <td width="30" align="center">
                                                <div class="handle"></div>
                                            </td>
                                            <td width="100">
                                                <div class="rank_no"><?php echo $contentrow->displayorder; ?></div>
                                            </td>
                                            <td width="200"><?php echo $contentrow->id; ?></td>
                                            <td width="200"><?php echo $contentrow->content; ?></td>
                                            <td width="200"><img class='img-fluid' src="<?php echo base_url($contentrow->path); ?>"></td>
                                            <td width="50" align="center"><?= $contentrow->display ? "是" : "否"; ?></td>
                                           
                                            <?php

                                            $url = base_url('backend/success_cases/edit?id=' . $contentrow->id);
                                            ?>
                                            <td width="50" align="center">

                                                <a href="<?= $url; ?>" class="btn btn-primary">更改</a>

                                            </td>
                                            <td width="50" align="center">

                                                <button type="submit" class="btn btn-danger remove">删除</button>

                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </li>
                        <?php
                        } //foreach ($test_drag_content as $contentrow) {
                        ?>
                    </ul>
                </section>
            </div>

        </div>
        <!-- end body table -->
    </div>
</div>

<!-- /Page Body -->
<script>
    var base_url = '<?= base_url(); ?>';
    var csrf_name = '<?= $csrf['name']; ?>';
    var csrf_hash = '<?= $csrf['hash']; ?>';
</script>
<script defer="" src="<?php echo base_url(); ?>public/static/backend/js/jquery-ui-min.js"></script>
<!-- <script defer="" src="<?php echo base_url(); ?>public/static/backend/js/custom/landingmain.js"></script> -->
<script defer="" src="<?php echo base_url(); ?>public/static/backend/js/custom/success_cases.js"></script>