<?xml version="1.0" encoding="UTF-8"?>
<h:screen xmlns:h="http://www.hand-china.com/hap">
    <script src="${base.contextPath}/common/code?wechatGender=WECHAT.GENDER" type="text/javascript"></script>
    <script src="${base.contextPath}/common/code?wechatIsleader=WECHAT.ISLEADER" type="text/javascript"></script>

    <script><![CDATA[

    var accountType = ${RequestParameters.accountType!-1};
    var memberId = ${RequestParameters.memberId!-1};
    var viewModel = kendo.observable({
        enabled: false,
        isEnabled: true,
        data: {},
        gender: wechatGender,
        isleader: wechatIsleader,
    });
    /*初始化viewModel.data*/
    $.ajax({
        type: "GET",
        async: false,
        url: "${base.contextPath}/wechat/member/query/detail?memberId=" + memberId,
        contentType: "application/json; charset=utf-8",
        success: function (datas) {
            var data = datas.rows[0];
            for (var key in data) {
                viewModel.data.set(key, data[key])
            }
            viewModel.data.subscribeDate = new Date(viewModel.data.subscribeTime);
        }
    })

    ]]></script>
    <h:hlsForm title="详细信息" width="100%" id="memberForm">
        <h:hlsHBox>
            <div id="firstBox">
                <h:hlsMaskedTextBox name="name" id="name" bind="enabled: enabled, value:data.name" colspan="2"
                                    prompt="姓名" promptColspan="1" style="width:100%" required="true"/>
                <h:hlsCombobox name="gender" id="gender"
                               bind="enabled: enabled,source: gender, value:data.gender"
                               colspan="2" dataTextField="meaning" dataValueField="value"
                               placeholder="性别" prompt="性别" promptColspan="1" valuePrimitive="true"
                               style="width:100%"/>

                <img src="" alt="暂无图片" id="avatar" width="80px" height="80px" style="margin-left: 120px"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="secondBox">
                <h:hlsMaskedTextBox name="mobile" id="mobile" bind="enabled: enabled, value:data.mobile" colspan="2"
                                    prompt="手机号" promptColspan="1" style="width:100%" required="true"/>
                <h:hlsMaskedTextBox name="email" id="email" bind="enabled: enabled, value:data.email" colspan="2"
                                    prompt="邮箱" promptColspan="1" style="width:100%"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="thirdBox">
                <h:hlsMaskedTextBox name="position" id="position" bind="enabled: enabled, value:data.position"
                                    colspan="2"
                                    prompt="职位" promptColspan="1" style="width:100%"/>
                <h:hlsCombobox name="isleader" id="isleader"
                               bind="enabled: enabled,source: isleader, value:data.isleader"
                               colspan="2" dataTextField="meaning" dataValueField="value"
                               placeholder="是否上级" prompt="是否上级" promptColspan="1" valuePrimitive="true"
                               style="width:100%"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="fourthBox">
                <h:hlsMaskedTextBox name="telephone" id="telephone" bind="enabled: enabled, value:data.telephone"
                                    colspan="2"
                                    prompt="座机" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="englishName" id="englishName" bind="enabled: enabled, value:data.englishName"
                                    colspan="2"
                                    prompt="英文名" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="extattr" id="extattr" bind="enabled: enabled, value:data.extattr" colspan="2"
                                    prompt="扩展属性" promptColspan="1" style="width:100%"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="fifthBox">
                <h:hlsMaskedTextBox name="nickname" id="nickname" bind="enabled: enabled, value:data.nickname"
                                    colspan="2"
                                    prompt="昵称" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="city" id="city" bind="enabled: enabled, value:data.city" colspan="2"
                                    prompt="城市" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="country" id="country" bind="enabled: enabled, value:data.country" colspan="2"
                                    prompt="国家" promptColspan="1" style="width:100%"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="sixthBox">
                <h:hlsMaskedTextBox name="province" id="province" bind="enabled: enabled, value:data.province"
                                    colspan="2"
                                    prompt="省份" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="language" id="language" bind="enabled: enabled, value:data.language"
                                    colspan="2"
                                    prompt="语言" promptColspan="1" style="width:100%"/>
                <h:hlsMaskedTextBox name="remark" id="remark" bind="enabled: enabled, value:data.remark" colspan="2"
                                    prompt="备注" promptColspan="1" style="width:100%"/>
            </div>
        </h:hlsHBox>
        <h:hlsHBox>
            <div id="seventhBox">
                <h:hlsDatePicker id="subscribeTime" bind="enabled: isEnabled,value:data.subscribeDate"
                                 style="width:100%;"
                                 placeholder="关注时间"
                                 prompt="关注时间"
                                 colspan="2"
                                 promptColspan="1"
                />
            </div>
        </h:hlsHBox>
    </h:hlsForm>
    <h:hlsToolBar id="toolBar">
        <h:hlsButton id="save" text="提交修改"></h:hlsButton>
    </h:hlsToolBar>
    <script><![CDATA[
    document.getElementById("avatar").src = viewModel.data.avatar;
    if (accountType == 1) {
        $("#fifthBox").hide();
        $("#sixthBox").hide();
        $("#seventhBox").hide();

    } else if (accountType == 2 || accountType == 3) {
        $("#firstBox").hide();
        $("#secondBox").hide();
        $("#thirdBox").hide();

    }

    $("#hlstoolbar_toolBar").hide();
    ]]></script>
</h:screen>