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

<%@ Register Src="../../../UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/SuperAdminScreenGroup.ascx" TagName="SuperAdminScreenGroupControl" TagPrefix="SuperAdminScreenGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="MainUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage">
                <!-- ContentPlaceHolder Box Starts -->

                <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>
                        <tr>
                            <td>
                                <div class="himsBoxContent">
                                    <div class="leftUlMenu">
                                        <SuperAdminScreenGroup:SuperAdminScreenGroupControl EnableViewState="true" ID="SuperAdminScreenGroupControl" ScreenGroupId="153"
                                            Visible="true" runat="server" />
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>

                <div class="whiteboxpaddingleft row">
                    <div class="card card-box">

                        <div class="himsDisplayBox">

                            <div class="himsBoxContent messageMessage">
                                <div class="topdisplayContainer p-l-10">
                                    <table class="fLeft">
                                        <tr>
                                            <td>
                                                <asp:Label ID="OrgCodeLabelL" runat="server" Text="Code :" Font-Bold="true"></asp:Label>
                                                &nbsp;&nbsp;<asp:Label ID="OrgCodeLabelT" runat="server" Text="" SkinID="CustomWidthLabel" Width="200px"></asp:Label></td>


                                            <td>
                                                <asp:Label ID="OrgDisplayTitleLabelL" runat="server" Text="Display Title :" Font-Bold="true"></asp:Label>
                                                &nbsp;&nbsp;<asp:Label ID="OrgDisplayTitleLabelT" runat="server" Text="" SkinID="CustomWidthLabel" Width="500px"></asp:Label></td>

                                        </tr>
                                    </table>

                                </div>
                            </div>

                        </div>


                        <div class="himsBoxHeader card-head">
                            <div class="leftdiv">
                            </div>
                            <div class="himsBoxTitle">
                                <div class="headerText">
                                    <header>
                                        <i class="fas fa-lock-open"></i>
                                        <asp:Label ID="Label4" runat="server" Text="Assign Organization Task Permission"></asp:Label>
                                    </header>
                                </div>
                            </div>
                            <%--<div class="fRight" style="margin-top: -20px">
                                            <asp:CheckBox ID="IsAllOrgCheckBox" runat="server" />
                                            <asp:Label ID="IsAllOrgLabel" runat="server" Text="Applicable To All Organization"></asp:Label>
                                        </div>--%>
                        </div>
                        <div class="himsBoxContent card-body">
                            <div class="contentHolder">
                                <%--<div class="outerBox pTop5 col-md-3">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="RoleLabel" runat="server" Text="Organization" SkinID="MandatoryLabel"
                                                        meta:resourcekey="RoleLabelResource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:DropDownList ID="OrganizationDropDownList" AutoPostBack="True" DataTextField="Title"
                                                        TabIndex="4" DataValueField="ID" runat="server" OnSelectedIndexChanged="OrganizationDropDownList_SelectedIndexChanged"
                                                        onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" SkinID="CustomWidthDropdownList"
                                                        CssClass="form-control" meta:resourcekey="RoleDropDownListResource2">
                                                    </asp:DropDownList>
                                                </div>
                                            </div>--%>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="ModuleLabel" runat="server" Text="Module" SkinID="MandatoryLabel"
                                            meta:resourcekey="ModuleLabelResource1"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList ID="ModuleDropDownList" Enabled="False" DataTextField="Title" DataValueField="Id"
                                            runat="server" OnSelectedIndexChanged="ModuleDropDownList_SelectedIndexChanged"
                                            TabIndex="5" AutoPostBack="True" CssClass="form-control" SkinID="CustomWidthDropDownList"
                                            onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" meta:resourcekey="ModuleDropDownListResource1">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="ResourceTypeLabel" runat="server" Text="Resource Type"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList ID="ResourceTypeDropDownList" Enabled="False" DataTextField="Title"
                                            DataValueField="Id" runat="server" AutoPostBack="True" CssClass="form-control" SkinID="CustomWidthDropDownList"
                                            OnSelectedIndexChanged="ResourceTypeDropDownList_SelectedIndexChanged" onmouseleave="showHideTooltip()"
                                            onmouseenter="showHideTooltip()" meta:resourcekey="ResourceTypeDropDownListResource1">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="ModeLabel" runat="server" Text="Mode"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:DropDownList ID="ModeDropDownList" runat="server" Enabled="False"
                                            CssClass="form-control" SkinID="CustomWidthDropDownList" onmouseleave="showHideTooltip()"
                                            onmouseenter="showHideTooltip()" OnSelectedIndexChanged="ModeDropDownList_SelectedIndexChanged" AutoPostBack="true">
                                            <asp:ListItem Value="0">- ALL -</asp:ListItem>
                                            <asp:ListItem Value="1" Selected="True">General</asp:ListItem>
                                            <asp:ListItem Value="2">Client Specific</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>

                                <div class="col-md-12 text-center pTop5 pb5">
                                    <asp:Button ID="GrantAllButton" Text="&#xf0ae; Grant All" runat="Server" OnClick="GrantAllButton_Click" SkinID="0" CssClass="btn btn-assign fas" />
                                    <asp:Button ID="RevokeAllButton" runat="server" Text="&#xf0ae; Revoke All" OnClick="RevokeAllButton_Click" SkinID="0" CssClass="btn btn-assign fas" />
                                </div>


                                <div class="himssuHeader7WireBox col-md-12" id="PatientRelationDiv" runat="server">
                                    <div>
                                        <div class="leftdiv">
                                        </div>
                                        <div class="himsBoxTitle">
                                            <%--<div class="headerText">
                                                            <div class="fLeft">
                                                                <asp:Label ID="GridViewLabel" Text="Task List" runat="server" meta:resourcekey="GridViewLabelResource1" />
                                                            </div>
                                                        </div>--%>
                                        </div>
                                    </div>
                                    <div class="himsBoxContent table-responsive">
                                        <asp:GridView ID="TasksGridView" AutoGenerateColumns="False" EmptyDataText="No Task available"
                                            Width="100%" runat="server" AllowPaging="false" meta:resourcekey="TasksGridViewResource1"
                                            CssClass="table table-striped table-bordered table-hover" OnRowDataBound="TasksGridView_RowDataBound">
                                            <PagerSettings Visible="False" />
                                            <PagerTemplate>
                                            </PagerTemplate>
                                            <Columns>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource1" HeaderText="Task Id">
                                                    <ItemTemplate>
                                                        <asp:Label ID="TaskIDLabel" runat="server" Text='<%# Eval("ID") %>' meta:resourcekey="TaskIDLabelResource1"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Task Name">
                                                    <ItemTemplate>
                                                        <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' CssClass="boxEllips"
                                                            Width="200px"></asp:Label>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" />
                                                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Resource Type Name">
                                                    <ItemTemplate>
                                                        <asp:Label ID="ResourceTypeNameLabel" runat="server" Text='<%# Eval("ResourceTypeName") %>'
                                                            CssClass="boxEllips" Width="200px"></asp:Label>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" />
                                                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                                                </asp:TemplateField>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource3">
                                                    <HeaderTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="ReadAllCheckBox" runat="server" OnCheckedChanged="ReadAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="8" meta:resourcekey="ReadAllCheckBoxResource1" />
                                                            <span></span>Read
                                                        </label>
                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="ReadCheckBox" Enabled='<%# Eval("RPermission") %>' Checked='<%# Eval("Read") %>'
                                                                runat="server" onclick="Read(this);"
                                                                TabIndex="9" meta:resourcekey="ReadCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Create" meta:resourcekey="TemplateFieldResource2">
                                                    <HeaderTemplate>

                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="CreateAllCheckBox" runat="server" OnCheckedChanged="CreateAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="6" meta:resourcekey="CreateAllCheckBoxResource1" />
                                                            <span></span>Create
                                                        </label>

                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="CreateCheckBox" Enabled='<%# Eval("CPermission") %>' Checked='<%# Eval("Create") %>'
                                                                runat="server" onclick="Create(this);"
                                                                TabIndex="7" meta:resourcekey="CreateCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource4">
                                                    <HeaderTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="UpdateAllCheckBox" runat="server" OnCheckedChanged="UpdateAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="10" meta:resourcekey="UpdateAllCheckBoxResource1" />
                                                            <span></span>Update
                                                        </label>
                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">

                                                            <asp:CheckBox ID="UpdateCheckBox" Enabled='<%# Eval("UPermission") %>' Checked='<%# Eval("Update") %>'
                                                                runat="server" onclick="Update(this);"
                                                                TabIndex="11" meta:resourcekey="UpdateCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource5">
                                                    <HeaderTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="DeleteAllCheckBox" runat="server" OnCheckedChanged="DeleteAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="12" meta:resourcekey="DeleteAllCheckBoxResource1" />
                                                            <span></span>Delete
                                                        </label>
                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">

                                                            <asp:CheckBox ID="DeleteCheckBox" Enabled='<%# Eval("DPermission") %>' Checked='<%# Eval("Delete") %>'
                                                                runat="server" onclick="Delete(this);"
                                                                TabIndex="13" meta:resourcekey="DeleteCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource7">
                                                    <HeaderTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="PrintAllCheckBox" runat="server" OnCheckedChanged="PrintAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="16" meta:resourcekey="PrintAllCheckBoxResource1" />
                                                            <span></span>Print
                                                        </label>
                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">

                                                            <asp:CheckBox ID="PrintCheckBox" Enabled='<%# Eval("PPermission") %>' Checked='<%# Eval("Print") %>'
                                                                runat="server" onclick="Print(this);"
                                                                TabIndex="17" meta:resourcekey="PrintCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField meta:resourcekey="TemplateFieldResource8">
                                                    <HeaderTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">
                                                            <asp:CheckBox ID="ExecuteAllCheckBox" runat="server" OnCheckedChanged="ExecuteAllCheckBox_CheckedChanged"
                                                                AutoPostBack="True" TabIndex="18" meta:resourcekey="ExecuteAllCheckBoxResource1" />
                                                            <span></span>Execute
                                                        </label>
                                                    </HeaderTemplate>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <ItemTemplate>
                                                        <label class="rt-chkbox rt-chkbox-outline">

                                                            <asp:CheckBox ID="ExecuteCheckBox" Enabled='<%# Eval("XPermission") %>' Checked='<%# Eval("Execute") %>'
                                                                runat="server" onclick="Execute(this);"
                                                                TabIndex="19" meta:resourcekey="ExecuteCheckBoxResource1" />
                                                            <span></span>
                                                        </label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
    <%--  <script data-main="../../../JavaScript/rjs/encrypt/organization-taskpermission-encrypt" src="../../../JavaScript/rjs/require.js"></script> --%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/organization-taskpermission")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script>
        function Read(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if(obj.checked == false) {
                check = false;
                obj.parentNode.parentNode.parentNode.cells[4].childNodes[1].control.checked = false;
                obj.parentNode.parentNode.parentNode.cells[5].childNodes[1].control.checked = false;
                obj.parentNode.parentNode.parentNode.cells[6].childNodes[1].control.checked = false;
                obj.parentNode.parentNode.parentNode.cells[7].childNodes[1].control.checked = false;
                obj.parentNode.parentNode.parentNode.cells[8].childNodes[1].control.checked = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/ReadCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check)}),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
        function Create(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if (obj.checked == false) {
                check = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/CreateCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check) }),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
        function Update(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if (obj.checked == false) {
                check = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/UpdateCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check) }),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
        function Delete(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if (obj.checked == false) {
                check = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/DeleteCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check) }),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
        function Print(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if (obj.checked == false) {
                check = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/PrintCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check) }),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
        function Execute(obj) {
            var TaskID = obj.parentNode.parentNode.parentNode.cells[0].innerText;
            var check = true;
            if (obj.checked == true) {
                check = true;
            }
            else if (obj.checked == false) {
                check = false;
            }
            $.ajax({
                type: "POST",
                url: "/Pages/BaseFramework/Security/OrganizationTaskPermission.aspx/ExecuteCheckBoxChecked",
                data: JSON.stringify({ "TaskId": parseInt(TaskID), "Check": Boolean(check) }),
                contentType: "application/json;charset=utf-8",
                dataType: "json",
            });
        }
    </script>
</asp:Content>
