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


<div class="row">
  <div class="col-12">
    <div runat="server" id="divTitle">
      <div class="col-4 col-lg-6 pr-0 font-weight-bold">
           <%: traduci("BatchList") %>
      </div>
      <div class="col-8 col-lg-6 pl-0 text-right" runat="server" id="divSelected">
        <asp:Label runat="server" ID="lblTakt" />
        <asp:LinkButton ID="lbtResetGlob" runat="server" OnClick="lbtReset_Click" CssClass="btn btn-sm btn-primary" Visible="true" ToolTip="Reset"><i class="fa fa-refresh"></i></asp:LinkButton>
      </div>
    </div>
  </div>
  <div class="col-12">
    <asp:GridView ID="grView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="BatchID" 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" CssClass="btn btn-sm btn-primary" CommandArgument='<%# Eval("Takt") %>'><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Batch Name" SortExpression="Takt">
          <ItemTemplate>
            <div class="row">
              <div class="col-4 col-lg-2">
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Takt") %>'></asp:Label>
              </div>
              <div class="col-4 px-0 col-lg-2 text-truncate">
                <asp:Label ID="lblStatus" runat="server" CssClass='<%# cssByStatus(Eval("Status"))  %>'><%# BStatus(Eval("Status")) %></asp:Label>
              </div>
              <div class="col-4 col-lg-2">
                <asp:Label ID="lblPosition" runat="server" Text='<%# BatchPositionStatus(Eval("Position")) %>' />
              </div>
              <div class="col-12 col-lg-6">
                <div runat="server" id="divMain" class='<%# "row mx-1 " + cssByPosition(Eval("Position")) %>'>
                  <div class="col-12 col-lg-6 p-lg-l-1 text-left">Bunk #: <b><%# Eval("NumStacks") %></b> --> <%# Eval("NumSheets") %> Sheets</div>
                  <div class="col-12 col-lg-6 p-lg-r-1">Orders: <b><%# Eval("NumOrders") %></b> --> <%# Eval("NumItems") %> Items</div>
                </div>
              </div>
            </div>
          </ItemTemplate>
        </asp:TemplateField>
      </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getForBunkMan" TypeName="AppData.DS_AppTableAdapters.BatchListTableAdapter">
      <SelectParameters>
        <asp:Parameter DefaultValue="3" Name="MaxPosition" Type="Int32" />
      </SelectParameters>
    </asp:ObjectDataSource>
  </div>
</div>
