mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
[AC-1345] Moved trials logic to a new function on _OrganizationFormScripts (#2917)
This commit is contained in:
parent
05f11a8ee1
commit
8e40e0bfeb
@ -20,60 +20,16 @@
|
|||||||
alert('Organization is not on a free plan.');
|
alert('Organization is not on a free plan.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Plan
|
togglePlanSettings('@((byte)Bit.Core.Enums.PlanType.TeamsAnnually)');
|
||||||
document.getElementById('@(nameof(Model.PlanType))').value = '@((byte)Bit.Core.Enums.PlanType.TeamsAnnually)';
|
|
||||||
document.getElementById('@(nameof(Model.Plan))').value = 'Teams (Trial)';
|
document.getElementById('@(nameof(Model.Plan))').value = 'Teams (Trial)';
|
||||||
document.getElementById('@(nameof(Model.Seats))').value = '10';
|
|
||||||
document.getElementById('@(nameof(Model.MaxCollections))').value = '';
|
|
||||||
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
|
|
||||||
// Features
|
|
||||||
document.getElementById('@(nameof(Model.UsePolicies))').checked = false;
|
|
||||||
document.getElementById('@(nameof(Model.UseSso))').checked = false;
|
|
||||||
document.getElementById('@(nameof(Model.UseGroups))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseDirectory))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseEvents))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UsersGetPremium))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = false;
|
|
||||||
document.getElementById('@(nameof(Model.UseTotp))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.Use2fa))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseApi))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.SelfHost))').checked = false;
|
|
||||||
document.getElementById('@(nameof(Model.UseResetPassword))').checked = false;
|
|
||||||
document.getElementById('@(nameof(Model.UseScim))').checked = false;
|
|
||||||
// Licensing
|
|
||||||
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
|
|
||||||
document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate';
|
|
||||||
document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true;
|
|
||||||
});
|
});
|
||||||
document.getElementById('enterprise-trial').addEventListener('click', () => {
|
document.getElementById('enterprise-trial').addEventListener('click', () => {
|
||||||
if (document.getElementById('@(nameof(Model.PlanType))').value !== '@((byte)Bit.Core.Enums.PlanType.Free)') {
|
if (document.getElementById('@(nameof(Model.PlanType))').value !== '@((byte)Bit.Core.Enums.PlanType.Free)') {
|
||||||
alert('Organization is not on a free plan.');
|
alert('Organization is not on a free plan.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Plan
|
togglePlanSettings('@((byte)Bit.Core.Enums.PlanType.EnterpriseAnnually)');
|
||||||
document.getElementById('@(nameof(Model.PlanType))').value = '@((byte)Bit.Core.Enums.PlanType.EnterpriseAnnually)';
|
|
||||||
document.getElementById('@(nameof(Model.Plan))').value = 'Enterprise (Trial)';
|
document.getElementById('@(nameof(Model.Plan))').value = 'Enterprise (Trial)';
|
||||||
document.getElementById('@(nameof(Model.Seats))').value = '10';
|
|
||||||
document.getElementById('@(nameof(Model.MaxCollections))').value = '';
|
|
||||||
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
|
|
||||||
// Features
|
|
||||||
document.getElementById('@(nameof(Model.UsePolicies))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseSso))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseGroups))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseDirectory))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseEvents))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UsersGetPremium))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseTotp))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.Use2fa))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseApi))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.SelfHost))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseResetPassword))').checked = true;
|
|
||||||
document.getElementById('@(nameof(Model.UseScim))').checked = true;
|
|
||||||
// Licensing
|
|
||||||
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
|
|
||||||
document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate';
|
|
||||||
document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true;
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
@await Html.PartialAsync("_OrganizationFormScripts")
|
@await Html.PartialAsync("_OrganizationFormScripts")
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
togglePlanSettings('@((byte)Model.PlanType)');
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>New Client Organization</h1>
|
<h1>New Client Organization</h1>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
const selectEl = document.getElementById('@(nameof(Model.PlanType))');
|
const selectEl = document.getElementById('@(nameof(Model.PlanType))');
|
||||||
const selectText = selectEl.options[selectEl.selectedIndex].text;
|
const selectText = selectEl.options[selectEl.selectedIndex].text;
|
||||||
document.getElementById('@(nameof(Model.Plan))').value = selectText;
|
document.getElementById('@(nameof(Model.Plan))').value = selectText;
|
||||||
|
togglePlanSettings(selectEl.options[selectEl.selectedIndex].value);
|
||||||
});
|
});
|
||||||
document.getElementById('gateway-customer-link').addEventListener('click', () => {
|
document.getElementById('gateway-customer-link').addEventListener('click', () => {
|
||||||
const gateway = document.getElementById('@(nameof(Model.Gateway))');
|
const gateway = document.getElementById('@(nameof(Model.Gateway))');
|
||||||
@ -32,4 +33,62 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
function togglePlanSettings(planType) {
|
||||||
|
document.getElementById('@(nameof(Model.PlanType))').value = planType;
|
||||||
|
switch(planType) {
|
||||||
|
case '@((byte)Bit.Core.Enums.PlanType.TeamsMonthly)':
|
||||||
|
case '@((byte)Bit.Core.Enums.PlanType.TeamsAnnually)':
|
||||||
|
// Plan
|
||||||
|
document.getElementById('@(nameof(Model.Seats))').value = '10';
|
||||||
|
document.getElementById('@(nameof(Model.MaxCollections))').value = '';
|
||||||
|
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
|
||||||
|
// Features
|
||||||
|
document.getElementById('@(nameof(Model.UsePolicies))').checked = false;
|
||||||
|
document.getElementById('@(nameof(Model.UseSso))').checked = false;
|
||||||
|
document.getElementById('@(nameof(Model.UseGroups))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseDirectory))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseEvents))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UsersGetPremium))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = false;
|
||||||
|
document.getElementById('@(nameof(Model.UseTotp))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.Use2fa))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseApi))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.SelfHost))').checked = false;
|
||||||
|
document.getElementById('@(nameof(Model.UseResetPassword))').checked = false;
|
||||||
|
document.getElementById('@(nameof(Model.UseScim))').checked = false;
|
||||||
|
// Licensing
|
||||||
|
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
|
||||||
|
document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate';
|
||||||
|
document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '@((byte)Bit.Core.Enums.PlanType.EnterpriseMonthly)':
|
||||||
|
case '@((byte)Bit.Core.Enums.PlanType.EnterpriseAnnually)':
|
||||||
|
// Plan
|
||||||
|
document.getElementById('@(nameof(Model.Seats))').value = '10';
|
||||||
|
document.getElementById('@(nameof(Model.MaxCollections))').value = '';
|
||||||
|
document.getElementById('@(nameof(Model.MaxStorageGb))').value = '1';
|
||||||
|
// Features
|
||||||
|
document.getElementById('@(nameof(Model.UsePolicies))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseSso))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseGroups))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseDirectory))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseEvents))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UsersGetPremium))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseCustomPermissions))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseTotp))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.Use2fa))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseApi))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.SelfHost))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseResetPassword))').checked = true;
|
||||||
|
document.getElementById('@(nameof(Model.UseScim))').checked = true;
|
||||||
|
// Licensing
|
||||||
|
document.getElementById('@(nameof(Model.LicenseKey))').value = '@Model.RandomLicenseKey';
|
||||||
|
document.getElementById('@(nameof(Model.ExpirationDate))').value = '@Model.FourteenDayExpirationDate';
|
||||||
|
document.getElementById('@(nameof(Model.SalesAssistedTrialStarted))').value = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user