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

<%@ Register Src="~/UserControls/TA_uc_OrganizationLevels_Mandatory.ascx" TagName="OrganizationLevel"
    TagPrefix="uc" %>
<asp:Content ContentPlaceHolderID="BodyContentPH" ID="conEntrance" runat="server">

    <script language="javascript" type="text/javascript">
        var SelectInTerminal = "Select In Terminal";
        var SelectOutTerminal = "Select Out Terminal";
        var ConfirmSave = "Are you sure, to Save?";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(Selectinterminal, Selectoutterminal, confirmSave) {
            SelectInTerminal = Selectinterminal;
            SelectOutTerminal = Selectoutterminal;
            ConfirmSave = confirmSave;
        }
        function EntranceValidation() {
            var EntranceInCount = document.getElementById('ctl00_BodyContentPH_ddl_NoOfINTerminals').options[document.getElementById('ctl00_BodyContentPH_ddl_NoOfINTerminals').selectedIndex].value;
            var increment;
            for (increment = 1; increment <= EntranceInCount; increment++) {
                if (document.getElementById('ctl00_BodyContentPH_ddl_InTerminal' + increment + '').selectedIndex == 0) {
                    alert(SelectInTerminal + increment + '');
                    return false;
                }
            }
            var EntranceOutCount = document.getElementById('ctl00_BodyContentPH_ddl_NoOfOUTTerminals').options[document.getElementById('ctl00_BodyContentPH_ddl_NoOfOUTTerminals').selectedIndex].value;
            for (increment = 1; increment <= EntranceOutCount; increment++) {
                if (document.getElementById('ctl00_BodyContentPH_ddl_OutTerminal' + increment + '').selectedIndex == 0) {
                    alert(SelectOutTerminal + increment + '');
                    return false;
                }
            }
            return confirm(ConfirmSave);
        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/Entrance.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_EntranceMaster" 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">
                                <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                (4 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">
                            <asp:UpdatePanel ID="upOrgLevel" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <uc:OrganizationLevel ID="uc_orglevel" runat="server" />
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EntranceName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_EntranceName" runat="server" CssClass="form-control  man-dat"
                                    ValidationGroup="ValEntrance" MaxLength="50" onkeypress="return chkMaxLen(event,this,50,MaxLength);"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_EntranceName"
                                    ValidationGroup="ValEntrance" ErrorMessage="Enter Entrance Name" SetFocusOnError="true"
                                    Display="None">*</asp:RequiredFieldValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EntranceDescription" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_EntranceDescription" runat="server" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                    Style="resize: none" CssClass="form-control" TextMode="multiLine" MaxLength="250"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-6 leftside-box">
                                <div class="row  form-group">
                                    <div class="col-md-4">
                                        <asp:Label ID="lbl_NoOfINTerminals" runat="server"></asp:Label>
                                    </div>
                                    <div class="col-md-6">
                                        <asp:DropDownList ID="ddl_NoOfINTerminals" runat="server" AutoPostBack="True" CssClass="form-control select2 Man-dat"
                                            ValidationGroup="ValEntrance">
                                            <asp:ListItem Value="0" Text="-Select-">
                                            </asp:ListItem>
                                            <asp:ListItem>1</asp:ListItem>
                                            <asp:ListItem>2</asp:ListItem>
                                            <asp:ListItem>3</asp:ListItem>
                                            <asp:ListItem>4</asp:ListItem>
                                            <asp:ListItem>5</asp:ListItem>
                                            <asp:ListItem>6</asp:ListItem>
                                            <asp:ListItem>7</asp:ListItem>
                                            <asp:ListItem>8</asp:ListItem>
                                            <asp:ListItem>9</asp:ListItem>
                                            <asp:ListItem>10</asp:ListItem>
                                            <asp:ListItem>11</asp:ListItem>
                                            <asp:ListItem>12</asp:ListItem>
                                            <asp:ListItem>13</asp:ListItem>
                                            <asp:ListItem>14</asp:ListItem>
                                            <asp:ListItem>15</asp:ListItem>
                                            <asp:ListItem>16</asp:ListItem>
                                            <asp:ListItem>17</asp:ListItem>
                                            <asp:ListItem>18</asp:ListItem>
                                            <asp:ListItem>19</asp:ListItem>
                                            <asp:ListItem>20</asp:ListItem>
                                            <asp:ListItem>21</asp:ListItem>
                                            <asp:ListItem>22</asp:ListItem>
                                            <asp:ListItem>23</asp:ListItem>
                                            <asp:ListItem>24</asp:ListItem>
                                            <asp:ListItem>25</asp:ListItem>
                                            <asp:ListItem>26</asp:ListItem>
                                            <asp:ListItem>27</asp:ListItem>
                                            <asp:ListItem>28</asp:ListItem>
                                            <asp:ListItem>29</asp:ListItem>
                                            <asp:ListItem>30</asp:ListItem>
                                            <asp:ListItem>31</asp:ListItem>
                                            <asp:ListItem>32</asp:ListItem>
                                            <asp:ListItem>33</asp:ListItem>
                                            <asp:ListItem>34</asp:ListItem>
                                            <asp:ListItem>35</asp:ListItem>
                                            <asp:ListItem>36</asp:ListItem>
                                            <asp:ListItem>37</asp:ListItem>
                                            <asp:ListItem>38</asp:ListItem>
                                            <asp:ListItem>39</asp:ListItem>
                                            <asp:ListItem>40</asp:ListItem>
                                            <asp:ListItem>41</asp:ListItem>
                                            <asp:ListItem>42</asp:ListItem>
                                            <asp:ListItem>43</asp:ListItem>
                                            <asp:ListItem>44</asp:ListItem>
                                            <asp:ListItem>45</asp:ListItem>
                                            <asp:ListItem>46</asp:ListItem>
                                            <asp:ListItem>47</asp:ListItem>
                                            <asp:ListItem>48</asp:ListItem>
                                            <asp:ListItem>49</asp:ListItem>
                                            <asp:ListItem>50</asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="rfvNoOfINTerminals" runat="server" ControlToValidate="ddl_NoOfINTerminals"
                                            ErrorMessage="Select No. Of IN Terminals" InitialValue="0" SetFocusOnError="True"
                                            ValidationGroup="ValEntrance" Display="None">*</asp:RequiredFieldValidator>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-10">
                                        <asp:Table ID="Table1" CssClass="table table-responsive table-bordered" CellPadding="0"
                                            CellSpacing="0" runat="server">
                                        </asp:Table>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6 rightside-box">
                                <div class="row  form-group">
                                    <div class="col-md-4">
                                        <asp:Label ID="lbl_NoOfOUTTerminals" runat="server"> </asp:Label>
                                    </div>
                                    <div class="col-md-6">
                                        <asp:DropDownList ID="ddl_NoOfOUTTerminals" runat="server" AutoPostBack="True" CssClass="form-control select2 Man-dat"
                                            ValidationGroup="ValEntrance">
                                            <asp:ListItem Value="0" Text="-Select-"></asp:ListItem>
                                            <asp:ListItem>1</asp:ListItem>
                                            <asp:ListItem>2</asp:ListItem>
                                            <asp:ListItem>3</asp:ListItem>
                                            <asp:ListItem>4</asp:ListItem>
                                            <asp:ListItem>5</asp:ListItem>
                                            <asp:ListItem>6</asp:ListItem>
                                            <asp:ListItem>7</asp:ListItem>
                                            <asp:ListItem>8</asp:ListItem>
                                            <asp:ListItem>9</asp:ListItem>
                                            <asp:ListItem>10</asp:ListItem>
                                            <asp:ListItem>11</asp:ListItem>
                                            <asp:ListItem>12</asp:ListItem>
                                            <asp:ListItem>13</asp:ListItem>
                                            <asp:ListItem>14</asp:ListItem>
                                            <asp:ListItem>15</asp:ListItem>
                                            <asp:ListItem>16</asp:ListItem>
                                            <asp:ListItem>17</asp:ListItem>
                                            <asp:ListItem>18</asp:ListItem>
                                            <asp:ListItem>19</asp:ListItem>
                                            <asp:ListItem>20</asp:ListItem>
                                            <asp:ListItem>21</asp:ListItem>
                                            <asp:ListItem>22</asp:ListItem>
                                            <asp:ListItem>23</asp:ListItem>
                                            <asp:ListItem>24</asp:ListItem>
                                            <asp:ListItem>25</asp:ListItem>
                                            <asp:ListItem>26</asp:ListItem>
                                            <asp:ListItem>27</asp:ListItem>
                                            <asp:ListItem>28</asp:ListItem>
                                            <asp:ListItem>29</asp:ListItem>
                                            <asp:ListItem>30</asp:ListItem>
                                            <asp:ListItem>31</asp:ListItem>
                                            <asp:ListItem>32</asp:ListItem>
                                            <asp:ListItem>33</asp:ListItem>
                                            <asp:ListItem>34</asp:ListItem>
                                            <asp:ListItem>35</asp:ListItem>
                                            <asp:ListItem>36</asp:ListItem>
                                            <asp:ListItem>37</asp:ListItem>
                                            <asp:ListItem>38</asp:ListItem>
                                            <asp:ListItem>39</asp:ListItem>
                                            <asp:ListItem>40</asp:ListItem>
                                            <asp:ListItem>41</asp:ListItem>
                                            <asp:ListItem>42</asp:ListItem>
                                            <asp:ListItem>43</asp:ListItem>
                                            <asp:ListItem>44</asp:ListItem>
                                            <asp:ListItem>45</asp:ListItem>
                                            <asp:ListItem>46</asp:ListItem>
                                            <asp:ListItem>47</asp:ListItem>
                                            <asp:ListItem>48</asp:ListItem>
                                            <asp:ListItem>49</asp:ListItem>
                                            <asp:ListItem>50</asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:RequiredFieldValidator ID="rfvNoOfOUTTerminals" runat="server" ControlToValidate="ddl_NoOfOUTTerminals"
                                            ErrorMessage="Select No. Of OUT Terminals" InitialValue="0" SetFocusOnError="True"
                                            ValidationGroup="ValEntrance" Display="None">*</asp:RequiredFieldValidator>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-10">
                                        <asp:Table ID="Table2" CssClass="table table-responsive table-bordered" CellPadding="0"
                                            CellSpacing="0" runat="server">
                                        </asp:Table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:ValidationSummary ID="ValidationSummary1" EnableClientScript="true" ShowMessageBox="true"
                                        ShowSummary="false" runat="server" ValidationGroup="ValEntrance" />
                                    <asp:LinkButton ID="btn_save" CssClass="btn save-btn fa-floppy-o" runat="server"
                                        ValidationGroup="ValEntrance" OnClick="btn_save_Click" OnClientClick="if(Page_ClientValidate()) return EntranceValidation();return false;" />
                                    <asp:LinkButton ID="btn_cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        OnClick="btn_cancel_Click" CausesValidation="False" />
                                </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="lblnotes1" runat="server" Text="Based on the device mapping here, the system will post the punches into database."></asp:Label>
                                    </li><br />
                                    <li>
                                        <asp:Label ID="lblnotes2" runat="server" Text="If you are using two different devices in a door for marking Check-In and Check-Out means, that case you need configure In device and Out device. This case, we will consider all punches of In device as In punch and all punches of Out devices as Out Punch."></asp:Label>
                                    </li>
                                    <li>
                                        <asp:Label ID="lblnotes3" runat="server" Text="<B>For example 1</B>: In Terminal is 159753 and Out Terminal is 159754 means, we will consider all punches of device 159753 as In punch and all punches of device 159754 as Out punch."></asp:Label>
                                    </li>
                                    <br />
                                    <li>
                                        <asp:Label ID="lblnotes4" runat="server" Text="At the same time if you are using only one device in a door / any entrance for marking both Check-In and Check-Out, that case you need to configure In and Out device as same here. Based on that, we will consider odd punches as In punch and even Punches as Out Punch."></asp:Label>
                                    </li>
                                    <li>
                                        <asp:Label ID="lblnotes5" runat="server" Text="<B>For example 1</B>: In Terminal is 159753 and Out Terminal is 159753 means, we will consider odd punches as In punch and even punches as Out punch."></asp:Label>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(".select2").select2();
    </script>

</asp:Content>
