From cfc4a494b19c89584cb0c5f9f0be398b58dc4745 Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Tue, 22 Oct 2024 21:12:36 +0200 Subject: [PATCH] feedback PO --- .../Models/CreateMspProviderModel.cs | 6 ++++- ...ultiOrganizationEnterpriseProviderModel.cs | 6 ++++- .../Models/CreateResellerProviderModel.cs | 4 ++- .../Views/Providers/Create.cshtml | 26 ++++++++++++++----- .../Enums/Provider/ProviderType.cs | 6 ++--- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/Admin/AdminConsole/Models/CreateMspProviderModel.cs b/src/Admin/AdminConsole/Models/CreateMspProviderModel.cs index b0593ea61fbe..f48cf21767b4 100644 --- a/src/Admin/AdminConsole/Models/CreateMspProviderModel.cs +++ b/src/Admin/AdminConsole/Models/CreateMspProviderModel.cs @@ -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; @@ -17,7 +18,10 @@ public class CreateMspProviderModel : IValidatableObject public virtual Provider ToProvider() { - return new Provider(); + return new Provider + { + Type = ProviderType.Msp + }; } public IEnumerable Validate(ValidationContext validationContext) diff --git a/src/Admin/AdminConsole/Models/CreateMultiOrganizationEnterpriseProviderModel.cs b/src/Admin/AdminConsole/Models/CreateMultiOrganizationEnterpriseProviderModel.cs index 5d7c72100107..ef7210a9ef79 100644 --- a/src/Admin/AdminConsole/Models/CreateMultiOrganizationEnterpriseProviderModel.cs +++ b/src/Admin/AdminConsole/Models/CreateMultiOrganizationEnterpriseProviderModel.cs @@ -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; @@ -19,7 +20,10 @@ public class CreateMultiOrganizationEnterpriseProviderModel : IValidatableObject public virtual Provider ToProvider() { - return new Provider(); + return new Provider + { + Type = ProviderType.MultiOrganizationEnterprise + }; } public IEnumerable Validate(ValidationContext validationContext) diff --git a/src/Admin/AdminConsole/Models/CreateResellerProviderModel.cs b/src/Admin/AdminConsole/Models/CreateResellerProviderModel.cs index d94257d8e212..958faf3f85e8 100644 --- a/src/Admin/AdminConsole/Models/CreateResellerProviderModel.cs +++ b/src/Admin/AdminConsole/Models/CreateResellerProviderModel.cs @@ -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; @@ -21,7 +22,8 @@ public virtual Provider ToProvider() { Name = Name, BusinessName = BusinessName, - BillingEmail = BillingEmail?.ToLowerInvariant().Trim() + BillingEmail = BillingEmail?.ToLowerInvariant().Trim(), + Type = ProviderType.Reseller }; } diff --git a/src/Admin/AdminConsole/Views/Providers/Create.cshtml b/src/Admin/AdminConsole/Views/Providers/Create.cshtml index 2a170185f09b..8f43a4f85eaf 100644 --- a/src/Admin/AdminConsole/Views/Providers/Create.cshtml +++ b/src/Admin/AdminConsole/Views/Providers/Create.cshtml @@ -9,7 +9,10 @@ @{ ViewData["Title"] = "Create Provider"; - var providerTypes = Enum.GetValues().ToList(); + var providerTypes = Enum.GetValues() + .OrderBy(x => x.GetDisplayAttribute().Order) + .ToList(); + if (!FeatureService.IsEnabled(FeatureFlagKeys.PM12275_MultiOrganizationEnterprises)) { providerTypes.Remove(ProviderType.MultiOrganizationEnterprise); @@ -24,13 +27,22 @@ @foreach (var providerType in providerTypes) { var providerTypeValue = (int)providerType; -
- @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}" }) -
- @Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetDescription(), new { @class = "form-check-label small text-muted ml-3 align-top", @for = $"providerType-{providerTypeValue}" }) +
+
+
+
+ @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}" }) +
+
+
+
+
+ @Html.LabelFor(m => m.Type, providerType.GetDisplayAttribute()?.GetDescription(), new { @class = "form-check-label small text-muted align-top", @for = $"providerType-{providerTypeValue}" }) +
+
}
- + diff --git a/src/Core/AdminConsole/Enums/Provider/ProviderType.cs b/src/Core/AdminConsole/Enums/Provider/ProviderType.cs index 087c1679061c..50c344ec955b 100644 --- a/src/Core/AdminConsole/Enums/Provider/ProviderType.cs +++ b/src/Core/AdminConsole/Enums/Provider/ProviderType.cs @@ -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, }