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

<%@ 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">
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

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

    <%--    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
    <script type="text/javascript">
        function DynamicDatePicker(txtBoxId) {
            try {
                $("#" + txtBoxId).datetimepicker({ format: 'DD-MMM-YYYY' });
            }
            catch (err) {

            }
        }
    </script>--%>
    <style type="text/css">
        .fupload {
            font-family: "FontAwesome";
        }

        .mycontent-left {
            border-right: 1px dashed #333;
        }
    </style>
    <style type="text/css">
        .FixedHeader {
            position: absolute;
            font-weight: bold;
        }

        .divgrid {
            /*height: 500px;*/
            width: 10080px !important;
            overflow: auto;
        }



        /* .divgrid table th {
                    background-color: Green;
                    color: #fff;
                }*/
    </style>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/import.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_ImportEmployeeHeader" 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-6 col-xs-5">
                </div>
                <div class="col-sm-6 col-xs-7">
                    <div class="leave-manda">
                        <span>|</span>
                        <asp:Label ID="lbl_IndicatesMandatoryFields" Visible="True" runat="server" Text="Mandatory"
                            ForeColor="black"></asp:Label>
                        (2 No.)
                    </div>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="row">
                <div class="col-md-12">
                    <div class="form-horizontal">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <span style="color: Red">|</span>
                                <asp:Label ID="lbl_Type" runat="server" Text="Import Type"></asp:Label>
                            </div>
                            <div class="col-md-10">
                                <asp:RadioButtonList ID="rblType" runat="server" RepeatDirection="Horizontal" CssClass="radio radio-primary">
                                    <asp:ListItem Text="Simple" Value="0"></asp:ListItem>
                                    <asp:ListItem Text="Advanced" Selected="True" Value="1"></asp:ListItem>
                                </asp:RadioButtonList>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <span style="color: Red">|</span>
                                <asp:Label ID="lbl_ImportFilePath" runat="server" Style="padding-left: 1px"></asp:Label>
                            </div>
                            <div class="col-md-4">
                                <asp:FileUpload ID="fp_ImportFilePath" runat="server" CssClass="form-control" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                            </div>
                            <div class="col-md-4">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btnTemplate" CssClass="btn save-btn fa-download" runat="server"
                                        OnClick="btnTemplate_Click" Style="margin-left: 0px" />
                                    <asp:LinkButton ID="btn_Upload" CssClass="btn save-btn fa-upload" runat="server"
                                        OnClick="btn_Upload_Click" />
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <div style="font-size: 10px;">
                                    <asp:Label ID="lbl_totEmployee" runat="server" Text="Total license Emp.Count"></asp:Label>
                                    :
                                <asp:Label ID="lbltotEmployee" runat="server" Text="" ForeColor="Red"></asp:Label>
                                    |
                                <asp:Label ID="Label1" runat="server" Text="Added Emp.Count"></asp:Label>
                                    :
                                <asp:Label ID="lblAddedEmpCount" runat="server" Text="" ForeColor="Red"></asp:Label>
                                    | 
                                <asp:Label ID="Label2" runat="server" Text="Active Emp.Count"></asp:Label>
                                    :
                                <asp:Label ID="lblActiveEmp" runat="server" Text="" ForeColor="Red"></asp:Label>
                                    | 
                                <asp:Label ID="Label5" runat="server" Text="In-Active Emp.Count"></asp:Label>
                                    :
                                <asp:Label ID="lblInActiveEmp" runat="server" Text="" ForeColor="Red"></asp:Label>
                                    | 
                                <asp:Label ID="Label4" runat="server" Text="Balance Emp.Count"></asp:Label>
                                    :
                                <asp:Label ID="lblbalanceEmpCount" runat="server" Text="" ForeColor="Red"></asp:Label>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="callout callout-info" style="margin-bottom: 0!important;">
                                    <asp:Label ID="lblImportNote" runat="server"></asp:Label>
                                </div>
                                <br />
                                <ul>
                                    <li>
                                        <asp:Label ID="Label3" runat="server" Text="Don't remove / modify any field in the downloaded template file while importing. 
                                        if you remove / modify any field in the downloaded template file and then upload means, it will not allow to upload data."></asp:Label></li>
                                    <li>Kindly use <b style="color: red">dd-MMM-yyyy (i.e 20-Jun-1986)</b> format for all date field in excel sheet before uploading.
                                    </li>
                                    <li>Don't use comma in any field value of excel sheet <b style="color: red">(Contact address / Permanent Address..etc).</b> Use <b style="color: red">colon(;)</b> instead of comma.
                                    </li>
                                    <li>
                                        <asp:Label ID="Label6" runat="server" Text="While importing, check whether the file has been opened or not. If it is opened try an import after closing the file which is minimized in the taskbar."></asp:Label>
                                    </li>
                                    <li>Save the file as <b style="color: red">.csv</b> file format before import.
                                    </li>
                                    <li>Under <b style="color: red">CompOffEligible, OTEligible and Hostel </b>mention the values as 0 or 1. <b style="color: red">0 - Not Eligible, 1 - Eligible.</b>
                                    </li>
                                    <br />

                                    <li>If you are going to import any <b style="color: red">Arabic content</b>, save the file as <b style="color: red">.xls</b> file format before Import. Dont use <b style="color: red">.csv</b> file format.
                                    </li>
                                    <li>Please ensure the system has spreadSheet or excel to support Import option.
                                    </li>

                                    <br />
                                    <li>Default password of each employee is <b style="color: red">welcome</b></li>
                                    <li>By Default Individual usergroup will be set to each employee(s).</li>
                                </ul>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btnDelete" CssClass="btn del-btn fa-trash-o" runat="server"
                                        OnClick="btnDelete_Click" Style="margin-left: 0px" OnClientClick="return validate();" />
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <asp:GridView ID="gvImportMaster" CssClass="table table-responsive table-bordered"
                                    runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="False"
                                    Style="margin-top: 15px; height: 100px!important;" DataKeyNames="id"
                                    Width="100%">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Record Number"
                                            HeaderStyle-CssClass="empheader" HeaderStyle-ForeColor="black">
                                            <ItemTemplate>
                                                <asp:Label ID="lblrecordNo" Text='<%# Bind("RecordNumber") %>' runat="server" Enabled="false"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle Width="10%" />
                                            <ItemStyle Width="50px" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Error message"
                                            HeaderStyle-CssClass="empheader" HeaderStyle-ForeColor="black">
                                            <ItemTemplate>
                                                <asp:Label ID="lblError" Style="text-align: left;" Text='<%# Bind("Error") %>' runat="server" Enabled="false"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle Width="50px" />
                                            <ItemStyle Width="50px" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <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>
                    <script language="javascript">

                        $(document).ready(function () {

                            try {
                                $(".divgrid").each(function () {
                                    var grid = $(this).find("table")[0];
                                    var ScrollHeight = 500;
                                    var gridWidth = $(this).width() - 50;
                                    var headerCellWidths = new Array();
                                    for (var i = 0; i < grid.getElementsByTagName('TH').length; i++) {
                                        headerCellWidths[i] = grid.getElementsByTagName('TH')[i].offsetWidth;
                                    }
                                    grid.parentNode.appendChild(document.createElement('div'));
                                    var parentDiv = grid.parentNode; var table = document.createElement('table');
                                    for (i = 0; i < grid.attributes.length; i++) {
                                        if (grid.attributes[i].specified && grid.attributes[i].name != 'id') {
                                            table.setAttribute(grid.attributes[i].name, grid.attributes[i].value);
                                        }
                                    }
                                    table.style.cssText = grid.style.cssText;
                                    table.style.width = gridWidth + 'px';
                                    table.appendChild(document.createElement('tbody'));
                                    table.getElementsByTagName('tbody')[0].appendChild(grid.getElementsByTagName('TR')[0]);
                                    var cells = table.getElementsByTagName('TH');
                                    var gridRow = grid.getElementsByTagName('TR')[0];
                                    //for (var i = 0; i < cells.length; i++) {
                                    //    var width; if (headerCellWidths[i] > gridRow.getElementsByTagName('TD')[i].offsetWidth) {
                                    //        width = headerCellWidths[i];
                                    //    } else {
                                    //        width = gridRow.getElementsByTagName('TD')[i].offsetWidth;
                                    //    } cells[i].style.width = parseInt(width - 3) + 'px';
                                    //    gridRow.getElementsByTagName('TD')[i].style.width = parseInt(width - 3) + 'px';
                                    //}
                                    var gridHeight = grid.offsetHeight;
                                    if (gridHeight < ScrollHeight)
                                        ScrollHeight = gridHeight;
                                    parentDiv.removeChild(grid);
                                    var dummyHeader = document.createElement('div');
                                    dummyHeader.appendChild(table); parentDiv.appendChild(dummyHeader);
                                    var scrollableDiv = document.createElement('div');
                                    if (parseInt(gridHeight) > ScrollHeight) {
                                        gridWidth = parseInt(gridWidth) + 17;
                                    }
                                    scrollableDiv.style.cssText = 'overflow:auto;height:' + ScrollHeight + 'px;width:' + gridWidth + 'px';
                                    scrollableDiv.appendChild(grid);
                                    parentDiv.appendChild(scrollableDiv);
                                });
                            }
                            catch (err) { }
                        }
                    );

                    </script>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
