{% extends "djmongo/console/base.html" %}
{% block Content %}

{% load i18n %}


<div class="container">
      
      
      
       <div class="row">
  <div class="col-lg-10">
         <div class="alert alert-info">
    <button type="button" class="close" data-dismiss="alert">×</button>
    <h4>{%trans "Notes:" %}</h4>
    Depending on how your saved searches are constructed, they may not run without GET parameters supplied.
    Use double dollar sign "$$" notation for variable replacement. 
	<a target="_blank" href="https://github.com/videntity/django-djmongo/wiki/Saved-Searches">
            See the Saved Search Documentation</a> for more information.
	  </div>
      
      </div>
   </div>
      
      
      <div class="row">
              <div class="col-lg-12">
                  <h1>{% trans "Saved Searches" %}</h1>
              </div>
      </div>

 <div class="row">
      <div class="col-lg-12">
           <a class="btn pull-right btn-primary btn-large" href="{% url 'djmongo_create_saved_search_w_params' database_name collection_name   %}">
            <i class="icon-plus-sign icon-white"></i> {% trans "Create a Saved Search in " %} {{database_name}}/{{collection_name}}
            </a>
           
       </div>
 </div>     
      

<div class="row">
  <div class="col-lg-12">    
<table class="table">
   

<thead>
<tr>
<th>Slug</th>
<th>Is Public</th>
<th>Group</th>
<th>Created By</th>
<th>Database/Collection</th>
<th>API URL</th>
<th>Query</th>
<th>Actions</th>

</tr>
</thead>
 
<tbody>


{% for s in savedsearches %}

<tr class="success">
<td>{{s.slug}}</td>
<td>{{s.is_public}}</td>
<td>{{s.group}}</td>
<td>{{s.user.first_name}}  {{s.user.last_name}}  ({{s.user}})</td>
<td>{{s.database_name}}/{{s.collection_name}}</td>
{% if s.is_public %}

    <td><pre>{% url 'djmongo_api_run_public_saved_search_by_slug' s.slug %}</pre></td>
{% else %}
    <td><pre>{% url 'djmongo_api_run_saved_search_by_slug' s.slug %}</pre></td>
{% endif %}

<td><pre>{{s.query}}</pre></td>
<td>
            
            {% if s.is_public %}
              <a class="btn pull-left btn-success btn-xs" target=_blank href="{% url 'djmongo_run_public_saved_search_by_slug' s.slug %}">
              <i class="icon-search  icon-white"></i> Run</a>
              
     
            {% else %}
     
              <a class="btn pull-left btn-success btn-xs" target=_blank href="{% url 'djmongo_run_saved_search_by_slug' s.slug %}">
              <i class="icon-search  icon-white"></i> Run</a>
              
     
            {% endif %}
     
            <a class="btn pull-left btn-primary btn-xs" href="{% url 'djmongo_edit_saved_search_by_slug' s.slug %}">
            <i class="icon-edit  icon-white"></i> Edit</a>
            
            <a class="btn pull-left btn-danger btn-xs" href="{% url 'djmongo_delete_saved_search_by_slug' s.slug %}">
            <i class="icon-remove-sign  icon-white"></i> Delete</a>
</td>

</tr>
{% endfor %}

</tbody>

    </table>

 </div>    
    
</div>
</div>

{% endblock %}