<%@ control language="VB" autoeventwireup="false" inherits="PCC_VPS_CC_EventLogs, MachSol.MachPanel.Web" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="EM" %>
<%@ Register Assembly="MachSol.MachPanel.Utility" Namespace="MachSol.MachPanel.Utility"
    TagPrefix="EM" %>
<%@ Register Src="~/Template/GVPager.ascx" TagName="Pager" TagPrefix="EM" %>

<script>
    function ShowFullText(event) {
        //console.log($("span[data-num='FullText" + $(event).attr("data-num") + "']").attr("id"));
        $("span[data-num='FullText" + $(event).attr("data-num") + "']").removeClass("hide");
        $("span[data-num='PartialText" + $(event).attr("data-num") + "']").addClass("hide");
        $(event).addClass("hide")
        $("button[data-num2='Less" + $(event).attr("data-num") + "']").removeClass("hide");
    }
    function ShowPartialText(event) {
        $("span[data-num='FullText" + $(event).attr("data-num") + "']").addClass("hide");
        $("span[data-num='PartialText" + $(event).attr("data-num") + "']").removeClass("hide");
        $(event).addClass("hide")
        $("input[data-num2='More" + $(event).attr("data-num") + "']").removeClass("hide");
    }
</script>
<asp:Panel ID="Pnl_Listing_ServerEventLogs" runat="server" DefaultButton="Btn_ApplyFilter_ServerEventLogs">

    <asp:Panel ID="Pnl_Btn_ApplyFilter" runat="server" CssClass="row" DefaultButton="Btn_ApplyFilter_ServerEventLogs">
        <div class="panel-group search-panel" id="AS_ServerEventLogs" role="tablist" aria-multiselectable="true">
            <div class="col-xs-12" role="tab" id="SH_ServerEventLogs">
                <div class="card">
                    <div class="header" role="button" data-toggle="collapse" data-parent="#AS_ServerEventLogs" href="#<%= CSB_ServerEventLogs.ClientID%>" aria-expanded="true" aria-controls="SH_ServerEventLogs">
                        <h3>
                            <%= Resources.Content.GN0000395%>
                        </h3>
                    </div>
                    <div id="CSB_ServerEventLogs" runat="server" class="body panel-collapse collapse" role="tabpanel" aria-labelledby="SH_ServerEventLogs" aria-expanded="false">
                        <div class="row">
                            <div class="col-md-3 col-sm-6 col-xs-12">
                                <div class="form-group form-float">
                                    <asp:DropDownList ID="DDL_Server" runat="server">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-6 col-xs-12">
                                <div class="form-group form-float">
                                    <asp:DropDownList ID="DDL_Logs" runat="server">
                                        <asp:ListItem Text="<%$ Resources:Content,GN0001280 %>" Value="Application"></asp:ListItem>
                                        <%--<asp:ListItem Text="<%$ Resources:Content,GN0001282 %>" Value="Security"></asp:ListItem>--%>
                                        <asp:ListItem Text="<%$ Resources:Content,M0123 %>" Value="Setup"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,GN0001281 %>" Value="System"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-6 col-xs-12">
                                <div class="form-group form-float">
                                    <asp:DropDownList ID="DDL_Levels" runat="server">
                                        <asp:ListItem Text="<%$ Resources:Content,AllLevels %>" Value="1,2,3,4,5"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,LogAlways %>" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,Critical %>" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,GN0000862 %>" Value="2" Selected="True"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,DGN1119956 %>" Value="3"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,DGN1110413 %>" Value="4"></asp:ListItem>
                                        <asp:ListItem Text="<%$ Resources:Content,Verbose %>" Value="5"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-6 col-xs-12">
                                <div class="form-group form-float">
                                    <asp:DropDownList ID="DDL_MaxEvents" runat="server">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-6 col-xs-12">
                                <div class="form-group form-float">
                                    <asp:ValidationSummary ID="VS_SearchServerEventLogs" runat="server" ShowMessageBox="true"
                                        ShowSummary="false" ValidationGroup="SearchServerEventLogs" />
                                    <asp:Button ID="Btn_ApplyFilter_ServerEventLogs" ValidationGroup="SearchServerEventLogs" class="btn btn-primary waves-effect" runat="server" Text="<%$ Resources:Content,GetLogs%>" />

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <div class="row">
        <div class="col-xs-12">
            <asp:GridView ID="GV_WinEvents" CssClass="table table-bordered table-striped table-hover" AllowSorting="false" AllowPaging="false"
                EmptyDataText='<%$ Resources:Content, GN00001375 %>' runat="server" AutoGenerateColumns="False">
                <Columns>
                    <asp:TemplateField HeaderStyle-CssClass="col-xs-8"
                        HeaderText='<%$ Resources:Content, Log %>'>
                        <ItemTemplate>
                            <div class="row">
                                <div class="col-sm-2 row-label">
                                    <asp:Label ID="Label2" runat="server"><%= Resources.Content.EventId %></asp:Label>
                                </div>
                                <div class="col-sm-2">
                                    <asp:Label ID="Lbl_EventId" runat="server" Text="" />
                                </div>
                                <div class="col-sm-3 row-label">
                                    <asp:Label ID="Label11" runat="server"><%= Resources.Content.SMI1898 %></asp:Label>
                                </div>
                                <div class="col-sm-5 break-word-all">
                                    <asp:Label ID="Lbl_Source" runat="server" Text="" />
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2 row-label">
                                    <asp:Label ID="Label13" runat="server"><%= Resources.Content.LogName %></asp:Label>
                                </div>
                                <div class="col-sm-2">
                                    <asp:Label ID="Lbl_Log" runat="server" Text="" />
                                </div>
                                <div class="col-sm-3 row-label">
                                    <asp:Label ID="Label15" runat="server"><%= Resources.Content.TaskCategory %></asp:Label>
                                </div>
                                <div class="col-sm-5">
                                    <asp:Label ID="Lbl_TaskCategory" runat="server" Text="" />
                                </div>
                                <div class="clearfix"></div>

                                <div class="col-sm-2 row-label">
                                    <asp:Label ID="Label6" runat="server"><%= Resources.Content.SPT002817 %></asp:Label>
                                </div>
                                <div class="col-sm-2">
                                    <asp:Label ID="Lbl_Level" runat="server" Text="" />
                                </div>
                                <div class="col-sm-3 row-label">
                                    <asp:Label ID="Label16" runat="server"><%= Resources.Content.GN0000779 %></asp:Label>
                                </div>
                                <div class="col-sm-5">
                                    <asp:Label ID="Lbl_Time" runat="server" Text="" />
                                </div>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="col-xs-4" SortExpression="Message"
                        HeaderText='<%$ Resources:Content, GN0000843 %>'>
                        <ItemTemplate>
                            <asp:Label ID="Lbl_Message_FullText"
                                data-num='<%# "FullText" & DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                runat="server" Text="" CssClass="hide break-word-all" />
                            <asp:Label ID="Lbl_Message_PartialText"
                                data-num='<%# "PartialText" & DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                CssClass="break-word-all"
                                runat="server" Text="" />
                            <br />
                            <asp:Button
                                ID="lbtn_More"
                                runat="server"
                                CommandName="Detail"
                                CommandArgument='<%# DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                Text="<%$ Resources:Content,ShowMore %>"
                                CssClass="btn btn-primary btn-sm"
                                data-num='<%# DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                data-num2='<%# "More" & DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                OnClientClick="ShowFullText($(this));return false;"></asp:Button>
                            <button id="btn_ViewLess"
                                class="btn btn-primary btn-sm hide"
                                data-num='<%#  DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                data-num2='<%# "Less" & DataBinder.Eval(Container.DataItem, "RecordId") %>'
                                onclick="ShowPartialText($(this));return false;">
                                <%= Resources.Content.ShowLess %></button>

                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    </div>
    <asp:Button ID="Btn_Dummy2" Style="display: none" runat="server" />
    <asp:Panel ID="Pnl_WinEvents" CssClass="width-modal-popup-auto" runat="server" Style="display: none">
        <ajax:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">
            <ContentTemplate>
                <div class="col-xs-12">
                    <div class="card">
                        <div class="header container-fluid">
                            <h3 class="pull-left">
                                <asp:Label ID="lbl_WinEventsHeader" runat="server"><%= Resources.Content.EventLog %></asp:Label>
                            </h3>
                            <span>
                                <button type="button" class="close" onclick="$find('<%=MPE_WinEvents.ClientID%>').hide();">&times;</button>
                            </span>
                        </div>
                        <div class="body">
                            <div class="row">
                                <div class="col-sm-2 row-label">
                                    <asp:Label ID="Label2" runat="server"><%= Resources.Content.LogName %></asp:Label>
                                </div>
                                <div class="col-sm-10">
                                    <asp:Label ID="Lbl_LogName" runat="server"></asp:Label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label3" runat="server"><%= Resources.Content.SMI1898 %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_Source" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label4" runat="server"><%= Resources.Content.Logged %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_Logged" runat="server"></asp:Label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label1" runat="server"><%= Resources.Content.EventId %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_EventId" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label5" runat="server"><%= Resources.Content.TaskCategory %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_TaskCategory" runat="server"></asp:Label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label7" runat="server"><%= Resources.Content.SPT002817 %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_Level" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label9" runat="server"><%= Resources.Content.Keywords %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_Keywords" runat="server"></asp:Label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label10" runat="server"><%= Resources.Content.Computer %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_Computer" runat="server"></asp:Label>
                                </div>
                                <div class="col-sm-2  row-label">
                                    <asp:Label ID="Label12" runat="server"><%= Resources.Content.OpCode %></asp:Label>
                                </div>
                                <div class="col-sm-4">
                                    <asp:Label ID="Lbl_OpCode" runat="server"></asp:Label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="col-sm-2 row-label">
                                    <asp:Label ID="Label8" runat="server"><%= Resources.Content.GN0000774 %></asp:Label>
                                </div>
                                <div class="col-sm-10">
                                    <asp:Label ID="Lbl_Message" runat="server"></asp:Label>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-12">
                                    <asp:Button class="btn btn-primary waves-effect" ID="Btn_Cancel2" runat="server" Text='<%$ Resources:Content,GN000150%>' />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </ajax:UpdatePanel>
    </asp:Panel>
    <EM:ModalPopupExtender runat="server" ID="MPE_WinEvents" BackgroundCssClass="modalBackground"
        DropShadow="false" PopupControlID="Pnl_WinEvents" CancelControlID="Btn_Cancel2" TargetControlID="Btn_Dummy2">
    </EM:ModalPopupExtender>
</asp:Panel>

