53 lines
5.1 KiB
Plaintext
53 lines
5.1 KiB
Plaintext
@model AdminSubscriptionsViewModel
|
|
@{
|
|
ViewData["Title"] = "Subscription administration";
|
|
var entitlement = Model.Entitlement;
|
|
var underlying = entitlement?.UnderlyingSubscription;
|
|
}
|
|
<nav class="breadcrumb-trail" aria-label="Breadcrumb"><a asp-action="Index">Admin</a><span>Subscriptions</span></nav>
|
|
<div class="page-heading compact"><div><p class="eyebrow">Administration</p><h1>Subscription access</h1><p class="lead-text">Billing state and PlotDirector access are shown separately.</p></div></div>
|
|
@if (TempData["AdminMessage"] is string message) { <div class="alert alert-success">@message</div> }
|
|
@if (TempData["AdminError"] is string error) { <div class="alert alert-warning">@error</div> }
|
|
|
|
<section class="edit-panel">
|
|
<form method="get" class="row g-2 align-items-end">
|
|
<div class="col-md-8"><label class="form-label" for="search">Email or display name</label><input class="form-control" id="search" name="search" value="@Model.Search" /></div>
|
|
<div class="col-md-4"><button class="btn btn-primary" type="submit">Search users</button></div>
|
|
</form>
|
|
@if (Model.Users.Count > 0)
|
|
{
|
|
<div class="list-group mt-3">
|
|
@foreach (var user in Model.Users)
|
|
{
|
|
<a class="list-group-item list-group-item-action" asp-action="Subscriptions" asp-route-search="@Model.Search" asp-route-userId="@user.UserID">
|
|
<strong>@user.Email</strong> — @user.DisplayName <span class="text-muted">@(user.UnderlyingPlanName ?? "No subscription")</span>
|
|
</a>
|
|
}
|
|
</div>
|
|
}
|
|
</section>
|
|
|
|
@if (Model.SelectedUser is not null && entitlement is not null)
|
|
{
|
|
<section class="edit-panel">
|
|
<h2>@Model.SelectedUser.Email</h2>
|
|
<div class="row g-3">
|
|
<div class="col-md-4"><p class="eyebrow">Paid / underlying plan</p><p>@(underlying?.DisplayName ?? "None")</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Billing status</p><p>@(underlying?.StripeStatus ?? (underlying?.IsTrial == true ? "Application trial" : "Not supplied"))</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Effective access</p><p><strong>@(entitlement.EffectiveLevel?.DisplayName ?? "Read only")</strong> — @entitlement.State</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Trial start</p><p>@(underlying?.StartDateUTC.ToString("d MMMM yyyy 'UTC'") ?? "Not set")</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Trial expiry</p><p>@(entitlement.TrialExpiryDateUTC?.ToString("d MMMM yyyy 'UTC'") ?? "Not set")</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Books</p><p>@(Model.Usage?.BooksUsed ?? 0) / @(entitlement.EffectiveLevel?.MaxBooks.ToString("N0") ?? "0")</p></div>
|
|
</div>
|
|
@if (entitlement.ActiveOverride is not null)
|
|
{
|
|
<div class="alert alert-info"><strong>Administrative override active.</strong> @entitlement.ActiveOverride.LevelDisplayName; expires @(entitlement.ActiveOverride.ExpiryDateUTC?.ToString("d MMMM yyyy 'UTC'") ?? "never"). This is not a paid subscription.</div>
|
|
<form asp-action="RevokeSubscriptionOverride" method="post" class="row g-2"><input type="hidden" name="UserID" value="@Model.SelectedUser.UserID" /><div class="col-md-8"><label class="form-label">Reason</label><input class="form-control" name="Reason" required maxlength="1000" /></div><div class="col-md-4 align-self-end"><button class="btn btn-outline-danger" type="submit">Remove override</button></div></form>
|
|
}
|
|
</section>
|
|
<div class="row g-3">
|
|
<div class="col-lg-6"><section class="edit-panel h-100"><h2>Change trial expiry</h2><form asp-action="ExtendTrial" method="post"><input type="hidden" name="UserID" value="@Model.SelectedUser.UserID" /><label class="form-label">Expiry (UTC)</label><input class="form-control" type="datetime-local" name="TrialExpiryDateUTC" value="@((entitlement.TrialExpiryDateUTC ?? DateTime.UtcNow.AddDays(30)).ToString("yyyy-MM-ddTHH:mm"))" required /><label class="form-label mt-2">Reason</label><textarea class="form-control" name="Reason" required maxlength="1000"></textarea><button class="btn btn-primary mt-3" type="submit">Update trial</button></form></section></div>
|
|
<div class="col-lg-6"><section class="edit-panel h-100"><h2>Administrative access override</h2><p class="muted">This changes effective access only. Stripe billing is not modified.</p><form asp-action="SaveSubscriptionOverride" method="post"><input type="hidden" name="UserID" value="@Model.SelectedUser.UserID" /><label class="form-label">Existing plan level</label><select class="form-select" name="SubscriptionLevelID" required>@foreach (var level in Model.Levels) { <option value="@level.SubscriptionLevelID">@level.DisplayName</option> }</select><label class="form-label mt-2">Starts (UTC)</label><input class="form-control" type="datetime-local" name="StartDateUTC" value="@DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm")" required /><label class="form-label mt-2">Optional expiry (UTC)</label><input class="form-control" type="datetime-local" name="ExpiryDateUTC" /><label class="form-label mt-2">Reason</label><textarea class="form-control" name="Reason" required maxlength="1000"></textarea><button class="btn btn-primary mt-3" type="submit">Grant override</button></form></section></div>
|
|
</div>
|
|
}
|