<%@ Page Title="工作日历" Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true" CodeBehind="sDay.aspx.cs" Inherits="helpdesk.admin.sDay" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


     
     

  <style>

  #cccal   table {
         border-collapse:collapse;
        }

        .r {
        color:#e02d2d;

        }       
   #cccal     td,    #cccal th {
  width: 65px;
  height: 60px;
  border: 1px solid #c8cacc;
  padding:0px;
   text-align:center;
} 
      
  #cccal   th.weekend {
    color: #e02d2d;
  }



.day-weekend {
   display: block;
  height: 22px;
  font-size: 18px;
   width:55px;
    text-align:center;
    color:#e02d2d;
   }

  .day-day {
  display: block;
  height: 22px;
  font-size: 18px;
   width:55px;
    text-align:center; 
}

  
     .tdrelative {
  position: relative;
  width: 100%;
  zoom: 1;
}


 

   
     .chn {
  display: block; margin-top:4px;
  color: #999;
  font-size: 12px;
}
       
 .xj{
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 15px;
  height: 15px;
  color: #fff;
  background: #f43;
  text-align: left;
  text-indent: 1px;
  line-height: 14px;
  overflow: hidden;
}


  .sb{
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 15px;
  height: 15px;
  color: #fff;
  background: #000;
  text-align: left;
  text-indent: 1px;
  line-height: 14px;
  overflow: hidden;
}
   

    </style>
 


    
    
<div class="result-wrap">


   <div class="result-title">
             <span class="span_help">说明</span>:设置工作日历，以便系统自动计算工作效率。
        </div>

   







    <div class="alert alert-success">
        <b>说明</b>在日历上右键选择单击，可以设置日期是否是节假日或者调整。
    </div>



    <div id="cccal">



          <div >
    
        <asp:DropDownList runat="server" style="display:inline-block" CssClass="form-control" Width="150px" ID="ddl_year" OnSelectedIndexChanged="ddl_year_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
              年
          <asp:DropDownList runat="server"  style="display:inline-block"  CssClass="form-control" Width="100"  ID="ddl_month" OnSelectedIndexChanged="ddl_month_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
              月
        <asp:label runat="server" ID="lbl_calendar"></asp:label>


          
    
      
    <ul class="dropdown-menu" id="contextMenu">
        <li>
            <a href="#" onclick="xiujia(1); return false;"  >标记休假</a>    
        </li>
         <li>
            <a href="#"  onclick="xiujia(0); return false;"  >取消休假标记</a>    
        </li>

          <li role="separator" class="divider">

          </li>
         

        <li>
            <a href="#"  onclick="shangban(1); return false;"  >标记上班</a>    
        </li>
                  <li>
           <a href="#"  onclick="shangban(0); return false;"  >取消上班标记</a>    
        </li>
        <li>
            

</ul>



          <input type="hidden" id="hf_trid" value="1900-1-1" />

          <input type="hidden" id="hf_selid" value="" />

        <script>



            //文档对象注册鼠标按下事件；
            $(document).on("mousedown", function (event) {
                //button等于0代表左键，button等于1代表中键
                if (event.button == 0 || event.button == 1) {

                    if (event.target.nodeName.toLowerCase() == "a") {
                    }
                    else {
                        $("#contextMenu").hide();//获取菜单停止动画，进行隐藏使用淡出效果
                    }
                }
            });




            //文档对象注册上下文（右键）菜单事件
            $("#tbl_cal tbody tr td").on("contextmenu", function (event) {
                var pageX = event.pageX;//鼠标单击的x坐标
                var pageY = event.pageY;//鼠标单击的y坐标

                $("#hf_trid").val($(this).attr("data-day"));
                $("#hf_selid").val($(this).prop("id"));

                //获取菜单
                var contextMenu = $("#contextMenu");

                var cssObj = {
                    top: pageY + "px",//设置菜单离页面上边距离，top等效于y坐标
                    left: pageX + "px"//设置菜单离页面左边距离，left等效于x坐标
                };

                //判断横向位置（pageX）+自定义菜单宽度之和，如果超过页面宽度及为溢出，需要特殊处理；
                var menuWidth = contextMenu.width();
                var pageWidth = $(document).width();
                if (pageX + contextMenu.width() > pageWidth) {
                    cssObj.left = pageWidth - menuWidth - 5 + "px"; //-5是预留右边一点空隙，距离右边太紧不太美观；
                }

                //设置菜单的位置
                $("#contextMenu").css(cssObj).show();//显示使用淡入效果,比如不需要动画可以使用show()替换;

                event.preventDefault();//阻止浏览器与事件相关的默认行为；此处就是弹出右键菜单
            });







            function xiujia(isXiujia) {
                _theid = $("#hf_trid").val();
                $.ajax({ cache: false, url: "ajax/day_op.aspx?calid=<%=calid%>&t=xj&dt=" + escape(_theid) + "&isxiujia=" + isXiujia });
                $("#contextMenu").hide();
                var tdid = $("#hf_selid").val().replace("id_", "");

                $('#_div' + tdid + ' div').remove();

                if (isXiujia == 1) {
                    $('#_div' + tdid).append("<div class=xj>休</div>");

                }
                else {
                    $('#_div' + tdid + ' div').remove();
                }
            }

            function shangban(isXiujia) {
                _theid = $("#hf_trid").val();
                $.ajax({ cache: false, url: "ajax/day_op.aspx?calid=<%=calid%>&t=sb&dt=" + escape(_theid) + "&isxiujia=" + isXiujia });
                $("#contextMenu").hide();


                var tdid = $("#hf_selid").val().replace("id_", "");
                $('#_div' + tdid + ' div').remove();

                if (isXiujia == 1) {
                    $('#_div' + tdid).append("<div class=sb>班</div>");

                }
                else {
                    $('#_div' + tdid + ' div').remove();
                }

            }

    </script>



    </div>

    </div>











  </div>

</asp:Content>
