Skip to content

Commit 1955fec

Browse files
committed
RE1-T112 Fixes
1 parent 392d2d9 commit 1955fec

4 files changed

Lines changed: 189 additions & 141 deletions

File tree

Core/Resgrid.Config/InfoConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static class InfoConfig
4444
LocationInfo =
4545
"This is the Resgrid system hosted in Central Europe (on OVH). This system services Resgrid customers in the European Union to help with data (GDPR) compliance requirements.",
4646
IsDefault = false,
47-
AppUrl = "https://app.eu-central.resgrid.com",
47+
AppUrl = "https://app-eu-central.resgrid.com",
4848
ApiUrl = "https://api-eu-central.resgrid.com",
4949
AllowsFreeAccounts = false
5050
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@using Microsoft.AspNetCore.Http
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>@ViewData["Title"]</title>
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
9+
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.0/css/bootstrap.min.css"
11+
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
12+
asp-fallback-test-class="sr-only"
13+
asp-fallback-test-property="position"
14+
asp-fallback-test-value="absolute" />
15+
16+
<link rel="stylesheet" href="/css/int-bundle.css" />
17+
18+
<link rel="shortcut icon" href="~/favicon.ico" />
19+
20+
@if (IsSectionDefined("Styles"))
21+
{
22+
@RenderSection("Styles", required: false)
23+
}
24+
</head>
25+
<body class="gray-bg">
26+
<div class="container" style="padding-top: 20px;">
27+
@RenderBody()
28+
</div>
29+
30+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.3/jquery.min.js"
31+
asp-fallback-src="lib/jquery/jquery-1.12.3.min.js"
32+
asp-fallback-test="window.jQuery"
33+
crossorigin="anonymous"
34+
integrity="sha384-ugqypGWrzPLdx2zEQTF17cVktjb01piRKaDNnbYGRSxyEoeAm+MKZVtbDUYjxfZ6">
35+
</script>
36+
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.0/js/bootstrap.min.js"
37+
asp-fallback-src="~/lib/bootstrap/js/bootstrap.min.js"
38+
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
39+
crossorigin="anonymous"
40+
integrity="sha384-vhJnz1OVIdLktyixHY4Uk3OHEwdQqPppqYR8+5mjsauETgLOcEynD9oPHhhz18Nw">
41+
</script>
42+
<script src="~/lib/sweetalert/dist/sweetalert.min.js"></script>
43+
44+
<script>
45+
var resgrid = resgrid || {};
46+
resgrid.absoluteBaseUrl = "@Resgrid.Config.SystemBehaviorConfig.ResgridBaseUrl";
47+
</script>
48+
49+
@if (IsSectionDefined("Scripts"))
50+
{
51+
@RenderSection("Scripts", required: false)
52+
}
53+
</body>
54+
</html>

Web/Resgrid.Web/Areas/User/Views/Subscription/Index.cshtml

Lines changed: 67 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
@inject IStringLocalizer<Resgrid.Localization.Areas.User.Subscription.Subscription> localizer
66
@{
77
ViewBag.Title = "Resgrid | " + @localizer["SubscriptionHeader"];
8+
9+
var locationName = SystemBehaviorConfig.LocationName ?? "US-West";
10+
var location = InfoConfig.Locations.Find(l => l.Name == locationName) ?? InfoConfig.Locations[0];
11+
var isEU = locationName.StartsWith("EU", StringComparison.OrdinalIgnoreCase);
12+
var currencySymbol = isEU ? "\u20AC" : "$";
813
}
914

1015
@section Styles
@@ -319,7 +324,17 @@
319324

320325
@if (Model.Plan == null || Model.Plan.PlanId == 1)
321326
{
322-
<p>Move the blue slider below with the arrows to select the number of Entities (Users + Units) you require. You can also type in the Entity count (in increments of 10) in the text box below. Please the "Buy Yearly" or "Buy Monthly" depending on the payment interval you wish. This will then take you to the Stripe checkout page. Please note you cannot buy a 10 entity pack as that is our free plan.</p>
327+
<p>Select the number of Entities (Users + Units) you require using the slider or text box below.
328+
@if (!isEU) { <text>Your first 10 entities are included at no chargeeach</text> } else { <text>Each</text> }
329+
additional pack of 10 entities is billed at the rate shown. Select "Buy Yearly" or "Buy Monthly" to proceed to checkout.</p>
330+
331+
@if (isEU)
332+
{
333+
<div class="alert alert-info" style="font-size:13px;">
334+
<strong>European Region</strong> — Pricing includes GDPR-compliant data hosting. All prices shown in EUR (@currencySymbol) with a regional adjustment. No free tier is available.
335+
</div>
336+
}
337+
323338
<div class="price-box">
324339

325340
<form class="form-horizontal form-pricing" role="form">
@@ -345,21 +360,19 @@
345360
</div>
346361
</div>
347362
<div class="form-group">
348-
<label for="amount" class="col-sm-6 control-label">Monthly ($): </label>
363+
<label for="amount" class="col-sm-6 control-label">Monthly (@currencySymbol): </label>
349364
<span class="help-text">Monthly billing amount</span>
350365
<div class="col-sm-6">
351366
<input type="hidden" id="amount" class="form-control">
352-
<p class="price lead" id="monthly-label"></p>
353-
<span class="price">.00</span>
367+
<p class="price lead" id="monthly-label">0.00</p>
354368
</div>
355369
</div>
356370
<div class="form-group">
357-
<label for="duration" class="col-sm-6 control-label">Yearly ($): </label>
371+
<label for="duration" class="col-sm-6 control-label">Yearly (@currencySymbol): </label>
358372
<span class="help-text">Yearly (annual) billing amount</span>
359373
<div class="col-sm-6">
360374
<input type="hidden" id="duration" class="form-control">
361-
<p class="price lead" id="yearly-label"></p>
362-
<span class="price">.00</span>
375+
<p class="price lead" id="yearly-label">0.00</p>
363376
</div>
364377
</div>
365378
<hr class="style">
@@ -627,6 +640,9 @@
627640
628641
629642
643+
var IS_EU = @(isEU ? "true" : "false");
644+
var EU_MULTIPLIER = 1.25;
645+
630646
$(document).ready(function () {
631647
$("#slider").slider({
632648
animate: true,
@@ -639,7 +655,7 @@
639655
handle.text($(this).slider("value"));
640656
},
641657
slide: function (event, ui) {
642-
update(1, ui.value); //changed
658+
update(1, ui.value);
643659
}
644660
});
645661
@@ -663,97 +679,87 @@
663679
}
664680
});
665681
666-
//Added, set initial value.
667682
$("#amount").val(10);
668-
//$("#duration").val(0);
669-
//$("#amount-label").text(0);
670-
$("#amount-input").val(0);
671-
$("#monthly-label").text(0);
672-
$("#yearly-label").text(0);
673-
674-
//$("#duration-label").text(0);
683+
$("#amount-input").val(10);
684+
$("#monthly-label").text('0.00');
685+
$("#yearly-label").text('0.00');
675686
676687
update();
677688
});
678689
679-
//changed. now with parameter
680-
function update(slider, val) {
690+
function update(sliderFlag, sliderVal) {
681691
let handle = $("#handle-text");
682-
683-
//changed. Now, directly take value from ui.value. if not set (initial, will use current value.)
684-
var $amount = slider == 1 ? val : $("#amount").val();
685-
var $duration = slider == 2 ? val : $("#duration").val();
686-
687-
/* commented
688-
$amount = $( "#slider" ).slider( "value" );
689-
$duration = $( "#slider2" ).slider( "value" );
690-
*/
692+
var $amount = sliderFlag == 1 ? sliderVal : $("#amount").val();
693+
var showButtons = IS_EU ? ($amount >= 10) : ($amount > 10);
691694
692695
handle.text($amount);
693-
//$total = "$" + ($amount * $duration);
694696
$("#amount").val($amount);
695-
//$("#amount-label").text($amount);
696697
$("#amount-input").val($amount);
697698
698-
if ($amount > 10) {
699-
const totalCostMonthly = calculateCostFromUsers($amount, true);
700-
const totalCostYearly = calculateCostFromUsers($amount, false);
699+
if (showButtons) {
700+
var totalCostMonthly = calculateCostFromUsers($amount, true);
701+
var totalCostYearly = calculateCostFromUsers($amount, false);
701702
702-
$("#monthly-label").text(totalCostMonthly);
703-
$("#yearly-label").text(totalCostYearly);
703+
$("#monthly-label").text(totalCostMonthly.toFixed(2));
704+
$("#yearly-label").text(totalCostYearly.toFixed(2));
704705
705706
$("#buyYearlyButton").show();
706707
$("#buyMonthlyButton").show();
707708
} else {
708-
$("#monthly-label").text(0);
709-
$("#yearly-label").text(0);
709+
$("#monthly-label").text('0.00');
710+
$("#yearly-label").text('0.00');
710711
711712
$("#buyYearlyButton").hide();
712713
$("#buyMonthlyButton").hide();
713714
}
714715
}
715716
716-
717717
const calculateCostFromUsers = (totalNumUsers, isMonthly) => {
718-
let marginalBreakdownStrs = [];
719-
720718
const pricingTiersMonthly = [
721-
//{ tier: 0, marginalUserSlots: 1, costPerUser: 0.0 },
722-
{ tier: 0, marginalUserSlots: 5, costPerUser: 20.0 },
723-
{ tier: 1, marginalUserSlots: 100, costPerUser: 2.0 },
724-
{ tier: 2, marginalUserSlots: 1000, costPerUser: 1.5 },
725-
{ tier: 3, marginalUserSlots: 5000, costPerUser: 1.0 },
726-
{ tier: 4, marginalUserSlots: 999999999, costPerUser: 0.5 },
719+
{ marginalUserSlots: 1, costPerUser: 0.0 },
720+
{ marginalUserSlots: 5, costPerUser: 20.0 },
721+
{ marginalUserSlots: 100, costPerUser: 2.0 },
722+
{ marginalUserSlots: 1000, costPerUser: 1.5 },
723+
{ marginalUserSlots: 5000, costPerUser: 1.0 },
724+
{ marginalUserSlots: 999999999, costPerUser: 0.5 },
727725
];
728726
729727
const pricingTiersYearly = [
730-
//{ tier: 0, marginalUserSlots: 1, costPerUser: 0.0 },
731-
{ tier: 0, marginalUserSlots: 5, costPerUser: 200.0 },
732-
{ tier: 1, marginalUserSlots: 100, costPerUser: 20.0 },
733-
{ tier: 2, marginalUserSlots: 1000, costPerUser: 15.0 },
734-
{ tier: 3, marginalUserSlots: 5000, costPerUser: 10.0 },
735-
{ tier: 4, marginalUserSlots: 999999999, costPerUser: 5.0 },
728+
{ marginalUserSlots: 1, costPerUser: 0.0 },
729+
{ marginalUserSlots: 5, costPerUser: 200.0 },
730+
{ marginalUserSlots: 100, costPerUser: 20.0 },
731+
{ marginalUserSlots: 1000, costPerUser: 15.0 },
732+
{ marginalUserSlots: 5000, costPerUser: 10.0 },
733+
{ marginalUserSlots: 999999999, costPerUser: 5.0 },
736734
];
737735
738736
let finalCost = 0.0;
739-
let remainingUsers = (totalNumUsers / 10) - 1; // First 10 users are free.
740-
let pricingTiers = isMonthly ? pricingTiersMonthly : pricingTiersYearly;
737+
let remainingUsers = totalNumUsers / 10;
738+
const baseTiers = isMonthly ? pricingTiersMonthly : pricingTiersYearly;
739+
740+
let tiers;
741+
if (IS_EU) {
742+
tiers = [{
743+
marginalUserSlots: baseTiers[0].marginalUserSlots + baseTiers[1].marginalUserSlots,
744+
costPerUser: baseTiers[1].costPerUser
745+
}].concat(baseTiers.slice(2));
746+
} else {
747+
tiers = baseTiers;
748+
}
741749
742-
for (let i = 0; i < pricingTiers.length; i++) {
743-
let tier = pricingTiers[i];
750+
for (let i = 0; i < tiers.length; i++) {
751+
let tier = tiers[i];
744752
if (tier.marginalUserSlots < remainingUsers) {
745-
// calculate cost
746753
finalCost += tier.marginalUserSlots * tier.costPerUser;
747-
marginalBreakdownStrs.push(`${tier.marginalUserSlots} @@ $${tier.costPerUser}`);
748-
// remove the users
749754
remainingUsers -= tier.marginalUserSlots;
750755
} else {
751-
// only need the partial group of the marginal user slots/ potentially all of them
752756
finalCost += tier.costPerUser * remainingUsers;
753-
marginalBreakdownStrs.push(`${remainingUsers} @@ $${tier.costPerUser}`);
754757
remainingUsers = 0;
755758
}
756-
//console.log("RemainingUsers: ", remainingUsers);
759+
}
760+
761+
if (IS_EU) {
762+
finalCost = Math.round(finalCost * EU_MULTIPLIER);
757763
}
758764
759765
return finalCost;

0 commit comments

Comments
 (0)