@using GBLab.Entities
@using GBLab.Common.Expand

@model T_User
@{
    // 模板视图
    Layout = "~/Areas/Manage/Views/DefaultSkin/Shared_Back/_Layout_ContentBase.cshtml";

    // 权限列表
    var actions = ViewData["actions"] as Dictionary<string, string>;

    // 树形链接
    string dataTreeUrl = ViewData["dataTreeUrl"].ToString();
    string dataDepartmentTreeUrl = ViewData["dataDepartmentTreeUrl"].ToString();
    string dataPostTreeUrl = ViewData["dataPostTreeUrl"].ToString();
}

@section Head{
}

@section JavaScript{
    @Html.Partial("~/Areas/Manage/Views/DefaultSkin/Shared_Back/_Layout_Head_Edit.cshtml")

    <script>
        // 重载掉基类的写法
        $(function () {
            $('#EditForm').ajaxForm({
                beforeSubmit: function () {

                    //遍历必填的文本框如果值为空就提示 并隐藏进度条
                    $('#EditForm input').each(function () {
                        if (($(this).attr('required') != undefined || $(this).attr('validType') != undefined) && $(this).attr('class').toString().indexOf('easy') < 0) {
                            if (!$(this).validatebox('isValid')) {
                                alert($(this).parents("td").prev("th").html() + "数据异常！");
                                $.messager.progress('close');
                            }
                        }
                    })

                    //提交前验证
                    var isValid = $('#EditForm').form('validate');
                    if (!isValid) {
                        // 如果表单是无效的则隐藏进度条
                        $.messager.progress('close');
                    }

                    // 返回false终止表单提交
                    return isValid;
                },
                success: function (data) {

                    //提交成功后
                    $.messager.progress('close');
                    if (data.result.success) {
                        $.messager.alert('提示', data.result.message, 'info', function () {
                            //window.parent.refreshGrid();
                            if (data.guid != undefined) {
                                window.setGuid(data.guid);
                            }
                        });
                    } else {
                        $.messager.alert('错误', data.result.message, 'error');
                    }

                },
                error: function (data) {

                    alert(data);

                    //提交失败
                    $.messager.progress('close');
                    $.messager.alert('错误', '页面提交发生错误，请联系管理员', 'error');
                },
                dataType: 'json'//数据格式
            });
        });
    </script>
}

<div data-options="region:'center',border:true">
    @using (Html.BeginForm("ChangePassword_Action", "User", new { action = "Post" }, FormMethod.Post, new { ID = "EditForm", name = "EditForm", fit = "true", style = "width:100%;height:100%;" }))
    {
        @*系统机制*@
        @Html.ValidationSummary()
        @Html.AntiForgeryToken()

        @*系统参数*@
        @Html.Hidden("IsNew", false)
        @Html.Hidden("ActionGUID", "")
        @Html.Hidden("Template", ViewData["Template"])
        @Html.Hidden("MvcMarkName", ViewData["MvcMarkName"])
        @Html.Hidden("MvcClassID", ViewData["MvcClassID"])

        @*字段隐藏*@
        @Html.HiddenFor(m => m.F_Id)
        @Html.HiddenFor(m => m.F_Guid)
        @Html.HiddenFor(m => m.F_MarkName)

        @*视图展示*@
        <div class="easyui-tabs" data-options="border:false,fit:true,plain:true">
            <div title="基本信息" style="padding:6px;">
                <table class="table">
                    <tr>
                        <th class="tdright" style="width: 100px;">
                            ID GUID：<em></em>
                        </th>
                        <td colspan="5">
                            @(Model.F_Id) 【@(Model.F_Guid.ToString().ToUpper())】
                        </td>
                    </tr>
                    <tr>
                        <th class="tdright">
                            昵称：<em>*</em>
                        </th>
                        <td colspan="5">
                            @(Html.TextBoxFor(t => t.F_Name, new { @Class = "easyui-validatebox textbox w500 Title ", required = "true" }))
                        </td>
                    </tr>
                    @if (Model.F_Id <= 0)
                    {
                        <tr>
                            <th class="tdright">
                                账户：<em>*</em>
                            </th>
                            <td colspan="5">
                                @(Html.TextBoxFor(t => t.F_Account, new { @Class = "easyui-textbox w500 ", @data_options = "prompt:'请输入账户',readonly:false,disabled:false,validType:['length[0,30]']", required = "true" }))
                            </td>
                        </tr>
                    }
                    else
                    {
                        <tr>
                            <th class="tdright">
                                账户：<em>*</em>
                            </th>
                            <td colspan="5">
                                @(Html.TextBoxFor(t => t.F_Account, new { @Class = "easyui-textbox w500 ", @data_options = "prompt:'请输入账户',readonly:true,disabled:false,validType:['length[0,30]']", required = "true" }))
                            </td>
                        </tr>
                    }
                    <tr>
                        <th class="tdright">
                            旧密码：<em>*</em>
                        </th>
                        <td colspan="5">
                            <input name="F_OldPassword" id="F_OldPassword" class="easyui-passwordbox w500" data-options="prompt:'请输入旧密码'" type="password">
                        </td>
                    </tr>
                    <tr>
                        <th class="tdright">
                            新密码：<em>*</em>
                        </th>
                        <td colspan="5">
                            <input name="F_ConfirmPassword" id="F_ConfirmPassword" class="easyui-passwordbox w500" data-options="prompt:'请输入新密码'" type="password">
                        </td>
                    </tr>
                    <tr>
                        <th class="tdright">
                            再次输入密码：<em>*</em>
                        </th>
                        <td colspan="5">
                            <input name="F_SecondPassword" id="F_SecondPassword" class="easyui-passwordbox w500" data-options="prompt:'请再次输入新密码'" type="password">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    }
</div>

@*底部操作*@
<div class="dialog-button TextCenter" data-options="region:'south',border:false">
    <a href="javascript:void(0);" class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-edit',plain:false" onclick="return Edit('5761b946-1e4f-4e37-992f-b68368b8f47a');" group="" id="">编辑</a>
    @*<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-no'" onclick="return window.parent.cancel();">取消</a>*@
</div>