150 lines
5.9 KiB
Plaintext
150 lines
5.9 KiB
Plaintext
@model IEnumerable<LittleShop.DTOs.BotDto>
|
|
|
|
@{
|
|
ViewData["Title"] = "Bot Management";
|
|
}
|
|
|
|
<h1>Bot Management</h1>
|
|
|
|
<p>
|
|
<a href="/Admin/Bots/Wizard" class="btn btn-primary">
|
|
<i class="fas fa-magic"></i> Create Telegram Bot (Wizard)
|
|
</a>
|
|
<a href="/Admin/Bots/Create" class="btn btn-outline-secondary">
|
|
<i class="fas fa-plus"></i> Manual Registration
|
|
</a>
|
|
</p>
|
|
|
|
@if (TempData["Success"] != null)
|
|
{
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
@TempData["Success"]
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
}
|
|
|
|
@if (TempData["Error"] != null)
|
|
{
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
@TempData["Error"]
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
}
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Type</th>
|
|
<th>Platform Info</th>
|
|
<th>Status</th>
|
|
<th>Active Sessions</th>
|
|
<th>Total Revenue</th>
|
|
<th>Last Seen</th>
|
|
<th>Created</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var bot in Model)
|
|
{
|
|
<tr>
|
|
<td>
|
|
<strong>@bot.Name</strong>
|
|
@if (!string.IsNullOrEmpty(bot.PersonalityName))
|
|
{
|
|
<span class="badge bg-secondary ms-2">@bot.PersonalityName</span>
|
|
}
|
|
@if (!string.IsNullOrEmpty(bot.Description))
|
|
{
|
|
<br />
|
|
<small class="text-muted">@bot.Description</small>
|
|
}
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-info">@bot.Type</span>
|
|
</td>
|
|
<td>
|
|
@if (!string.IsNullOrEmpty(bot.PlatformUsername))
|
|
{
|
|
<div>
|
|
<strong>@@@bot.PlatformUsername</strong>
|
|
@if (!string.IsNullOrEmpty(bot.PlatformDisplayName))
|
|
{
|
|
<br />
|
|
<small class="text-muted">@bot.PlatformDisplayName</small>
|
|
}
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-muted">Not configured</span>
|
|
}
|
|
</td>
|
|
<td>
|
|
@switch (bot.Status)
|
|
{
|
|
case LittleShop.Enums.BotStatus.Active:
|
|
<span class="badge bg-success">Active</span>
|
|
break;
|
|
case LittleShop.Enums.BotStatus.Inactive:
|
|
<span class="badge bg-secondary">Inactive</span>
|
|
break;
|
|
case LittleShop.Enums.BotStatus.Suspended:
|
|
<span class="badge bg-warning">Suspended</span>
|
|
break;
|
|
case LittleShop.Enums.BotStatus.Maintenance:
|
|
<span class="badge bg-info">Maintenance</span>
|
|
break;
|
|
default:
|
|
<span class="badge bg-dark">@bot.Status</span>
|
|
break;
|
|
}
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-primary">@bot.ActiveSessions</span>
|
|
</td>
|
|
<td>$@bot.TotalRevenue.ToString("F2")</td>
|
|
<td>
|
|
@if (bot.LastSeenAt.HasValue)
|
|
{
|
|
<span title="@bot.LastSeenAt.Value.ToString("yyyy-MM-dd HH:mm:ss")">
|
|
@((DateTime.UtcNow - bot.LastSeenAt.Value).TotalMinutes < 5 ? "Online" : bot.LastSeenAt.Value.ToString("yyyy-MM-dd HH:mm"))
|
|
</span>
|
|
@if ((DateTime.UtcNow - bot.LastSeenAt.Value).TotalMinutes < 5)
|
|
{
|
|
<span class="text-success">●</span>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<span class="text-muted">Never</span>
|
|
}
|
|
</td>
|
|
<td>@bot.CreatedAt.ToString("yyyy-MM-dd")</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm" role="group">
|
|
<a href="/Admin/Bots/Details/@bot.Id" class="btn btn-outline-info" title="View Details">
|
|
<i class="bi bi-eye"></i>
|
|
</a>
|
|
<a href="/Admin/Bots/Edit/@bot.Id" class="btn btn-outline-primary" title="Edit">
|
|
<i class="bi bi-pencil"></i>
|
|
</a>
|
|
<a href="/Admin/Bots/Metrics/@bot.Id" class="btn btn-outline-success" title="View Metrics">
|
|
<i class="bi bi-graph-up"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if (!Model.Any())
|
|
{
|
|
<div class="alert alert-info">
|
|
No bots have been registered yet. <a asp-action="Create">Register your first bot</a>.
|
|
</div>
|
|
} |