<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/smalot_bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<script src="<?php echo base_url();?>public/js/vendor/smalot_bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/smalot_bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>流失用户召回</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div style="margin-bottom:20px;">
                                        <button style="margin: 10px;" type="button" class="btn btn-success" data-toggle="modal" data-target="#actionCode">新增召回推送</button>
                                    </div>
                                    <div class="table-responsive">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>设备</th>
                                                <th>天数</th>
                                                <th>标题</th>
                                                <th>内容</th>
                                                <th>发送人数</th>
                                                <th>添加时间</th>
                                                <th>推送时间</th>
                                                <th>状态</th>
                                                <th>操作人</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php foreach($list as $v) { ?>
                                                <tr>
                                                    <td><?php echo $v['id'];?></td>
                                                    <td>
                                                        <?php 
                                                        $devices = explode(',', $v['devices']);
                                                        $deviceName = array(1 => 'Android', 2 => 'IOS');
                                                        foreach ($devices as $val) {
                                                            echo $deviceName[$val]." ";
                                                        }
                                                        ?>
                                                    </td>
                                                    <td><?php echo $v['days'];?></td>
                                                    <td><?php echo $v['title'];?></td>
                                                    <td><?php echo $v['content'];?></td>
                                                    <td><?php echo $v['nums'];?></td>
                                                    <td><?php echo date('Y-m-d H:i:s',$v['times']);?></td>
                                                    <td><?php echo $v['endtime'] == 0 ? '未发送': date('Y-m-d H:i:s', $v['endtime']);?></td>
                                                    <td>
                                                        <?php 
                                                            switch ($v['status']) {
                                                                case 1:
                                                                    echo '已完成';
                                                                    break;
                                                                case 2:
                                                                    echo '发送中';
                                                                    break;
                                                                default:
                                                                    echo '未开始';
                                                                    break;
                                                            }
                                                        ?>
                                                    </td>
                                                    <td><?php echo $v['user'];?></td>
                                                </tr>
                                            <?php } ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>

<div class="modal fade" id="actionCode" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">流失用户召回(信鸽)</h4>
            </div>
            <form class="form-horizontal J_ajaxForm" role="form" method="post" action="recallback/addpush">
                <div class="alert alert-danger" role="alert">提交后, 隔10分钟开始发送</div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">设备:</label>
                        <div class="col-sm-9">
                            <label class="checkbox-inline">
                              <input type="checkbox" name="user_device[]" value="1"> IOS
                            </label>
                            <label class="checkbox-inline">
                              <input type="checkbox" name="user_device[]" value="2"> Android
                            </label>
                        </div>
                    </div>
                    <div class="form-group uiddiv">
                        <label class="col-sm-3 control-label">流失天数:</label>
                        <div class="col-sm-9">
                            
                            <select class="form-control" name="days">
                              <option>3</option>
                              <option>7</option>
                              <option>15</option>
                              <option>30</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group uiddiv">
                        <label class="col-sm-3 control-label">推送标题:</label>
                        <div class="col-sm-9">
                            <input type="text" name="title" class="form-control" placeholder="推送标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">推送内容:</label>
                        <div class="col-sm-9">
                            <textarea class="form-control" rows="5" placeholder="推送内容" name="content"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary J_ajaxSubmitBtn">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    //选择日期
    $('.datetimepicker').datetimepicker({
        format: 'yyyy-mm-dd hh:ii:ss',
        locale: 'zh-cn'
    });
</script>