{% extends "corporate_memberships/base.html" %}
{% load pagination_tags %}
{% load bootstrap_pagination_tags %}
{% load base_filters %}
{% load perm_tags %}
{% load corporate_memberships_tags %}
{% load i18n %}

{% block title %}{{ block.super }}{% trans "Corporate Membership Search" %}{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}bootstrap/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/corporate_memberships.css">
<style>
    #id_search_criteria, #id_search_text{
        width: 150px;
    }
    #id_search_method{
        width: 100px;
    }
    .search-form input[type=submit]{
       height: 30px;
       vertical-align: top;
    }
</style>
{% endblock %}

{% block body %}
<div class="t">
<div class="t-search">
 {% corpmemb_nav request.user %}

{% if pending_only %}
<h1>{% trans "Pending Corporate Membership List" %}</h1>
{% else %}
<h1>{% trans "Corporate Membership Search" %}</h1>
{% endif %}

<form class="search-form" method="get">
<p>
    {% if 'cp_id' in search_form.fields %}
    {{ search_form.cp_id.label }}: {{ search_form.cp_id }}
    {% endif %}
     
    {% if 'industry' in search_form.fields %}
    <br />
    {{ search_form.industry.label }}: {{ search_form.industry }}
    {% endif %}
    
    <br />
   {% trans 'Search By'%}: {{ search_form.search_criteria }} {{ search_form.search_text }} {{ search_form.search_method }}

    <input type="submit" name="search" value="Submit" />
</p>
</form>

{% autopaginate corp_members 10 %}
<span><em>{{ paginator.count }} {% firstof MODULE_CORPORATEMEMBERSHIPS_LABEL_PLURAL 'Corporate Members' %} {% trans "Found" %}</em></span>

<div class="corpmembers-wrap">
    {% for corp_memb in corp_members %}
        {% with corp_memb|get_object as corporate_membership %}
            {% include 'corporate_memberships/applications/search-result.html' %}
        {% endwith %}   
    {% empty %}
        <div>{% trans "0 Results Found" %}</div>
    {% endfor %}
</div>


 {% paginate %}
 
 </div>
</div>

{% endblock %}

{% block extra_body %}
 <script type="text/javascript">
    $(document).ready(function(){

        // delete confirmation
        $('.delete').click(function(){
            var delete_corp_memb = confirm('Permenantly delete {% firstof MODULE_CORPORATEMEMBERSHIPS_LABEL 'Corporate Membership' %}?');   // confirm
            if(delete_corp_memb) $(this).parents('.wrap-search-item').find('form[name="corp-memb-delete"]').submit(); // delete: if OK
            return false;   // cancel
        });
    });
   </script>
<script>
    var filename = "{{ STATIC_URL }}js/global/dropdown.js";
    
    if (typeof dropdown == "undefined")
    {
        var fileref=document.createElement('script');
        fileref.setAttribute("type","text/javascript");
        fileref.setAttribute("src", filename);
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(fileref);
    }
</script>

<script type="text/javascript">
var iconrow = new dropdown({
    container:  'more-options-wrap',
    trigger:    'more-options-trigger',
    target:     'more-options-target'
});
</script>


    
{% endblock %}
