<%@ Page Language="C#" MasterPageFile="~/MasterFile/TimeCheck.master" AutoEventWireup="true"
    CodeFile="TA_UI_Transactions_MultipleLeaveApplicationView.aspx.cs" Inherits="Transactions_TA_UI_Transactions_MultipleLeaveApplicationView"
    ValidateRequest="false" %>

<%@ Register Src="../UserControls/TA_uc_OrgLevel_Filter.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">

    <script type="text/javascript">
        function openPopupMailCc() {
            var MailType = "CC";
            window.open('GetEmailIdsPopup.aspx?MailType=' + MailType + '', 'Test', 'height=610,top=200,left=250,width=600');
            return false;
        }
        function LeaveApplicationModifyClear() {
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionFrom.selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex = 0;
            document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value = "";
        }
        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_ddl_SessionFrom.selectedIndex == 0) {
                alert("Select From Session");
                return false;

            }
            else if (document.aspnetForm.ctl00_BodyContentPH_ddl_SessionTo.selectedIndex == 0) {
                alert("Select To Session");
                return false;

            }
            else if (trim(document.aspnetForm.ctl00_BodyContentPH_txtReason.value) == "") {
                alert("Fill Reason");
                return false;

            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value == "") {
                alert("Number of Days Applied Should Not Be Empty");
                return false;

            }
            else if (document.aspnetForm.ctl00_BodyContentPH_txt_Numberofdays.value == "0") {
                alert("Number of Days Applied Should Not Be Zero");
                return false;

            }

            else {
                return confirm('Are you sure to Save?');
            }
            //return true;   
        }

        function assignEmployeeId(empid) {
            document.getElementById('ctl00_BodyContentPH_hdnEmployeeId').value = empid;
            document.getElementById('ctl00_BodyContentPH_ddl_Type').focus();

        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/lve-app.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_HeaderLeaveApplication" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-12">
                    <div class="pull-right">
                        <h6>
                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px">Mandatory
                                (1 No.)</span>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </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="lbl_EmployeeID1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EmployeeID" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmployeeName1" 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="lblLevel" Text="Level Name" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="LblLevelData" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <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" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="row">
                        <div class="line16">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-12">
                                <div id="divLeaveDetails" runat="server" style="padding-bottom: 10px; overflow: auto;">
                                    <asp:GridView ID="grv_LeaveApplication" runat="server" CssClass="table das-table1"
                                        AutoGenerateColumns="False" AllowSorting="True" PageSize="5" CellPadding="4"
                                        OnRowDataBound="grv_LeaveApplication_RowDataBound" OnRowCommand="grv_LeaveApplication_RowCommand"
                                        OnRowCancelingEdit="grv_LeaveApplication_RowCancelingEdit">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Leave Category">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLeaveCategory" Text='<%# Eval("Type") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Leave Type">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLeaveType" runat="server" Text='<%# Bind("LeaveType") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="From">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLeaveFrom" runat="server" Text='<%# Bind("LeaveFrom") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="To">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLeaveTo" Text='<%# Eval("LeaveTo") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Session From">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblSessionFrom" Text='<%# Eval("Leave_SessionFrom") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Session To">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblSessionTo" Text='<%# Eval("Leave_SessionTo") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="No.of Days">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLeaveDays" Text='<%# Eval("NumberOfDays") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="lbCancel" CssClass="fa-ban" CommandArgument='<%# Eval("LeaveApplication_Id") + "," + Eval("LeaveFrom") + "," + Eval("LeaveTo") + "," + Eval("Leave_SessionFrom") + "," + Eval("Leave_SessionTo") %>'
                                                        OnClientClick="if(Page_ClientValidate()) return confirm('Are you sure, to Cancel the leave?');return false;"
                                                        CommandName="Cancel" runat="server">
                                                         Cancel</asp:LinkButton>
                                                </ItemTemplate>
                                                <ItemStyle HorizontalAlign="Center" />
                                            </asp:TemplateField>
                                        </Columns>
                                        <EmptyDataTemplate>
                                            No Records Found
                                        </EmptyDataTemplate>
                                        <HeaderStyle CssClass="empheader" />
                                        <RowStyle Height="30px" CssClass="table-bg" BorderColor="#C5DFFC" />
                                        <PagerStyle Font-Overline="False" HorizontalAlign="Right" CssClass="GridPager" />
                                        <PagerSettings FirstPageText="<<" LastPageText=">>" Mode="NumericFirstLast" NextPageText=">"
                                            PreviousPageText="<" />
                                        <AlternatingRowStyle BackColor="white" />
                                    </asp:GridView>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div id="divLeaveConversation" runat="server">
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblReasonForCancel" runat="server" Text="Reason For Cancellation"></asp:Label>
                            </div>
                            <div class="col-md-10">
                                <asp:TextBox ID="txtReasonForCancel" runat="server" TextMode="MultiLine" CssClass="form-control man-dat" Style="resize: none;"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvReasonForCancel" runat="server" ControlToValidate="txtReasonForCancel"
                                    ErrorMessage="Reason for cancellation is required" SetFocusOnError="True" ValidationGroup="ReasonCancel"
                                    Display="None">*</asp:RequiredFieldValidator>
                                <input id="Hidden1" type="hidden" value='<% Response.Write(Session["IDateFormat"].ToString()); %>' />
                                <asp:HiddenField ID="hdnEmployeeEmailId" runat="server" />
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph"
                                    ShowMessageBox="True" ValidationGroup="ReasonCancel" ShowSummary="False" />
                            </div>
                        </div>
                        <div class="row" style="display: none;">
                            <div class="col-md-2">
                                <asp:Label ID="lblApprovalCC" runat="server" Text="Cc Mail Ids"></asp:Label>
                            </div>
                            <div class="col-md-11">
                                <asp:TextBox ID="txtApprovalCC" runat="server" CssClass="textbox_4" OnKeyPress="return false"
                                    Width="365px" Height="40px" TextMode="MultiLine"></asp:TextBox>
                                <asp:Button ID="btnApprovalCC" runat="server" CssClass="but" Text="Cc..." Width="28px"
                                    OnClientClick="javascript:return openPopupMailCc();" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btnModify" runat="server" Text="&nbsp;&nbsp;Modify" CausesValidation="false"
                                        CssClass="btn save-btn fa-floppy-o" OnClick="btnModify_Click" />
                                    <asp:LinkButton ID="btn_Delete" CssClass="btn save-btn fa-ban" runat="server" CausesValidation="true"
                                        OnClientClick="if(Page_ClientValidate()) return confirm('Are you sure, to Cancel the leave?');return false;"
                                        TabIndex="11" OnClick="btn_Delete_Click" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server" CausesValidation="False"
                                        TabIndex="12" OnClick="btn_Cancel_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</asp:Content>
