{% load base_filters %}
{% load corporate_memberships_tags %}
{% load i18n %}
<div class="wrap-search-item{% if corporate_membership.status_detail == 'disapproved' %} disapproved{% endif %}">
    {% if corporate_membership %}
    <div class="corpmember-box">
        <div class="corpmember-box-header"><a href="{% url corp_memb.view corporate_membership.pk %}">{{ corporate_membership.name }}</a></div>
        <div class="corpmember-box-body">
            <div class="float-left label">{% trans "Corporate Address: " %}</div>
            <div class="float-left">
                {% if corporate_membership.address or corporate_membership.address2 %}
                    {{ corporate_membership.address }} {{ corporate_membership.address2 }} <br />
                {% endif %}
                
                {% if corporate_membership.city %}{{ corporate_membership.city }}{% endif %} {% if corporate_membership.state %}{{ corporate_membership.state }}{% endif %} 
                {% if corporate_membership.zip %}{{ corporate_membership.zip }}{% endif %} {% if corporate_membership.country %}{{ corporate_membership.country }}{% endif %}
                
                
            </div>
            <div class="clear-left"></div>
            
            <div class="corpmember-left float-left">
                <div><span class="label">{% trans "Corporate Phone:" %}</span> {% if corporate_membership.phone %}{{ corporate_membership.phone|phonenumber }}{% endif %}</div>
                <div><span class="label">{% trans "Website:" %}</span> {% if corporate_membership.url %}{{ corporate_membership.url|safe|urlize }}{% endif %}</div>
                <div><span class="label">{% trans "Member Type:" %}</span> {{ corporate_membership.corporate_membership_type.name }}
                {% if corporate_membership.invoice %}
                    - {{ SITE_GLOBAL_CURRENCYSYMBOL }}{{ corporate_membership.invoice.total }}
                {% endif %}
                </div>
                <div><a href="{% url membership.application_details_corp_pre corporate_membership.corp_app.memb_app.slug corporate_membership.id %}">{% trans "Join under this corporation" %}</a></div>
            </div>
            
            <div class="corpmember-right float-left">
                <div><span class="label">{% trans "Join Date:" %}</span> {{ corporate_membership.join_dt|date:'Y-n-j' }}</div>
                <div><span class="label">{% trans "Expiration Date:" %}</span> {% if corporate_membership.expiration_dt %}
                                    {{ corporate_membership.expiration_dt|date:'Y-n-j' }}
                                    {% else %}
                                    {% trans "Never Expire" %}
                                    {% endif %}
                </div>
                {% with corporate_membership.get_pending_renewal_entry as pending_renewal_entry %}
                {% if pending_renewal_entry %}
                    <div class="pending-info-box">
                    {% blocktrans with pending_renewal_entry.create_dt|date:"d-M-Y" as renewal %} Renewed on {{ renewal }} {% endblocktrans %}<br />
                    {% trans "Status of Renewal: " %}<span class="status-pending">{{ pending_renewal_entry.status_detail }}</span><br />
                    {% if request.user.is_superuser %}
                        <b>{% trans "Admin" %}</b>: <a href="{% url corp_memb.approve corporate_membership.pk %}">{% trans "Approve / Disapprove" %}</a>
                    {% endif %}
                    </div>
                {% else %}
                    {% if request.user.is_superuser and corporate_membership.is_join_pending %}
                        <div class="pending-info-box">
                        <b>{% trans "Admin" %}</b>: <a href="{% url corp_memb.approve corporate_membership.pk %}">{% trans "Approve / Disapprove" %}</a>
                        </div>
                    {% endif %}
                    
                    {% if corporate_membership.can_renew %}
                        <a href="{% url corp_memb.renew corporate_membership.id %}" style="background-color:yellow;">{% trans "Renew" %}</a>
                    {% endif %}
                {% endif %}
                
                {% endwith %}
                
                
            </div>
            <div class="clear-left"></div>
        </div>
        
        <!-- delete-corp_memb form -->
        <form name="corp-memb-delete" method="POST" action="{% url corp_memb.delete corporate_membership.pk %}">{% csrf_token %}
            <input type="hidden" name="action" value="delete">
        </form>
    </div>
    {% include 'corporate_memberships/meta.html' %}
    {% endif %}
</div>
