<!doctype html>
<html class="no-js">
<head>

<include file="Common/head" />

</head>
<body>

<include file="Common/header" />

<div class="am-cf admin">

    <!-- sidebar start -->
    <include file="Common/sidebar" nav="$nav"/>
    <!-- sidebar end -->

    <!-- Start right Content here -->
        <div class="content-page" style="background: white;">
            <!-- Start content -->
            <div class="content">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">Mini Game Management </strong> / <small>Scratch & Win</small>  / <small>Prize List</small> 
                </div>
            </div>
            <hr style="margin-top:0px;">
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">
                    <div class="am-btn-toolbar">
                        <a class="am-btn am-btn-secondary" href="{:U('sc_add_goods')}">Add Prize</a>
                        <a class="am-btn am-btn-secondary" href="{:U('sc_config')}">Scratch & Win Setting</a>
                        <a class="am-btn am-btn-secondary" href="{:U('sc_winning_record')}">View Record</a>
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form am-form-horizontal" action="" method="POST" enctype="multipart/form-data" id="goodsForm">
                    <table class="am-table am-table-hover table-main am-text-nowrap">
                        <thead>
                            <tr>
                                <th>Prize Name</th>
                                <th>Image</th>
                                <th  style="text-align:center" >Hit Percentage<span style="color: red;">（(Set the number between 0 to 100, the higher the number the easier to get the prize)</span></th>
                                <th  style="text-align:center" >Prize Winnable<span style="color: red;"></span></th>
                                <th>Created Date</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if (empty($list)) : ?>
                                <tr><td colspan="9" style="text-align:center" >There Is No Data</td></tr>
                            <?php endif;?>
                            <volist name="list" id="vo">
                                <tr>
                                    <td>{$vo.goods_name}</td>
                                    <td><img src="__UPLOADS__/{$vo.img}" style="width: 80px; height: 60px"></td>
                                    <td><input type="text" name="probability[]" value="{$vo.probability}"  style="text-align:center"  placeholder="example：10"></td>
                                    <td  style="text-align:center" >
                                        <?php if ($vo['status'] == 1) : ?>
                                            yes
                                        <?php else : ?>
                                            no
                                        <?php endif;?>    
                                    </td>
                                    <td>{$vo.create_time|date="Y-m-d H:i:s", ###}</td>
                                    <td>
                                        <div class="am-dropdown" data-am-dropdown>
                                            <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle>
                                                <span class="am-icon-cog"></span>
                                                <span class="am-icon-caret-down"></span>
                                            </button>
                                            <ul class="am-dropdown-content">
                                                <li><a href="{:U('sc_edit_goods',array('id' => $vo['id']))}">Edit</a></li>
                                                <li>
                                                    <a class="del_link" data-name="{$vo.name}" data-url="{:U('sc_delete', array('id' => $vo[id]))}" href="javascript:;">
                                                        Delete
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            </volist>
                        </tbody>
                    </table>
                <?php if (!empty($list)) : ?>
                <button type="submit" class="am-btn am-btn-primary am-btn-block" id="comfirm" style="width:80px;">Save</button>
                <?php endif;?>
                </form>
                {$page}
                </div>
            </div>
        </div>
    </div>
    <!-- content end -->
</div>

<include file="Common/footer" />

<script src="__PUBLIC__/assets/js/laytpl.js" type="text/javascript" charset="utf-8" async defer></script>
<script type="text/javascript">
    $(function(){
        // 删除
        $(".del_link").on("click",function(){
            var name=$(this).attr("data-name");
            var the_link=$(this).attr("data-url");
            var bool = confirm("Confirm Delete?");
            if (bool) {
                location.href = the_link;
            };
        });
    });
</script>
</body>
</html>