diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 7705393d..cff8063a 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -289,6 +289,10 @@ h6 { align-items: center; position: relative; } +.intro-pricing.success-pricing{ + height: 100vh; + max-height: 100vh; +} .intro-pricing::before{ content: ""; position: absolute; @@ -296,7 +300,7 @@ h6 { bottom: 0; left: 0; right: 0; - background: rgba(90, 116, 175, 0.8); + background: rgba(90, 116, 175, 0.7); } .intro-pricing .intro-message .section-heading{ font-size: 45px; @@ -578,8 +582,8 @@ h6 { } .price-calc-section .text .section-heading{ font-family: 'Montserrat-Bold'; - font-size: 48px; - line-height: 48px; + font-size: 50px; + line-height: 50px; padding-bottom: 25px; color: #3a3a3a; letter-spacing: 1px; @@ -636,24 +640,22 @@ h6 { border-bottom: 1px solid rgba(128, 128, 128, 0.3); position: relative; display: flex; - justify-content: center; + justify-content: space-around; align-items: center; } -.price-calc-section .card .description span{ - font-size: 20px; +.price-calc-section .card .description span { + font-size: 16px; margin-left: 4px; + margin-left: 0px; + /* justify-self: start; */ + width: 30%; + text-align: left; } .price-calc-section .card .description input{ font-size: 20px; text-align: center; - width: 70px; -} -.price-calc-section .card .description #coreValue{ - width: 50px; -} -.price-calc-section .card .description #ramValue{ - width: 50px; + width: 60px; } .price-calc-section .card .description i{ color: #29427A; @@ -684,12 +686,32 @@ h6 { height: 40px; width: 200px; text-align: center; - font-size: 18px; + font-size: 16px; + margin-left: 10px; } .price-calc-section .card .check-ip{ font-size: 18px; } - +.price-calc-section .card .description.input{ + justify-content: center; +} +.price-calc-section .card .description.input label{ + font-size: 15px; + font-weight: 800; + font-family: 'Montserrat-Regular'; + margin-bottom: 0; + width: 40px; +} +.price-calc-section .card .description.input input{ + width: 200px; + font-size: 14px; + text-align: left; + padding: 5px 10px; + border-radius: 4px; + border: 1px solid #d0d0d0; + background: #fff; + margin-left: 10px; +} .price-calc-section .card .check-ip input[type=checkbox]{ font-size: 17px; margin: 0 8px; @@ -814,6 +836,10 @@ h6 { transform: translate(-50%, 0); } + .intro-pricing .intro-message .section-heading { + font-size: 30px; + } + .price-calc-section{ flex-direction: column; padding: 60px 10px !important; @@ -842,6 +868,14 @@ h6 { font-size: 18px; text-align: center; } + + .price-calc-section .card .description input { + font-size: 17px; + text-align: center; + width: 60px; + } + + } @media(max-width:540px) { @@ -858,13 +892,13 @@ h6 { .intro-message > h1 { font-size: 2em; } - .price-calc-section .text .section-heading { + .price-calc-section .text .section-heading { font-size: 24px; line-height: 25px; } .price-calc-section .card .description span { - font-size: 17px; - margin-left: 4px; + font-size: 15px; + margin-left: 0px; } } @@ -960,3 +994,7 @@ a#forgotpassword { .form-300{ width: 300px; } + +.error-message-box{ + margin-top: 20px; +} diff --git a/datacenterlight/templates/datacenterlight/beta_access.html b/datacenterlight/templates/datacenterlight/beta_access.html index 1552a1c0..c7a2f14e 100644 --- a/datacenterlight/templates/datacenterlight/beta_access.html +++ b/datacenterlight/templates/datacenterlight/beta_access.html @@ -18,7 +18,7 @@ {{ form.email.errors|striptags}} - + + + + + + - + + diff --git a/datacenterlight/templates/datacenterlight/pricing.html b/datacenterlight/templates/datacenterlight/pricing.html index 6c1be74c..7c8e66a6 100644 --- a/datacenterlight/templates/datacenterlight/pricing.html +++ b/datacenterlight/templates/datacenterlight/pricing.html @@ -1,7 +1,7 @@ {% load staticfiles i18n%} {% get_current_language as LANGUAGE_CODE %} - + diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index 9c3c84fb..f14e7186 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url -from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView +from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView, SuccessView, OrderView urlpatterns = [ @@ -8,5 +8,7 @@ urlpatterns = [ url(r'^/beta-program/?$', BetaProgramView.as_view(), name='beta'), url(r'^/landing/?$', LandingProgramView.as_view(), name='landing'), url(r'^/pricing/?$', PricingView.as_view(), name='pricing'), + url(r'^/order/?$', OrderView.as_view(), name='order'), + url(r'^/order-success/?$', SuccessView.as_view(), name='order_success'), url(r'^/beta_access?$', BetaAccessView.as_view(), name='beta_access'), ] diff --git a/datacenterlight/views.py b/datacenterlight/views.py index f8a5de6a..19591339 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -7,6 +7,8 @@ from django.core.urlresolvers import reverse_lazy, reverse from utils.mailer import BaseEmail from django.shortcuts import render from django.shortcuts import redirect +from django import forms +from django.core.exceptions import ValidationError from opennebula_api.models import OpenNebulaManager from opennebula_api.serializers import VirtualMachineTemplateSerializer @@ -14,6 +16,9 @@ from opennebula_api.serializers import VirtualMachineTemplateSerializer class LandingProgramView(TemplateView): template_name = "datacenterlight/landing.html" +class SuccessView(TemplateView): + template_name = "datacenterlight/success.html" + class PricingView(TemplateView): template_name = "datacenterlight/pricing.html" @@ -63,6 +68,81 @@ class PricingView(TemplateView): return redirect(reverse('hosting:payment')) +class OrderView(TemplateView): + template_name = "datacenterlight/order.html" + + def get(self, request, *args, **kwargs): + try: + manager = OpenNebulaManager() + templates = manager.get_templates() + + context = { + 'templates': VirtualMachineTemplateSerializer(templates, many=True).data, + } + except: + messages.error( request, + 'We have a temporary problem to connect to our backend. \ + Please try again in a few minutes' + ) + context = { + 'error' : 'connection' + } + + return render(request, self.template_name, context) + + def post(self, request): + + cores = request.POST.get('cpu') + memory = request.POST.get('ram') + storage = request.POST.get('storage') + price = request.POST.get('total') + template_id = int(request.POST.get('config')) + manager = OpenNebulaManager() + template = manager.get_template(template_id) + template_data = VirtualMachineTemplateSerializer(template).data + + name = request.POST.get('name') + email = request.POST.get('email') + name_field = forms.CharField() + email_field = forms.EmailField() + try: + name = name_field.clean(name) + except ValidationError as err: + messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name)) + return HttpResponseRedirect(reverse('datacenterlight:order')) + + try: + email = email_field.clean(email) + except ValidationError as err: + messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email)) + return HttpResponseRedirect(reverse('datacenterlight:order')) + + # We have valid email and name of the customer, hence send an + # email to the admin + + context = { + 'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()), + 'name': name, + 'email': email, + 'cores': cores, + 'memory': memory, + 'storage': storage, + 'price': price, + 'template': template_data['name'], + } + email_data = { + 'subject': 'New Order Received', + 'to': 'info@ungleich.ch', + 'context': context, + 'template_name': 'new_order_notification', + 'template_path': 'datacenterlight/emails/' + } + email = BaseEmail(**email_data) + email.send() + + return HttpResponseRedirect(reverse('datacenterlight:order_success')) + + class BetaAccessView(FormView): template_name = "datacenterlight/beta_access.html" form_class = BetaAccessForm