<%@ Page Title="Materials" Language="C#" MasterPageFile="~/Site.Master" 
    AutoEventWireup="true" CodeBehind="Materials.aspx.cs" Inherits="SMTBETECH_V3.Materials" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<style type="text/css">

    .GridPager a, .GridPager span {
        display: block;
        height: 28px;
        width: 24px;
        font-weight: bold;
        text-align: center;
        text-decoration: none;
    }

    .GridPager a {
        background-color: #f5f5f5;
        color: #969696;
        border: 1px solid #969696;
    }

    .GridPager span {
        /*background-color: #A1DCF2;*/
        background-color: steelblue;
        color: whitesmoke;
        border: 1px solid #3AC0F2;
    }
</style>


    
    
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>

    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="UpdatePanel1" >

   <ProgressTemplate>
      Loading...
   </ProgressTemplate>
   
    </asp:UpdateProgress>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

            <h2 id="title"><%: Title %></h2>

           
            <asp:Panel runat="server" DefaultButton="btnSearch">

            <div class="row" style="width:100%">

                <div class="col-2" style="text-align:left">
                    <asp:Button CssClass="btn btn-primary btn-sm" ID="btnNewMaterials" runat="server"
                        Text="New" OnClick="btnNewMaterials_Click"/>
                </div>
                <div class="col-4">
                    <asp:TextBox CssClass="form-control" placeholder="Search Part Number"  runat="server"
                        ID="txtSearchMaterials" AutoPostBack="false" onFocus="this.select()"/>
                </div>
                <div class="col-6" style="text-align:left">
                    <asp:Button CssClass="btn btn-primary btn-sm" ID="btnSearch" runat="server" 
                        Text="Search" OnClick="btnSearch_Click"/>
                    <asp:Button CssClass="btn btn-primary btn-sm" ID="btnClearSearch" runat="server"
                        Text="Clear" OnClick="btnClearSearch_Click"/>
                </div>

            </div>
            <p></p>
            </asp:Panel>

        <div style="overflow-x:scroll">
            <asp:GridView CssClass="table table-bordered table-striped table-sm"
                ID="GVMaterials"
                runat="server"
                AutoGenerateColumns="False"
                AllowPaging="True"
                AllowSorting="False"
                OnRowCommand="GVMaterials_RowCommand" OnPageIndexChanging="GVMaterials_PageIndexChanging" PageSize="10">
            <HeaderStyle CssClass="table-primary" />
                <Columns>
                    <asp:BoundField HeaderStyle-Width="80px" DataField="Id" HeaderText="Id" ReadOnly="True" InsertVisible="False" SortExpression="Id"></asp:BoundField>

                    <asp:ButtonField HeaderStyle-Wrap="false" HeaderStyle-Width="300px" ItemStyle-Wrap="false" SortExpression="PartNumber" 
                        CommandName="EditMaterials" DataTextField="PartNumber" HeaderText="Part Number" />
            
                    <asp:BoundField HeaderStyle-Wrap="false" HeaderStyle-Width="400px" ItemStyle-Wrap="false" DataField="Description" HeaderText="Description" SortExpression="Description"></asp:BoundField>                    

                    <asp:TemplateField HeaderText="Quantity" HeaderStyle-Width="100px" ItemStyle-Wrap="false" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"  ItemStyle-ForeColor="Blue">    
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblQuantity" Text='<%# int.Parse(Eval("Quantity").ToString()).ToString("N0") %>'/>
                        </ItemTemplate>    
                    </asp:TemplateField>   

                   <%-- <asp:BoundField 
                        HeaderStyle-Wrap="false" 
                        HeaderStyle-Width="100px" 
                        ItemStyle-Wrap="false" 
                        DataField="Quantity" 
                        HeaderText="Quantity" 
                        SortExpression="Quantity"
                        ItemStyle-ForeColor="Blue"
                        DataFormatString="{0:N0}" 
                        ItemStyle-HorizontalAlign="Right">
                    </asp:BoundField>--%>
                                        
                    <asp:BoundField Visible="false" ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="CreationDate" HeaderText="Creation Date" SortExpression="CreationDate"></asp:BoundField>
                    <asp:BoundField Visible="false" ItemStyle-Wrap="false" ItemStyle-Width="200px" DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate"></asp:BoundField>
                    
                </Columns>
                    <PagerStyle CssClass="GridPager" />
        
        </asp:GridView>
    </div>
            <p></p>
            <%--<div style="width:50%">
                Total: <asp:Label runat="server" ID="lblCount"></asp:Label>
            </div>--%>

            <table width="100%">
              <tr>
                <td style="width: 50%">Total: <asp:Label runat="server" ID="lblCount" ForeColor="Blue"></asp:Label></td>
                <td style="width: 50%; text-align: right;">Quantity: <asp:Label runat="server" ID="lblQuantity" ForeColor="Blue"></asp:Label></td>
              </tr>
            </table>

        </ContentTemplate>
    </asp:UpdatePanel>




</asp:Content>
