File: //usr/local/CyberCP/emailPremium/templates/emailPremium/emailLimits.html
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{{ domain }} Email Limits - CyberPanel{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.modern-container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
.page-header {
text-align: center;
margin-bottom: 3rem;
animation: fadeInDown 0.5s ease-out;
}
.page-title {
font-size: 2.5rem;
font-weight: 700;
color: #1e293b;
margin-bottom: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
gap: 1rem;
flex-wrap: wrap;
}
.domain-badge {
background: #5b5fcf;
color: white;
padding: 0.5rem 1.5rem;
border-radius: 8px;
font-size: 1.5rem;
font-weight: 600;
}
.page-subtitle {
font-size: 1.125rem;
color: #64748b;
margin-bottom: 0;
}
.docs-link {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: #fff;
border: 1px solid #e8e9ff;
border-radius: 8px;
color: #5b5fcf;
text-decoration: none;
font-size: 0.875rem;
transition: all 0.3s ease;
}
.docs-link:hover {
background: #5b5fcf;
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.3);
}
.main-card {
background: white;
border-radius: 16px;
box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 10px 40px rgba(0,0,0,0.08);
border: 1px solid #e8e9ff;
overflow: hidden;
animation: fadeInUp 0.5s ease-out;
margin-bottom: 2rem;
}
.card-header {
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
padding: 1.5rem 2rem;
border-bottom: 1px solid #e8e9ff;
}
.card-title {
font-size: 1.25rem;
font-weight: 600;
color: #1e293b;
margin: 0;
display: flex;
align-items: center;
gap: 0.75rem;
}
.card-body {
padding: 2rem;
}
.stats-table {
width: 100%;
background: white;
border-radius: 8px;
overflow: hidden;
border: 1px solid #e8e9ff;
}
.stats-table thead {
background: #f8f9ff;
}
.stats-table th {
padding: 1rem;
text-align: left;
font-weight: 600;
color: #1e293b;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
border-bottom: 1px solid #e8e9ff;
}
.stats-table td {
padding: 1rem;
color: #64748b;
font-size: 0.875rem;
border-bottom: 1px solid #f3f4f6;
}
.stats-table tbody tr:hover {
background: #f8f9ff;
}
.code-badge {
background: #f3f4f6;
color: #1e293b;
padding: 0.25rem 0.75rem;
border-radius: 4px;
font-family: monospace;
font-size: 0.875rem;
}
.status-toggle {
display: flex;
align-items: center;
gap: 0.75rem;
}
.status-indicator {
width: 24px;
height: 24px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.status-on {
background: #d1fae5;
color: #065f46;
}
.status-off {
background: #fee2e2;
color: #991b1b;
}
.btn-primary {
background: #5b5fcf;
color: white;
border: none;
padding: 0.75rem 2rem;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn-primary:hover {
background: #4547a9;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.4);
}
.btn-success {
background: #10b981;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.875rem;
}
.btn-success:hover {
background: #059669;
transform: translateY(-1px);
}
.btn-danger {
background: #ef4444;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.875rem;
}
.btn-danger:hover {
background: #dc2626;
transform: translateY(-1px);
}
.btn-edit {
background: #fff;
color: #5b5fcf;
border: 1px solid #e8e9ff;
padding: 0.5rem 1rem;
border-radius: 6px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.875rem;
}
.btn-edit:hover {
background: #5b5fcf;
color: white;
transform: translateY(-1px);
}
.form-section {
background: #f8f9ff;
border: 1px solid #e8e9ff;
border-radius: 12px;
padding: 2rem;
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: #1e293b;
font-size: 0.875rem;
}
.form-control {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid #e8e9ff;
border-radius: 8px;
font-size: 0.875rem;
transition: all 0.3s ease;
background: #fff;
}
.form-control:focus {
outline: none;
border-color: #5b5fcf;
box-shadow: 0 0 0 3px rgba(91, 95, 207, 0.1);
}
.search-box {
position: relative;
margin-bottom: 1.5rem;
}
.search-box input {
padding-left: 2.5rem;
}
.search-box i {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
color: #64748b;
}
.alert {
padding: 1rem 1.5rem;
border-radius: 8px;
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.75rem;
animation: slideInRight 0.3s ease-out;
}
.alert-success {
background: #d1fae5;
color: #065f46;
border: 1px solid #a7f3d0;
}
.alert-danger {
background: #fee2e2;
color: #991b1b;
border: 1px solid #fecaca;
}
.loading-spinner {
width: 20px;
height: 20px;
border: 2px solid #e8e9ff;
border-top-color: #5b5fcf;
border-radius: 50%;
animation: spin 1s linear infinite;
display: inline-block;
}
.close-btn {
background: #fff;
border: 1px solid #e8e9ff;
border-radius: 8px;
padding: 0.5rem;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
justify-content: center;
}
.close-btn:hover {
background: #fee2e2;
border-color: #fecaca;
}
.pagination {
display: flex;
gap: 0.5rem;
list-style: none;
padding: 0;
margin: 1.5rem 0 0 0;
justify-content: flex-end;
}
.pagination li {
cursor: pointer;
}
.pagination a {
display: block;
padding: 0.5rem 1rem;
background: #fff;
border: 1px solid #e8e9ff;
border-radius: 6px;
color: #64748b;
text-decoration: none;
transition: all 0.3s ease;
}
.pagination li:hover a {
background: #5b5fcf;
color: white;
border-color: #5b5fcf;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideInRight {
from {
opacity: 0;
transform: translateX(20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
</style>
<div ng-controller="emailDomainPage" class="modern-container">
<div class="page-header">
<h1 class="page-title">
<i class="fas fa-tachometer-alt"></i>
{% trans "Email Limits" %}
<span class="domain-badge" id="domainNamePage">{{ domain }}</span>
</h1>
<p class="page-subtitle">{% trans "View and manage email sending limits for your domain" %}</p>
<a target="_blank" href="http://go.cyberpanel.net/emailLimits" class="docs-link">
<i class="fas fa-book"></i>
{% trans "Email Limits Documentation" %}
</a>
</div>
{% if not error %}
<!-- Domain Resource Usage -->
<div class="main-card">
<div class="card-header">
<h2 class="card-title">
<i class="fas fa-chart-line"></i>
{% trans "Domain Resource Usage" %}
<span ng-show="emailLimitsLoading" class="loading-spinner"></span>
</h2>
</div>
<div class="card-body">
<table class="stats-table">
<thead>
<tr>
<th>{% trans "Domain" %}</th>
<th>{% trans "Email Accounts" %}</th>
<th>{% trans "Monthly Limit" %}</th>
<th>{% trans "Monthly Used" %}</th>
<th>{% trans "Limit Status" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="code-badge">{{ domain }}</span></td>
<td><span class="code-badge">{{ emailAccounts }}</span></td>
<td><span class="code-badge">{{ monthlyLimit }}</span></td>
<td><span class="code-badge">{{ monthlyUsed }}</span></td>
<td>
<div class="status-toggle">
<span ng-show="{{ limitsOn }}" class="status-indicator status-on" title="{% trans 'Limits are being Applied!' %}">
<i class="fas fa-check"></i>
</span>
<button ng-click="enableDisableEmailLimits(0, '{{ domain }}')" ng-show="{{ limitsOn }}" class="btn-danger">
<i class="fas fa-power-off"></i>
{% trans 'Disable' %}
</button>
<span ng-show="{{ limitsOff }}" class="status-indicator status-off" title="{% trans 'Limits are not being applied!' %}">
<i class="fas fa-times"></i>
</span>
<button ng-click="enableDisableEmailLimits(1, '{{ domain }}')" ng-show="{{ limitsOff }}" class="btn-success">
<i class="fas fa-power-off"></i>
{% trans 'Enable' %}
</button>
</div>
</td>
<td>
<button ng-click="showLimitsForm()" class="btn-edit">
<i class="fas fa-edit"></i>
{% trans 'Edit' %}
</button>
</td>
</tr>
</tbody>
</table>
<div ng-hide="changeLimitsForm" class="form-section">
<form name="websiteCreationForm" action="/" method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="form-label">{% trans "Monthly Limit" %}</label>
<input name="dom" type="number" class="form-control" ng-model="monthlyLimit" placeholder="Enter monthly email limit" required>
</div>
<div style="display: flex; gap: 1rem; align-items: center;">
<button type="button" ng-click="changeDomainEmailLimits('{{ domain }}')" class="btn-primary">
<i class="fas fa-save"></i>
{% trans "Change Limits" %}
</button>
<button type="button" ng-click="hideLimitsForm()" class="close-btn" title="{% trans 'Cancel' %}">
<i class="fas fa-times" style="color: #ef4444;"></i>
</button>
</div>
</div>
</div>
<div style="margin-top: 1.5rem;">
<div ng-hide="changeLimitsFail" class="alert alert-danger">
<i class="fas fa-exclamation-circle"></i>
{% trans "Can not change limits. Error message:" %} {$ errorMessage $}
</div>
<div ng-hide="changeLimitsSuccess" class="alert alert-success">
<i class="fas fa-check-circle"></i>
{% trans "Limits successfully changed, refreshing in 3 seconds." %}
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<i class="fas fa-times-circle"></i>
{% trans "Could not connect to server. Please refresh this page." %}
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Email Resource Usage -->
<div class="main-card">
<div class="card-header">
<h2 class="card-title">
<i class="fas fa-envelope"></i>
{% trans "Email Account Resource Usage" %}
<span ng-show="emailLimitsLoading" class="loading-spinner"></span>
</h2>
</div>
<div class="card-body">
<div class="search-box">
<i class="fas fa-search"></i>
<input type="text" ng-model="emailSearch" placeholder="{% trans 'Search email accounts...' %}" class="form-control">
</div>
<table class="stats-table">
<thead>
<tr>
<th>{% trans "Email" %}</th>
<th>{% trans "Monthly Limit" %}</th>
<th>{% trans "Monthly Used" %}</th>
<th>{% trans "Hourly Limit" %}</th>
<th>{% trans "Hourly Used" %}</th>
<th>{% trans "Limit Status" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="email in emailList | filter:emailSearch">
<td><span class="code-badge" ng-bind="email.email"></span></td>
<td><span class="code-badge" ng-bind="email.monthlyLimit"></span></td>
<td><span class="code-badge" ng-bind="email.monthlyUsed"></span></td>
<td><span class="code-badge" ng-bind="email.hourlyLimit"></span></td>
<td><span class="code-badge" ng-bind="email.hourlyUsed"></span></td>
<td>
<div class="status-toggle">
<span ng-show="email.status==1" class="status-indicator status-on" title="{% trans 'Limits are being Applied!' %}">
<i class="fas fa-check"></i>
</span>
<button ng-click="enableDisableIndividualEmailLimits(0, email.email)" ng-show="email.status==1" class="btn-danger">
{% trans 'Disable' %}
</button>
<span ng-show="email.status==0" class="status-indicator status-off" title="{% trans 'Limits are not being applied!' %}">
<i class="fas fa-times"></i>
</span>
<button ng-click="enableDisableIndividualEmailLimits(1, email.email)" ng-show="email.status==0" class="btn-success">
{% trans 'Enable' %}
</button>
</div>
</td>
<td>
<a href="/emailPremium/{$ email.email $}" class="btn-edit">
<i class="fas fa-cog"></i>
{% trans 'Manage' %}
</a>
</td>
</tr>
</tbody>
</table>
<div ng-hide="listFail" class="alert alert-danger" style="margin-top: 1rem;">
<i class="fas fa-exclamation-circle"></i>
{% trans "Cannot list emails. Error message:" %} {$ errorMessage $}
</div>
{% if pagination %}
<nav aria-label="Page navigation">
<ul class="pagination">
{% for items in pagination %}
<li ng-click="getFurtherEmailsFromDB({{ forloop.counter }})" id="webPages">
<a href="">{{ forloop.counter }}</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
</div>
</div>
{% else %}
<div class="main-card">
<div class="card-body">
<div class="alert alert-danger">
<i class="fas fa-exclamation-circle"></i>
{{ domain }}
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}