<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Transactions_TA_UI_Transactions_PermissionBulkSanction_Angler, App_Web_3ncxb30a" %>

<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web"
    TagPrefix="dxe" %>
<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<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_HeaderPermissionSanction" 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="gdPermissionSanctionView" EnableCallBacks="false" runat="server"
                                    ClientInstanceName="gdPermissionSanctionView" AutoGenerateColumns="false" Width="100%"
                                    OnHtmlRowCreated="gdPermissionSanctionView_HtmlRowCreated">
                                    <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("Permission_Id") %>' />
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataTextColumn Caption="Employee Name" FieldName="Employee_FirstName"
                                            VisibleIndex="1" Width="130px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label Style="float: left; overflow-y: auto; overflow-x: auto; word-break: break-all;
                                                    word-wrap: break-word; display: inline-block;" ID="lblEmployeeName" runat="server"
                                                    Text='<%# Eval("Employee_FirstName")%>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <%-- Added by Manjula.P on 21-Apr-2014 for Levelname--%>
                                        <dxGridview:GridViewDataTextColumn FieldName="levelname" Caption="Level Name" VisibleIndex="1"
                                            Width="100px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lbl_level" runat="server" Text='<%# Eval("levelname") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <%--************************************************--%>
                                        <dxGridview:GridViewDataTextColumn FieldName="Permission_AppliedDate" VisibleIndex="2"
                                            Width="120px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Permission_AppliedDate") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Duration" VisibleIndex="3" Width="220px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lbl_Duration" runat="server" Text='<%# Bind("Duration") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <Settings AllowAutoFilter="False" />
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Permission_Status" VisibleIndex="4"
                                            Width="80px">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblPermissionStatus" runat="server" Text='<%# Bind("Permission_Status") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <%-- Added by Manjula.P on 21-Apr-2014 for Levelname--%>
                                        <dxGridview:GridViewDataTextColumn FieldName="permission_reason" VisibleIndex="5"
                                            Caption="Reason">
                                            <Settings AllowDragDrop="False" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblPermissionReason" runat="server" Text='<%# Bind("permission_reason") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" BackColor="#5172AD" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <%--************************************************--%>
                                        <dxGridview:GridViewDataColumn FieldName="Permission_FromTime" VisibleIndex="5" Visible="false">
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="Permission_ToTime" VisibleIndex="6" Visible="false">
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="Permission_Id" VisibleIndex="5" Visible="false">
                                            <DataItemTemplate>
                                                <asp:Label ID="lblPerID" runat="server" Text='<%# Bind("Permission_Id") %>'></asp:Label>
                                            </DataItemTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                                            CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="30px">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <a data-toggle="modal" title="Edit" href="TA_UI_Transactions_PermissionSanctionModify_Angler.aspx?Permission_Id=<%# Eval("Permission_Id") %>&LevelId=<%=Request.QueryString["LevelId"]%>&Status=<%=Request.QueryString["Status"]%>&From_Date=<%=Request.QueryString["From_Date"]%>&To_Date=<%=Request.QueryString["To_Date"]%>&strSwipeCardNo=<%=Request.QueryString["strSwipeCardNo"]%>&strEmployeeName=<%=Request.QueryString["strEmployeeName"]%>&strEmployeeCodeId=<%=Request.QueryString["strEmployeeCodeId"]%>">
                                                    <span class="btn btn-defalut edit-icons"></span></a>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                                        </dxGridview:GridViewDataColumn>
                                    </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="550px"></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" OnKeyPress="return false"
                                                Width="450px"></asp:TextBox>
                                            <span class="input-group-btn">
                                                <asp:Button ID="btnApprovalTO" runat="server" CssClass="btn save-btn" OnClientClick="javascript:return openPopupMailTo();"
                                                    Text="To..." Width="28px" 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" OnKeyPress="return false"
                                            placeholder="Use Semicolon(;) to separate Email Ids" Style="resize: none" TextMode="MultiLine"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:Button ID="btnApprovalCC" runat="server" CssClass="btn save-btn" OnClientClick="javascript:return openPopupMailCc();"
                                                Text="Cc..." Width="28px" data-toggle="modal" data-target="#myModal" />
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12" align="right">
                        <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< gdPermissionSanctionView.pageRowCount;i++)
            {
                if(document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_cell' + (i + gdPermissionSanctionView.visibleStartIndex) + '_0_chkSelect').disabled==false)
                {
                    document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_cell' + (i + gdPermissionSanctionView.visibleStartIndex) + '_0_chkSelect').checked=true;
                    var hdnUserId = document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_cell' + (i + gdPermissionSanctionView.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< gdPermissionSanctionView.pageRowCount;i++)
            {
                document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_cell' + (i + gdPermissionSanctionView.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 < gdPermissionSanctionView.pageRowCount; i++) {
                if (document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_cell' + (i + gdPermissionSanctionView.visibleStartIndex) + '_0_chkSelect').checked)
                    varTotalCheckedCount = varTotalCheckedCount + 1;
                else
                    break;
            }
            if (varTotalCheckedCount == gdPermissionSanctionView.pageRowCount)
                document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_header0_chkSelectAll').checked = true;
            else
                document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_header0_chkSelectAll').checked = false;
        }
        else {
            if (Array.contains(removeId, hdnUserId)) {
                Array.remove(removeId, hdnUserId);
            }
            hdnSelectRow.value = removeId;

            document.getElementById('ctl00_BodyContentPH_gdPermissionSanctionView_header0_chkSelectAll').checked = false;
        }
    }
    //Added by Manjula.P on 25-Apr-2014 for Integrating ANGLER into PRODUCT
//     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=650');
//            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();
        }
       //************************************************************
    </script>

</asp:Content>
