<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true"
	CodeFile="Groups.aspx.cs" Inherits="Secyrity_Groups" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
	<!-- DataTables -->
	<link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
	<link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
	<link rel="stylesheet" href="../plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
    <script language="javascript" type="text/javascript">
        function validate() {
            var message = "";
            if (document.getElementById("<%=txtGroupName.ClientID%>").value == "") {
                message += "Group Name Feild can not be blank\n";
                document.getElementById("<%=txtGroupName.ClientID%>").classList.add('is-invalid');
                document.getElementById("<%=txtGroupName.ClientID%>").parentNode.innerHTML = document.getElementById("<%=txtGroupName.ClientID%>").parentNode.innerHTML + "<span class='error invalid-feedback'>Please enter a valid group name</span>";
            }


            if (message.length > 0) {
                //alert(message);
                return false;
            }
            return true;
        }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
	<asp:ScriptManager ID="ScriptManager1" runat="server">
	</asp:ScriptManager>
	<!-- Content Wrapper. Contains page content -->
	<div class="content-wrapper">
		<!-- Content Header (Page header) -->
	<section class="content-header">
	  <div class="container-fluid">
		<div class="row mb-2">
		  <div class="col-sm-6">
			<h1>Manage Groups</h1>
		  </div>
		  <div class="col-sm-6">
			<ol class="breadcrumb float-sm-right">
			  <li class="breadcrumb-item"><a href="#">Home</a></li>
			  <li class="breadcrumb-item active">Security</li>
			  <li class="breadcrumb-item active">Manage Groups</li>
			</ol>
		  </div>
		</div>
	  </div><!-- /.container-fluid -->
	</section>
		<!-- /.content-header -->
		<!-- Main content -->
	<section class="content">
	    <div class="container-fluid">
		<!-- Default box -->
		<div class="card card-info color-palette-box">
			<div class="card-header">
				<h3 class="card-title">
                    <i class="fas fa-tag"></i>
                    Groups List
                </h3>

				<div class="card-tools">
					<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
						<i class="fas fa-minus"></i>
					</button>
					</div>
			</div>
			<div><asp:Label ID="lblError" runat="server" Text="Label"></asp:Label></div>
			<div class="card-body">
			<asp:GridView ID="GridView1" class="table table-striped table-bordered table-sm" BorderStyle="None" BorderWidth="0"
					GridLines="None" runat="server" AutoGenerateColumns=false OnRowCommand="GridView1_RowCommand" 
					DataKeyNames="GID" onprerender="GridView1_PreRender" 
					onrowcreated="GridView1_RowCreated1">
				<Columns>
					<asp:BoundField DataField="GROUP_NAME" HeaderText="Group&nbsp;Name"/>
					<asp:BoundField DataField="DESCRIPTION" HeaderText="Description" />
					<asp:BoundField DataField="status" HeaderText="Status"  />
                    <asp:BoundField DataField="status_txt" HeaderText="Status"  />
					<asp:BoundField DataField="app_status" HeaderText="Approval&nbsp;Status"  />

					<asp:TemplateField HeaderText="Actions" Visible=true >
					<ItemTemplate>
							<button type="button" class="btn btn-default btn-block btn-xs dropdown-toggle" data-toggle="dropdown">
							Action
						</button>
						<div class="dropdown-menu">
							<a class="dropdown-item" href="#"><asp:Button ID="Button5" CssClass="btn btn-outline-success btn-block btn-sm" runat="server" Text="Approve" CommandName="a" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>
							<a class="dropdown-item" href="#"><asp:Button ID="update" CssClass="btn btn-outline-info btn-block btn-sm" runat="server" Text="Edit" CommandName="u" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>
							<a class="dropdown-item" href="#"><asp:Button ID="delete" CssClass="btn btn-outline-danger btn-block btn-sm" runat="server" Text="Delete" CommandName="d" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>
							<a class="dropdown-item" href="#"><asp:Button ID="Button6" CssClass="btn btn-outline-warning btn-block btn-sm" runat="server" Text="Decline" CommandName="decline" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>
							<a class="dropdown-item" href="#"><asp:Button ID="Button3" CssClass="btn btn-outline-primary btn-block btn-sm" runat="server" Text="List Screens" CommandName="vp" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>
							<a class="dropdown-item" href="#"><asp:Button ID="Button4" CssClass="btn btn-outline-dark btn-block btn-sm" runat="server" Text="List Reports" CommandName="vr" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"/></a>	  
						</div>
					</ItemTemplate>
				</asp:TemplateField>
				</Columns>
			</asp:GridView>
			</div>
					
			<!-- /.card-body -->
		</div>

			<div class="row">
                <div class="col-12" style="text-align: center; margin-bottom: 2%">
                    <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" class="btn btn-secondary float-right" />
                </div>
            </div>

		<!-- /.card -->
		<div class="row">
			<div class="modal fade" id="modal-xl">
		   
				<div class="modal-dialog modal-xl">
					<div class="modal-content">
					<div class="modal-header">
						<h4 class="modal-title">Group</h4>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
							
						<div class="card-body">
							<div class="form-group">
							<label for="exampleInputEmail1">Group Name</label>
							<asp:TextBox ID="txtGroupName" runat="server" class="form-control" MaxLength="100" placeholder="Enter group name"></asp:TextBox>
                            
							</div>
							<div class="form-group">
							<label for="exampleInputPassword1">Group Description</label>
								<asp:TextBox ID="txtDesc" runat="server" Rows="4" class="form-control" TextMode="MultiLine" MaxLength="255"  placeholder="Enter group description"></asp:TextBox>
							</div>
							<div class="form-group">
							<div class="form-check">
								<asp:RadioButton ID="rdActive" runat="server" class="form-check-input" Checked="True" GroupName="group" Text="" />
								<label class="form-check-label">Active</label>
							</div>
							<div class="form-check">
								<asp:RadioButton ID="rdInActive" runat="server" class="form-check-input" GroupName="group" Text="" />
								<label class="form-check-label">Inactive</label>
							</div>
							</div>
								  
						</div>
						<!-- /.card-body -->

							  
					</div>
					<div class="modal-footer justify-content-between">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<asp:Button ID="btnSave" OnClientClick="return validate()" runat="server" Text="Save changes" OnClick="btnSave_Click" class="btn btn-primary" />
					</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal-dialog -->
			  
				</div>
				<!-- /.modal -->
		</div>

		<!-- UR-Confirmation-modal -->
            <div class="row">
                <div id="UR-confirmation-modal-xl" class="modal fade modal-full" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                    <button aria-label="" type="button" class="close px-2" data-dismiss="modal" aria-hidden="true">
                        <span aria-hidden="true">×</span>
                    </button>
                    <div class="modal-dialog modal-dialog-centered" role="document">
                        <div class="modal-content">
                            <div class="modal-body text-center">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td colspan="2" class="tdNormal" align="center">
                                            <asp:Label ID="Lbl_CommandName" Visible="false" runat="server"></asp:Label>
                                            <asp:Label ID="Lbl_CommandArgument" Visible="false" runat="server"></asp:Label>
                                            <asp:Label ID="Lbl_URC_Message" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="tdNormal">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" class="tdNormal" align="center">
                                            <asp:Button ID="btn_URConfirm_OK" runat="server" Text="Yes" CssClass="btn btn-primary" OnClick="btn_URConfirm_OK_Click" />
                                            <button type="button" class="btn btn-primary" data-dismiss="modal">No</button>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

	</div><!-- /.container-fluid -->
	</section>
		<!-- /.content -->
	</div>
	<!-- Toastr -->
	<!-- jQuery -->
	<script src="../plugins/jquery/jquery.min.js"></script>
	<!-- Bootstrap 4 -->
	<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
	<!-- SweetAlert2 -->
	<script src="../plugins/sweetalert2/sweetalert2.min.js"></script>
	<!-- Toastr -->
	<script src="../plugins/toastr/toastr.min.js"></script>
	<!-- AdminLTE App -->
	<script src=".../dist/js/adminlte.min.js"></script>
	<!-- AdminLTE for demo purposes -->
	<script src="../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
	<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
	<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
	<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
	<script src="../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
	<script src="../plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
	<script src="../plugins/jszip/jszip.min.js"></script>
	<script src="../plugins/pdfmake/pdfmake.min.js"></script>
	<script src="../plugins/pdfmake/vfs_fonts.js"></script>
	<script src="../plugins/datatables-buttons/js/buttons.html5.min.js"></script>
	<script src="../plugins/datatables-buttons/js/buttons.print.min.js"></script>
	<script src="../plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
	<!-- AdminLTE App -->
	<script src="../dist/js/adminlte.min.js"></script>
	<!-- AdminLTE for demo purposes -->
	<script src="../dist/js/demo.js"></script>
	<!-- /.content-wrapper -->
	<script>
		$(function () {

		    $('#ctl00_ContentPlaceHolder1_GridView1').DataTable({
				"responsive": true, "lengthChange": false, "autoWidth": false,
				"buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
			}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
});
 
</script>

</asp:Content>
