<?php
/**
 * @var \yii\web\View $this
 * @var array $roleList
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>BIT System 后台管理平台</title>
    <?= $this->render('/common/css_js_main') ?>
    <script src="<?= STATIC_URL ?>/static/js/jquery.qrcode.min.js"></script>
    <script src="<?= STATIC_URL ?>/static/cp/plugin-datatables/date/bootstrap-datetimepicker.min.js"></script>
    <script src="<?= STATIC_URL ?>/static/cp/plugin-datatables/date/locales/bootstrap-datetimepicker.zh-CN.js"></script>
</head>
<body id="main">
<div class="main-nav"> <span class="fn-left">编辑微信群</span> <span class="fn-right"><a href="javascript:history.go(-1);"><i class="icon-chevron-left"></i>返回</a></span>
    <div class="fn-clear"></div>
</div>
<div class="main-content">
    <div class="form-or-table">
        <form class="form-horizontal" id="validateForm" action="/cp/group/save" method="post" enctype="multipart/form-data">
            <input type="hidden" name="id" value="<?= $group['id'] ?>" />
            <input type="hidden" name="<?= Yii::$app->request->csrfParam ?>" value="<?= Yii::$app->request->getCsrfToken() ?>" />
            <fieldset>
                <div class="blank15"></div>
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>微信群名称</label>
                    <div class="controls">
                        <input type="text" id="group_name" name="group_name" class="span5" autocomplete="off" value="<?= $group['group_name'] ?>" />
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>微信群logo</label>
                    <div class="controls">
                        <input type="file" id="group_logo" name="group_logo" class="input-file" autocomplete="off" />
                        <span>上传图片不超过1024KB，支持JPG,JPEG,BMP,PNG</span>
                    </div>
                </div>
                
                <div class="control-group">
                    <div class="controls">
                        <img id="group_logo_previewer" width="180px" height="180px" src="<?= $group['group_logo'] ?>" />
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label">二维码扫描器</label>
                    <div class="controls">
                        <a href="<?= $this->context->qrcode['link'] ?>" target="_blank"><?= $this->context->qrcode['name'] ?></a>
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>微信群链接</label>
                    <div class="controls">
                        <input type="text" id="group_link" name="group_link" class="span5" autocomplete="off" value="<?= $group['group_link'] ?>" />
                        <input type="hidden" id="group_qrcode" name="group_qrcode" value="" />
                        <input type="button" id="generate_qrcode" value="生成二维码" />
                    </div>
                </div>
                
                <div class="control-group">
                    <div class="controls">
                        <div id="group_qrcode_previewer"></div>
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>二维码有效时间</label>
                    <div class="controls">
                        <input type="text" id="qrcode_expire" name="qrcode_expire" class="span5" autocomplete="off" data-date-format="yyyy-mm-dd" value="<?= $group['qrcode_expire'] ?>" />
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label"><span class="must-input">*</span>排序</label>
                    <div class="controls">
                        <input type="text" id="sort" name="sort" class="span5" autocomplete="off" value="<?= $group['sort'] ?>" />
                    </div>
                </div>
                
                <div class="control-group">
                    <label class="control-label">启用</label>
                    <div class="controls">
                        <label class="radio inline">
                            <input type="radio" name="is_enable" value="1" id="is_enable_1" <?= $group['is_enable'] == 1 ? 'checked="checked"' : '' ?> /><span style="float: left;">是</span>
                            <input type="radio" name="is_enable" value="0" id="is_enable_0" style="margin-left: 36px;" <?= $group['is_enable'] == 0 ? 'checked="checked"' : '' ?> /><span>否</span>  
                        </label>
                    </div>
                </div>
                
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary"><i class="icon-upload"></i> 提交</button>
                    <button type="reset" class="btn" onclick="javascript:history.go(-1);"><i class="icon-repeat"></i> 返回</button>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</body>
<?= $this->render('_add_or_edit_common') ?>
<script type="text/javascript">
function init() {
    // 二维码
    $('#generate_qrcode').click();    
}
$(function () {
    init();    
});
</script>
</html>