<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_batchDetailSplitInfo.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_batchDetailSplitInfo" %>
<%@ Register Src="~/WebUserControls/cmp_batchDetailMongo.ascx" TagPrefix="uc1" TagName="cmp_batchDetailMongo" %>

<asp:HiddenField runat="server" ID="hfBatchId" />

<asp:FormView runat="server" ID="frmView" DataSourceID="ods" CssClass="" Width="100%">
    <ItemTemplate>
        <div class="row table-info textCondens">
            <div class="col-6 text-left ">
                <asp:Label runat="server" ID="lblBatchType" ToolTip='<%# tooltipByType(Eval("BatchType")) %>'><span style="font-size: 1.3em;"><i class='<%# cssIconByType(Eval("BatchType")) %>'></i></span>&nbsp;&nbsp;<b><%# Eval("Takt") %></b></asp:Label>
            </div>
            <div class="col-3 text-right">
                # KIT/Parts: <b><%# Eval("NumOrders") %>/<%# Eval("NumItems") %></b>
            </div>
            <div class="col-3 text-right">
                Estim.Time: <b><%# Eval("TotalTime","{0:N2}") %></b> min
            </div>
        </div>
        <div class="row ">
            <div class="col-4 text-right">
                <asp:HyperLink runat="server" ID="hlShowErr" NavigateUrl='<%# $"../site/ErrorsLog?PUID=B.{Eval("BatchID")}" %>' CssClass="text-warning" Visible='<%# Eval("NumErrPre").ToString()!="0" %>' Target="_blank" ToolTip="Show errors"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <%# $"{Eval("Errors")} (tot: {Eval("NumErrPre")} err)" %></asp:HyperLink>
                <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# $"../site/ErrorsLog?PUID={Eval("EnvNum")}" %>' CssClass="text-danger" Visible='<%# Eval("NumErr").ToString()!="0" %>' Target="_blank" ToolTip="Show errors"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <%# $"{Eval("Errors")} (tot: {Eval("NumErr")} err)" %></asp:HyperLink>
            </div>
            <div class="col-8 text-left">
                <div class="d-flex">
                    <div class="px-2 flex-grow-1">
                        <asp:Label ID="lblStatus" runat="server" CssClass='<%# cssByStatus(Eval("Status"))  %>'><%# BStatus(Eval("Status")) %></asp:Label>
                        <i class="fa fa-spinner fa-spin" aria-hidden="true" runat="server" visible='<%# Eval("Status").ToString()=="1" || Eval("Status").ToString()=="3" %>'></i>
                    </div>
                    <div class="px-2 text-right">
                        <asp:HyperLink runat="server" ID="hlSheetPreview" Target="_blank" NavigateUrl='<%# $"../site/BatchPreview?BatchId={Eval("BatchID")}" %>' Visible='<%# isPreviewVisible(Eval("Status")) && hasPreviewByType(Eval("BatchType")) %>' ToolTip="Show Batch preview" CssClass="btn btn-sm btn-info"><i class="fa fa-object-group" aria-hidden="true"></i></asp:HyperLink>
                        <asp:HyperLink runat="server" ID="hlPlannerReports" Target="_blank" NavigateUrl='<%# $"../site/PlannerReports?BatchId={Eval("BatchID")}&MaxHour=4" %>' Visible='<%# isPreviewVisible(Eval("Status")) && hasPreviewByType(Eval("BatchType")) %>' ToolTip="Show Unload Preview" CssClass="btn btn-sm btn-dark"><i class="fa fa-bar-chart" aria-hidden="true"></i></asp:HyperLink>
                    </div>
                </div>
            </div>
        </div>
    </ItemTemplate>
</asp:FormView>
<asp:HiddenField ID="hfDeleteEnabled" runat="server" />
<asp:ObjectDataSource ID="ods" runat="server" SelectMethod="getByKey" TypeName="AppData.DS_AppTableAdapters.BatchListTableAdapter" FilterExpression="Status <> 5">
    <SelectParameters>
        <asp:ControlParameter ControlID="hfBatchId" DefaultValue="0" Name="BatchId" PropertyName="Value" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<div class="row table-info">
    <div class="col-12">
        <uc1:cmp_batchDetailMongo runat="server" ID="cmp_batchDetailMongo" showInline="false" />
    </div>
</div>