{% extends "layout.html" %}

{% block content %}

<ol class="breadcrumb">
    <li><a href="{{ url_for('account_view') }}">Account</a></li>
    <li class="active">{{subscription_id}}</li>
</ol>

<h3>Resource Groups</h3>
<table class="table table-striped table-condensed">
    <thead>
        <tr>
            <th>Name</th>
            <th>Location</th>
        </tr>
    </thead>
    <tbody>
        {% for group in model.resource_groups %}
        <tr>
            <td><a href="{{ url_for('resourcegroup_view', subscription_id=subscription_id, resource_group_name=group.name) }}">{{group.name}}</a></td>
            <td>{{group.location}}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<h3>Providers</h3>
<table class="table table-striped table-condensed">
    <thead>
        <tr>
            <th>Namespace</th>
            <th>State</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        {% for provider in model.providers %}
        <tr>
            <td>{{provider.namespace}}</td>
            <td>{{provider.registration_state}}</td>
            {% if provider.registration_state == 'Registered' %}
            <td>
                <form action="{{ url_for('provider_unregister_post', subscription_id=subscription_id, provider_namespace=provider.namespace) }}" method="post">
                    <button class="btn btn-sm btn-danger" type="submit">Unregister</button>
                </form>
            </td>
            {% else %}
            <td>
                <form action="{{ url_for('provider_register_post', subscription_id=subscription_id, provider_namespace=provider.namespace) }}" method="post">
                    <button class="btn btn-sm btn-primary" type="submit">Register</button>
                </form>
            </td>
            {% endif %}
        </tr>
        {% endfor %}
    </tbody>
</table>

{% endblock %}
