<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_postRX_DT_LIST.ascx.cs" Inherits="GMW.WebUserControls.mod_postRX_DT_LIST" %>
<%if (false)
  { %>
<webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" />
<webopt:BundleReference ID="BundleReference2" runat="server" Path="~/Content/themes/base/css" />
<%} %>

<div class="row">
  <div class="col-sm-4">
    <div style="float: left; text-align: center;">
      <div class="card bg-warning small">
        <div class="card-header">
          <b><%: traduci("DtxLetti") %></b>
        </div>
        <div class="card-body bg-light text-dark">
          <asp:GridView ID="grView" runat="server" AllowSorting="True" AutoGenerateColumns="False" Width="100%" OnDataBound="grView_DataBound" DataKeyNames="FormatoDtmx" DataSourceID="ods" OnSelectedIndexChanged="grView_SelectedIndexChanged">
            <RowStyle CssClass="ctrRowStyle" />
            <AlternatingRowStyle CssClass="ctrAltRowStyle" />
            <EditRowStyle CssClass="ctrEditRowStyle" />
            <SelectedRowStyle CssClass="ctrSelRowStyle" />
            <FooterStyle CssClass="ctrFooter" />
            <PagerStyle CssClass="ctrHeaderPager" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
            <EmptyDataRowStyle CssClass="ctrRowStyle" />
            <EmptyDataTemplate>
              <asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
            </EmptyDataTemplate>
            <Columns>
              <asp:TemplateField ShowHeader="False">
                <HeaderTemplate>
                  <asp:LinkButton ID="btnReset" runat="server" OnClick="btnReset_Click" CssClass="btn btn-default btn-sm"><i class="fa fa-refresh"></i> <%: traduci("Reset") %></asp:LinkButton>
                </HeaderTemplate>
                <ItemTemplate>
                  <asp:LinkButton ID="lbSelect" runat="server" CausesValidation="False" CommandName="Select" CssClass="text-success"><i class="fa fa-search-plus btn-lg"></i></asp:LinkButton>
                </ItemTemplate>
              </asp:TemplateField>
              <asp:TemplateField HeaderText="FormatoDtmx" SortExpression="FormatoDtmx">
                <ItemTemplate>
                  <asp:Label ID="lblParticolare" runat="server" Text='<%# Eval("FormatoDtmx") %>' />
                </ItemTemplate>
              </asp:TemplateField>
              <asp:TemplateField HeaderText="LettureDtx" SortExpression="DataOra_INI">
                <ItemTemplate>
                  <div class="didascalia">
                    <asp:Label ID="lblPM" runat="server" Text='<%# Eval("DataOra_INI", "PM: {0:dd/MM/yy HH:mm}") %>' ToolTip='<%# traduci("PrimoMarcato") %>' />
                  </div>
                  <div class="didascalia">
                    <asp:Label ID="lblUM" runat="server" Text='<%# Eval("DataOra_END", "UM: {0:dd/MM/yy HH:mm}") %>' ToolTip='<%# traduci("UltimoMarcato") %>' Visible='<%# (Eval("DTX_END").ToString() != "") %>' />
                  </div>
                </ItemTemplate>
              </asp:TemplateField>
              <asp:TemplateField HeaderText="Qta" SortExpression="Qta" ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                  <span style="padding: 0px 4px;">
                    <b>
                      <asp:Label ID="lblQta" runat="server" Text='<%# Eval("Qta","{0:#}") %>' /></b>
                  </span>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Right"></ItemStyle>
              </asp:TemplateField>
              <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                  <asp:LinkButton ID="lbtDelete" runat="server" CausesValidation="False" CommandName="Delete" OnClientClick="return confirm('Confermi eliminazione?')" CssClass="text-danger" Visible='<%# string.IsNullOrEmpty((Eval("DTX_END").ToString() )) %>'><i class="fa fa-trash btn-lg"></i></asp:LinkButton>
                </ItemTemplate>
              </asp:TemplateField>
            </Columns>
          </asp:GridView>
          <asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getByLinea" DeleteMethod="deleteQuery" TypeName="GMW_data.DS_DataMatrixTableAdapters.Linea2Dtx_IETableAdapter" OnDeleted="ods_Deleted">
            <SelectParameters>
              <asp:ControlParameter ControlID="hfCodLinea" DefaultValue="W" Name="CodLinea" PropertyName="Value" Type="String" />
            </SelectParameters>
            <DeleteParameters>
              <asp:ControlParameter ControlID="hfCodLinea" DefaultValue="W" Name="Original_CodLinea" PropertyName="Value" Type="String" />
              <asp:Parameter Name="Original_FormatoDtmx" Type="String" />
            </DeleteParameters>
          </asp:ObjectDataSource>
          <asp:HiddenField runat="server" ID="hfCodLinea" />
        </div>
      </div>
      <div runat="server" id="divDetDtx" class="card bg-info small">
        <div class="card-header">
          <b><%: traduci("ParticolariCaricati") %></b>
        </div>
        <div class="card-body bg-light text-dark">
          <asp:GridView runat="server" ID="grViewDet" AutoGenerateColumns="False" DataSourceID="odsDet">
            <Columns>
              <asp:BoundField DataField="UDC" HeaderText="UDC" ReadOnly="True" SortExpression="UDC" />
              <asp:BoundField DataField="Particolare" HeaderText="Particolare" ReadOnly="True" SortExpression="Particolare" />
              <asp:BoundField DataField="Qta" HeaderText="Qta" ReadOnly="True" SortExpression="Qta" />
            </Columns>

          </asp:GridView>
          <asp:ObjectDataSource ID="odsDet" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GMW_data.DS_DataMatrixTableAdapters.L2D_dettPartTableAdapter" OnDeleted="ods_Deleted">
            <SelectParameters>
              <asp:ControlParameter ControlID="hfCodLinea" DefaultValue="W" Name="CodLinea" PropertyName="Value" Type="String" />
              <asp:ControlParameter ControlID="grView" DefaultValue="P" Name="FormatoDtmx" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
          </asp:ObjectDataSource>
        </div>
      </div>
    </div>
  </div>
  <div class="col-sm-4">
    <div>
      <asp:Label runat="server" ID="lblParticolareAttivo" Font-Size="3em" Text="" />
    </div>
    <div>
      <asp:Label runat="server" ID="lblDescrAttivo" Font-Size="2em" Text="" ToolTip="particolare" />
      <br />
      <asp:Label runat="server" ID="lblDisegno" Font-Size="1.8em" Text="" ForeColor="#FFFFFF" Font-Bold="true" ToolTip="disegno" />
    </div>
    <div>
      <div id="divModoInput" runat="server" style="width: 320px; margin: auto; text-align: center;">
        <asp:RadioButtonList ID="rblInputMode" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rblInputMode_SelectedIndexChanged" class="btn-group" RepeatDirection="Horizontal" RepeatLayout="Flow">
          <asp:ListItem Value="BARCODE" Text="MATRIX" Selected="True" class="btn btn-default btn-lg"></asp:ListItem>
        </asp:RadioButtonList>
      </div>
      <div id="divElenco" runat="server">
        <div>
          <asp:Label runat="server" ID="lblElencoPart" AssociatedControlID="ddlPart"><%: traduci("lblElencoPart") %></asp:Label>
        </div>
        <span style="font-size: 18pt;">
          <asp:DropDownList ID="ddlPart" runat="server" DataSourceID="odsParticolari" DataTextField="label" DataValueField="value"></asp:DropDownList>
        </span>
        <asp:ObjectDataSource ID="odsParticolari" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio" TypeName="GMW_data.DS_UtilityTableAdapters.v_selParticolariTableAdapter">
          <SelectParameters>
            <asp:Parameter DefaultValue="P" Name="conditio" Type="String" />
          </SelectParameters>
        </asp:ObjectDataSource>
        <asp:LinkButton runat="server" ID="lbtAddPart" CssClass="btn btn-primary" OnClick="lbtAddPart_Click"><i aria-hidden='true' class='fa fa-plus'></i></asp:LinkButton>
      </div>
      <div id="divBarcode" runat="server">
        <div>
          <div>
            <asp:Label runat="server" ID="lblBarcode" AssociatedControlID="txtBarcode"><%: traduci("lblDataMatrix") %></asp:Label>
          </div>
          <asp:TextBox runat="server" ID="txtBarcode" Height="1.2em" Width="100%" Font-Size="3em" AutoPostBack="True" Style="text-align: center" TabIndex="1" />
        </div>
      </div>
      <div id="divNote" runat="server">
        <div>
          <%: traduci("Note") %>
        </div>
        <div>
          <asp:TextBox runat="server" ID="txtNote" Height="4em" Width="100%" Font-Size="2em" TextMode="MultiLine" />
        </div>
        <div style="width: 400px; margin: auto;">
          <asp:LinkButton runat="server" ID="lbtGeneraAl" Width="100%" CssClass="btn btn-warning btn-lg" OnClick="lbtGeneraAl_Click"><i aria-hidden='true' class='fa fa-check fa-2x'></i> <%: traduci("lbtCreaUdcAl") %></asp:LinkButton>
          <asp:LinkButton runat="server" ID="lbtStampaAL" Width="100%" CssClass="btn btn-success btn-lg" OnClick="lbtStampaAL_Click"><i aria-hidden='true' class='fa fa-print fa-2x'></i> <%: traduci("lbtStampaAL") %></asp:LinkButton>
        </div>
      </div>
    </div>
  </div>
  <div class="col-sm-4">
    <div style="float: right; text-align: center;">
      <div class="card bg-default small">
        <div class="card-header">
          <b><%: traduci("lblQtaPart") %></b>
        </div>
        <div class="card-body bg-light text-dark">
          <%--disabilitati in maschera dtx--%>
          <asp:TextBox runat="server" ID="txtQta" Width="100%" Font-Size="28pt" Style="text-align: center" Enabled="false" />
        </div>
      </div>
      <div class="card bg-default small">
        <div class="card-header">
          <b><%: traduci("DataFusione") %></b>
        </div>
        <div class="card-body bg-light text-dark">
          <asp:Label runat="server" ID="lblDTFus" />
          <br />
          <b>
            <asp:Label runat="server" ID="lblLinFus" /></b>
        </div>
      </div>
      <div class="card bg-default small">
        <div class="card-header">
          <b><%: traduci("lblCesta") %></b>
        </div>
        <div class="card-body bg-light text-dark">
          <asp:TextBox runat="server" ID="txtCesta" Width="100%" Font-Size="28pt" Style="text-align: center" palceholder="num cesta" AutoPostBack="True" OnTextChanged="txtCesta_TextChanged" />
        </div>
      </div>
    </div>
  </div>
</div>
