<%@ page language="C#" autoeventwireup="true" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" inherits="Pages_MaterialManagement_Procurement_StockChargeMapping, App_Web_reu4ptl4" uiculture="auto" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl"
    TagPrefix="Date" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager"
    TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/AutoComplete/AutoCompleteControl.ascx" TagName="AutoCompleteControl"
    TagPrefix="acc" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl"
    TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl"
    TagPrefix="DPC" %>
<%@ Register Src="~/UserControls/Common/Stock/StockDetailBoxControl.ascx" TagName="StockControl" TagPrefix="Stock" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">
                <div class="dashBoardLeftCont">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="160"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <Stock:StockControl ID="StockUserControl" runat="server" Visible="true" />
                    <div class="himssuHeader1WireBox card card-box">                        
                        <div class="himsBoxContent card-body">
                            <asp:Panel ID="DetailPanel" runat="Server">
                                <div class="contentHolder">
                                    <asp:Panel ID="SearchCriteriaPanel" runat="Server">
                                        <div class="outerBox pTop5 col-md-3">
                                            <div class="controlLabelWidth">
                                                <asp:Label ID="StockMainGroupLabel" Text="Stock Main Group" runat="server"></asp:Label>
                                            </div>
                                            <div class="fLeft pRight5">
                                                <asp:DropDownList ID="StockMainGroupDropDownList" runat="server" CssClass="form-control" onmouseleave="showHideTooltip()"
                                                    onmouseenter="showHideTooltip()" AutoPostBack="true"
                                                    meta:resourcekey="StockMainGroupDropDownListResource1" OnSelectedIndexChanged="StockMainGroupDropDownList_SelectedIndexChanged">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="outerBox pTop5 col-md-3">
                                            <div class="controlLabelWidth">
                                                <asp:Label ID="StockSubGroupLabel" Text="Stock Sub Group" runat="server"></asp:Label>
                                            </div>
                                            <div class="fLeft pRight5">
                                                <asp:DropDownList ID="StockSubGroupDropDownList" runat="server" CssClass="form-control" onmouseleave="showHideTooltip()"
                                                    onmouseenter="showHideTooltip()"
                                                    meta:resourcekey="StockSubGroupDropDownListResource1">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="outerBox pTop5 col-md-3">
                                            <div class="controlLabelWidth">
                                                <asp:Label ID="StockItemCategoryLabel" Text="Stock Item Category" runat="server"></asp:Label>
                                            </div>
                                            <div class="fLeft pRight5">
                                                <asp:DropDownList ID="StockItemCategoryDropDownList" runat="server" CssClass="form-control" onmouseleave="showHideTooltip()"
                                                    onmouseenter="showHideTooltip()"
                                                    meta:resourcekey="StockItemCategoryDropDownListResource1">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="cBoth">
                                        </div>
                                        <div class="alignCenter pTop5">
                                            <asp:Button ID="SearchButton" runat="Server"
                                                SkinID="0" CssClass="btn-search btn fas" Text="&#xf002; Search Stock Item" OnClick="SearchButton_Click" />
                                            <asp:Button ID="ResetButton" runat="server" Text="&#xf0e2; Reset" CssClass="btn-reset btn fas" SkinID="0" OnClick="ResetButton_Click" />
                                        </div>
                                    </asp:Panel>
                                    <div id="Div1" class="himssuHeader7WireBox col-md-12" runat="server">
                                        <div class="himsBoxHeader card-head inner" id="GridViewPagerDiv" runat="server" visible="false">
                                            <div class="leftdiv">
                                            </div>
                                            <div class="himsBoxTitle">
                                           
                                                <div class="pull-right col-md-6 display-flex">
                                                
                                                    <asp:DropDownList ID="ApplyDropDownList" runat="server" SkinID="CustomWidthDropDownList" CssClass="form-control mt-10">
                                                    </asp:DropDownList>
                                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                                    <asp:TextBox ID="ApplyTextBox" runat="server" ClientIDMode="Static" MaxLength="15"
                                                                SkinID="CustomWidthTextBox" CssClass="pTop5"></asp:TextBox>&nbsp;&nbsp;&nbsp;&nbsp;
                                                       <asp:Button ID="ApplyButton" runat="server" Text="Apply All" SkinID="0" CssClass="btn-apply btn fas" OnClick="ApplyButton_Click"/>
                                                </div>
                                            </div>


                                        </div>
                                        <div class="himsBoxContent">
                                            <asp:UpdatePanel ID="ScreenDetailUpdatePanel" runat="server" UpdateMode="Always">
                                                <ContentTemplate>
                                                    <div id="Div4" runat="server" class="table-responsive">                                                        
                                                        <asp:GridView ID="StockChargeMappingGridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                            EmptyDataText="No Records Found !!" AllowPaging="false" ShowHeader="true" DataKeyNames="StockItemId"
                                                            CssClass="table table-striped table-bordered" OnRowDataBound="StockChargeMappingGridView_RowDataBound">
                                                            <Columns>
                                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
                                                                    <HeaderTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="HeaderSelectCheckBox" runat="server" onclick="checkAllRows(this);" />
                                                                            <span></span>
                                                                        </label>
                                                                    </HeaderTemplate>
                                                                    <ItemStyle HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="SelectCheckBox" runat="server" onClick="checkUncheckHeaderCheckBox(this);" />
                                                                            <span></span>
                                                                        </label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>      
                                                                <asp:TemplateField HeaderText="Stock Item" ItemStyle-Width="40%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="StockItemLabel" runat="server" Text='<%# Bind("StockItem") %>'></asp:Label>                                                                        
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>                                                          
                                                                <asp:TemplateField HeaderText="Charge ReceiptBook" ItemStyle-Width="16%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="ChargeReceiptBookLabel" runat="server" Text='<%# Bind("ChargeReceiptBookId") %>' Visible="false"></asp:Label>
                                                                        <asp:DropDownList ID="ChargeReceiptBookDropDownList" Width="200px " runat="server" onmouseleave="showHideTooltip()" AutoPostBack="true" OnSelectedIndexChanged="ChargeReceiptBookDropDownList_SelectedIndexChanged"
                                                                            onmouseenter="showHideTooltip()" SkinID="CustomWidthDropDownList" CssClass="form-control !important">
                                                                        </asp:DropDownList>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Charge Category" ItemStyle-Width="16%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="ChargeCategoryLabel" runat="server" Text='<%# Bind("ChargeCategoryId") %>' Visible="false"></asp:Label>
                                                                        <asp:DropDownList ID="ChargeCategoryDropDownList" Width="200px " runat="server" onmouseleave="showHideTooltip()" AutoPostBack="true" OnSelectedIndexChanged="ChargeCategoryDropDownList_SelectedIndexChanged"
                                                                            onmouseenter="showHideTooltip()" SkinID="CustomWidthDropDownList" CssClass="form-control !important">
                                                                        </asp:DropDownList>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>                                                                
                                                                <asp:TemplateField HeaderText="Charge" ItemStyle-Width="17%" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="ChargeLabel" runat="server" Text='<%# Bind("ChargeId") %>' Visible="false"></asp:Label>
                                                                        <asp:DropDownList ID="ChargeDropDownList" Width="200px " runat="server" onmouseleave="showHideTooltip()"
                                                                            onmouseenter="showHideTooltip()" SkinID="CustomWidthDropDownList" CssClass="form-control !important">
                                                                        </asp:DropDownList>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>                                                                
                                                            </Columns>
                                                            <PagerSettings Visible="False" />
                                                        </asp:GridView>
                                                    </div>
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </div>
                                    </div>
                                </div>
                            </asp:Panel>
                        </div>
                    </div>
                </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <script type="text/javascript">        
        function checkAllRows(obj) {
            var objGridview = obj.closest('table');
            var list = objGridview.getElementsByTagName("input");
            for (var i = 0; i < list.length; i++) {
                var objRow = list[i].parentNode.parentNode;
                if (list[i].type == "checkbox" && obj != list[i]) {
                    if (!list[i].disabled) {
                        if (obj.checked) {
                            list[i].checked = true;
                        }
                        else {
                            list[i].checked = false;
                        }
                    }
                }
            }
        }
        function checkUncheckHeaderCheckBox(obj) {
            var objGridView = obj.closest('table');
            var list = objGridView.getElementsByTagName("input");
            for (var i = 0; i < list.length; i++) {
                var objHeaderChkBox = list[0];
                var checked = true;
                if (list[i].type == "checkbox" && list[i] != objHeaderChkBox) {
                    if (!list[i].checked) {
                        checked = false;
                        break;
                    }
                }
            }
            objHeaderChkBox.checked = checked;
        }
    </script>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/stock-charge-mapping")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>    
</asp:Content>
