<%@ Page Title="" Language="C#" MasterPageFile="~/Application.Master" AutoEventWireup="true" CodeBehind="AlarmLog.aspx.cs" Inherits="ICDAS_3_0_Web_App.ICDAS_3_0.Data_Log_Analysis.AlarmLog" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

        function checkDate(sender, args) {
            if (sender._selectedDate > new Date()) {
                alert("You cannot select a future date than today!");
                sender._selectedDate = new Date();
                // set the date back to the current date
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
        }

        function SelectAllCheckboxes(spanChk) {
            var xState = spanChk.checked;
            var theBox = spanChk;
            elm = theBox.form.elements;
            for (i = 0; i < elm.length; i++)
                if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
                    if (elm[i].checked != xState)
                        elm[i].click();
                }
        }
    </script>

    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            font-family: Arial;
        }

        .loadingmodal {
            position: fixed;
            z-index: 999 !important;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: white;
            filter: alpha(opacity=60);
            opacity: 0.8;
            -moz-opacity: 1;
        }

        .loadingcenter {
            z-index: 1000 !important;
            width: 200px;
            height: 100px;
            position: absolute;
            left: 45%;
            top: 60%;
            margin-left: -150px;
            margin-top: -150px;
            opacity: 1;
            /*-moz-opacity: 1;*/
            background: url("Images/loading.gif") no-repeat;
        }
    </style>

</asp:Content>
<asp:Content ID="cotMain" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upnlwzAlarmLog">
        <ProgressTemplate>
            <div class="loadingmodal">
                <div class="loadingcenter">
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="upnlwzAlarmLog" UpdateMode="Always" runat="server">
        <ContentTemplate>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_content">
                            <div class="x_title">
                                <h4>
                                    <asp:Label ID="lblFormTitle" runat="server"></asp:Label></h4>
                                <div class="clearfix"></div>
                            </div>
                            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12 col-lg-3">
                                        <div class="input-group ">
                                            <span class="input-group-addon">From Date&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                            <asp:TextBox runat="server" ID="txtFromDate" CssClass="form-control"></asp:TextBox>
                                            <ajaxToolkit:CalendarExtender ID="calFromDate" runat="server" OnClientDateSelectionChanged="checkDate" Format="dd-MM-yyyy" TargetControlID="txtFromDate" />
                                        </div>
                                    </div>
                                    <div class="col-xs-7 col-sm-6 col-lg-2">
                                        <div class="input-group ">
                                            <span class="input-group-addon">Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                            <asp:DropDownList runat="server" CssClass="form-control" ID="ddlFromHours">
                                                <asp:ListItem Value="00" Selected="True">00</asp:ListItem>
                                                <asp:ListItem Value="01">01</asp:ListItem>
                                                <asp:ListItem Value="02">02</asp:ListItem>
                                                <asp:ListItem Value="03">03</asp:ListItem>
                                                <asp:ListItem Value="04">04</asp:ListItem>
                                                <asp:ListItem Value="05">05</asp:ListItem>
                                                <asp:ListItem Value="06">06</asp:ListItem>
                                                <asp:ListItem Value="07">07</asp:ListItem>
                                                <asp:ListItem Value="08">08</asp:ListItem>
                                                <asp:ListItem Value="09">09</asp:ListItem>
                                                <asp:ListItem Value="10">10</asp:ListItem>
                                                <asp:ListItem Value="11">11</asp:ListItem>
                                                <asp:ListItem Value="12">12</asp:ListItem>
                                                <asp:ListItem Value="13">13</asp:ListItem>
                                                <asp:ListItem Value="14">14</asp:ListItem>
                                                <asp:ListItem Value="15">15</asp:ListItem>
                                                <asp:ListItem Value="16">16</asp:ListItem>
                                                <asp:ListItem Value="17">17</asp:ListItem>
                                                <asp:ListItem Value="18">18</asp:ListItem>
                                                <asp:ListItem Value="19">19</asp:ListItem>
                                                <asp:ListItem Value="20">20</asp:ListItem>
                                                <asp:ListItem Value="21">21</asp:ListItem>
                                                <asp:ListItem Value="22">22</asp:ListItem>
                                                <asp:ListItem Value="23">23</asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="col-xs-5 col-sm-6 col-lg-1">
                                        <asp:DropDownList runat="server" CssClass="form-control" ID="ddlFromMins">
                                            <asp:ListItem Value="00" Selected="True">00</asp:ListItem>
                                            <asp:ListItem Value="01">01</asp:ListItem>
                                            <asp:ListItem Value="02">02</asp:ListItem>
                                            <asp:ListItem Value="03">03</asp:ListItem>
                                            <asp:ListItem Value="04">04</asp:ListItem>
                                            <asp:ListItem Value="05">05</asp:ListItem>
                                            <asp:ListItem Value="06">06</asp:ListItem>
                                            <asp:ListItem Value="07">07</asp:ListItem>
                                            <asp:ListItem Value="08">08</asp:ListItem>
                                            <asp:ListItem Value="09">09</asp:ListItem>
                                            <asp:ListItem Value="10">10</asp:ListItem>
                                            <asp:ListItem Value="11">11</asp:ListItem>
                                            <asp:ListItem Value="12">12</asp:ListItem>
                                            <asp:ListItem Value="13">13</asp:ListItem>
                                            <asp:ListItem Value="14">14</asp:ListItem>
                                            <asp:ListItem Value="15">15</asp:ListItem>
                                            <asp:ListItem Value="16">16</asp:ListItem>
                                            <asp:ListItem Value="17">17</asp:ListItem>
                                            <asp:ListItem Value="18">18</asp:ListItem>
                                            <asp:ListItem Value="19">19</asp:ListItem>
                                            <asp:ListItem Value="20">20</asp:ListItem>
                                            <asp:ListItem Value="21">21</asp:ListItem>
                                            <asp:ListItem Value="22">22</asp:ListItem>
                                            <asp:ListItem Value="23">23</asp:ListItem>
                                            <asp:ListItem Value="24">24</asp:ListItem>
                                            <asp:ListItem Value="25">25</asp:ListItem>
                                            <asp:ListItem Value="26">26</asp:ListItem>
                                            <asp:ListItem Value="27">27</asp:ListItem>
                                            <asp:ListItem Value="28">28</asp:ListItem>
                                            <asp:ListItem Value="29">29</asp:ListItem>
                                            <asp:ListItem Value="30">30</asp:ListItem>
                                            <asp:ListItem Value="31">31</asp:ListItem>
                                            <asp:ListItem Value="32">32</asp:ListItem>
                                            <asp:ListItem Value="33">33</asp:ListItem>
                                            <asp:ListItem Value="34">34</asp:ListItem>
                                            <asp:ListItem Value="35">35</asp:ListItem>
                                            <asp:ListItem Value="36">36</asp:ListItem>
                                            <asp:ListItem Value="37">37</asp:ListItem>
                                            <asp:ListItem Value="38">38</asp:ListItem>
                                            <asp:ListItem Value="39">39</asp:ListItem>
                                            <asp:ListItem Value="40">40</asp:ListItem>
                                            <asp:ListItem Value="41">41</asp:ListItem>
                                            <asp:ListItem Value="42">42</asp:ListItem>
                                            <asp:ListItem Value="43">43</asp:ListItem>
                                            <asp:ListItem Value="44">44</asp:ListItem>
                                            <asp:ListItem Value="45">45</asp:ListItem>
                                            <asp:ListItem Value="46">46</asp:ListItem>
                                            <asp:ListItem Value="47">47</asp:ListItem>
                                            <asp:ListItem Value="48">48</asp:ListItem>
                                            <asp:ListItem Value="49">49</asp:ListItem>
                                            <asp:ListItem Value="50">50</asp:ListItem>
                                            <asp:ListItem Value="51">51</asp:ListItem>
                                            <asp:ListItem Value="52">52</asp:ListItem>
                                            <asp:ListItem Value="53">53</asp:ListItem>
                                            <asp:ListItem Value="54">54</asp:ListItem>
                                            <asp:ListItem Value="55">55</asp:ListItem>
                                            <asp:ListItem Value="56">56</asp:ListItem>
                                            <asp:ListItem Value="57">57</asp:ListItem>
                                            <asp:ListItem Value="58">58</asp:ListItem>
                                            <asp:ListItem Value="59">59</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                    <div class="col-xs-12 col-sm-12 col-lg-3">
                                        <div class="input-group">
                                            <span class="input-group-addon">To Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                            <asp:TextBox runat="server" ID="txtTodate" CssClass="form-control"></asp:TextBox>
                                            <ajaxToolkit:CalendarExtender ID="calToDate" runat="server" Format="dd-MM-yyyy" OnClientDateSelectionChanged="checkDate" TargetControlID="txtTodate" />
                                        </div>
                                    </div>
                                    <div class="col-xs-7 col-sm-6 col-lg-2">
                                        <div class="input-group">
                                            <span class="input-group-addon">Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                            <asp:DropDownList runat="server" CssClass="form-control" ID="ddlToHrs">
                                                <asp:ListItem Value="00">00</asp:ListItem>
                                                <asp:ListItem Value="01">01</asp:ListItem>
                                                <asp:ListItem Value="02">02</asp:ListItem>
                                                <asp:ListItem Value="03">03</asp:ListItem>
                                                <asp:ListItem Value="04">04</asp:ListItem>
                                                <asp:ListItem Value="05">05</asp:ListItem>
                                                <asp:ListItem Value="06">06</asp:ListItem>
                                                <asp:ListItem Value="07">07</asp:ListItem>
                                                <asp:ListItem Value="08">08</asp:ListItem>
                                                <asp:ListItem Value="09">09</asp:ListItem>
                                                <asp:ListItem Value="10">10</asp:ListItem>
                                                <asp:ListItem Value="11">11</asp:ListItem>
                                                <asp:ListItem Value="12">12</asp:ListItem>
                                                <asp:ListItem Value="13">13</asp:ListItem>
                                                <asp:ListItem Value="14">14</asp:ListItem>
                                                <asp:ListItem Value="15">15</asp:ListItem>
                                                <asp:ListItem Value="16">16</asp:ListItem>
                                                <asp:ListItem Value="17">17</asp:ListItem>
                                                <asp:ListItem Value="18">18</asp:ListItem>
                                                <asp:ListItem Value="19">19</asp:ListItem>
                                                <asp:ListItem Value="20">20</asp:ListItem>
                                                <asp:ListItem Value="21">21</asp:ListItem>
                                                <asp:ListItem Value="22">22</asp:ListItem>
                                                <asp:ListItem Value="23" Selected="True">23</asp:ListItem>
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="col-xs-5 col-sm-6 col-lg-1">
                                        <asp:DropDownList runat="server" CssClass="form-control" ID="ddlToMins">
                                            <asp:ListItem Value="00">00</asp:ListItem>
                                            <asp:ListItem Value="01">01</asp:ListItem>
                                            <asp:ListItem Value="02">02</asp:ListItem>
                                            <asp:ListItem Value="03">03</asp:ListItem>
                                            <asp:ListItem Value="04">04</asp:ListItem>
                                            <asp:ListItem Value="05">05</asp:ListItem>
                                            <asp:ListItem Value="06">06</asp:ListItem>
                                            <asp:ListItem Value="07">07</asp:ListItem>
                                            <asp:ListItem Value="08">08</asp:ListItem>
                                            <asp:ListItem Value="09">09</asp:ListItem>
                                            <asp:ListItem Value="10">10</asp:ListItem>
                                            <asp:ListItem Value="11">11</asp:ListItem>
                                            <asp:ListItem Value="12">12</asp:ListItem>
                                            <asp:ListItem Value="13">13</asp:ListItem>
                                            <asp:ListItem Value="14">14</asp:ListItem>
                                            <asp:ListItem Value="15">15</asp:ListItem>
                                            <asp:ListItem Value="16">16</asp:ListItem>
                                            <asp:ListItem Value="17">17</asp:ListItem>
                                            <asp:ListItem Value="18">18</asp:ListItem>
                                            <asp:ListItem Value="19">19</asp:ListItem>
                                            <asp:ListItem Value="20">20</asp:ListItem>
                                            <asp:ListItem Value="21">21</asp:ListItem>
                                            <asp:ListItem Value="22">22</asp:ListItem>
                                            <asp:ListItem Value="23">23</asp:ListItem>
                                            <asp:ListItem Value="24">24</asp:ListItem>
                                            <asp:ListItem Value="25">25</asp:ListItem>
                                            <asp:ListItem Value="26">26</asp:ListItem>
                                            <asp:ListItem Value="27">27</asp:ListItem>
                                            <asp:ListItem Value="28">28</asp:ListItem>
                                            <asp:ListItem Value="29">29</asp:ListItem>
                                            <asp:ListItem Value="30">30</asp:ListItem>
                                            <asp:ListItem Value="31">31</asp:ListItem>
                                            <asp:ListItem Value="32">32</asp:ListItem>
                                            <asp:ListItem Value="33">33</asp:ListItem>
                                            <asp:ListItem Value="34">34</asp:ListItem>
                                            <asp:ListItem Value="35">35</asp:ListItem>
                                            <asp:ListItem Value="36">36</asp:ListItem>
                                            <asp:ListItem Value="37">37</asp:ListItem>
                                            <asp:ListItem Value="38">38</asp:ListItem>
                                            <asp:ListItem Value="39">39</asp:ListItem>
                                            <asp:ListItem Value="40">40</asp:ListItem>
                                            <asp:ListItem Value="41">41</asp:ListItem>
                                            <asp:ListItem Value="42">42</asp:ListItem>
                                            <asp:ListItem Value="43">43</asp:ListItem>
                                            <asp:ListItem Value="44">44</asp:ListItem>
                                            <asp:ListItem Value="45">45</asp:ListItem>
                                            <asp:ListItem Value="46">46</asp:ListItem>
                                            <asp:ListItem Value="47">47</asp:ListItem>
                                            <asp:ListItem Value="48">48</asp:ListItem>
                                            <asp:ListItem Value="49">49</asp:ListItem>
                                            <asp:ListItem Value="50">50</asp:ListItem>
                                            <asp:ListItem Value="51">51</asp:ListItem>
                                            <asp:ListItem Value="52">52</asp:ListItem>
                                            <asp:ListItem Value="53">53</asp:ListItem>
                                            <asp:ListItem Value="54">54</asp:ListItem>
                                            <asp:ListItem Value="55">55</asp:ListItem>
                                            <asp:ListItem Value="56">56</asp:ListItem>
                                            <asp:ListItem Value="57">57</asp:ListItem>
                                            <asp:ListItem Value="58">58</asp:ListItem>
                                            <asp:ListItem Value="59" Selected="True">59</asp:ListItem>
                                        </asp:DropDownList>
                                        <%--</div>--%>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12 col-lg-6">
                                        <div class="input-group">
                                            <span class="input-group-addon">Equipment* &nbsp;&nbsp;</span>
                                            <asp:DropDownList runat="server" ID="ddlEquipment" AutoPostBack="true" CssClass="form-control" OnSelectedIndexChanged="ddlEquipment_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="col-xs-12 col-sm-12 col-lg-5">
                                        <div class="input-group">
                                            <span class="input-group-addon">Alarm Type</span>
                                            <asp:DropDownList class="form-control" runat="server" ID="ddlAlarmType">
                                                <asp:ListItem Value="" Text="Select Alarm Type" />
                                                <asp:ListItem Value="A" Text="Alarm" />
                                                <asp:ListItem Value="E" Text="Event" />
                                                <asp:ListItem Value="N" Text="Notifications" />
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                    <div class="col-xs-12 col-sm-12 col-lg-1">
                                        <asp:Button runat="server" ID="btnSearch" Text="Search" OnClick="btnSearch_Click" ToolTip="SEARCH" CssClass="btn btn-primary btn-success btn-sm " formnovalidate="true" />
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12 col-lg-12">
                                        <table id="tblHeader0" runat="server" style="background: #d9ffd9" class="table table-bordered dt-responsive nowrap">
                                            <tr>
                                                <td style="width: 3%; text-align: center">
                                                    <asp:CheckBox ID="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
                                                        AutoPostBack="false" ToolTip="Select/Deselect All"></asp:CheckBox></td>
                                                <td style="width: 30%; text-align: center">Log Date Time</td>
                                                <td style="width: 48%; text-align: center">Alarm Desc</td>
                                                <td style="width: 18%; text-align: center">Alarm Type</td>
                                            </tr>
                                        </table>
                                    </div>
                                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                                        <div id="dvNodata" runat="server" visible="false">
                                            <p style="margin: 10% 33% 88px; font-family: Tahoma; font-size: xx-large; color: darkgreen">No Pending Alarms!!!</p>
                                        </div>
                                        <div id="AdjResultsDiv" onscroll="SetDivPosition()" runat="server" style="height: 350px; overflow-y: auto; overflow-x: hidden;">
                                            <asp:GridView ID="grdAlarmLog" runat="server" ShowHeaderWhenEmpty="true" CellPadding="0" CellSpacing="0"
                                                AllowPaging="false" AllowSorting="false" AutoGenerateColumns="False"
                                                CssClass="table table-striped table-bordered dt-responsive nowrap"
                                                ShowHeader="false" EmptyDataText="No records Found">
                                                <HeaderStyle CssClass="bg-success" />
                                                <Columns>
                                                    <asp:BoundField DataField="EquipmentMasterAlarmAuditTrailId" HeaderText="EquipmentMasterAlarmAuditTrail Id">
                                                        <HeaderStyle CssClass="hidden txtalign" />
                                                        <ItemStyle CssClass="hidden" />
                                                    </asp:BoundField>
                                                    <asp:TemplateField ControlStyle-CssClass="widthchk">
                                                        <ItemTemplate>
                                                            <asp:CheckBox ID="chkRecordId" runat="server" AutoPostBack="false" OnCheckedChanged="chkRecordId_CheckedChanged"></asp:CheckBox>
                                                        </ItemTemplate>
                                                        <ItemStyle Width="3%" />
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="AlarmLogDateTime" HeaderText="Log Date Time">
                                                        <ItemStyle Width="30%" />
                                                    </asp:BoundField>
                                                    <asp:BoundField DataField="AlarmEvent" HeaderText="Alarm Desc">
                                                        <ItemStyle Width="49%" />
                                                    </asp:BoundField>
                                                    <asp:BoundField DataField="AlarmType" HeaderText="Alarm Type">
                                                        <ItemStyle Width="18%" />
                                                    </asp:BoundField>
                                                </Columns>
                                            </asp:GridView>
                                        </div>
                                        <br />
                                        <div id="dvValidation" runat="server">
                                            <div class="col-md-12 col-sm-12 col-xs-12 col-lg-12">
                                                <asp:TextBox ID="txtAlarmLogIds" MaxLength="100" runat="server" AutoCompleteType="Disabled" autocomplete="off"
                                                    Style="display: none" />
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12 col-sm-12 col-lg-4">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Username*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                                        <asp:TextBox ID="txtUsername" MaxLength="100" runat="server" class="form-control" AutoCompleteType="Disabled" autocomplete="off" required ReadOnly="true" />
                                                    </div>
                                                </div>
                                                <div class="col-xs-12 col-sm-12 col-lg-4">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Password*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                                        <asp:TextBox ID="txtPassword" TextMode="Password" MaxLength="100" runat="server" class="form-control" AutoCompleteType="Disabled" autocomplete="off" required />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12 col-sm-12 col-lg-8">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Comments*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                                        <%--  <asp:TextBox ID="txtComments" MaxLength="100" runat="server" class="form-control" AutoCompleteType="Disabled" autocomplete="off" TextMode="MultiLine" required
                                                            placeholder="Give Your Comments.." />--%>
                                                        <textarea id="txtComments" maxlength="255" runat="server" class="form-control" autocomplete="Off" cols="20" rows="2"
                                                            placeholder="Give Your Comments.. (max length 255)"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: right;">
                                                <asp:Button runat="server" ID="btnPrint" Text="View Report" ToolTip="VIEW REPORT" OnClick="btnPrint_Click" CssClass="btn btn-primary btn-success btn-sm " formnovalidate="true" />
                                                <asp:Button runat="server" ID="btnTrendReport" Text="View Trend Report" OnClick="btnTrendReport_Click" ToolTip="VIEW TREND REPORT" CssClass="btn btn-primary btn-success btn-sm " formnovalidate="true" Visible="false" />
                                                <asp:Button runat="server" ID="btnAck" Text="Save" ToolTip="SAVE" OnClick="btnAck_Click" CssClass="btn btn-primary btn-success btn-sm " />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
