<%@ Page Title="Products" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Products.aspx.cs" Inherits="ZFJINV.Definitions.Products" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <div class="row">
        <div class="col-md-12 mySpace">

            <div class="caption">
                <!-- <i class="icon-settings font-red"></i> -->
                <span class="caption-subject font-blue sbold" style="font-size: 150%;">Products</span>
            </div>
            <input type="hidden" id="hidtab1" />
            <asp:HiddenField ID="hidtab" runat="server" />


            <div class="portlet-body">

                <div class="tabbable-line">
                    <ul class="nav nav-tabs" id="myTabs">

                        <li>
                            <a href="#tab_addProduct" data-toggle="tab" aria-controls="tab_addProduct"
                                style="font-size: 13px; color: #2E4053; font-weight: 700;">Add Product </a>
                        </li>
                        <li>
                            <a href="#tab_productList" data-toggle="tab" aria-controls="tab_productList"
                                style="font-size: 13px; color: #2E4053; font-weight: 700;">Product List </a>
                        </li>

                    </ul>


                    <div class="tab-content">
                        <div class="tab-pane active" id="tab_addProduct">
                            <asp:UpdatePanel ID="upanel" runat="server">
                                <ContentTemplate>
                                    <div class="ui segment">
                                        <div class="ui stackable form">


                                            <div class="col-md-3">
                                                <label class="lbStyle">Product Code:</label>
                                                <asp:TextBox ID="txtProductID" runat="server" title="Product Code" CssClass="myInput"></asp:TextBox>
                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Product Name:</label>
                                                <asp:TextBox ID="txtProductName" runat="server" title="Product Name" CssClass="myInput"></asp:TextBox>
                                            </div>
                                           <%-- <div class="col-md-3">
                                                <label class="lbStyle">Unit Price:</label>
                                                <asp:TextBox ID="txtUnitPrice" runat="server" title="Unit Price" CssClass="myInput"></asp:TextBox>
                                            </div>

                                            <div class="col-md-3">
                                                <label class="lbStyle">Tax Per:</label>
                                                <asp:TextBox ID="txtTaxPercentage" runat="server" title="Tax Percentage" CssClass="myInput"></asp:TextBox>
                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Generic Name:</label>
                                                <asp:TextBox ID="txtBrand" runat="server" title="Generic Name" CssClass="myInput"></asp:TextBox>
                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Purchase Rate:</label>
                                                <asp:TextBox ID="txtPurchaseRate" runat="server" title="Purchase Rate" CssClass="myInput"></asp:TextBox>
                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Purchase Discount Per:</label>
                                                <asp:TextBox ID="txtPurchaseDiscountPer" runat="server" title="Purchase Discount Percentage" CssClass="myInput"></asp:TextBox>
                                            </div>--%>
                                            <div class="col-md-3">
                                                <label class="lbStyle">UOM Purchase:</label>
                                                <asp:TextBox ID="txtUOMPurchase" runat="server" title="Purchase Unit of Measurement" CssClass="myInput"></asp:TextBox>

                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">UOM Sale:</label>
                                                <asp:TextBox ID="txtUOMSale" runat="server" title="Sale Unit of Measurement" CssClass="myInput"></asp:TextBox>

                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Max Limit:</label>
                                                <asp:TextBox ID="txtMaxLimit" runat="server" title="Maximum Limit" CssClass="myInput"></asp:TextBox>

                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Min Limit:</label>
                                                <asp:TextBox ID="txtMinLimit" runat="server" title="Minimum Limit" CssClass="myInput"></asp:TextBox>

                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle">Brand:</label>
                                                <asp:DropDownList ID="txtBrand" runat="server" class="myInput form-control" AppendDataBoundItems="true" required="Required"></asp:DropDownList>

                                            </div>


                                            <%--  <div class="col-md-3">
                                                <label class="lbStyle">Warranty Start:</label>
                                                <asp:TextBox ID="txtWarrantyStart" runat="server" title="Start date of warranty" class="mydatepickerclass myInput"></asp:TextBox>
                                            </div>

                                            <div class="col-md-3">
                                                <label class="lbStyle">Warranty End:</label>
                                                <asp:TextBox ID="txtWarrantyEnd" runat="server" title="End date of warranty" class="mydatepickerclass myInput"></asp:TextBox>
                                            </div>--%>

                                            <div class="col-md-3">
                                                <label class="lbStyle">Product Opening:</label>
                                                <asp:TextBox ID="txtProductOpening" runat="server" title="Product Opening" CssClass="myInput"></asp:TextBox>

                                            </div>
                                            <div class="col-md-3">
                                                <label class="lbStyle"></label>

                                            </div>
                                            
                                        </div>

                                        <div class="row">
                                        </div>
                                        <div class="row">
                                        </div>

                                        <div id="dvGrid1" class="clearfix">
                                            <div class="rounded-corners">
                                                <div style="width: 100%; overflow: auto;">

                                                    <asp:GridView ID="grdProductOpening" ShowHeaderWhenEmpty="True"
                                                        GridLines="Horizontal" BorderColor="WhiteSmoke" RowStyle-Wrap="false"
                                                        HeaderStyle-Wrap="false" RowStyle-BorderColor="#e8e8ec"
                                                        CssClass="uimy ui table" runat="server" AutoGenerateColumns="False"
                                                        ShowFooter="True"
                                                        OnRowCommand="grdProductOpening_RowCommand" AllowPaging="true"
                                                        OnPageIndexChanging="grdProductOpening_PageIndexChanging"
                                                        OnRowEditing="grdProductOpening_RowEditing"
                                                        OnRowUpdating="grdProductOpening_RowUpdating"
                                                        OnRowCancelingEdit="grdProductOpening_RowCancelingEdit"
                                                        OnRowDataBound="grdProductOpening_RowDataBound"
                                                        PageSize="10"
                                                        PagerStyle="pagination-ys">

                                                        <Columns>

                                                            <asp:TemplateField HeaderText="WHID" InsertVisible="False" Visible="false" SortExpression="WHID" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                                                <EditItemTemplate>
                                                                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("warehouseid") %>'></asp:Label>
                                                                </EditItemTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("warehouseid") %>'></asp:Label>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:TextBox ID="txtCode" Enabled="False" CssClass="itemCode" runat="server"></asp:TextBox>
                                                                </FooterTemplate>
                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="Warehouse" InsertVisible="False" SortExpression="WarehouseID" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle2">
                                                                <EditItemTemplate>
                                                                    <asp:DropDownList ID="txtWareHouseName" Text='<%# Eval("WareHouseName") %>' OnSelectedIndexChanged="txtWareHouseName_SelectedIndexChanged" CssClass="select2 form-control gvModel" AppendDataBoundItems="true" runat="server"></asp:DropDownList>
                                                                </EditItemTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Label ID="Label6" Text='<%# Eval("WareHouseName") %>' runat="server"></asp:Label>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:DropDownList ID="txtWareHouseName" OnSelectedIndexChanged="txtWareHouseName_SelectedIndexChanged" CssClass="select2 form-control gvModel" AppendDataBoundItems="true" runat="server"></asp:DropDownList>
                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                                                        ControlToValidate="txtWareHouseName"
                                                                        ValidationGroup="gvValidation" CssClass="message"
                                                                        ErrorMessage="Required Field."
                                                                        runat="Server">
                                                                    </asp:RequiredFieldValidator>
                                                                </FooterTemplate>
                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="Batch No" InsertVisible="False" SortExpression="Batch No" HeaderStyle-CssClass="gridViewModel" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                                                <EditItemTemplate>
                                                                    <asp:TextBox ID="txtBatchNo" Text='<%# Bind("BatchNo") %>' TextMode="Number" CssClass="Quatntity" runat="server"></asp:TextBox>
                                                                </EditItemTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Label ID="Label12" runat="server" Text='<%# Bind("BatchNo") %>'></asp:Label>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:TextBox ID="txtBatchNo" CssClass="Quatntity" runat="server"></asp:TextBox>

                                                                </FooterTemplate>
                                                            </asp:TemplateField>


                                                            <asp:TemplateField HeaderText="Product Balance" InsertVisible="False" SortExpression="Product Balance" HeaderStyle-CssClass="gridViewModel" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                                                <EditItemTemplate>
                                                                    <asp:TextBox ID="txtProductBalance" AutoPostBack="false" Text='<%# Bind("productbalance") %>' TextMode="Number" OnTextChanged="txtProductBalance_TextChanged" CssClass="Quatntity" runat="server" required="required"></asp:TextBox>
                                                                </EditItemTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Label ID="Label12" runat="server" Text='<%# Bind("productbalance") %>'></asp:Label>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:TextBox ID="txtProductBalance" AutoPostBack="true" TextMode="Number" OnTextChanged="txtProductBalance_TextChanged" CssClass="Quatntity" runat="server"></asp:TextBox>
                                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11"
                                                                        ControlToValidate="txtProductBalance"
                                                                        ValidationGroup="gvValidation" CssClass="message"
                                                                        ErrorMessage="Required Field."
                                                                        runat="Server">
                                                                    </asp:RequiredFieldValidator>
                                                                </FooterTemplate>
                                                            </asp:TemplateField>

                                                            <asp:TemplateField HeaderText="Action" InsertVisible="False" SortExpression="Action" HeaderStyle-CssClass="gridView2" ItemStyle-CssClass="gridviewBody1" FooterStyle-CssClass="FooterStyle">
                                                                <ItemTemplate>
                                                                    <asp:Button CssClass="small ui button red" Text="Delete" ID="lblDelete" ToolTip="Delete" CommandArgument='<%# Eval("warehouseid") %>'
                                                                        formnovalidate="formnovalidate" CausesValidation="false" ImageUrl="~/assets/global/img/deletee.png" runat="server" CommandName="DeleteRow" />
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:Button ID="lblSave" CommandName="InsertRow" CssClass="small ui button blue" Text="Add" runat="server"
                                                                        CausesValidation="true" ValidationGroup="gvValidation"></asp:Button>
                                                                </FooterTemplate>

                                                            </asp:TemplateField>

                                                        </Columns>
                                                    </asp:GridView>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="newButton">
                                            <img src="../assets/global/img/ripples.gif" style="display: none; padding: 0;" id="loaderButton" />
                                            <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_OnClick" CausesValidation="false" CssClass="btn green-meadow" Text="Save" OnClientClick="showLoader('Button')" />
                                            <asp:Button ID="btnCancel" runat="server" formnovalidate="formnovalidate" CssClass="btn red-mint " Text="Cancel" OnClick="btnCancel_OnClick" />
                                        </div>
                                    </div>

                                    <div class="col-md-8 ">
                                        <div class="messagealert" id="alert_container">
                                        </div>
                                    </div>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnAdd" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>
                        <div class="tab-pane" id="tab_productList">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <asp:TextBox ID="search_textbox" runat="server" CssClass="myInput" Font-Size="18px" onkeyup="Search_Gridview(this, 'gvTest')"></asp:TextBox><br />
                                    <div class="rounded-corners">
                                        <div style="width: 100%; overflow: auto;">
                                            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="False" AutoGenerateColumns="False" DataKeyNames="Code" GridLines="Horizontal" BorderColor="#ECF0F1" AlternatingRowStyle-BackColor="#F2F3F4" RowStyle-Wrap="false"
                                                HeaderStyle-Wrap="false" RowStyle-BorderColor="#e8e8ec" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                                                CssClass="gridviewdesign " RowStyle-CssClass="GV" PageSize="10" 
                                                OnRowCommand="GridView1_OnRowCommand"
                                                OnRowDeleting="GridView1_OnRowDeleting"
                                                OnPageIndexChanging="GridView1_OnPageIndexChanging"
                                                EmptyDataText="No products to display">
                                                <Columns>
                                                    <asp:CommandField
                                                        HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody"
                                                        ButtonType="Image"
                                                        HeaderText="Actions"
                                                        SelectImageUrl="~/assets/global/img/edit.png"
                                                        ShowHeader="True"
                                                        ShowSelectButton="True" />
                                                    <asp:BoundField DataField="Code" HeaderText="Code" ReadOnly="True" SortExpression="Code" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" Visible="false" />

                                                    <asp:BoundField DataField="Supplier" HeaderText="Supplier" SortExpression="Supplier" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" Visible="false" />

                                                    <asp:BoundField DataField="Brand" HeaderText="Brand" SortExpression="Brand" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="Tax %" HeaderText="Tax %" SortExpression="Tax %" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" Visible="false"/>
                                                    <asp:BoundField DataField="Purchase Rate" HeaderText="Purchase Rate" SortExpression="Purchase Rate" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" Visible="false"/>
                                                    <asp:BoundField DataField="Purchase Disc %" HeaderText="Purchase Disc %" SortExpression="Purchase Disc %" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" Visible="false"/>
                                                    <asp:BoundField DataField="Max Limit" HeaderText="Max Limit" SortExpression="Max Limit" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="Min Limit" HeaderText="Min Limit" SortExpression="Min Limit" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="UOM Sale" HeaderText="UOM Sale" SortExpression="UOM Sale" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="UOM Purchase" HeaderText="UOM Purchase" SortExpression="UOM Purchase" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />

                                                    <%-- <asp:BoundField DataField="Warr. Start" HeaderText="Warr. Start" SortExpression="Warr. Start" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />
                                                    <asp:BoundField DataField="Warr. End" HeaderText="Warr. End" SortExpression="Warr. End" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />--%>
                                                    <asp:BoundField DataField="ProductOpening" HeaderText="Product Opening" SortExpression="ProductOpening" HeaderStyle-CssClass="gridView1" ItemStyle-CssClass="gridviewBody" />

                                                </Columns>
                                                <PagerStyle CssClass="pagination-ys" />
                                            </asp:GridView>
                                        </div>
                                    </div>
                                    <br />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="GridView1" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>



                    </div>

                </div>

            </div>

        </div>

    </div>




    <script type="text/javascript">
        function Search_Gridview(strKey, strGV) {
            var strGV = '<%= GridView1.ClientID %>';
            var strData = strKey.value.toLowerCase().split(" ");
            var tblData = document.getElementById(strGV);
            var rowData;
            for (var i = 1; i < tblData.rows.length; i++) {
                rowData = tblData.rows[i].innerHTML;
                var styleDisplay = 'me';
                for (var j = 0; j < strData.length; j++) {
                    if (rowData.toLowerCase().indexOf(strData[j].toLowerCase()) != -1)
                        styleDisplay = '';
                    else {
                        styleDisplay = 'none';
                        break;
                    }
                }
                tblData.rows[i].style.display = styleDisplay;
            }
        }
    </script>
</asp:Content>


