<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/SiteMenu.Master" AutoEventWireup="true" CodeBehind="CustomerPhoto.aspx.cs" Inherits="Crm25175.CustomerPhoto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" href="../assets/css/jquery-ui-1.10.3.full.min.css" />

    <script type="text/javascript">
        function DoubleAddClick() {
            document.getElementById('<%=BT_Add.ClientID %>').click();
        }
        //后台调用,区分提示信息底色
        //Danger,Info
        function ChangeMsgClass(MsgType) {
            if (MsgType == "Danger") 
            {
                DivMsg.className = 'alert alert-danger';
            }
            else 
            {
                DivMsg.className = 'alert alert-info';
            }
        }
    </script>
    <link rel="stylesheet" href="../assets/css/datepicker.css" />

    <link rel="stylesheet" href="../assets/css/colorbox.css" />

   <%-- <link rel="stylesheet" href="../assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="../assets/css/ace-skins.min.css" />--%>



</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
		</script>
		<ul class="breadcrumb">
			<li>
				<i class="<%=PageIcon %>"></i>
                客戶照片
			</li>
		</ul>
	</div>

    <div class="page-content">
        <div class="row col-xs-12">
            <div id="DivMsg" class="alert alert-info">
                <i class="icon-hand-right"></i>
                <asp:Label ID="LabMsg" runat="server" Text=" "></asp:Label>
			    <button class="close" data-dismiss="alert">
                <i class="icon-remove"></i>
                </button>
            </div>
        </div>

        <div class="page-header">
            <div class="col-xs-12 widget-box">
                <asp:Button ID="BtMenuList" runat="server" OnClick="BtMenuList_Click" Text="照片列表" CssClass="btn btn-info btn-sm" />
                <asp:Button ID="BtMenuAdd" runat="server" OnClick="BtMenuAdd_Click" Text="添加" CssClass="btn btn-primary btn-sm" />
                <%--<asp:Button ID="BtMenuDel" runat="server" OnClick="BtMenuDel_Click" Text="删除" CssClass="btn btn-info btn-sm hidden" />
                <asp:Button ID="BtDel" runat="server" Text="删除" CssClass="btn btn-danger btn-sm"/>--%>
                <asp:TextBox runat="server" ID="TxtCustName_Find" placeholder="姓名..." CssClass="input-mini"></asp:TextBox>
                <span>
                    <asp:TextBox runat="server" ID="TxtDateStart" placeholder="上传起始" CssClass="input-small date-picker" data-date-format="yyyy-mm-dd"></asp:TextBox> ~
                </span>
                <span>
                    <asp:TextBox runat="server" ID="TxtDateEnd" placeholder="上传结束" CssClass="input-small date-picker" data-date-format="yyyy-mm-dd"></asp:TextBox>
                </span>
                <asp:Button ID="BtSearch" runat="server"  CssClass="btn btn-success btn-sm hidden" 
                    Text="查找" onclick="BtSearch_Click" />
				<span >
					<a href="#" data-action="reload"><i class="icon-search nav-search-icon green bigger-140" id="idsearch" title="查找"></i></a>
				</span>
                
            </div>
        </div>
		
        <div id="dialog-del" class="hide">
			<div class="alert alert-warning bigger-110">
				当前这张照片将被删除。
			</div>
			<div class="space-6"></div>
			<p class="bigger-110 bolder center grey">
				<i class="icon-hand-right blue bigger-120"></i>
				确定删除吗?
			</p>
		</div><!-- #dialog-confirm -->



        <asp:Panel runat="server" Visible="false" ID="PanelAdd">
            <div class="row" id="DivAdd">
                <div class="col-xs-12">
                    <div class="col-xs-6">
                        <div class="row">
				            <div class="profile-info-row">
					            <div class="profile-info-name">客户姓名</div>
					            <div class="profile-info-value row">
                                    <asp:TextBox ID="TxtCustName_Add" runat="server"></asp:TextBox>
                                    <asp:Button ID="BtFindCustName" runat="server"  CssClass="btn btn-success btn-sm hidden" 
                                        Text="筛选" onclick="BtFindCustName_Click" />
				                    <span >
					                    <a href="#" data-action="reload"><i class="icon icon-chevron-right green bigger-140" id="FindCustName" title="筛选">查找</i></a>
				                    </span>
                                </div>
				            </div>
                            
                        </div>
                    </div>

                    <div class="col-xs-6">
                        <div class="row">
				            <div class="profile-info-row">
					            <div class="profile-info-name">选择客户</div>
					            <div class="profile-info-value">
						            <asp:DropDownList ID="DDLCustID_Add" runat="server">
                                    </asp:DropDownList>
					            </div>

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

                    <div class="row">
                        <div class="col-xs-6 col-sm-offset-2">
                            <input id="FacePhoto_Edit" type="file" runat="server"/>
                        </div>
                    </div>

                    <div class="col-xs-10">
                        <div class="row">				    
				            <div class="profile-info-row">
					            <div class="profile-info-name">照片说明</div>
					            <div class="profile-info-value">
						            <asp:TextBox ID="TxtPhotoDetail_Add" runat="server" CssClass="col-xs-12"></asp:TextBox>
					            </div>
				            </div>
			            </div>
                    </div>
                    
				    <div class="form-group col-xs-12 center">
                        <div class="space-6"></div>
                        <asp:Button ID="BT_Add" runat="server" Text="新增" class="icon-ok"
                                CssClass="btn btn-info icon-ok btn-sm hidden" OnClick="BT_Add_Click" />
                        <button class="btn btn-info bigger-110" type="button" onclick="DoubleAddClick()">
						    <i class="icon-ok"></i>
						    新增
					    </button>
                        <Button id="Reset1" type="reset" value="取消"  class="btn bigger-110" >
                            <i class="icon-undo"></i>
					        Reset
                        </Button>
                    </div>
                </div>
            </div>
        </asp:Panel>

        <asp:Panel runat="server" Visible="false" ID="PanelData">
            <div class="row">
	            <div class="col-xs-12">
		            <div class="row-fluid">
                        <ul class="ace-thumbnails">                                                 
                            <asp:Literal ID="LiteralPhoto" runat="server"></asp:Literal>
                        </ul>
		            </div><!-- /.table-responsive -->
	            </div><!-- /span -->
            </div>
        </asp:Panel>
    </div>
    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder_Footer" runat="server">

    <script type="text/javascript" src="../assets/js/jquery-2.0.3.min.js"></script>

	<script type="text/javascript">
		window.jQuery || document.write("<script src='../assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
	</script>

	<script type="text/javascript">
		if ("ontouchend" in document) document.write("<script src='../assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
	</script>
	<script type="text/javascript" src="../assets/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../assets/js/typeahead-bs2.min.js"></script>

	<!-- page specific plugin scripts -->
    <!--插件bootstrap-datepicker.min.js必须在jquery-ui-1.10.3.full.min.js之后,否则日期格式、年的选中等会部分失效-->
    <script type="text/javascript" src="../assets/js/jquery-ui-1.10.3.full.min.js"></script>	
    <script type="text/javascript" src="../assets/js/date-time/bootstrap-datepicker.min.js"></script>
	<script type="text/javascript" src="../assets/js/jquery.ui.touch-punch.min.js"></script>


    <script type="text/javascript" src="../assets/js/jquery.colorbox-min.js"></script>


	<!-- ace scripts -->

	<script type="text/javascript" src="../assets/js/ace-elements.min.js"></script>
	<script type="text/javascript" src="../assets/js/ace.min.js"></script>
    <script type="text/javascript" src="../assets/js/bootbox.min_25175.js"></script>

    <script type="text/javascript">

        jQuery(function ($) {

            //对话框全局
            $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
                _title: function (title) {
                    var $title = this.options.title || '&nbsp;'
                    if (("title_html" in this.options) && this.options.title_html == true)
                        title.html($title);
                    else title.text($title);
                }
            }));

            //删除
            //$("#DelPhotoN").on('click', function (e) {
            $(document.getElementsByName("DelPhotoN")).on('click', function (e) {
                e.preventDefault();
                var cp_id = $(this).attr("href");
                var div_id = $(this).parent("div").parent("li").attr("value");
                $("#dialog-del").removeClass('hide').dialog(
                            {
                                resizable: false,
                                modal: true,
                                title: "<div class='widget-header'><h4 class='smaller'><i class='icon-warning-sign red'></i>删除</h4></div>",
                                title_html: true,
                                buttons: [
						            {
						                html: "<i class='icon-trash bigger-110'></i>&nbsp; 确定",
						                "class": "btn btn-danger btn-xs",
						                click: function () {
						                    $.post("DeletePhoto.aspx",
                                            {
                                                cpid: cp_id
                                            },
                                            function (data, status) {
                                                //判断返回是否成功
                                                if (data == "删除照片成功") {
                                                    alert("结果: " + data + "\n状态: " + status);
                                                    //remove照片
                                                    $(document.getElementById(div_id)).remove();
                                                    //notice
                                                    $("#ContentPlaceHolder1_LabMsg").html("删除照片成功");
                                                    $("#DivMsg").removeClass('alert-danger');
                                                }
                                                else {
                                                    $("#ContentPlaceHolder1_LabMsg").html("删除照片失败");
                                                    $("#DivMsg").addClass('alert alert-danger');
                                                }
                                            });
						                    //close确认
						                    $(this).dialog("close");
						                }
						            }
						            ,
						            {
						                html: "<i class='icon-remove bigger-110'></i>&nbsp; 取消",
						                "class": "btn btn-xs",
						                click: function () {
						                    $(this).dialog("close");
						                }
						            }]
                            });
            });

            //日期
            $('.date-picker').datepicker({ autoclose: true }).next().on(ace.click_event, function () {
                $(this).prev().focus();
            });

            //查询
            $("#idsearch").on('click', function (e) {
                document.getElementById('<%=BtSearch.ClientID %>').click();
            });

            $("#FindCustName").on('click', function (e) {
                document.getElementById('<%=BtFindCustName.ClientID %>').click();
            });

            var colorbox_params = {
                reposition: true,
                scalePhotos: true,
                scrolling: false,
                previous: '<i class="icon-arrow-left"></i>',
                next: '<i class="icon-arrow-right"></i>',
                close: '&times;',
                current: '{current} of {total}',
                maxWidth: '100%',
                maxHeight: '100%',
                onOpen: function () {
                    document.body.style.overflow = 'hidden';
                },
                onClosed: function () {
                    document.body.style.overflow = 'auto';
                },
                onComplete: function () {
                    $.colorbox.resize();
                }
            };

            $('.ace-thumbnails [data-rel="colorbox"]').colorbox(colorbox_params);
            $("#cboxLoadingGraphic").append("<i class='icon-spinner orange'></i>"); //let's add a custom loading icon

            $('#ContentPlaceHolder1_FacePhoto_Edit').ace_file_input({
                style: 'well',
                btn_choose: '选择照片',
                btn_change: null,
                no_icon: 'icon-cloud-upload',
                droppable: true,
                thumbnail: 'small',
                preview_error: function (filename, error_code) {
                }
            }).on('change', function () {
            });

        });
    </script>
    

</asp:Content>
