add superadmin dashboard. subscriptions
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
{% extends 'superadmin/layout.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="sa-header">
|
||||
<h1>Создание тарифа</h1>
|
||||
<a href="{{ base_url('/superadmin/plans') }}" class="btn btn-primary">← Назад</a>
|
||||
</div>
|
||||
|
||||
<div class="sa-card">
|
||||
<div class="sa-card-body">
|
||||
<form action="{{ base_url('/superadmin/plans/store') }}" method="post">
|
||||
{{ csrf_field()|raw }}
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="name">Название тарифа *</label>
|
||||
<input type="text" name="name" id="name" class="form-control" value="{{ old('name') }}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="price">Цена *</label>
|
||||
<input type="number" name="price" id="price" class="form-control" value="{{ old('price', 0) }}" step="0.01" min="0" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Описание</label>
|
||||
<textarea name="description" id="description" class="form-control" rows="3">{{ old('description') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="currency">Валюта</label>
|
||||
<select name="currency" id="currency" class="form-control">
|
||||
<option value="RUB" {{ old('currency', 'RUB') == 'RUB' ? 'selected' : '' }}>Рубль (RUB)</option>
|
||||
<option value="USD" {{ old('currency') == 'USD' ? 'selected' : '' }}>Доллар (USD)</option>
|
||||
<option value="EUR" {{ old('currency') == 'EUR' ? 'selected' : '' }}>Евро (EUR)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="billing_period">Период оплаты</label>
|
||||
<select name="billing_period" id="billing_period" class="form-control">
|
||||
<option value="monthly" {{ old('billing_period', 'monthly') == 'monthly' ? 'selected' : '' }}>Ежемесячно</option>
|
||||
<option value="yearly" {{ old('billing_period') == 'yearly' ? 'selected' : '' }}>Ежегодно</option>
|
||||
<option value="quarterly" {{ old('billing_period') == 'quarterly' ? 'selected' : '' }}>Ежеквартально</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="max_users">Максимум пользователей *</label>
|
||||
<input type="number" name="max_users" id="max_users" class="form-control" value="{{ old('max_users', 5) }}" min="1" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="max_clients">Максимум клиентов *</label>
|
||||
<input type="number" name="max_clients" id="max_clients" class="form-control" value="{{ old('max_clients', 100) }}" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="max_storage">Максимум хранилища (ГБ) *</label>
|
||||
<input type="number" name="max_storage" id="max_storage" class="form-control" value="{{ old('max_storage', 10) }}" min="1" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="features">Возможности (каждая с новой строки)</label>
|
||||
<textarea name="features_list" id="features" class="form-control" rows="5" placeholder="Неограниченные проекты Приоритетная поддержка Экспорт в PDF">{{ old('features_list') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" value="1" {{ old('is_active', 1) ? 'checked' : '' }}>
|
||||
Активен (доступен для выбора)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="is_default" value="1" {{ old('is_default') ? 'checked' : '' }}>
|
||||
Тариф по умолчанию
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success btn-block">Создать тариф</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,96 @@
|
||||
{% extends 'superadmin/layout.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="sa-header">
|
||||
<h1>Редактирование тарифа: {{ plan.name }}</h1>
|
||||
<a href="{{ base_url('/superadmin/plans') }}" class="btn btn-primary">← Назад</a>
|
||||
</div>
|
||||
|
||||
<div class="sa-card">
|
||||
<div class="sa-card-body">
|
||||
<form action="{{ base_url('/superadmin/plans/update/' ~ plan.id) }}" method="post">
|
||||
{{ csrf_field()|raw }}
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="name">Название тарифа *</label>
|
||||
<input type="text" name="name" id="name" class="form-control" value="{{ plan.name }}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="price">Цена *</label>
|
||||
<input type="number" name="price" id="price" class="form-control" value="{{ plan.price }}" step="0.01" min="0" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Описание</label>
|
||||
<textarea name="description" id="description" class="form-control" rows="3">{{ plan.description|default('') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="currency">Валюта</label>
|
||||
<select name="currency" id="currency" class="form-control">
|
||||
<option value="RUB" {{ plan.currency == 'RUB' ? 'selected' : '' }}>Рубль (RUB)</option>
|
||||
<option value="USD" {{ plan.currency == 'USD' ? 'selected' : '' }}>Доллар (USD)</option>
|
||||
<option value="EUR" {{ plan.currency == 'EUR' ? 'selected' : '' }}>Евро (EUR)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="billing_period">Период оплаты</label>
|
||||
<select name="billing_period" id="billing_period" class="form-control">
|
||||
<option value="monthly" {{ plan.billing_period == 'monthly' ? 'selected' : '' }}>Ежемесячно</option>
|
||||
<option value="yearly" {{ plan.billing_period == 'yearly' ? 'selected' : '' }}>Ежегодно</option>
|
||||
<option value="quarterly" {{ plan.billing_period == 'quarterly' ? 'selected' : '' }}>Ежеквартально</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label for="max_users">Максимум пользователей *</label>
|
||||
<input type="number" name="max_users" id="max_users" class="form-control" value="{{ plan.max_users }}" min="1" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="max_clients">Максимум клиентов *</label>
|
||||
<input type="number" name="max_clients" id="max_clients" class="form-control" value="{{ plan.max_clients }}" min="1" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="max_storage">Максимум хранилища (ГБ) *</label>
|
||||
<input type="number" name="max_storage" id="max_storage" class="form-control" value="{{ plan.max_storage }}" min="1" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="features">Возможности (каждая с новой строки)</label>
|
||||
<textarea name="features_list" id="features" class="form-control" rows="5" placeholder="Неограниченные проекты Приоритетная поддержка Экспорт в PDF">{% if plan.features is iterable %}{% for feature in plan.features %}
|
||||
{{ feature }}{% endfor %}{% endif %}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="grid-2">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" value="1" {{ plan.is_active ? 'checked' : '' }}>
|
||||
Активен (доступен для выбора)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>
|
||||
<input type="checkbox" name="is_default" value="1" {{ plan.is_default ? 'checked' : '' }}>
|
||||
Тариф по умолчанию
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success btn-block">Сохранить изменения</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,77 @@
|
||||
{% extends 'superadmin/layout.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="sa-header">
|
||||
<h1>Тарифы</h1>
|
||||
<a href="{{ base_url('/superadmin/plans/create') }}" class="btn btn-success">+ Добавить тариф</a>
|
||||
</div>
|
||||
|
||||
{% for alert in get_alerts() %}
|
||||
<div class="alert alert-{{ alert.type }}">{{ alert.message }}</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="sa-card">
|
||||
<div class="sa-card-body">
|
||||
{% if plans is empty %}
|
||||
<p style="color: #7f8c8d; text-align: center; padding: 40px;">Тарифов пока нет. Создайте первый тариф.</p>
|
||||
{% else %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Описание</th>
|
||||
<th>Цена</th>
|
||||
<th>Период</th>
|
||||
<th>Лимиты</th>
|
||||
<th>Статус</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for plan in plans %}
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ plan.name }}</strong>
|
||||
{% if plan.is_default %}
|
||||
<span class="badge badge-success">По умолчанию</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ plan.description|default('—') }}</td>
|
||||
<td>
|
||||
<strong>{{ plan.price|number_format(0, '', ' ') }}</strong> {{ plan.currency }}
|
||||
</td>
|
||||
<td>
|
||||
{% if plan.billing_period == 'monthly' %}
|
||||
Месяц
|
||||
{% elseif plan.billing_period == 'yearly' %}
|
||||
Год
|
||||
{% else %}
|
||||
{{ plan.billing_period }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<small style="color: #7f8c8d;">
|
||||
👥 до {{ plan.max_users }} чел.<br>
|
||||
👤 до {{ plan.max_clients }} клиентов<br>
|
||||
💾 до {{ plan.max_storage }} ГБ
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
{% if plan.is_active %}
|
||||
<span class="badge badge-success">Активен</span>
|
||||
{% else %}
|
||||
<span class="badge badge-danger">Неактивен</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ base_url('/superadmin/plans/edit/' ~ plan.id) }}" class="btn btn-primary btn-sm">✏️</a>
|
||||
<a href="{{ base_url('/superadmin/plans/delete/' ~ plan.id) }}" class="btn btn-danger btn-sm" onclick="return confirm('Вы уверены?')">🗑️</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user