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


<asp:HiddenField ID="hfCartID" runat="server" />
<asp:DetailsView ID="detView" runat="server" Width="100%" AutoGenerateRows="False" DataSourceID="odsCart">
    <Fields>
        <asp:TemplateField SortExpression="OrderExtCode" ShowHeader="false">
            <ItemTemplate>
                <div class="row text-center ">
                    <div class="col-12 col-md-3">
                        req date:
                        <asp:Label ID="BatchNameLabel" runat="server" Text='<%# Eval("BatchName") %>' CssClass="h4" />
                    </div>
                    <div class="col-12 col-md-3">
                        model:<asp:Label ID="FamilyCodeLabel" runat="server" Text='<%# Eval("FamilyCode") %>' CssClass="h4" />
                    </div>
                    <div class="col-12 col-md-3">
                        order:
                        <asp:Label ID="OrderExtCodeLabel" runat="server" Text='<%# Eval("OrderExtCode") %>' CssClass="h4" />
                    </div>
                    <div class="col-12 col-md-3">
                        cart: <asp:Label ID="CartDtmxLabel" runat="server" Text='' CssClass="h4"><b><%# Eval("CartIndex","C{0}") %></b> <%# Eval("CartDtmx") %></asp:Label>
                    </div>
                </div>
            </ItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="odsCart" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByCartId" TypeName="AppData.DS_AppTableAdapters.Pack2CartTableAdapter">
    <SelectParameters>
        <asp:ControlParameter ControlID="hfCartID" DefaultValue="0" Name="CartID" PropertyName="Value" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>

<div class="table-responsive-sm">
    <asp:GridView runat="server" ID="grView" CssClass="table table-sm table-striped small smallTable" AutoGenerateColumns="False" DataSourceID="ods" DataKeyNames="ItemExtCode" OnSelectedIndexChanged="grView_SelectedIndexChanged">
        <Columns>
            <asp:TemplateField HeaderText="Part" SortExpression="ItemExtCode">
                <HeaderTemplate>
                    <asp:Label ID="PartLabel" runat="server" Text='<%# traduci("Part") %>' />
                </HeaderTemplate>
                <ItemTemplate>
                    <div class="row">
                        <div class="col-12 col-md-2">
                            <asp:Label ID="ItemExtCodeLabel" runat="server" CssClass="font-weight-bold" Text='<%# Eval("ItemExtCode") %>' />
                        </div>
                        <div class="col-12 col-md-4">
                            <asp:Label ID="ItemDescLabel" CssClass="text-truncate" runat="server" Text='<%# Eval("ItemDesc") %>' />
                        </div>
                        <div class="col-12 col-md-2">
                            <asp:Label ID="ItemMatExtCode" runat="server" CssClass="font-weight-bold" Text='<%# Eval("MatExtCode") %>' />
                        </div>
                        <div class="col-12 col-md-4">
                            <asp:Label ID="MatDescLabel" CssClass="text-truncate" runat="server" Text='<%# Eval("MatDesc") %>' />
                        </div>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="TotReq" HeaderText="Req Qty" ReadOnly="True" SortExpression="TotReq" />
            <asp:BoundField DataField="TotCur" HeaderText="Scan Qty" ReadOnly="True" SortExpression="TotCur" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="lbtInvalidate" runat="server" CausesValidation="False" CommandName="Select" CssClass="btn btn-sm btn-warning py-0" Visible='<%# checkQty(Eval("TotCur")) %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("CofirmInvalidatePart")%>' ToolTip='<%# traduci("Invalidate") %>'><i class="fa fa-chain-broken" aria-hidden="true"></i></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>

    </asp:GridView>
    <asp:ObjectDataSource runat="server" ID="ods" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="AppData.DS_AppTableAdapters.CartIRKTableAdapter">
        <SelectParameters>
            <asp:ControlParameter ControlID="hfCartID" DefaultValue="0" Name="CartID" PropertyName="Value" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
</div>
