<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Transactions_TA_UI_Transactions_PermissionSanctionModify_Angler, App_Web_kcclil20" %>
<asp:Content ID="ConPermissionSanctionModify" ContentPlaceHolderID="BodyContentPH"
    runat="Server">
    <script type="text/javascript">
     function PermissionSanctionValidation()
    {
     var status=document.aspnetForm.ctl00_BodyContentPH_hdnStatusofApplication.value;
     var Authority=document.aspnetForm.ctl00_BodyContentPH_hdnAutorityLevel.value;
      if(Authority=='2' && status=='Pending')
      {
      return confirm('Reporting person yet to approve, do you want to continue?');
      }
      else
      {
      return true;
      }      
    }
//       function openPopupMailTo()
//   {
//        var MailType="TO";
//        window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '','Test','height=610,top=200,left=250,width=600');
//        return false;
//   }
//    function openPopupMailCc()
//   {
//        var MailType="CC";
//        window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '','Test','height=610,top=200,left=250,width=600');
//        return false;
//   }
   function openPopupMailTo() {
            var MailType = "TO";
            document.getElementById('ctl00_BodyContentPH_iframePopup').src ='GetEmailIdsPopup.aspx?MailType=' + MailType + '', '';
           // window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,height=700,top=200,left=250,width=800;scrollbars=yes');
            return false;
        }
        function openPopupMailCc() {
            var MailType = "CC";
             document.getElementById('ctl00_BodyContentPH_iframePopup').src ='GetEmailIdsPopup.aspx?MailType=' + MailType + '', '';
           // window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '', '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,height=700,top=200,left=250,width=800;scrollbars=yes');
            return false;
        }
    function RedirectionFunction()
    {
        //alert('Test');
        document.getElementById('ctl00_BodyContentPH_btn_Cancel').click();
    }
    function Validation()
    {
        var LTypeIndex=document.aspnetForm.ctl00_BodyContentPH_ddl_LeaveType.selectedIndex;
        var LeaveType=document.aspnetForm.ctl00_BodyContentPH_ddl_LeaveType.options[LTypeIndex].value; 
        var TypeIndex=document.aspnetForm.ctl00_BodyContentPH_ddl_Type.selectedIndex;
        var Type=document.aspnetForm.ctl00_BodyContentPH_ddl_Type.options[TypeIndex].value; 
        if(LeaveType=="-Select-")  
        {
             alert("Select Leave Type");
             return false;
        }
        else if (Type=="-Select-") 
        {
             alert("Select Leave/Restricted Holiday");
             return false;
        }
        else if(document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value=="")
        {
              alert("Fill From Date");
              return false;
        } 
        else if(document.aspnetForm.ctl00_BodyContentPH_txtToDate.value=="")
        {
              alert("Fill To Date");
              return false;
        } 
        else if(document.aspnetForm.ctl00_BodyContentPH_txtReason.value=="")
        {
              alert("Fill Reason");
              return false;  
        }
       /* else if(document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value!="" && document.aspnetForm.ctl00_BodyContentPH_txtToDate.value!="")
        {   
               var Curdate=new Date();
               var CurYear=Curdate.getFullYear();
               var CurMonth=Curdate.getMonth();
               CurMonth=CurMonth+1;
               if(CurMonth < 10)
               {
                var CurMonth="0" + CurMonth;
               }
               var cdate=Curdate.getDate();
               var TDate=document.aspnetForm.ctl00_BodyContentPH_txtToDate.value;
               var FDate=document.aspnetForm.ctl00_BodyContentPH_txtFromDate.value;
               var Tmon=TDate.substring(0,2);
               var Tdate=TDate.substring(3,5);
               var Tyear=TDate.substring(5,TDate.length);
               var Fmon=FDate.substring(0,2);
               var Fdate=FDate.substring(3,5);
               var Fyear=FDate.substring(5,FDate.length);
               if ((Fyear<CurYear) || (Tyear<CurYear))
               {
                   if (Fyear<CurYear)
                   {
                        alert("From Year is Past")
                        return false;
                   }
                   if (Tyear<CurYear)
                   {
                        alert("To Year is Past")
                        return false;
                   }
                }   
                   if((Fyear==CurYear) && (Tyear==CurYear))
                   {
                        if((Fmon < CurMonth) || (Tmon < CurMonth))
                        {
                           if(Fmon < CurMonth)
                            {
                                alert("From Month Is past");
                                return false;   
                            }
                            if(Tmon < CurMonth)
                            {
                                alert("To Month Is past");
                                return false;   
                            }
                        }    
                   }
               if(Fmon == Tmon)
              {
                if((Fdate < cdate) || (Tdate < cdate) )
                  {  
                    if(Fdate < cdate)
                    {
                        alert("From Date is past");
                        return false;
                    }
                    if(Tdate < cdate)
                    {
                        alert("To Date is past");
                        return false;
                    }
                  }
                  else
                  {
                      if(Fdate > Tdate)
                      {
                           alert("ToDate Should be Greater than FromDate");
                           return false;
                      }
                 }  
             }
       }*/
    else
    {
    return confirm('Are you sure to Save?');  
    }
    //return true;   
   }
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/lve-san.png'); background-repeat: no-repeat;
            padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 50px">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="650px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="exda-table">
            <h6>
                <span style="color: Red">|</span>
                <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server" Text="Mandatory"></asp:Label>
                (1 No.)</h6>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="Label1" Text="Employee Id" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblEmpID" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmpName" runat="server"></asp:Label></div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EmployeeName" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="Label2" Text="Organization Level" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblLevel" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblPermissionApplicationDate" Text="Application Date" runat="server"></asp:Label></div>
                            <div class="col-md-3">
                                <asp:Label ID="lblPermissionApplicationDateData" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Permissiondate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblPermissionDate" runat="server" Text="PermissionDate" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_AppliedHours" runat="server" Text="Applied Hours"></asp:Label></div>
                            <div class="col-md-3">
                                <asp:Label ID="lblAppliedHours" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PermissionFromTime" runat="server"></asp:Label></div>
                            <div class="col-md-3">
                                <asp:Label ID="lblPermissionFromTime" runat="server" Text="From Time" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PermissionToTime" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblPermissionToTime" runat="server" Text="To Time" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Reason" runat="server"></asp:Label></div>
                            <div class="col-md-3">
                                <asp:Label ID="lblReason" runat="server" Text="lblReason" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-5">
                            </div>
                        </div>
                        <div id="divComments" runat="server">
                            <div class="form-group">
                                <div class="col-md-11 src-LeavePaddingRight">
                                    <div id="divLeaveConversation" runat="server">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Remarks" runat="server" Text="Label"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox ID="txtRemarks" runat="server" CssClass="form-control man-dat" Height="70px"
                                    Width="400px" MaxLength="1000" onkeypress="return chkMaxLen(event,this,1000);"
                                    Style="resize: none" TextMode="MultiLine"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblApprovalCC" runat="server" Text="Cc Mail Ids"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <div class="input-group input-group-sm">
                                    <asp:TextBox ID="txtApprovalCC" runat="server" CssClass="form-control" TextMode="MultiLine"
                                        placeholder="Use Semicolon(;) to separate Email Ids" Style="resize: none" Height="70px"></asp:TextBox>
                                    <span class="input-group-btn">
                                        <asp:Button ID="btnApprovalCC" runat="server" CssClass="btn save-btn" Text="Cc..."
                                            Style="min-width: 45px" OnClientClick="javascript:return openPopupMailCc();"
                                            data-toggle="modal" data-target="#myModal" Height="70px" />
                                    </span>
                                </div>
                            </div>
                        </div>
                        <%--  <tr style="display: none">
                            <td class="td">
                                <asp:Label ID="lblApprovalTO" runat="server" Text="To Mail Ids"></asp:Label></td>
                            <td class="td" width="50%">
                                <asp:TextBox ID="txtApprovalTO" runat="server" CssClass="textbox_4" OnKeyPress="return false"
                                    Width="350px" Height="40px" TextMode="MultiLine"></asp:TextBox>
                                <asp:Button ID="btnApprovalTO" runat="server" CssClass="but" Text="To..." Width="28px"
                                    OnClientClick="javascript:return openPopupMailTo();" /></td>
                        </tr>--%>
                        <div class="row form-group" style="display: none;">
                            <div id="divStatus" runat="server" style="width: 100%">
                                <div class="col-md-2">
                                </div>
                                <div class="col-md-10">
                                    <asp:RadioButtonList ID="rblStatus" runat="server" RepeatDirection="Horizontal" CssClass="radio radio-primary"
                                        RepeatLayout="Flow">
                                    </asp:RadioButtonList>
                                    <asp:Label ID="lbl_Error" runat="server" Style="color: #ff0000"></asp:Label>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblStatus" runat="server" Text="Status"></asp:Label>
                            </div>
                            <div class="col-md-10" style="padding-left: 0px">
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbApproved" Text="Approved" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbApproved_OnCheckedChanged" />
                                </div>
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbForwarded" Text="Forwarded" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbForwarded_OnCheckedChanged" />
                                </div>
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbPending" Text="Pending" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbPending_OnCheckedChanged" />
                                </div>
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbRejected" Text="Rejected" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbRejected_OnCheckedChanged" />
                                </div>
                                <div class="col-md-2">
                                    <asp:RadioButton ID="rbResend" Text="Resend" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbResend_OnCheckedChanged" />
                                </div>
                                <div class="col-md-1">
                                    <asp:RadioButton ID="rbReply" Text="Reply" runat="server" CssClass="radio radio-primary"
                                        GroupName="ValStatus" OnCheckedChanged="rbReply_OnCheckedChanged" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                    </div>
                    <div class="col-md-5" align="right">
                        <asp:LinkButton ID="btn_Save" runat="server" CssClass="btn save-btn  fa-floppy-o"
                            OnClick="btn_Save_Click" OnClientClick="return PermissionSanctionValidation();" />
                        <asp:LinkButton ID="btn_Cancel" runat="server" CausesValidation="False" CssClass="btn save-btn fa-angle-left"
                            OnClick="btn_Cancel_Click" />
                        <asp:HiddenField ID="hdnStatusofApplication" runat="server" />
                        <asp:HiddenField ID="hdnAutorityLevel" runat="server" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
