<%@ Page AutoEventWireup="true" CodeFile="TA_UI_Master_ShiftPatternModify.aspx.cs"
    Inherits="Masters_TA_UI_Master_ShiftPatternModify" Language="C#" MasterPageFile="~/MasterFile/TimeCheck.master" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ContentPlaceHolderID="BodyContentPH" runat="server">
    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
 <![endif]-->
    <script type="text/javascript" language="javascript" src="../js/ShiftPatternNameValid.js"></script>
    <script type="text/javascript" src="../js/ShiftPattern.js"></script>
    <script type="text/javascript">
        var ClickGobuttontoGenerateDays = "Select Number of Days and then Click Go button to Generate Days";
        var SelectDay = "Select Day ";
        var ConfirmSave = "Are you sure, to Save?";
        var MaxLength = "Maximum length is ";
        var PatternNameExist = "Pattern Name Already Exists !";
        var EnterPatternName = "Enter Pattern Name";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetPatternName(patternNameExist) {
            PatternNameExist = patternNameExist;
        }
        function SetAlertMessages(clickgobuttontogeneratedays, selectday, confirmSave) {
            ClickGobuttontoGenerateDays = clickgobuttontogeneratedays;
            SelectDay = selectday;
            ConfirmSave = confirmSave;
        }
        function PatternName(pattern) {
            PatternNameExist = pattern;
            var name = document.aspnetForm.ctl00_BodyContentPH_lblPattern_Name.value;
            var id = document.aspnetForm.ctl00_BodyContentPH_hdf_ShiftPatternId.value;
            ValidShiftPatternName(name, id, PatternNameExist);
        }
        function ShiftPatternModifiedValidation() {
            var PatternName = document.aspnetForm.ctl00_BodyContentPH_lblPattern_Name.value;
            if (PatternName == "") {
                alert(EnterPatternName);
                return false;
            }
            var ShiftCount = document.getElementById('ctl00_BodyContentPH_ddl_NoDays').selectedIndex;
            var increment;
            if (document.getElementById('ctl00_BodyContentPH_ddl_Pattern' + ShiftCount) == null) {
                alert(ClickGobuttontoGenerateDays);
                return false;
            }
            for (increment = 1; increment <= ShiftCount; increment++) {
                if (document.getElementById('ctl00_BodyContentPH_ddl_Pattern' + increment + '').selectedIndex == 0) {
                    alert(SelectDay + increment + '');
                    return false;
                }
            }
            if (document.getElementById("hidFlag").value != 0) {
                alert(document.getElementById("hidFlag").value);
                return false;
            }
            return confirm(ConfirmSave);
        }
        function CheckShift(ctrl, ctrlID, totCtrl) {
            str = '';
            for (i = 1; i <= totCtrl; i++) {
                shift1ID = document.getElementById("ctl00_BodyContentPH_ddl_Pattern" + i).value;
                if (shift1ID == '-Select-')
                    shift1ID = 0;
                str = str + shift1ID + '*';
            }
            if (str != '') {
                CheckShiftPatternTime(str)
            }
        }
        function checkGo() {
            if (document.getElementById("hidFlag").value != 0) {
                alert(document.getElementById("hidFlag").value);
                return false;
            }
            else {
                return true;
            }
        }
    </script>
    <input type="hidden" name="hidFlag" id="hidFlag" />
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/shift-pattern.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_HeaderShiftPattern" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <asp:UpdatePanel ID="upLeave" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pnlProgress" runat="server" Style="display: none;">
                    <asp:Panel ID="pnlLoading" runat="server" HorizontalAlign="center">
                        <div class="InsideProgressBar">
                            <div class="row" style="margin-top: 10px">
                                <img src="../dist/img/logo-Progress.png" />
                            </div>
                            <div class="row" style="min-width: 280px">
                                <img src="../dist/img/default.gif" style="width: 100px" />
                            </div>
                            <div class="row" style="margin-bottom: 10px">
                                <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: center"
                                    Text="Please Wait..." Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial"></asp:Label>
                            </div>
                            <div class="clear clearfix">
                            </div>
                        </div>
                    </asp:Panel>
                </asp:Panel>
                <asp:HiddenField ID="hdnProgress" runat="server" />
                <cc1:ModalPopupExtender ID="popupProgress" runat="server" TargetControlID="hdnProgress"
                    BackgroundCssClass="ModalPopup" PopupControlID="pnlProgress" BehaviorID="popupProgress">
                </cc1:ModalPopupExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
        <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>
                                (3 No.)</span>
                        </h6>
                    </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">
                            <div class="col-md-2">
                                <asp:Label ID="lblCompany" runat="server" Text="Company"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblCompanyName" runat="server" CssClass="form-control mandatory"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PatternName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="lblPattern_Name" runat="server" CssClass="form-control mandatory"
                                    MaxLength="30" onkeypress="return chkMaxLen(event,this,30,MaxLength);"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="lblPattern_Name"
                                    ValidationGroup="vpattern" ErrorMessage="Enter Pattern Name" Display="none">*</asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_NumberOfDays" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_NoDays" runat="server" CssClass="form-control select2 Man-dat"
                                    AutoPostBack="true" OnSelectedIndexChanged="ddl_NoDays_SelectedIndexChanged">
                                    <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:DropDownList>
                            </div>
                            <div class="col-md-2 src-margintop" style="display:none">
                                <asp:Label ID="lblNoDays" runat="server" Visible="False"></asp:Label>
                                <asp:LinkButton ID="butSelect" runat="server" CssClass="btn save-btn fa-angle-right"
                                    OnClientClick="return checkGo();" OnClick="butSelect_Click" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddl_NoDays"
                                    ValidationGroup="vpattern" InitialValue="0" ErrorMessage="Select Number Of Days"
                                    SetFocusOnError="True" Display="None">*</asp:RequiredFieldValidator>
                                <asp:HiddenField ID="hid" runat="server" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <asp:Panel ID="Table1" runat="server" Style="overflow: auto;">
                            </asp:Panel>
                        </div>
                        <div class="row">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:HiddenField ID="hdf_ShiftPatternId" runat="server" />
                                    <asp:LinkButton ID="btn_Modify" runat="server" CssClass="btn save-btn fa-floppy-o"
                                        OnClientClick="javascript:return ShiftPatternModifiedValidation();" OnClick="btn_Modify_Click" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        CausesValidation="False" OnClick="btn_Cancel_Click" />
                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                        ShowSummary="False" ValidationGroup="vpattern" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
