{template "header.html"}
<div class="note note-danger">
    <p>{dr_lang('用户详细资料')}</p>
</div>

<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>

<script type="text/javascript">
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    orientation: "left",
                    autoclose: true
                });
            }
        });
    }
    function dr_add_group() {
        var loading = layer.load(2, {
            shade: [0.3,'#fff'], //0.1透明度的白色背景
            time: 10000
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: '{dr_url('member/group_all_edit')}',
            data: $("#myform").serialize(),
            success: function(json) {
                layer.close(loading);
                if (json.code == 1) {
                    setTimeout("window.location.href='{dr_now_url()}&page="+$('#dr_page').val()+"'", 1000)
                }
                dr_layer_tips(json.msg);
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError);
            }
        });
    }
    function dr_delete(id) {
        var loading = layer.load(2, {
            shade: [0.3,'#fff'], //0.1透明度的白色背景
            time: 10000
        });
        $.ajax({
            type: "POST",
            dataType: "json",
            url: '{dr_url('member/group_del', ['uid'=>$id])}&id='+id,
            data: $("#myform").serialize(),
            success: function(json) {
                layer.close(loading);
                if (json.code == 1) {
                    setTimeout("window.location.href='{dr_now_url()}&page="+$('#dr_page').val()+"'", 1000)
                }
                dr_layer_tips(json.msg);
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError);
            }
        });
    }
</script>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                <li class="{if $page==0}active{/if}">
                    <a href="#tab_0" data-toggle="tab" onclick="$('#dr_page').val('0')"> <i class="fa fa-cog"></i> {dr_lang('基本信息')} </a>
                </li>
                <li class="{if $page==1}active{/if}">
                    <a href="#tab_1" data-toggle="tab" onclick="$('#dr_page').val('1')"> <i class="fa fa-reorder"></i> {dr_lang('自定义字段')} </a>
                </li>
                <li class="{if $page==2}active{/if}">
                    <a href="#tab_2" data-toggle="tab" onclick="$('#dr_page').val('2')"> <i class="fa fa-gear"></i> {dr_lang('状态设置')} </a>
                </li>
                <li>
                    <a href="javascript:dr_iframe('{dr_lang('设置用户组')}', '{dr_url('member/group_edit', ['id'=>$id])}', '60%')" > <i class="fa fa-users"></i> {dr_lang('用户组')} </a>
                </li>
                <li class="{if $page==4}active{/if}">
                    <a href="#tab_4" data-toggle="tab" onclick="$('#dr_page').val('4')"> <i class="fa fa-qq"></i> {dr_lang('绑定账号')} </a>
                </li>
                <li class="{if $page==5}active{/if}">
                    <a href="#tab_5" data-toggle="tab" onclick="$('#dr_page').val('5')"> <i class="fa fa-calendar"></i> {dr_lang('登录记录')} </a>
                </li>
            </ul>
            <div class="actions">
                <div class="btn-group">
                    <a class="btn" href="{$reply_url}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回列表')}</a>
                </div>
            </div>
        </div>
        <div class="portlet-body">

            <div class="tab-content">

                <div class="tab-pane {if $page==0}active{/if}" id="tab_0">
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label "></label>
                            <div class="col-md-9">
                                <a href="javascript:dr_iframe_show('{dr_lang('头像设置')}', '{dr_url('member/avatar_edit', ['id'=>$id])}', '500px');"><img class="img-circle" src="{dr_avatar($id)}" style="width:50px;height:50px"></a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">UID</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$id} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <div class="input-group" style="width: 300px;">
                                    <input type="text" readonly value="{$username}" class="form-control">
                                    <span class="input-group-btn">
                                        <a class="btn red" href="javascript:dr_iframe('{dr_lang("变更")}', '{dr_url("member/username_edit", ['id' => $id])}', '500px');"><i class="fa fa-edit"></i> {dr_lang('变更')}</a>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group" id="dr_row_name">
                            <label class="col-md-2 control-label ">{MEMBER_CNAME}</label>
                            <div class="col-md-9">
                                <label><input type="text" class="form-control input-large" id="dr_name" name="member[name]" value="{htmlspecialchars($name)}"></label>
                            </div>
                        </div>
                        <div class="form-group" id="dr_row_phone">
                            <label class="col-md-2 control-label ">{dr_lang('手机')}</label>
                            <div class="col-md-9">
                                <label><input type="text" class="form-control input-large" id="dr_phone" name="member[phone]" value="{htmlspecialchars($phone)}"></label>
                            </div>
                        </div>
                        <div class="form-group" id="dr_row_email">
                            <label class="col-md-2 control-label ">{dr_lang('邮箱')}</label>
                            <div class="col-md-9">
                                <label><input type="text" class="form-control input-large" id="dr_email" name="member[email]" value="{htmlspecialchars($email)}"></label>
                            </div>
                        </div>
                        <div class="form-group" id="dr_row_password">
                            <label class="col-md-2 control-label ">{dr_lang('密码')}</label>
                            <div class="col-md-9">
                                <label><input type="text" class="form-control input-large" id="dr_password" name="password" placeholder="{dr_lang('留空表示不修改密码')}"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('注册时间')}</label>
                            <div class="col-md-9">
                                {dr_fieldform($regfield['regtime'], $regtime)}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('注册地址')}</label>
                            <div class="col-md-9">
                                {dr_fieldform($regfield['regip'], $regip)}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账户余额')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> ￥{$money} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('随机验证码')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$randcode} </p>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="tab-pane {if $page==1}active{/if}" id="tab_1">
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$username} </p>
                            </div>
                        </div>
                        {$myfield}
                        {$diyfield}

                        {if $field}
                        <script>
                            $(function () {
                                {loop $field $f}
                                $('#dr_row_{$f.fieldname} .col-md-9').append('<a style="color:red" href="javascript:dr_help(774);" class="form-control-static">{dr_lang('此字段在前端不可用')}</a>');
                                {/loop}
                            });
                            </script>
                        {/if}
                    </div>
                </div>
                <div class="tab-pane {if $page==2}active{/if}" id="tab_2">
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$username} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('审核状态')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_verify]" value="1" {if $is_verify}checked{/if} data-on-text="{dr_lang('已审核')}" data-off-text="{dr_lang('未审核')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('当审核通过后才能正常操作网站')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('锁定状态')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_lock]" value="1" {if $is_lock}checked{/if} data-on-text="{dr_lang('已锁定')}" data-off-text="{dr_lang('未锁定')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('锁定账号后，不能登录此账号进行操作网站')} </p>
                            </div>
                        </div>
                        <div class="form-group hide">
                            <label class="col-md-2 control-label">{dr_lang('实名认证')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_auth]" value="1" {if $is_auth}checked{/if} data-on-text="{dr_lang('已认证')}" data-off-text="{dr_lang('未认证')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('账号是否实名认证')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('手机认证')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_mobile]" value="1" {if $is_mobile2}checked{/if} data-on-text="{dr_lang('已认证')}" data-off-text="{dr_lang('未认证')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('账号的手机号码是否认证')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('邮箱认证')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_email]" value="1" {if $is_email}checked{/if} data-on-text="{dr_lang('已认证')}" data-off-text="{dr_lang('未认证')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('账号的邮箱是否认证')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('补全资料')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_complete]" value="1" {if $is_complete}checked{/if} data-on-text="{dr_lang('已补全')}" data-off-text="{dr_lang('未补全')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('账号资料是否补全')} </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('上传头像')}</label>
                            <div class="col-md-9" style="padding-top:3px">
                                <input type="checkbox" name="status[is_avatar]" value="1" {if $is_avatar}checked{/if} data-on-text="{dr_lang('已上传')}" data-off-text="{dr_lang('未上传')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <p class="help-block"> {dr_lang('用户是否上传头像')} </p>
                            </div>
                        </div>

                    </div>
                </div>



                <div class="tab-pane {if $page==4}active{/if}" id="tab_4">
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$username} </p>
                            </div>
                        </div>
                        {loop $oauth $t}
                        <div class="form-group">
                            <label class="col-md-2 control-label "><img class="img-circle" src="{$t.avatar}" style="width:50px;height:50px"></a> </label>
                            <div class="col-md-9">
                                <div class="form-control-static" style="padding-top: 18px;">
                                    <label style="padding-right: 8px;"> <img src="{THEME_PATH}assets/oauth/{$t.oauth}.png"></label>
                                    <label style="padding-right: 8px;"> {dr_html2emoji($t.nickname)} </label>
                                    <label> <a href="javascript:;" onclick="dr_ajax_url('{dr_url('member/jb_del', ['tid'=>$t.oauth, 'id'=>$uid])}', '{dr_lang('你确定要解绑它吗？')}', 1)" class="btn red btn-xs"> <i class="fa fa-trash"></i> {dr_lang('解绑')}</a> </label>
                                </div>
                            </div>
                        </div>
                        {/loop}
                    </div>
                </div>

                <div class="tab-pane {if $page==5}active{/if}" id="tab_5">
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-md-2 control-label ">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <p class="form-control-static"> {$username} </p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label "> </label>
                            <div class="col-md-9">

                                <div class="table-scrollable table-scrollable-borderless">
                                    <table class="table table-hover table-light">
                                        <thead>
                                        <tr class="uppercase">
                                            <th width="150"> {dr_lang('登录时间')} </th>
                                            <th> {dr_lang('登录地点')} </th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {table table=member_login uid=$id order=logintime desc cache=0}
                                        <tr>
                                            <td> {dr_date($t.logintime)} </td>
                                            <td> <a href="https://www.baidu.com/s?wd={$t['loginip']}&action=xunruicms" target="_blank">{Ip::address($t['loginip'])}</a> </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2"> {$t.useragent}</td>
                                        </tr>
                                        {/table}
                                        </tbody>
                                    </table>
                                </div>

                            </div>
                        </div>

                    </div>
                </div>

            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
            <a href="{dr_url('member/alogin_index', ['id'=>$id])}" target="_blank" class="btn red"> <i class="fa fa-user"></i> {dr_lang('授权登录')}</a>
        </div>
    </div>
</form>
{template "footer.html"}