62 lines
5.3 KiB
Plaintext
62 lines
5.3 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">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.UsesAdministrativeOverride ? "Administrative override" : entitlement.State.ToString())</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Underlying trial start</p><p>@(underlying?.IsTrial == true ? underlying.StartDateUTC.ToString("d MMMM yyyy 'UTC'") : "Not applicable")</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Underlying trial expiry</p><p>@(underlying?.TrialExpiryDateUTC?.ToString("d MMMM yyyy 'UTC'") ?? "Not set")</p></div>
|
|
<div class="col-md-4"><p class="eyebrow">Override expiry</p><p>@(entitlement.ActiveOverride is null ? "Not active" : entitlement.ActiveOverride.ExpiryDateUTC?.ToString("d MMMM yyyy 'UTC'") ?? "Never")</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>
|
|
<section class="edit-panel">
|
|
<h2>Administrative access override</h2>
|
|
<p class="muted">This is the sole administrator control for temporary or indefinite complimentary access. It does not change Stripe or the underlying application trial.</p>
|
|
<form asp-action="SaveSubscriptionOverride" method="post" class="row g-3">
|
|
<input type="hidden" name="UserID" value="@Model.SelectedUser.UserID" />
|
|
<div class="col-md-6"><label class="form-label">Plan level</label><select class="form-select" name="SubscriptionLevelID" required>@foreach (var level in Model.Levels) { <option value="@level.SubscriptionLevelID" selected="@(entitlement.ActiveOverride?.SubscriptionLevelID == level.SubscriptionLevelID)">@level.DisplayName</option> }</select></div>
|
|
<div class="col-md-6"><label class="form-label">Starts (UTC)</label><input class="form-control" type="datetime-local" name="StartDateUTC" value="@((entitlement.ActiveOverride?.StartDateUTC ?? DateTime.UtcNow).ToString("yyyy-MM-ddTHH:mm"))" required /></div>
|
|
<div class="col-md-6"><label class="form-label">Optional expiry (UTC)</label><input class="form-control" type="datetime-local" name="ExpiryDateUTC" value="@(entitlement.ActiveOverride?.ExpiryDateUTC?.ToString("yyyy-MM-ddTHH:mm"))" /></div>
|
|
<div class="col-md-12"><label class="form-label">Reason</label><textarea class="form-control" name="Reason" required maxlength="1000"></textarea></div>
|
|
<div class="col-md-12"><button class="btn btn-primary" type="submit">@(entitlement.ActiveOverride is null ? "Grant override" : "Update override")</button></div>
|
|
</form>
|
|
</section>
|
|
}
|