<%@ page language="C#" autoeventwireup="true" masterpagefile="~/MasterFile/TimeCheck.master" inherits="Organization_Settings_Organization_ExportData, App_Web_buswflca" enableeventvalidation="false" %>

<asp:Content ContentPlaceHolderID="BodyContentPH" ID="conExportData" runat="server">
    <%--Newly Added By Karthikeyan.R in this file. Previously which is used in master file--%>

    <script src="../js/ExportData.js" type="text/javascript"></script>

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

    <script language="javascript" type="text/javascript">
        var SelectanyoneOptiontomove = "Select any one Option to move";
        var SelectCompany = "Select Company";
        var SelectDuration = "Select Duration";
        var SureToExportData = "Are you sure to Export Data?";

        window.onload = function () { Loaddropdown(); };

        function SetAlertMessages(selectanyoneOptiontomove, selectCompany, selectDuration, sureToExportData) {
            SelectanyoneOptiontomove = selectanyoneOptiontomove;
            SelectCompany = selectCompany;
            SelectDuration = selectDuration;
            SureToExportData = sureToExportData;
        }
        function IsCompanyAndDurationSelected() {
            if (document.getElementById('<%=ddlCompany.ClientID%>').selectedIndex == 0) {
                document.getElementById('<%=ddlCompany.ClientID%>').focus();
                alert(SelectCompany);
                return false;
            }
            else if (document.getElementById('<%=ddlDuration.ClientID%>').selectedIndex == 0) {
                document.getElementById('<%=ddlDuration.ClientID%>').focus();
                alert(SelectDuration);
                return false;
            }
            else {
                return confirm(SureToExportData);
            }
    }
    function OpenCustomLabelWindow() {
        var SelectedOption;
        SelectedOption = document.getElementById("ctl00_BodyContentPH_hdnSelectedOption").value;
        var SelectedData;
        SelectedData = document.getElementById("ctl00_BodyContentPH_hdnSelectedDataType").value;
        var loc = 'ExportData_FieldName.aspx?Option=' + SelectedOption + '&DailyOrSummarizedData=' + SelectedData + '';
        document.getElementById('ctl00_BodyContentPH_iframePopup').src = loc;
        //        popupwindow('ExportData_FieldName.aspx?Option=' + SelectedOption +'&DailyOrSummarizedData='+ SelectedData +'','',600,500);
        return false;
    }
    //On Center Screen
    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>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/export-data.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lblHeader_ExportData" 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">
                            <asp:Label ID="lblDataView" runat="server" Text="Data View"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="500px"
                            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"></asp:Label>
                (2 No.)</h6>
        </div>
        <!--FILTERS-->
        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <div>
                        <div class="col-md-6">
                            <div class="form-group row">
                                <div class="col-sm-4 control-label">
                                    <asp:Label ID="lblCompany" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-6">
                                    <asp:DropDownList ID="ddlCompany" runat="server" AppendDataBoundItems="true" CssClass="form-control select2 Man-dat"
                                        OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged" AutoPostBack="true">
                                        <asp:ListItem Value="-Select-" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList><asp:RequiredFieldValidator Visible="false" ID="RequiredFieldValidator2"
                                        runat="server" ErrorMessage="Select Company" ControlToValidate="ddlCompany" InitialValue="-Select-"
                                        SetFocusOnError="True">*</asp:RequiredFieldValidator>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-sm-4  control-label">
                                    <asp:Label ID="lblDuration" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-6">
                                    <asp:DropDownList ID="ddlDuration" runat="server" CssClass="form-control select2 Man-dat">
                                        <asp:ListItem Value="-Select-" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" Visible="false" runat="server"
                                        ControlToValidate="ddlDuration" InitialValue="-Select-" SetFocusOnError="True"
                                        ErrorMessage="Select Duration">*</asp:RequiredFieldValidator>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                        </div>
                    </div>
                    <div>
                        <div class="col-md-12">
                            <div class="form-group row">
                                <div class="col-md-2 col-sm-4">
                                    <asp:Label ID="lblOption" Text="Option" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-8 col-sm-8 Pad-left-7px">
                                    <%--  <div class="col-md-2">
                                        <asp:RadioButton ID="rbtOptionAll" Checked="true" runat="server" CssClass="radioLeave radioLeave-primary"
                                            OnCheckedChanged="rbOption_SelectedIndexChanged" GroupName="Option" Text="All" />
                                    </div>
                                    <div class="col-md-2">
                                        <asp:RadioButton ID="rbtOT" runat="server" Text="OT Data" GroupName="Option" CssClass="radioLeave radioLeave-primary"
                                            OnCheckedChanged="rbOption_SelectedIndexChanged" AutoPostBack="true" Enabled="false" />
                                    </div>
                                    <div class="col-md-3">
                                        <asp:RadioButton ID="rbtAttData" runat="server" Text="Attendance Data" OnCheckedChanged="rbOption_SelectedIndexChanged"
                                            GroupName="Option" CssClass="radioLeave radioLeave-primary" Enabled="false" />
                                    </div>
                                    <asp:HiddenField ID="hdnSelectedOption" runat="server" />--%>
                                    <div class="col-md-7">
                                        <asp:RadioButtonList CssClass="radio radio-primary" ID="rbOption" runat="server" AutoPostBack="True"
                                             RepeatDirection="Horizontal" OnSelectedIndexChanged="rbOption_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Text="All" Value="All"></asp:ListItem>
                                            <asp:ListItem Value="OT" Text="OT Data"></asp:ListItem>
                                            <asp:ListItem Value="Attendance" Text="Attendance Data"></asp:ListItem>
                                        </asp:RadioButtonList>
                                        <asp:HiddenField ID="hdnSelectedOption" runat="server" />
                                    </div>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col-md-2 col-sm-4">
                                    <asp:Label ID="lblDataType" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-8 col-sm-8 Pad-left-8px">
                                    <%--  <div class="col-md-4">
                                        <asp:RadioButton ID="rbtMonthDateSummarizedData" Checked="true" runat="server" CssClass="radioLeave radioLeave-primary"
                                            OnCheckedChanged="rblMonthDateWise_SelectedIndexChanged" AutoPostBack="true"
                                            GroupName="MonthDateWise" Text="Summarized Data" />
                                    </div>
                                    <div class="col-md-3">
                                        <asp:RadioButton ID="rbtMonthDateDailyData" runat="server" Text="Daily Data" GroupName="MonthDateWise"
                                            CssClass="radioLeave radioLeave-primary" OnCheckedChanged="rblMonthDateWise_SelectedIndexChanged"
                                            AutoPostBack="true" />
                                    </div>--%>
                                    <div class="col-md-7">
                                        <asp:RadioButtonList CssClass="radio radio-primary" ID="rblMonthDateWise" runat="server" AutoPostBack="True" 
                                            RepeatDirection="Horizontal" OnSelectedIndexChanged="rblMonthDateWise_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Text="Summarized Data" Value="SummarizedData"></asp:ListItem>
                                            <asp:ListItem Value="DailyData" Text="Daily Data"></asp:ListItem>
                                        </asp:RadioButtonList>
                                        <asp:HiddenField ID="HiddenField1" runat="server" />
                                        <asp:HiddenField ID="hdnSelectedDataType" runat="server" />
                                    </div>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-2 col-sm-4 control-label">
                                    <asp:Label ID="lblConfiguration" Text="Configuration" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3 col-sm-3">
                                    <asp:LinkButton ID="lnkCustomFields" OnClientClick="return OpenCustomLabelWindow();" data-toggle="modal" data-target="#myModal"
                                        runat="server" Text="Custom Fields" CssClass="file-input btn btn-block save-btn btn-file mar-right-0px">
                                        
                                    </asp:LinkButton>
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-md-2 col-sm-4">
                                    <asp:Label ID="lblExport" Text="Export" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-8 col-sm-8 pad-left-0px">
                                    <div class="col-md-4 pad-right-60px">
                                        <asp:RadioButton ID="rbExportToXLS" Checked="true" runat="server" CssClass="radio radio-success"
                                            GroupName="Filetype" Text='&lt;img src=&#39;../dist/img/xls-icon.jpg&#39;&gt;' />
                                    </div>
                                    <div class="col-md-4 pad-right-60px">
                                        <asp:RadioButton ID="rbExportToCSV" runat="server" Text='&lt;img src=&#39;../dist/img/csv-icon.jpg&#39;&gt;'
                                            GroupName="Filetype" CssClass="radio radio-primary" />
                                    </div>
                                    <div class="col-md-4">
                                        <asp:RadioButton ID="rbExportToXML" runat="server" Text='&lt;img src=&#39;../dist/img/xml-icon.jpg&#39;&gt;'
                                            GroupName="Filetype" CssClass="radio radio-danger" />
                                    </div>
                                    <input id="hdn_SelectedFieldNames" type="hidden" value="" runat="server" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div>
                        <div class="col-md-12">
                            <div class="row">
                                <div class="col-md-2 col-sm-4">
                                </div>
                                <div class="col-md-9 col-sm-8">
                                    <div class="row">
                                        <div class="col-md-4 col-sm-4">
                                            <h4>
                                                <strong style="font-family: MS Sans Serif;">
                                                    <asp:Label ID="lbl_FieldList" runat="server"></asp:Label></strong>
                                            </h4>
                                            <asp:ListBox ID="lst_PayrollFieldList" runat="server" Style="height: 160px" CssClass="form-control"></asp:ListBox>
                                        </div>
                                        <div class="col-md-4 col-sm-2 list-martop">
                                            <ul class="list-unstyled emport-button field-btn">
                                                <li>
                                                    <asp:ImageButton ID="btn_RemoveAll" runat="server"
                                                        CssClass="arrow-btn" OnClientClick="return FieldListRemoveAll();" />
                                                </li>
                                                <li>
                                                    <asp:ImageButton ID="btn_Remove" runat="server"
                                                        CssClass="arrow-btn" OnClientClick="return FieldListRemove(SelectanyoneOptiontomove);" />
                                                </li>
                                                <li>
                                                    <asp:ImageButton ID="btn_Add" runat="server" CssClass="arrow-btn"
                                                        OnClientClick="return FieldListAdd(SelectanyoneOptiontomove);" />
                                                </li>
                                                <li>
                                                    <asp:ImageButton ID="btn_AddAll" runat="server" ImageUrl="../dist/img/button4.jpg"
                                                        CssClass="arrow-btn" OnClientClick="return FieldListAddAll();" />
                                                </li>
                                            </ul>
                                        </div>
                                        <div class="col-md-4 col-sm-4">
                                            <h4>
                                                <strong style="font-family: MS Sans Serif;">
                                                    <asp:Label ID="lbl_SelectedFieldList" runat="server"></asp:Label></strong></h4>
                                            <asp:ListBox ID="lst_PayrollSelectedFieldList" runat="server" CssClass="form-control"
                                                Style="height: 160px"></asp:ListBox>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="col-md-6">
                    </div>
                    <div class="col-md-6">
                        <div class="filter-button">
                            <div class="btn view-btn">
                                <img src="../dist/img/exp-data.png" class="exp-databtn" />
                                <asp:LinkButton ID="btn_Export" runat="server" OnClientClick="return IsCompanyAndDurationSelected();"
                                    OnClick="btn_Export_Click"></asp:LinkButton>
                            </div>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                ShowSummary="False" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel-heading" style="display: none">
            <span style="color: #ff0033">*</span>
            <div class="row" style="display: none">
                <div class="col-md-12">
                    <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
