<%@ Page Title="" Language="C#" MasterPageFile="../BaseMaster.Master" CodeBehind="UserInfoDetail.aspx.cs" Inherits="WAP2P.Web.PC.Admin.Member.UserInfoDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="header" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <form class="auto" method="post" action="<% =Request.RawUrl %>"  onsuccess="parent.$.jPopupEdit.close(true);">
        <div class="m-editbar">
            <% =Request.QueryString["op"]  == "view" ? string.Empty : "<input type=\"submit\" class=\"btn-larger c-priority iconfont\" value=\"&#xe684; 保存\" />" %>
            <input type="button" class="btn-larger c-normal iconfont" value="&#xe634; 关闭" onclick="parent.$.jPopupEdit.close();" />
        </div>
        <div class="m-content m-editcontent">            
            <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <th>会员账号</th>
                    <td class="g-fbold"><% =GetUserDisplay(Model.Id, Model.Name) %></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <dl class="edittabs" id="formTabs">
                            <dt>
                                <asp:Repeater runat="server" ID="rptFormModuledt" ItemType="WAP2P.Sys.FormModule">
                                    <ItemTemplate>
                                        <label<%# Container.ItemIndex == 0 ? " class=\"on\"" : string.Empty %>><span><%# Item.Name %>(<%# Item.ValidStatus.GetDescription() %>)</span></label>
                                    </ItemTemplate>
                                </asp:Repeater>                                    
                            </dt>
                            <asp:Repeater runat="server" ID="rptFormModuledd" ItemType="WAP2P.Sys.FormModule">
                                <ItemTemplate>
                                    <dd<%# Container.ItemIndex == 0 ? " class=\"on\"" : string.Empty %>>
                                        <div class="pa10">
                                            <input type="hidden" class="js-moduleCallCode" name="moduleCallCode" value="<%# Item.CallCode.HtmlEncode() %>" />
                                            <table class="m-info" cellpadding="0" cellspacing="0" width="100%">
                                                <asp:Repeater runat="server" ID="rptFormFields" ItemType="WAP2P.Sys.FormField">
                                                    <ItemTemplate>
                                                        <%# Item.BuildHtml("<tr><th>{%=Name%}</th><td>{%=Value%}</td></tr>", Request.QueryString["op"] == "edit", formMoule.CallCode + "_") %>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                                <% if(Request.QueryString["op"] != "edit") { %>
                                                <tr><th class="info-listhead" colspan="2">资料审核</th></tr>
                                                <tr>
                                                    <th>审核状态</th>
                                                    <td>
                                                        <%# Request.QueryString["op"] == "valid" && Item.ValidStatus == FormSettingValidStatus.WaitValid ? string.Format(@"<div class=""ui-radio""><label><input type=""radio"" name=""{0}_validStatus"" value=""0"" checked=""checked"" /> 等待审核</label> <label><input type=""radio"" name=""{0}_validStatus"" value=""1"" /> 通过</label><label><input type=""radio"" name=""{0}_validStatus"" value=""-1"" /> 拒绝</label></div>", Item.CallCode) : Item.ValidStatus.GetDescription() %>                                                    
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th>审核备注</th>
                                                    <td><textarea name="<%# Item.CallCode %>_validRemark"<%# Request.QueryString["op"] != "valid" ? "readonly=\"readonly\"" : string.Empty %>><%# Item.ValidRemark.HtmlEncode() %></textarea></td>
                                                </tr>
                                                <tr>
                                                    <th>审核信息</th>
                                                    <td><%# Item.ValidStatus == FormSettingValidStatus.ValidSuccess ? string.Format("操作员 {0} 于 {1} 审核通过！", Item.ValidByName, Item.ValidAt.ToDateTimeString()) : string.Empty %></td>
                                                </tr>
                                                <%} %>    
                                            </table>
                                        </div>
                                    </dd>
                                </ItemTemplate>
                            </asp:Repeater>
                        </dl>
                    </td>
                </tr>
            </table>
        </div>
    </form>    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script" runat="server">
    <script src="<% =this.ImportJsCss("../res/core/Scripts/edittabs.js") %>"></script>
    <script src="<% =this.ImportJsCss("../../res/core/scripts/areadata.js") %>"></script>
    <script>
        //配合后端的表单编辑的js
        var formService = {
            initJs: function() {
                $('script.js-script').each(function (i, n) {
                    eval(n.innerHTML);
                });
            },
            initUpload: function(id, multi, isfile) {
                setTimeout(function () {
                    $('#' + id + 'File').uploadify({
                        width: 120,
                        height: 32,
                        multi: multi ? true : false,
                        removeTimeout: 0,
                        swf: '../res/uploadify/uploadify.swf?v=<% =CryptoHelper.Random(100000,999999) %>',
                        uploader: '../res/uploadify/SwfUpload.aspx?type=' + (isfile ? 'file' : 'image'),
                        buttonClass:'iconfont',
                        buttonText: '&#xe629; 上传' + (isfile ? '文件' : '图片'),
                        fileTypeExts: isfile ? '<% =WAP2P.Web.PC.Admin.Res.uploadify.SwfUpload.AllowFiles %>' : '<% =WAP2P.Web.PC.Admin.Res.uploadify.SwfUpload.AllowImages %>',
                        formData: {
                            <% =WAP2P.Web.Admin.Membership.CookieName %> : '<% =Request.Cookies[WAP2P.Web.Admin.Membership.CookieName].Value %>'
                        },
                        onUploadSuccess: function(res, data) {
                            eval('var d = ' + data);
                            if (d.Success) {
                                var showHtml = isfile ? '<a href="' + d.Message + '" target="_blank">点击下载查看</a>' : '<a href="' + d.Message + '" target="_blank"><img width="150" src="' + d.Message + '" alt="" /></a>';
                                if (multi) {
                                    var vals = $('#' + id + 'Input');
                                    vals.append('<input type="hidden" name="' + id + '" value="' + d.Message + '" />');
                                    vals.find('.js-uploadMustInput').val(d.Message).trigger('blur');
                                    $('#' + id + 'Result').append(showHtml);
                                } else {
                                    $('#' + id).val(d.Message).trigger('blur');
                                    $('#' + id + 'Result').html(showHtml);
                                }
                            } else {
                                $.jError(d.Message);
                            }
                        }
                    });
                }, 10);
            },
            init: function() {
                formService.initJs();
                $('input.js-imageUpload').each(function(i, n) {
                    n = $(n);
                    formService.initUpload(n.attr('data-id'), false, false);
                });
                $('input.js-imageMultiUpload').each(function(i, n) {
                    n = $(n);
                    formService.initUpload(n.attr('data-id'), true, false);
                });
                $('input.js-fileUpload').each(function(i, n) {
                    n = $(n);
                    formService.initUpload(n.attr('data-id'), false, true);
                });
                $('input.js-fileMultiUpload').each(function(i, n) {
                    n = $(n);
                    formService.initUpload(n.attr('data-id'), true, true);
                });

                //自定义表单多图片或文件上传处理
                $('.ui-imageuploadmulti, .ui-fileuploadmulti').on('mouseenter', 'a', function () {                    
                    $(this).append($('<i class="iconfont fs22 listvalue-delete" title="删除">&#xe65a;</i>').click(function() {
                        var a = $(this).closest('a'), src = a.attr('href');
                        var inputs = a.closest('div').next();
                        inputs.find('[value="' + src + '"]').not('.js-uploadMustInput').remove();
                        if (inputs.find('input').length == 1) inputs.find('.js-uploadMustInput').val('');
                        a.remove();
                        return false;
                    }));
                }).on('mouseleave', 'a', function () {
                    $(this).find('i').remove();
                });
            }
        };

        formService.init();

        var imgObj=$('.ui-customuploads').before('<div class="customuploads-new"><div class="customuploads-col"></div><div class="customuploads-col"></div><div class="customuploads-col"></div></div>').find('img').each(function(){
            var me=$(this),
                myparent=me.parent(),
                newImgList=myparent.prev(),
                imgUrl=me.attr('src'),
                indexNum=me.index()+1; 
            if(indexNum%3==0){
                indexNum=2;
            }else if(indexNum%3==1){
                indexNum=0;
            }else{
                indexNum=1;
            };

            newImgList.find('.customuploads-col').eq(indexNum).append('<a target="_blank" href="'+ imgUrl +'"><img src="'+ imgUrl +'" width="'+newImgList.find('.customuploads-col').width()+'" /></a>');
            if(myparent.find('img').length==newImgList.find('img').length){
                myparent.remove();
            }
        });
        $('.m-info').imageWidthReset({ 'pWidth': 210 });
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="list" runat="server">
</asp:Content>