Skip to content

Commit

Permalink
feedback PO
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashendrickx committed Oct 22, 2024
1 parent fc50152 commit cfc4a49
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
6 changes: 5 additions & 1 deletion src/Admin/AdminConsole/Models/CreateMspProviderModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.SharedWeb.Utilities;

namespace Bit.Admin.AdminConsole.Models;
Expand All @@ -17,7 +18,10 @@ public class CreateMspProviderModel : IValidatableObject

public virtual Provider ToProvider()
{
return new Provider();
return new Provider
{
Type = ProviderType.Msp
};
}

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.Core.Billing.Enums;
using Bit.SharedWeb.Utilities;

Expand All @@ -19,7 +20,10 @@ public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject

public virtual Provider ToProvider()
{
return new Provider();
return new Provider
{
Type = ProviderType.MultiOrganizationEnterprise
};
}

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
Expand Down
4 changes: 3 additions & 1 deletion src/Admin/AdminConsole/Models/CreateResellerProviderModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.AdminConsole.Entities.Provider;
using Bit.Core.AdminConsole.Enums.Provider;
using Bit.SharedWeb.Utilities;

namespace Bit.Admin.AdminConsole.Models;
Expand All @@ -21,7 +22,8 @@ public virtual Provider ToProvider()
{
Name = Name,
BusinessName = BusinessName,
BillingEmail = BillingEmail?.ToLowerInvariant().Trim()
BillingEmail = BillingEmail?.ToLowerInvariant().Trim(),
Type = ProviderType.Reseller
};
}

Expand Down
26 changes: 19 additions & 7 deletions src/Admin/AdminConsole/Views/Providers/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
@{
ViewData["Title"] = "Create Provider";

var providerTypes = Enum.GetValues<ProviderType>().ToList();
var providerTypes = Enum.GetValues<ProviderType>()
.OrderBy(x => x.GetDisplayAttribute().Order)
.ToList();

if (!FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises))
{
providerTypes.Remove(ProviderType.MultiOrganizationEnterprise);
Expand All @@ -24,13 +27,22 @@
@foreach (var providerType in providerTypes)
{
var providerTypeValue = (int)providerType;
<div class="form-check">
@Html.RadioButtonFor(m => m.Type, providerType, new { id = $"providerType-{providerTypeValue}", @class = "form-check-input", onclick = $"toggleProviderTypeInfo({providerTypeValue})" })
@Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetName(), new { @class = "form-check-label align-middle", @for = $"providerType-{providerTypeValue}" })
<br/>
@Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetDescription(), new { @class = "form-check-label small text-muted ml-3 align-top", @for = $"providerType-{providerTypeValue}" })
<div class="form-group">
<div class="row">
<div class="col">
<div class="form-check">
@Html.RadioButtonFor(m => m.Type, providerType, new { id = $"providerType-{providerTypeValue}", @class = "form-check-input" })
@Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetName(), new { @class = "form-check-label align-middle", @for = $"providerType-{providerTypeValue}" })
</div>
</div>
</div>
<div class="row">
<div class="col">
@Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetDescription(), new { @class = "form-check-label small text-muted align-top", @for = $"providerType-{providerTypeValue}" })
</div>
</div>
</div>
}
</div>
<button type="submit" class="btn btn-primary mb-2">Next Step</button>
<button type="submit" class="btn btn-primary mb-2">Next</button>
</form>
6 changes: 3 additions & 3 deletions src/Core/AdminConsole/Enums/Provider/ProviderType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace Bit.Core.AdminConsole.Enums.Provider;

public enum ProviderType : byte
{
[Display(ShortName = "MSP", Name = "Managed Service Provider", Description = "Access to clients organization")]
[Display(ShortName = "MSP", Name = "Managed Service Provider", Description = "Access to clients organization", Order = 0)]
Msp = 0,
[Display(ShortName = "Reseller", Name = "Reseller", Description = "Access to clients billing")]
[Display(ShortName = "Reseller", Name = "Reseller", Description = "Access to clients billing", Order = 1000)]
Reseller = 1,
[Display(ShortName = "MOE", Name = "Multi-organization Enterprise", Description = "Access to multiple organizations")]
[Display(ShortName = "MOE", Name = "Multi-organization Enterprise", Description = "Access to multiple organizations", Order = 1)]
MultiOrganizationEnterprise = 2,
}

0 comments on commit cfc4a49

Please sign in to comment.