<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Transactions_TA_UI_Transactions_LeaveSanctionViewForBulkApproval_Angler, App_Web_kcclil20" %>
<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web"
    TagPrefix="devxEditors" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <link href="../css/ProgressBar.css" rel="stylesheet" type="text/css" />

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

    <script src="../plugins/datepicker/bootstrap-datepicker.js"></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 class="exda-table" runat="server" id="divMandatory">
            <h6>
                <span style="color: Red">|</span>
                <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server" Text="Mandatory"></asp:Label>
                <asp:HiddenField ID="hdnLeaveApplicationId" runat="server" />
                (1 No.)</h6>
        </div>
        <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="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        
                        <div class="row form-group">
                            <asp:HiddenField ID="hdnSelectRow" runat="server" />
                            <asp:HiddenField ID="hdnGetAllid" runat="server" />
                            <div class="col-md-12" style="overflow: auto; padding-bottom: 10px; overflow-y: hidden;">
                                <dxGridview:ASPxGridView ID="gdLeaveSanctionView" EnableCallBacks="false" runat="server"
                                    ClientInstanceName="gdLeaveSanctionView" AutoGenerateColumns="false" KeyFieldName="LeaveApplication_Id">
                                    <Columns>
                                        <dxGridview:GridViewDataColumn VisibleIndex="0" Width="34px" HeaderStyle-VerticalAlign="Middle"
                                            HeaderStyle-HorizontalAlign="Center" CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center">
                                            <Settings AllowAutoFilter="false" />
                                            <HeaderTemplate>
                                                <input id="chkSelectAll" runat="server" type="checkbox" onclick="SelectAllOnThisPage(this)" />
                                            </HeaderTemplate>
                                            <DataItemTemplate>
                                                <input id="chkSelect" runat="server" type="checkbox" onclick="SelectOnRow(this)"
                                                    accesskey='<%# Eval("LeaveApplication_Id") %>' />
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" ForeColor="white" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataTextColumn Caption="Employee Name" FieldName="Employee_FirstName"
                                            VisibleIndex="1">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                    <asp:Label ID="LabelEmp" Style="float: left; overflow-y: auto; overflow-x: auto;
                                                        word-break: break-all; word-wrap: break-word; display: inline-block;"
                                                        runat="server" Text='<%# Eval("Employee_FirstName")%>'></asp:Label>
                                              
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Leave_ApplicationDate" VisibleIndex="2">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Leave_ApplicationDate") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Duration" VisibleIndex="3" Width="180px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="Label3" runat="server" Text='<%# Eval("Duration") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <Settings AllowAutoFilter="False" />
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Type" VisibleIndex="4">
                                            <Settings AllowDragDrop="False" />
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Status" VisibleIndex="5" Width="70px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("Status") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                                        CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="40px">
                                        <Settings AllowAutoFilter="false" />
                                        <DataItemTemplate>
                                            <a data-toggle="modal" title="Edit" href="TA_UI_Transactions_LeaveSanctionModify_Angler.aspx?LeaveApplication_Id=<%# Eval("LeaveApplication_Id") %>&Status=<%# Eval("Status") %>">
                                                <span class="btn btn-defalut edit-icons"></span></a>
                                        </DataItemTemplate>
                                        <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                    </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="LeaveApplication_Id" VisibleIndex="6"
                                            Visible="false">
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                    </Columns>
                                    <Settings ShowGroupFooter="VisibleAlways" />
                                    <SettingsPager PageSize="10">
                                    </SettingsPager>
                                    <SettingsText EmptyDataRow="No Records Found" />
                                    <Settings ShowFilterRow="True" />
                                    <SettingsBehavior SortMode="Value" />
                                    <Styles CssFilePath="../bootstrap/css/GridView.css" AlternatingRow-CssClass="table-bg">
                                    </Styles>
                                </dxGridview:ASPxGridView>
                            </div>
                        </div>
                        <div runat="server" id="dvRemarks">
                            <div class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lblRemarks" runat="server" Text="Remarks :"></asp:Label>
                                </div>
                                <div class="col-md-10">
                                    <asp:TextBox ID="txtRemarks" runat="server" Text="OK" TextMode="MultiLine" Height="75px"
                                        CssClass="form-control man-dat" Width="500px"></asp:TextBox>
                                    <%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtRemarks"
                                                            Display="None" ErrorMessage="Enter Remarks"></asp:RequiredFieldValidator>--%>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div style="display: none" runat="server" id="tdApprovalTo">
                                    <div class="col-md-2">
                                        <asp:Label ID="lblApprovalTO" runat="server" Text="To Mail Ids"></asp:Label></div>
                                    <div class="col-md-10">
                                        <div class="input-group input-group-sm">
                                            <asp:TextBox ID="txtApprovalTO" runat="server" CssClass="form-control man-dat" Height="70px"
                                                OnKeyPress="return false" placeholder="Use Semicolon(;) to separate Email Ids"
                                                Style="resize: none"></asp:TextBox>
                                            <span class="input-group-btn">
                                                <asp:Button ID="btnApprovalTO" runat="server" CssClass="btn save-btn" Text="To..."
                                                    Style="min-width: 45px" Height="70px" OnClientClick="javascript:return openPopupMailTo();"
                                                    data-toggle="modal" data-target="#myModal" />
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lblApprovalCC" runat="server" Text="Cc Mail Ids"></asp:Label>
                                </div>
                                <div class="col-md-10">
                                    <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>
                        </div>
                    </div>
                    <div class="col-md-12" align="right">
                        <asp:LinkButton ID="btnSave" runat="server" Height="24px" Text="Sanction" Width="84px"
                            CssClass="btn save-btn  fa-floppy-o" OnClick="btnSave_Click" Visible="false" />
                        <asp:LinkButton ID="btnForward" Text="Forward" OnClientClick="return confirmMsg(this.form);"
                            runat="server" CssClass="btn save-btn fa-angle-double-right" OnClick="btnForward_Click" />
                        <asp:LinkButton ID="btnApprove" Text="Approve" OnClientClick="return confirmMsg(this.form);"
                            runat="server" CssClass="btn save-btn fa-thumbs-o-up" OnClick="btnApprove_Click" />
                        <asp:LinkButton ID="btnBack" runat="server" CssClass="btn save-btn fa-angle-left"
                            OnClick="btnBack_Click" /></div>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" language="javascript">
    function SelectAllOnThisPage(chkSelectAll)
    {   
    
        var hdnSelectRow=document.getElementById('<%= hdnSelectRow.ClientID %>' );
        var hdnSelectAll=document.getElementById('<%= hdnGetAllid.ClientID %>' );        
        if(chkSelectAll.checked == true)
        {
            for(var i=0;i< gdLeaveSanctionView.pageRowCount;i++)
            {
                if(document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_cell' + (i + gdLeaveSanctionView.visibleStartIndex) + '_0_chkSelect').disabled==false)
                {
                    document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_cell' + (i + gdLeaveSanctionView.visibleStartIndex) + '_0_chkSelect').checked=true;
                    var hdnUserId = document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_cell' + (i + gdLeaveSanctionView.visibleStartIndex) + '_0_chkSelect').accessKey;
                    var hdnSelectRow = document.getElementById('<%= hdnSelectRow.ClientID %>');
                    var removeId = hdnSelectRow.value.split(",");                    
                    if (hdnUserId != "" && !Array.contains(removeId, hdnUserId)) 
                    {
                        if (hdnSelectRow.value != "")
                            hdnSelectRow.value += ",";
                            hdnSelectRow.value += hdnUserId;
                    }                    
                }
            }            
        }
        else
        {
            for(var i=0;i< gdLeaveSanctionView.pageRowCount;i++)
            {
                document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_cell' + (i + gdLeaveSanctionView.visibleStartIndex) + '_0_chkSelect').checked=false;
            }
            hdnSelectRow.value='';
        }
    }
    
    
    function SelectOnRow(chkOnSelect)
    {
        var hdnUserId = chkOnSelect.accessKey;
        var hdnSelectRow = document.getElementById('<%= hdnSelectRow.ClientID %>');

        var removeId = hdnSelectRow.value.split(",");

        if (chkOnSelect.checked) {
            if (hdnUserId != "" && !Array.contains(removeId, hdnUserId)) {
                if (hdnSelectRow.value != "")
                    hdnSelectRow.value += ",";
                hdnSelectRow.value += hdnUserId;
            }

            var varTotalCheckedCount = 0;
            for (var i = 0; i < gdLeaveSanctionView.pageRowCount; i++) {
                if (document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_cell' + (i + gdLeaveSanctionView.visibleStartIndex) + '_0_chkSelect').checked)
                    varTotalCheckedCount = varTotalCheckedCount + 1;
                else
                    break;
            }
            if (varTotalCheckedCount == gdLeaveSanctionView.pageRowCount)
                document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_header0_chkSelectAll').checked = true;
            else
                document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_header0_chkSelectAll').checked = false;
        }
        else {
            if (Array.contains(removeId, hdnUserId)) {
                Array.remove(removeId, hdnUserId);
            }
            hdnSelectRow.value = removeId;

            document.getElementById('ctl00_BodyContentPH_gdLeaveSanctionView_header0_chkSelectAll').checked = false;
        }
    }
    //Added by Manjula.P on 25-Apr-2014 for Integrating ANGLER into PRODUCT
//     function openPopupMailTo()
//       {
//            var MailType="TO";
//            popupwindow('GetEmailIdsPopup.aspx?MailType=' + MailType + '', 'Test', 700, 500) ;
////            window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '','Test','height=610,top=200,left=250,width=600');
//            return false;
//       }
//    function openPopupMailCc()
//       {
//            var MailType="CC";
//            popupwindow('GetEmailIdsPopup.aspx?MailType=' + MailType + '', 'Test', 700, 500);
////            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_btnBack').click();
        }
       //************************************************************
       
        function popupwindow(url, title, w, h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
    </script>

</asp:Content>
