1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 23:04:50 -05:00
bitwarden/src/Admin/Views/Users/Edit.cshtml
2018-03-22 21:21:57 -04:00

177 lines
7.2 KiB
Plaintext

@model UserEditModel
@{
ViewData["Title"] = "User: " + Model.User.Email;
}
@section Scripts {
<script>
(function() {
document.getElementById('upgrade-premium').addEventListener('click', function () {
if (document.getElementById('@(nameof(Model.Premium))').checked) {
alert('User is already premium.');
return;
}
// Premium
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
document.getElementById('@(nameof(Model.Premium))').checked = true;
// Licensing
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
document.getElementById('@(nameof(Model.PremiumExpirationDate))').value =
'@Model.OneYearExpirationDate';
});
document.getElementById('gateway-customer-link').addEventListener('click', function () {
var gateway = document.getElementById('@(nameof(Model.Gateway))');
var customerId = document.getElementById('@(nameof(Model.GatewayCustomerId))');
if (!gateway || gateway.value === '' || !customerId || customerId.value === '') {
return;
}
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
window.open('https://dashboard.stripe.com/customers/' + customerId.value, '_blank');
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/'
+ customerId.value, '_blank');
}
});
document.getElementById('gateway-subscription-link').addEventListener('click', function () {
var gateway = document.getElementById('@(nameof(Model.Gateway))');
var subId = document.getElementById('@(nameof(Model.GatewaySubscriptionId))');
if (!gateway || gateway.value === '' || !subId || subId.value === '') {
return;
}
if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Stripe)') {
window.open('https://dashboard.stripe.com/subscriptions/' + subId.value, '_blank');
} else if (gateway.value === '@((byte)Bit.Core.Enums.GatewayType.Braintree)') {
window.open('https://www.braintreegateway.com/merchants/@(Model.BraintreeMerchantId)/' +
'subscriptions/' + subId.value, '_blank');
}
});
})();
</script>
}
<h1>User <small>@Model.User.Email</small></h1>
<h2>Information</h2>
<dl class="row">
<dt class="col-sm-2">Id</dt>
<dd class="col-sm-10"><code>@Model.User.Id</code></dd>
<dt class="col-sm-2">Items</dt>
<dd class="col-sm-10">@Model.CipherCount</dd>
<dt class="col-sm-2">Created</dt>
<dd class="col-sm-10">@Model.User.CreationDate.ToString()</dd>
<dt class="col-sm-2">Modified</dt>
<dd class="col-sm-10">@Model.User.RevisionDate.ToString()</dd>
<dt class="col-sm-2">Account Modified</dt>
<dd class="col-sm-10">@Model.User.AccountRevisionDate.ToString()</dd>
</dl>
<form method="post" id="edit-form">
<h2>General</h2>
<div class="row">
<div class="col-sm">
<div class="form-group">
<label asp-for="Name"></label>
<input type="text" class="form-control" asp-for="Name">
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label asp-for="Email"></label>
<input type="email" class="form-control" asp-for="Email">
</div>
</div>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="EmailVerified">
<label class="form-check-label" asp-for="EmailVerified"></label>
</div>
<h2>Premium</h2>
<div class="row">
<div class="col-sm">
<div class="form-group">
<label asp-for="MaxStorageGb"></label>
<input type="number" class="form-control" asp-for="MaxStorageGb" min="1">
</div>
</div>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" asp-for="Premium">
<label class="form-check-label" asp-for="Premium"></label>
</div>
<h2>Licensing</h2>
<div class="row">
<div class="col-sm">
<div class="form-group">
<label asp-for="LicenseKey"></label>
<input type="text" class="form-control" asp-for="LicenseKey">
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label asp-for="PremiumExpirationDate"></label>
<input type="datetime-local" class="form-control" asp-for="PremiumExpirationDate">
</div>
</div>
</div>
<h2>Billing</h2>
<div class="row">
<div class="col-sm">
<div class="form-group">
<div class="form-group">
<label asp-for="Gateway"></label>
<select class="form-control" asp-for="Gateway"
asp-items="Html.GetEnumSelectList<Bit.Core.Enums.GatewayType>()">
<option value="">--</option>
</select>
</div>
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label asp-for="GatewayCustomerId"></label>
<div class="input-group">
<input type="text" class="form-control" asp-for="GatewayCustomerId">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" id="gateway-customer-link">
<i class="fa fa-external-link"></i>
</button>
</div>
</div>
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label asp-for="GatewaySubscriptionId"></label>
<div class="input-group">
<input type="text" class="form-control" asp-for="GatewaySubscriptionId">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" id="gateway-subscription-link">
<i class="fa fa-external-link"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="d-flex mt-4">
<button type="submit" class="btn btn-primary" form="edit-form">Save</button>
<div class="ml-auto d-flex">
<button class="btn btn-secondary mr-2" type="button" id="upgrade-premium">
Upgrade Premium
</button>
<form asp-action="Delete" asp-route-id="@Model.User.Id"
onsubmit="return confirm('Are you sure you want to delete this user (@Model.User.Email)?')">
<button class="btn btn-danger" type="submit">Delete</button>
</form>
</div>
</div>