<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="ContainerList.aspx.cs" Inherits="TruxWebPortal.OnlineBin.ContainerList" %>

<%@ Register TagPrefix="ucHeader" TagName="truxHeader" Src="../header.ascx" %>
<%@ Register TagPrefix="ucHeader2" TagName="truxHeader2" Src="../header2.ascx" %>
<%@ Register TagPrefix="ucFooter" TagName="truxFooter" Src="../footer.ascx" %>
<%@ PreviousPageType TypeName="TruxWebPortal.TruxBasePage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="HeadLogin" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Container List</title>
    <link rel="stylesheet" type="text/css" href="../_style/stylesheet.css" title="TRUX7" />

</head>
<body>
    <form id="frmLogin" runat="server" autocomplete="off">
        <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
        <% 
        if (!string.IsNullOrWhiteSpace(sCompanyCode))
        {
        %>
            <ucHeader:truxHeader ID="Hdr1" runat="server" />
        <%
        }
        else
        { 
        %>
            <ucHeader2:truxHeader2 ID="Hdr2" runat="server" />
        <%
        }
        %>
        
        <div id="main_area">
            <div id="work_area">
                <div style="width: 100%; position:relative">
                    <asp:Label ID="lblAddress" CssClass="headerLabel topRight" runat="server"></asp:Label>
                </div>
                
                <h1>Dumpster/Temporary Service</h1>
                
                <p class="description" style="margin-bottom: 20px">
                    <span id="Span19">
                        <asp:Label ID="lblDesc" runat="server"></asp:Label>
                    </span>
                </p>
                <div style="float: left; width: 20%;">
                    <div style="margin-right: 10px">


                        <b>Filter By</b>
                        <div style="border: 1px solid gray;">
                            <p>
                                <b>Container Type:</b>
                            </p>
                            <asp:CheckBoxList CssClass="checkboxlist" ID="chkContainerTypes" runat="server" AutoPostBack="True" OnSelectedIndexChanged="chkContainerTypes_SelectedIndexChanged"></asp:CheckBoxList>
                            <p>
                                <b>Container Size:</b>
                            </p>
                            <asp:CheckBoxList CssClass="checkboxlist" ID="chkContainerSizes" runat="server" AutoPostBack="True" OnSelectedIndexChanged="chkContainerSizes_SelectedIndexChanged"></asp:CheckBoxList>
                        </div>
                    </div>
                </div>
                <div style="float: left; width: 80%;">
                    <div style="margin-left: 10px">

                        <asp:UpdatePanel ID="upContainers" runat="server">
                            <ContentTemplate>
                                <asp:GridView Width="100%" ID="gvContainers" AutoGenerateColumns="False" GridLines="None" OnRowCommand="gvContainers_OnRowCommand" runat="server" AllowPaging="True" OnPageIndexChanged="gvContainers_PageIndexChanged" OnPageIndexChanging="gvContainers_PageIndexChanging">
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <div style="border: 1px solid gray; margin-bottom: 10px">
                                                    <div class="title_bar_blk">
                                                        <asp:Label ID="lblContainerHeader" runat="server" Text='<%# string.Join(" - ", new string[]{Eval("CONT_DESC").ToString(),string.Format("{0} {1}", Eval("CONT_SIZE"), Eval("CONT_UOM"))}.Where(text => !string.IsNullOrWhiteSpace(text)))  %>'></asp:Label>
                                                    </div>
                                                    <div id="status_bar" style="margin-bottom: 0px">
                                                        <p>
                                                            <span id="Span1" class="data">
                                                                <asp:Label ID="lblBlueHeader" runat="server" Text=""></asp:Label>
                                                            </span>
                                                        </p>
                                                    </div>
                                                    <div style="clear: both; display: flex">
                                                        <div style="width: 25%; flex: 0 0 25%">
                                                            <asp:Image ImageUrl='<%# string.IsNullOrWhiteSpace(Eval("CONT_BASE64").ToString()) ? "~/_images/no-photo.png" : string.Format("data:image/{0};base64,{1}",Eval("CONTIMG_EXT"),Eval("CONT_BASE64"))   %>' style="max-width: 100%; height: auto;"  runat="server"/>
                                                            <div style="width: 100%;">
                                                                <p style="text-align: left">
                                                                    <u><%# Eval("AVAILABLE") != DBNull.Value && (bool)Eval("AVAILABLE") ? "Available in next 7 days" : ""  %></u>
                                                                </p>
                                                                <p style="text-align: left">
                                                                    <strong>From <%# string.Format("{0:C2}",Eval("ACTV_RATE"))  %></strong>
                                                                </p>
                                                            </div>
                                                        </div>
                                                        <div style="width: 75%; margin: 5px">
                                                            <div>
                                                                <div id="descriptionContent" runat="server">
                                                                    <%# Eval("CONT_NOTE")  %>
                                                                   
                                                                </div>
                                                                
                                                            </div>
                                                        </div>
                                                        
                                                       
                                                    </div>
                                                    <div>
                                                        <hr/>
                                                        <div style="width: 100%; display: flex; flex-direction: row; margin: 5px;">
                                                           
                                          
                                                                <div style="width: 50%">
                                                                    <%# GetString(new string[] {"<p><label style=\"display: inline;float:none\">Included:<label></p>",(int)Eval("DEM_DAYS") > 0 ? string.Format("<p>{0} Days Usage Included</p>", Eval("DEM_DAYS")) : "",(Eval("MATL_CAP") != DBNull.Value && Eval("MATL_RATE") != DBNull.Value && Eval("MATL_UOM") != DBNull.Value && (decimal)Eval("MATL_RATE") > 0 && (decimal)Eval("MATL_CAP") > 0) ? string.Format("<p>{0}{1} Disposal Included</p>", Eval("MATL_CAP"),Eval("MATL_UOM")) : ""}.Where(item => !string.IsNullOrWhiteSpace(item)).ToArray())  %>
                                                                </div>
                                                                <div style="width: 50%">
                                                                    <%# GetString(new string[] {"<p><label style=\"display: inline;float: none\">Extra:</label></p>",(decimal)Eval("DEM_RATE") > 0 ? string.Format("<p>{0:C2} per{1} Day Usage</p>", Eval("DEM_RATE"),(int)Eval("DEM_DAYS") < 1 ? "" : " Extra") : "",(Eval("MATL_CAP") != DBNull.Value && Eval("MATL_RATE") != DBNull.Value && Eval("MATL_UOM") != DBNull.Value && (decimal)Eval("MATL_RATE") > 0 && (decimal)Eval("MATL_CAP") > 0) ? string.Format("<p>{0:C2} per Extra {1}</p>", Eval("MATL_RATE"),Eval("MATL_UOM")) : ""}.Where(item => !string.IsNullOrWhiteSpace(item)).ToArray())  %>
                                                                </div>
                                                             
                                                           
                                                            <div style="width: 25%; display: flex; justify-content: flex-end;flex-grow: 1">
                                                                <asp:Button CssClass="gridButton" Style="width: 75%; display: block; margin-left: auto; margin-right: auto; align-self: flex-end" ID="Button1" runat="server" Text="Detail" CommandName="Select" CommandArgument='<%# new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(new TruxWebPortal.OnlineBin.Objects.Container() { CompanyCode = Eval("COMP").ToString(), ContainerSize = (decimal)Eval("CONT_SIZE"), ContainerType = Eval("CONT_TYPE").ToString(), DemmurageDays = (int)Eval("DEM_DAYS") , DemmurageRate = (decimal)Eval("DEM_RATE"), ServiceId = (int)Eval("SERVICE_ID"), ContainerUom = Eval("CONT_UOM").ToString(), ContainerDesc = Eval("CONT_DESC").ToString(), ContainerUomDesc = Eval("CONT_UOM_DESC").ToString()} )%>' />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>

                                </asp:GridView>
                            </ContentTemplate>

                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="chkContainerTypes" />
                                <asp:AsyncPostBackTrigger ControlID="chkContainerSizes" />
                                <asp:PostBackTrigger ControlID="gvContainers" />
                            </Triggers>

                        </asp:UpdatePanel>
                    </div>
                </div>
                <div style="clear: both;"></div>
            </div>
        </div>
        <ucFooter:truxFooter ID="Ftr1" runat="server"></ucFooter:truxFooter>
    </form>
</body>
</html>
