From 545b49ecd2309f4d52a94d54e046f9adae52fe5c Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 16 Jul 2025 15:12:25 +0200 Subject: [PATCH] csp roi calculator --- .../calculator/csp_roi_calculator.html | 1276 +++++++++++++++++ .../templates/calculator/password_form.html | 39 + hub/services/urls.py | 5 + hub/services/views/__init__.py | 1 + hub/services/views/calculator.py | 37 + 5 files changed, 1358 insertions(+) create mode 100644 hub/services/templates/calculator/csp_roi_calculator.html create mode 100644 hub/services/templates/calculator/password_form.html create mode 100644 hub/services/views/calculator.py diff --git a/hub/services/templates/calculator/csp_roi_calculator.html b/hub/services/templates/calculator/csp_roi_calculator.html new file mode 100644 index 0000000..c05152a --- /dev/null +++ b/hub/services/templates/calculator/csp_roi_calculator.html @@ -0,0 +1,1276 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}CSP ROI Calculator{% endblock %} + +{% block extra_css %} + + +{% endblock %} + +{% block content %} +
+
+ +
+
+
+

CSP ROI Calculator

+

Calculate potential returns from investing in Servala platform

+
+
+ + +
+
+
+
+ +
+ +
+ +
+
Export Results
+
+ + +
+
+ + +
+

Investment Settings

+ +
+ +
+ CHF + +
+
+ +
+ CHF 100,000 - CHF 2,000,000 +
+ +
+ + +
+ +
+ + +
+ +
+ 5% - 20% +
+
+ + +
+

Revenue Model

+ +
+ +
+ CHF + +
+
+ +
+ CHF 20 - CHF 200 +
+ +
+ + +
+ +
+ 10% - 40% +
+ +
+ + +
+ +
+ 0 - 24 months (100% revenue to CSP) +
+
+ + +
+

Growth Scenarios

+ +
+
+ + +
+

Steady, predictable growth with minimal risk

+ Churn: 2% | New instances: 50-200/month +
+ +
+
+ + +
+

Balanced approach with moderate risk/reward

+ Churn: 3% | New instances: 100-400/month +
+ +
+
+ + +
+

Rapid expansion with higher risk/reward

+ Churn: 5% | New instances: 200-800/month +
+ + +
+
+
+ Advanced Parameters + +
+
+
+
+ +
+
+
+
+
+ + +
+ +
+
+ Calculating... +
+

Calculating scenarios...

+
+ + +
+
+
+
0
+
Total Instances
+
+
+
+
+
CHF 0
+
Total Revenue
+
+
+
+
+
0%
+
Average ROI
+
+
+
+
+
N/A
+
Avg Break-even
+
+
+
+ + +
+
+
+
Instance Growth Over Time
+ +
+
+
+ +
+
+
+
Cumulative Revenue
+ +
+
+
+
+
Monthly Cash Flow
+ +
+
+
+ + +
+
+
+
Scenario Comparison
+
+ + + + + + + + + + + + + + + + +
ScenarioFinal InstancesTotal RevenueCSP RevenueServala RevenueROIBreak-evenNPV Break-even
+
+
+
+
+ + +
+
+
+
+
+ Monthly Breakdown + +
+
+
+
+
+ + + + + + + + + + + + + + + + + +
MonthScenarioNew InstancesChurnedTotal InstancesMonthly RevenueCSP RevenueServala RevenueCumulative CSP
+
+
+
+
+
+
+
+
+
+{% endblock %} + +{% block extra_js %} + + + +{% endblock %} diff --git a/hub/services/templates/calculator/password_form.html b/hub/services/templates/calculator/password_form.html new file mode 100644 index 0000000..71f51f8 --- /dev/null +++ b/hub/services/templates/calculator/password_form.html @@ -0,0 +1,39 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Authentication Required{% endblock %} + +{% block content %} +
+
+
+
+
+
+ +

Authentication Required

+

Please enter the password to access the CSP ROI Calculator

+
+ + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + +
+ {% csrf_token %} +
+ + +
+ +
+
+
+
+
+
+{% endblock %} diff --git a/hub/services/urls.py b/hub/services/urls.py index 2ead4b0..d03881a 100644 --- a/hub/services/urls.py +++ b/hub/services/urls.py @@ -29,4 +29,9 @@ urlpatterns = [ views.pricelist, name="pricelist", ), + path( + "csp-roi-calculator/", + views.csp_roi_calculator, + name="csp_roi_calculator", + ), ] diff --git a/hub/services/views/__init__.py b/hub/services/views/__init__.py index 56d2142..b67de3f 100644 --- a/hub/services/views/__init__.py +++ b/hub/services/views/__init__.py @@ -7,3 +7,4 @@ from .services import * from .pages import * from .subscriptions import * from .pricelist import * +from .calculator import * diff --git a/hub/services/views/calculator.py b/hub/services/views/calculator.py new file mode 100644 index 0000000..fb257d3 --- /dev/null +++ b/hub/services/views/calculator.py @@ -0,0 +1,37 @@ +from django.shortcuts import render, redirect +from django.contrib import messages +from django.views.decorators.http import require_http_methods + + +@require_http_methods(["GET", "POST"]) +def csp_roi_calculator(request): + """ + CSP ROI Calculator - Protected view with password authentication + Provides a comprehensive ROI calculation tool for cloud provider investors + """ + # Handle logout + if request.method == "POST" and request.POST.get("logout"): + request.session.pop("csp_calculator_authenticated", None) + return redirect("services:csp_roi_calculator") + + # Simple password protection - check if authenticated in session + if not request.session.get("csp_calculator_authenticated", False): + if request.method == "POST": + password = request.POST.get("password", "") + # Simple password check - in production, this should be more secure + if password == "servala2025": # TODO: Move to environment variable + request.session["csp_calculator_authenticated"] = True + return redirect("services:csp_roi_calculator") + else: + messages.error(request, "Invalid password. Please try again.") + + # Show password form + return render(request, "calculator/password_form.html") + + # User is authenticated, show the calculator + context = { + "page_title": "CSP ROI Calculator", + "page_description": "Calculate potential returns from investing in Servala platform", + } + + return render(request, "calculator/csp_roi_calculator.html", context)