113 lines
5.6 KiB
HTML
113 lines
5.6 KiB
HTML
{# ==============================================================================
|
|
Formeleon - Multi-tenant Form Generator
|
|
Author: Björn Runden <br@runden.net>
|
|
Template: admin/tenants/list.html
|
|
Description: List all tenants with filtering and pagination.
|
|
============================================================================== #}
|
|
|
|
{% extends "base.html" %}
|
|
|
|
{% block title %}Tenants - Formeleon{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
<div class="row mb-4">
|
|
<div class="col-12 d-flex justify-content-between align-items-center">
|
|
<h1><i class="bi bi-buildings"></i> Tenants</h1>
|
|
<div>
|
|
{% if is_admin %}
|
|
<a href="{{ url_for('admin.create_tenant') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus"></i> Create Tenant
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if tenants %}
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
|
<h5><i class="bi bi-list"></i> All Tenants ({{ tenants|length }})</h5>
|
|
<div class="input-group" style="width: 300px;">
|
|
<input type="text" class="form-control" id="searchInput" placeholder="Search tenants...">
|
|
<button class="btn btn-outline-secondary" type="button">
|
|
<i class="bi bi-search"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>ID</th>
|
|
<th>Public Key</th>
|
|
<th>Status</th>
|
|
<th>Forms</th>
|
|
<th>Created</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for tenant in tenants %}
|
|
<tr>
|
|
<td>{{ tenant.name }}</td>
|
|
<td><code>{{ tenant.id }}</code></td>
|
|
<td><code class="text-truncate" style="max-width: 200px;" title="{{ tenant.public_key }}">{{ tenant.public_key[:16] }}...</code></td>
|
|
<td>
|
|
<span class="badge bg-{{ 'success' if tenant.status.value == 'active' else 'warning' if tenant.status.value == 'suspended' else 'danger' }}">
|
|
{{ tenant.status.value }}
|
|
</span>
|
|
</td>
|
|
<td>{{ tenant.forms|length }}</td>
|
|
<td>{{ tenant.created_at.strftime('%Y-%m-%d') if tenant.created_at else 'N/A' }}</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group">
|
|
<a href="{{ url_for('admin.view_tenant', tenant_id=tenant.id) }}" class="btn btn-outline-secondary" title="View">
|
|
<i class="bi bi-eye"></i>
|
|
</a>
|
|
{% if is_admin %}
|
|
<a href="{{ url_for('admin.view_tenant', tenant_id=tenant.id) }}" class="btn btn-outline-primary" title="Edit">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<form action="{{ url_for('admin.delete_tenant', tenant_id=tenant.id) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this tenant? This action cannot be undone.');">
|
|
<button type="submit" class="btn btn-outline-danger" title="Delete">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body text-center py-5">
|
|
<i class="bi bi-buildings display-4 text-muted mb-3"></i>
|
|
<h3>No Tenants</h3>
|
|
<p class="text-muted">No tenants have been created yet.</p>
|
|
{% if is_admin %}
|
|
<a href="{{ url_for('admin.create_tenant') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus"></i> Create First Tenant
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|