<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_BP_bunkList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_BP_bunkList" %>



<asp:GridView ID="grView" runat="server" AutoGenerateColumns="False" DataKeyNames="StackID" DataSourceID="ods" CssClass="table table-sm table-striped" AllowSorting="True" OnSelectedIndexChanged="grView_SelectedIndexChanged" OnRowCommand="grView_RowCommand">
  <HeaderStyle CssClass="default" />
  <PagerStyle CssClass="active GridPager" />
  <PagerSettings Mode="NumericFirstLast" />
  <SelectedRowStyle CssClass="table-info" />
  <EmptyDataTemplate>
      <%: traduci("NoRecord") %>
  </EmptyDataTemplate>
  <Columns>
    <asp:TemplateField ShowHeader="False">
      <HeaderTemplate>
        <asp:LinkButton ID="lbtReset" runat="server" OnClick="lbtReset_Click" CssClass="btn btn-sm btn-primary" Visible="true" ToolTip="Reset"><i class="fa fa-refresh"></i></asp:LinkButton>
      </HeaderTemplate>
      <ItemTemplate>
        <asp:LinkButton ID="lbSelect" runat="server" CausesValidation="False" CommandName="Select" CommandArgument='<%# Eval("StackIndex") %>' CssClass="btn btn-sm btn-primary"><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Bunk #" SortExpression="StackIndex">
      <ItemTemplate>
        <asp:Label ID="lblStackIndex" runat="server" Text='<%# Eval("StackIndex") %>' CssClass="font-weight-bold" />
        <br/>
        <asp:Label ID="lblStackID" runat="server" Text='<%# Eval("StackID","{0}") %>' CssClass="small" />
      </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField HeaderText="Sheets /Parts" SortExpression="NumSheets">
      <ItemTemplate>
        <div runat="server" id="divMain" class="row mx-1 ">
          <div class="col-12 px-0 text-left">S: <b><%# Eval("NumSheets") %></b></div>
          <div class="col-12 px-0 text-left">P: <b><%# Eval("NumItems") %></b></div>
        </div>
      </ItemTemplate>
      <ItemStyle CssClass="text-right" />
    </asp:TemplateField>    
    <asp:TemplateField HeaderText="File">
      <ItemTemplate>
        <asp:HyperLink runat="server" ID="hlFileExp" Target="_blank" NavigateUrl='<%# $"~/export/BunkDetail?BunkId={Eval("StackID")}" %>' CssClass="btn btn-sm btn-success" ToolTip="Excel Export"><i class="fa fa-file-excel-o" aria-hidden="true"></i></asp:HyperLink>
      </ItemTemplate>
    </asp:TemplateField>
  </Columns>
</asp:GridView>
<asp:HiddenField ID="hfBatchID" runat="server" />
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByBatch" TypeName="AppData.DS_AppTableAdapters.StackListTableAdapter">
  <SelectParameters>
    <asp:ControlParameter ControlID="hfBatchID" DefaultValue="0" Name="BatchID" PropertyName="Value" Type="Int32" />
  </SelectParameters>
</asp:ObjectDataSource>
