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

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <script type="text/javascript" language="javascript" src="../js/ShiftRoaster.js"></script>
    <script language="javascript" type="text/javascript">
        var SelectShiftPattern = "Select Pattern";
        var ConfirmSave = "Are you sure, to Save?";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(Selectshiftpattern, confirmSave) {
            SelectShiftPattern = Selectshiftpattern;
            ConfirmSave = confirmSave;
        }
        function ShiftRoasterModifiedValidation() {
            var patternCount = document.getElementById('ctl00_BodyContentPH_ddl_Nopatterns').selectedIndex;
            var increment;
            for (increment = 1; increment <= patternCount; increment++) {
                if (document.getElementById('ctl00_BodyContentPH_ddl_SRoaster' + increment + '').selectedIndex == 0) {
                    alert(SelectShiftPattern + ' ' + 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 = '';
            rost = '';
            for (i = 1; i <= totCtrl; i++) {
                shift1ID = document.getElementById("ctl00_BodyContentPH_ddl_SRoaster" + i).value;
                if (shift1ID == '-Select-')
                    shift1ID = 0;
                ddl = document.getElementById("ctl00_BodyContentPH_ddl_SRoaster" + i);
                rost = rost + ddl.options[ddl.selectedIndex].text + '*';
                str = str + shift1ID + '*';
            }
            if (str != '') {
                CheckShiftRosterTime(str, rost)
            }
        }
    </script>
    <input type="hidden" name="hidFlag" id="hidFlag" />
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/shift-roster.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" 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>
                                (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_RoasterName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_RoasterName" runat="server" CssClass="form-control mandatory"
                                    onkeyup="return chkMaxLen(event,this,30,MaxLength);" onkeypress="return Valiadteltgt(event,this);"
                                    MaxLength="30"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_RoasterName"
                                    Display="None" ValidationGroup="RoasterAdd">*</asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Nopatterns" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_Nopatterns" runat="server" CssClass="form-control select2 Man-dat"
                                    AutoPostBack="True" OnSelectedIndexChanged="ddl_Nopatterns_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:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddl_Nopatterns"
                                    InitialValue="-Select-" SetFocusOnError="True" Display="None" ValidationGroup="RoasterAdd">*</asp:RequiredFieldValidator>
                            </div>
                        </div>
                        <div class="row form-group">
                            <asp:Panel ID="tbl_ShiftRoaster" runat="server" Style="overflow: auto;">
                            </asp:Panel>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btn_Save" runat="server" CssClass="btn save-btn fa-floppy-o"
                                        OnClick="btn_Save_Click" OnClientClick="javascript:return ShiftRoasterModifiedValidation();" />
                                    <asp:LinkButton ID="btn_Back" CssClass="btn save-btn fa-angle-left" runat="server"
                                        CausesValidation="False" OnClick="btn_Back_Click" />
                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                        ShowSummary="False" ValidationGroup="RoasterAdd" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
