<%@ page title="" language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="Pages_Administration_DisplayField, App_Web_z53ggjcq" uiculture="auto" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl"
    TagPrefix="ScreenGroup" %>
<%--<%@ Register Src="~/UserControls/Emrd/EmrdPatientSearch.ascx" TagName="EmrdPtSearch" TagPrefix="EPS" %>
<%@ Register Src="~/UserControls/Common/PatientSearch/PatientSearch.ascx" TagName="PatientSearchUserControl" TagPrefix="PS" %>--%>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">
                <!-- ContentPlaceHolder Box Starts -->

                <div class="dashBoardLeftCont" valign="top">
                    <div class="himssuHeader3WireBox">
                        <%-- <div class="himsBoxHeader">
                                        <div class="leftdiv">
                                        </div>
                                        <div class="himsBoxTitle">
                                            <div class="headerText">
                                            <asp:Label runat="server" ID="ScreenGroupNameLabel"></asp:Label>    
                                            </div>
                                        </div>
                                    </div>--%>
                        <table width=" 0px" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="167"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="row whiteboxpaddingleft">
                    <div class="himssuHeader2WireBox">
                        <div class="contentHolder">
                            <div class="himssuHeader1WireBox card card-box">
                                <div class="himsBoxHeader card-head">
                                    <div class="leftdiv">
                                    </div>
                                    <div class="himsBoxTitle">
                                        <div class="headerText">
                                            <header>
                                                <i class="fas fa-chess-king"></i>
                                                <asp:Label ID="Label1" runat="server" Text="Display Field Master "></asp:Label>
                                            </header>
                                        </div>
                                    </div>
                                </div>

                                <div class="himsBoxContent card-body">
                                    <asp:Panel ID="DetailPanel" runat="Server">
                                        <div class="contentHolder">
                                            <div class="outerBox pTop5 col-md-3">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="SourceLabel" Text="Field Source" runat="server"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:DropDownList ID="SourceDropDown" runat="server" onmouseleave="showHideTooltip()"
                                                        onmouseenter="showHideTooltip()" AutoPostBack="true" OnSelectedIndexChanged="SourceDropDown_OnSelectedIndexChanged"
                                                        SkinID="CustomWidthDropDownList" CssClass="form-control">
                                                        <asp:ListItem>- Select -</asp:ListItem>
                                                        <asp:ListItem>Student</asp:ListItem>
                                                        <asp:ListItem>Employee</asp:ListItem>
                                                        <asp:ListItem>Lesson Plan</asp:ListItem>
                                                        <asp:ListItem>Leaving</asp:ListItem>
                                                        <asp:ListItem>Admission Form</asp:ListItem>
                                                        <asp:ListItem>Admission Inquiry</asp:ListItem>
                                                        <asp:ListItem>Recruitment Form</asp:ListItem>
                                                        <asp:ListItem>Student Detail</asp:ListItem>
                                                    </asp:DropDownList>
                                                    <div class="fLeft pRight5">
                                                    </div>
                                                </div>
                                            </div>
                                            <div id="Div1" class="himssuHeader1WireBox col-md-12" runat="server">
                                                <div id="GridViewPagerDiv" runat="server" visible="True">
                                                    <div class="leftdiv">
                                                    </div>
                                                    <div class="himsBoxTitle">
                                                    </div>
                                                </div>
                                                <div class="himsBoxContent">
                                                    <div id="Div4" runat="server" class="table-responsive">
                                                        <input id="SourceDropDownValHiddenField" type="hidden" name="hid" runat="server" />
                                                        <asp:GridView ID="DisplayFieldOrgGridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                            EmptyDataText="No Records Found !!" CssClass="table table-striped table-bordered table-hover"
                                                            AllowPaging="false" OnRowDataBound="DisplayFieldOrgGridView_RowDataBound"
                                                            ShowHeader="true"
                                                            DataKeyNames="DisplayFieldId,Selected,IsMandatory">

                                                            <Columns>

                                                                <asp:BoundField DataField="DisplayFieldId" HeaderText="DisplayFieldId" Visible="false"></asp:BoundField>
                                                                <asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="70%" HeaderStyle-HorizontalAlign="Left"></asp:BoundField>
                                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
                                                                    <HeaderTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <bdo>Display</bdo>
                                                                            <asp:CheckBox ID="HeaderCheckBox" OnCheckedChanged="HeaderSelectCheckBox_OnCheckedChanged" runat="server" AutoPostBack="True" />
                                                                            <span></span>
                                                                        </label>
                                                                    </HeaderTemplate>
                                                                    <ItemStyle HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="SelectCheckBox" runat="server" OnCheckedChanged="SelectCheckBox_CheckedChanged"
                                                                                Checked='<%# Eval("Selected") %>' AutoPostBack="false" onclick="Check(this);" />
                                                                            <span></span>
                                                                        </label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>

                                                                <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
                                                                    <HeaderTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <bdo>Mandatory</bdo>
                                                                            <asp:CheckBox ID="HeaderIsMandatoryCheckBox" runat="server" OnCheckedChanged="HeaderIsMandatoryCheckBox_OnCheckedChanged" AutoPostBack="true" Enabled="false" />
                                                                            <span></span>
                                                                        </label>
                                                                    </HeaderTemplate>
                                                                    <ItemStyle HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                                            <asp:CheckBox ID="IsMandatoryCheckBox" runat="server" Checked='<%# Eval("IsMandatory") %>' />
                                                                            <span></span>
                                                                        </label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>


                                                            </Columns>
                                                            <PagerSettings Visible="False" />
                                                        </asp:GridView>
                                                    </div>
                                                </div>
                                            </div>
                                    </asp:Panel>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="spacer">
                        <asp:Image ID="Image4" runat="server" ImageUrl="~/Images/spacer.gif" />
                    </div>

                </div>

            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
    <%--    <script data-main="../../JavaScript/rjs/encrypt/assign-organization-encrypt" src="../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/assign-organization")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
        function Check(obj) {
            var table = document.getElementById('<%=DisplayFieldOrgGridView.ClientID %>');
            var rid = document.getElementById('<%=SourceDropDownValHiddenField.ClientID %>').value;
            var chk = false;
            if ($(obj).is(':checked'))
                chk = true;
            else
                chk = false;
            var row = obj.parentNode.parentNode.parentNode.rowIndex + 1;

            RowIndex = row - 2;

            if (row < 10)
                row = "0" + row;

            if (rid == 5) {
                if (chk == true && RowIndex != 24 && RowIndex != 25 && RowIndex != 35 && RowIndex != 38 && RowIndex != 39 && RowIndex != 40 &&
                            RowIndex != 41 && RowIndex != 42 && RowIndex != 43 && RowIndex != 44 && RowIndex != 45 && RowIndex != 46 && RowIndex != 47 && RowIndex != 57 && RowIndex != 63 && RowIndex != 64
                            && RowIndex != 65 && RowIndex != 66 && RowIndex != 67 && RowIndex != 68 && RowIndex != 70 && RowIndex != 72
                            && RowIndex != 81 && RowIndex != 82 && RowIndex != 83 && RowIndex != 84 && RowIndex != 85 && RowIndex != 86
                            && RowIndex != 88 && RowIndex != 89 && RowIndex != 90 && RowIndex != 91 && RowIndex != 92 && RowIndex != 93 && RowIndex != 104) {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').removeAttr('disabled');
                }
                else {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').prop('checked', false);
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                }
            }
            else if (rid == 6) {
                if (chk == true) {
                    if (RowIndex == 27 || RowIndex == 28) {
                        $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                    }
                    else {
                        $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').removeAttr('disabled');
                    }
                }
                else {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').prop('checked', false);
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                }
            }
            else if (rid == 7) {
                if (chk == true) {
                    if (RowIndex == 22) {
                        $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                    }
                    else {
                        $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').removeAttr('disabled');
                    }
                    // mantis start - 0032015
                    if (row == 39) {
                        if (chk == true) {
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_SelectCheckBox').removeAttr('disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_SelectCheckBox').removeAttr('disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_SelectCheckBox').removeAttr('disabled');
                        }
                        else {
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_SelectCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_SelectCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_SelectCheckBox').attr('disabled', 'disabled');
                        }
                    }
                    // mantis End - 0032015
                }
                else {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').prop('checked', false);
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                    if (row == 39) {
                        if (chk == true) {
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_SelectCheckBox').removeAttr('disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_SelectCheckBox').removeAttr('disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_SelectCheckBox').removeAttr('disabled');
                        }
                        else {
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_SelectCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_SelectCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_SelectCheckBox').attr('disabled', 'disabled');
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_IsMandatoryCheckBox').attr('disabled', 'disabled');


                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_SelectCheckBox').prop('checked', false);
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 1) + '_IsMandatoryCheckBox').prop('checked', false);
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_SelectCheckBox').prop('checked', false);
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 2) + '_IsMandatoryCheckBox').prop('checked', false);
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_SelectCheckBox').prop('checked', false);
                            $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + (row + 3) + '_IsMandatoryCheckBox').prop('checked', false);


                        }
                    }
                }
            }
            else if (rid == 8) {
                if (chk == true) {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').removeAttr('disabled');
                }
                else {
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').prop('checked', false);
                    $('#ctl00_CP_DisplayFieldOrgGridView_ctl' + row + '_IsMandatoryCheckBox').attr('disabled', 'disabled');
                }
            }
        }
    </script>
</asp:Content>
