<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改活动</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }

    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="content_wrapper">
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="recommendForm" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>商城推荐</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="recommendsubmitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 10px 0;">
                            <?php foreach ($list as $row){ ?>
                                <div class="form-group" >
                                    <input type="text" class="form-control" style="display: none" readonly name="id[]" value="<?php echo $row['id'];?>">
                                    <label class="col-sm-1 control-label">名称*: </label>
                                    <div class="col-sm-1">
                                        <input type="text" class="form-control" readonly name="name[]" value="<?php echo $row['name'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">排序*: </label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control"  name="sort[]" value="<?php echo $row['sort'];?>">
                                    </div>
                                    <label class="col-sm-1 control-label">开关*: </label>
                                    <div class="col-sm-2">
                                        <select class="form-control typeControl" name="open[]">
                                            <option value="0" <?php if($row['open'] == 0) echo 'selected'; ?>>关</option>
                                            <option value="1" <?php if($row['open'] == 1) echo 'selected'; ?>>开</option>
                                        </select>
                                    </div>
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>
</body>

<script>
    $(function () {
        $('#recommendsubmitBtn').click(function () {
            var data = new FormData(document.getElementById("recommendForm"));
            $.ajax({
                url: rootPath + 'Shop/actionRecommend',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false,
                processData: false,
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
    });
</script>
</html>
