<!-- 
    Security Knowledge Framework is an expert system application 
    that uses OWASP Application Security Verification Standard, code examples,
    helps developers in pre-development and post-development.  
    Copyright (C) 2015  Glenn ten Cate, Riccardo ten Cate

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

{% include 'header.html' %}

<!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
      <!--main content start-->
	  
      <section id="main-content" class="pageC project-list">

          <section class="intro">
			<div class="inner">
			
				<div class="text">
				
				<h1>All Groups</h1>
				<p>View and manage your groups</p>
				
				</div>
				
			</div>
		  </section>		  
		  
		  <section class="wrapper">

                  <div class="row mt">
                      <div class="col-lg-12">
                        <div class="content-panel">
                         <table class="table table-striped table-advance table-hover">
                              <thead>
                              <tr>
                                  <th><i class="fa fa-bullhorn"></i> Group Name</th>
                                  <th><i class="fa fa-clock-o"></i> Date/Time</th>
                                  
                                  {% if "delete" in session['permissions'] -%} 
                                  <th><i class="fa fa-times"></i> Delete</th>
                                  {% endif -%} 
                                  <th></th>
                              </tr>
                              </thead>
                              <tbody>

                                        {% set counter = 0 -%}
                                        {% for entry in groups -%}
                  <div id="projectRow{{entry.projectID|safe}}">
                              <tr>
                                  <td><a href="/group-users">{{entry.groupName|safe}}</a></td>
                                  <td><span class="label label-info label-mini">{{entry.timestamp|safe}}</span></td>
                                  <td>  
                                  {% if "delete" in session['permissions'] -%} 
                                  <!-- Button trigger modal -->
                                   <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#myModal{{entry.groupID|safe}}">
                                  <i class="fa fa-times "></i>                 
                                  </button>
                       			  {% endif -%} 
                                  <!-- Modal -->
                                  <div class="modal fade" id="myModal{{entry.groupID|safe}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                  <div class="modal-dialog">
                                  <div class="modal-content">
                                  <div class="modal-header">
                                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                  <h4 class="modal-title" id="myModalLabel">Warning</h4>
                                  </div>
                                  <div   class="modal-body">
                                  <table id='checklist' style="width:525px">
                                 
                        <p>When you press the "Remove group" button, This group will be deleted<br/>
                        Are you sure you want to continue.
                        </p>


                                  </table>
                                  </div>
                                  <div class="modal-footer">
                                  <form method="POST" action="/group-del">
                                  <input type="hidden" value="{{entry.groupID|safe}}" name="groupID"/>
                                  <input type="hidden" value="{{csrf_token|safe}}" name="csrf_token"/>
                                  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                  <input type="submit" value="Remove group" id="" class="btn btn-danger"/>
                                  </form>
                                  </div>
                                  </div>
                                    </div>
                                  </div>                     
                                    </div>
                    </div>
                          </div>               </td>
                                  <td>

                                  </td>
                              </tr>   
                                        {% set counter = counter + 1 %}
                                        {% endfor %}
                             
                    
                              </tbody>
                          </table>
                      </div>
   
               </div><!-- /col-lg-4 -->           
              </div><!-- /row -->
        </section><!--/wrapper -->
      </section><!-- /MAIN CONTENT -->
       
{% include 'footer.html' %} 