From f8dc2c6bbee5a8a48c259bf55ef4c2b48a42b062 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 05:07:58 +0530 Subject: [PATCH 01/18] discount option added to calculator --- datacenterlight/cms_plugins.py | 1 - .../migrations/0022_auto_20180506_1950.py | 25 ++ datacenterlight/models.py | 12 +- .../static/datacenterlight/css/common.css | 9 + .../static/datacenterlight/js/main.js | 6 +- .../includes/_calculator_form.html | 11 +- .../datacenterlight/landing_payment.html | 19 +- .../datacenterlight/order_detail.html | 8 + datacenterlight/views.py | 5 +- hosting/static/hosting/css/commons.css | 9 + hosting/static/hosting/css/landing-page.css | 224 ------------ hosting/static/hosting/css/order.css | 4 + hosting/static/hosting/css/payment.css | 333 +++++++++++++----- hosting/static/hosting/js/initial.js | 6 +- hosting/templates/hosting/order_detail.html | 8 + hosting/templates/hosting/payment.html | 331 +++++++++-------- hosting/views.py | 8 +- utils/hosting_utils.py | 11 +- 18 files changed, 554 insertions(+), 476 deletions(-) create mode 100644 datacenterlight/migrations/0022_auto_20180506_1950.py diff --git a/datacenterlight/cms_plugins.py b/datacenterlight/cms_plugins.py index ecc0a355..12de0daf 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -37,7 +37,6 @@ class DCLSectionPlugin(CMSPluginBase): 'DCLSectionIconPluginModel', ] for child in instance.child_plugin_instances: - print(child.__dict__) if child.__class__.__name__ in right_children: context['children_to_side'].append(child) elif child.plugin_type == 'DCLCalculatorPlugin': diff --git a/datacenterlight/migrations/0022_auto_20180506_1950.py b/datacenterlight/migrations/0022_auto_20180506_1950.py new file mode 100644 index 00000000..dd79b825 --- /dev/null +++ b/datacenterlight/migrations/0022_auto_20180506_1950.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-05-06 14:20 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('datacenterlight', '0021_cmsintegration_calculator_placeholder'), + ] + + operations = [ + migrations.AddField( + model_name='vmpricing', + name='discount_amount', + field=models.DecimalField(decimal_places=2, default=0, max_digits=4), + ), + migrations.AddField( + model_name='vmpricing', + name='discount_name', + field=models.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/datacenterlight/models.py b/datacenterlight/models.py index eceb7617..56a19f03 100644 --- a/datacenterlight/models.py +++ b/datacenterlight/models.py @@ -34,6 +34,10 @@ class VMPricing(models.Model): hdd_unit_price = models.DecimalField( max_digits=7, decimal_places=6, default=0 ) + discount_name = models.CharField(max_length=255, null=True, blank=True) + discount_amount = models.DecimalField( + max_digits=4, decimal_places=2, default=0 + ) def __str__(self): return self.name + ' => ' + ' - '.join([ @@ -42,8 +46,12 @@ class VMPricing(models.Model): '{}/GB SSD'.format(self.ssd_unit_price.normalize()), '{}/GB HDD'.format(self.hdd_unit_price.normalize()), '{}% VAT'.format(self.vat_percentage.normalize()) - if not self.vat_inclusive else 'VAT-Incl', ] - ) + if not self.vat_inclusive else 'VAT-Incl', + '{} {}'.format( + self.discount_amount if self.discount_amount else '', + self.discount_name if self.discount_name else 'Discount' + ), + ]) @classmethod def get_vm_pricing_by_name(cls, name): diff --git a/datacenterlight/static/datacenterlight/css/common.css b/datacenterlight/static/datacenterlight/css/common.css index 895256ef..b6eabd75 100644 --- a/datacenterlight/static/datacenterlight/css/common.css +++ b/datacenterlight/static/datacenterlight/css/common.css @@ -150,3 +150,12 @@ footer .dcl-link-separator::before { border-radius: 100%; background: #777; } + +.mb-0 { + margin-bottom: 0; +} + +.thin-hr { + margin-top: 10px; + margin-bottom: 10px; +} \ No newline at end of file diff --git a/datacenterlight/static/datacenterlight/js/main.js b/datacenterlight/static/datacenterlight/js/main.js index f6ba036b..292e8c16 100644 --- a/datacenterlight/static/datacenterlight/js/main.js +++ b/datacenterlight/static/datacenterlight/js/main.js @@ -180,9 +180,13 @@ if(typeof window.ssdUnitPrice === 'undefined'){ window.ssdUnitPrice = 0.6; } + if(typeof window.discountAmount === 'undefined'){ + window.discountAmount = 0; + } var total = (cardPricing['cpu'].value * window.coresUnitPrice) + (cardPricing['ram'].value * window.ramUnitPrice) + - (cardPricing['storage'].value * window.ssdUnitPrice); + (cardPricing['storage'].value * window.ssdUnitPrice) - + window.discountAmount; total = parseFloat(total.toFixed(2)); $("#total").text(total); } diff --git a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html index 8335c7ec..dfc0bf22 100644 --- a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html +++ b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html @@ -8,6 +8,7 @@ window.ramUnitPrice = {{vm_pricing.ram_unit_price|default:0}}; window.ssdUnitPrice = {{vm_pricing.ssd_unit_price|default:0}}; window.hddUnitPrice = {{vm_pricing.hdd_unit_price|default:0}}; + window.discountAmount = {{vm_pricing.discount_amount|default:0}}; </script> {% endif %} @@ -19,11 +20,15 @@ <div class="price"> <span id="total"></span> <span>CHF/{% trans "month" %}</span> - {% if vm_pricing.vat_inclusive %} <div class="price-text"> - <p>{% trans "VAT included" %}</p> + <p> + {% if vm_pricing.vat_inclusive %}{% trans "VAT included" %} <br>{% endif %} + {% if vm_pricing.discount_amount %} + {% trans "Discount" as discount_name %} + {{ vm_pricing.discount_amount }} CHF <strong>{{ vm_pricing.discount_name|default:discount_name }}</strong> included + {% endif %} + </p> </div> - {% endif %} </div> <div class="descriptions"> <div class="description form-group"> diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index b808e033..4d111fa1 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -78,7 +78,24 @@ <hr> <p>{% trans "Configuration"%} <strong class="pull-right">{{request.session.template.name}}</strong></p> <hr> - <p class="last-p"><strong>{%trans "Total" %}</strong> <small>({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %})</small> <strong class="pull-right">{{request.session.specs.price|intcomma}} CHF/{% trans "Month" %}</strong></p> + <p> + <strong>{%trans "Total" %}</strong> + <small> + ({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}) + </small> + <strong class="pull-right">{{request.session.specs.price|intcomma}} CHF/{% trans "Month" %}</strong> + </p> + <hr> + {% if vm_pricing.discount_amount %} + <p class="mb-0"> + {%trans "Discount" as discount_name %} + <strong>{{ vm_pricing.discount_name|default:discount_name }}</strong> + <strong class="pull-right text-primary">- {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %}</strong> + </p> + <p> + ({% trans "Will be applied at checkout" %}) + </p> + {% endif %} </div> </div> </div> diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 95bfa3c6..13d2c61e 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -65,6 +65,7 @@ <span>{% trans "Disk space" %}: </span> <span class="pull-right">{{vm.disk_size|intcomma}} GB</span> </p> + <hr> {% if vm.vat > 0 %} <p> <strong>{% trans "Subtotal" %}: </strong> @@ -75,6 +76,13 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} + {% if vm_pricing.discount_amount %} + <p class="text-primary"> + {%trans "Discount" as discount_name %} + <span>{{ vm_pricing.discount_name|default:discount_name }}: </span> + <span class="pull-right">- {{ vm_pricing.discount_amount }} CHF</span> + </p> + {% endif %} <p> <strong>{% trans "Total" %}</strong> <span class="pull-right">{{vm.total_price|floatformat:2|intcomma}} CHF</span> diff --git a/datacenterlight/views.py b/datacenterlight/views.py index cccd4277..bc5ea49e 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -387,7 +387,10 @@ class OrderConfirmationView(DetailView): 'billing_address_data': ( request.session.get('billing_address_data') ), - 'cms_integration': get_cms_integration('default') + 'cms_integration': get_cms_integration('default'), + 'vm_pricing': VMPricing.get_vm_pricing_by_name( + self.request.session['specs']['pricing_name'] + ), } return render(request, self.template_name, context) diff --git a/hosting/static/hosting/css/commons.css b/hosting/static/hosting/css/commons.css index 59ca56eb..0abfd499 100644 --- a/hosting/static/hosting/css/commons.css +++ b/hosting/static/hosting/css/commons.css @@ -361,4 +361,13 @@ .locale_date.done{ opacity: 1; +} + +.mb-0 { + margin-bottom: 0; +} + +.thin-hr { + margin-top: 10px; + margin-bottom: 10px; } \ No newline at end of file diff --git a/hosting/static/hosting/css/landing-page.css b/hosting/static/hosting/css/landing-page.css index d5236324..389e6999 100644 --- a/hosting/static/hosting/css/landing-page.css +++ b/hosting/static/hosting/css/landing-page.css @@ -449,230 +449,6 @@ a.unlink:hover { color: inherit; } -/***** DCL payment page **********/ -.dcl-order-container { - font-weight: 300; -} - -.dcl-order-table-header { - border-bottom: 1px solid #eee; - padding-top: 15px; - padding-bottom: 15px; - font-size: 16px; - color: #333; - text-align: center; - font-weight: 300; -} - -.dcl-order-table-content { - border-bottom: 1px solid #eee; - padding-top: 15px; - padding-bottom: 15px; - font-size: 18px; - font-weight: 600; - text-align: center; -} - -.tbl-content { -} - -.dcl-order-table-total { - border-bottom: 4px solid #eee; - padding-top: 15px; - padding-bottom: 20px; - font-size: 20px; - font-weight: 600; - color: #999; -} - -.dcl-order-table-total span { - font-size: 13px; - color: #999; - font-weight: 400; - padding-left: 5px; -} - -.dcl-place-order-text{ - color: #808080; -} - -.dcl-order-table-total .tbl-total { - text-align: center; - color: #000; - padding-left: 44px; -} - -.tbl-total .dcl-price-month { - font-size: 16px; - text-transform: capitalize; - color: #000; -} - -.tbl-no-padding { - padding: 0px; -} - -.dcl-billing-sec { - margin-top: 50px; -} - -.dcl-order-sec { - padding: 0 30px; -} - -.card-warning-content { - font-weight: 300; - border: 1px solid #a1a1a1; - border-radius: 3px; - padding: 5px; - margin-bottom: 15px; -} -.card-warning-error { - border: 1px solid #EB4D5C; - color: #EB4D5C; -} - -.card-warning-addtional-margin { - margin-top: 15px; -} - -.stripe-payment-btn { - outline: none; - width: auto; - float: right; - font-style: normal; - font-weight: 300; - position: absolute; - padding-left: 30px; - padding-right: 30px; - right: 0; -} - -.card-cvc-element label { - padding-left: 10px; -} - -.card-element { - margin-bottom: 10px; -} - -.card-element label{ - width:100%; - margin-bottom:0px; -} - -.my-input { - border-bottom: 1px solid #ccc; - } - -.card-cvc-element .my-input { - padding-left: 10px; -} - -#card-errors { - clear: both; - padding: 0 0 10px; - color: #eb4d5c; -} - -.credit-card-goup{ - padding: 0; -} - -@media (max-width: 767px) { - .dcl-order-table-total span { - padding-left: 3px; - } - - .dcl-order-sec { - padding: 10px 20px 30px 20px; - border-bottom: 4px solid #eee; - } - - .tbl-header { - border-bottom: 1px solid #eee; - padding: 10px 0; - } - - .tbl-content { - border-bottom: 1px solid #eee; - padding: 10px 0; - } - - .dcl-order-table-header { - border-bottom: 0px solid #eee; - padding: 10px 0; - text-align: left; - } - - .dcl-order-table-content { - border-bottom: 0px solid #eee; - padding: 10px 0; - text-align: right; - font-size: 16px; - } - - .dcl-order-table-total { - font-size: 18px; - color: #000; - padding: 10px 0; - border-bottom: 0px solid #eee; - } - - .dcl-order-table-total .tbl-total { - padding: 0px; - text-align: right; - } - - .dcl-billing-sec { - margin-top: 30px; - margin-bottom: 30px; - } - - .card-expiry-element { - padding-right: 10px; - } - - .card-cvc-element { - padding-left: 10px; - } - - #billing-form .form-control { - box-shadow: none !important; - font-weight: 400; - } -} - -@media (min-width: 1200px) { - .dcl-order-container { - width: 990px; - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; - } -} - -@media (min-width: 768px) { - .dcl-billing { - padding-right: 65px; - border-right: 1px solid #eee; - } - - .dcl-creditcard { - padding-left: 65px; - } - - .tbl-tot { - padding-left: 17px; - } - - .content-dashboard { - /*width: auto !important;*/ - } - -} - @media only screen and (max-width: 1040px) and (min-width: 768px) { .content-dashboard { width: 96% !important; diff --git a/hosting/static/hosting/css/order.css b/hosting/static/hosting/css/order.css index 0cd22c21..27a67f3e 100644 --- a/hosting/static/hosting/css/order.css +++ b/hosting/static/hosting/css/order.css @@ -96,4 +96,8 @@ #virtual_machine_create_form { padding: 15px 0; +} + +.dcl-place-order-text { + color: #808080; } \ No newline at end of file diff --git a/hosting/static/hosting/css/payment.css b/hosting/static/hosting/css/payment.css index de89afd0..8a1bc70f 100644 --- a/hosting/static/hosting/css/payment.css +++ b/hosting/static/hosting/css/payment.css @@ -1,19 +1,35 @@ - -.payment-container {padding-top:70px; padding-bottom: 11%;} -.creditcard-box .panel-title {display: inline;font-weight: bold; font-size:17px;} -.creditcard-box .checkbox.pull-right { margin: 0; } -.creditcard-box .pl-ziro { padding-left: 0px; } -.creditcard-box .form-control.error { - border-color: red; - outline: 0; - box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,0,0,0.6); +.payment-container { + padding-top: 70px; + padding-bottom: 11%; } + +.creditcard-box .panel-title { + display: inline; + font-weight: bold; + font-size: 17px; +} + +.creditcard-box .checkbox.pull-right { + margin: 0; +} + +.creditcard-box .pl-ziro { + padding-left: 0px; +} + +.creditcard-box .form-control.error { + border-color: red; + outline: 0; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); +} + .creditcard-box label.error { font-weight: bold; color: red; padding: 2px 8px; margin-top: 2px; } + .creditcard-box .payment-errors { font-weight: bold; color: red; @@ -21,96 +37,221 @@ margin-top: 2px; } -/* landing page payment new style */ -.last-p { - margin-bottom: 0; -} -.dcl-payment-section { - max-width: 391px; - margin: 0 auto 30px; - padding: 0 10px 30px; - border-bottom: 1px solid #edebeb; - height: 100%; -} -.dcl-payment-section hr{ - margin-top: 15px; - margin-bottom: 15px; -} -.dcl-payment-section .top-hr { - margin-left: -10px; -} -.dcl-payment-section h3 { - font-weight: 600; -} -.dcl-payment-section p { - /*padding: 0 5px;*/ - font-weight: 400; -} -.dcl-payment-section .card-warning-content { - padding: 8px 10px; - font-weight: 300; -} -.dcl-payment-order strong{ - font-size: 17px; -} -.dcl-payment-order p { - font-weight: 300; -} -.dcl-payment-section .form-group { - margin-bottom: 10px; -} -.dcl-payment-section .form-control { - box-shadow: none; - padding: 6px 12px; - height: 32px; -} -.dcl-payment-user { - height: 100%; - display: flex; - flex-direction: column; - justify-content: center; +.dcl-order-sec { + padding: 0 30px; } -.dcl-payment-user h4 { - font-weight: 600; - font-size: 17px; +.dcl-billing-sec { + margin-top: 50px; +} + +.dcl-order-container { + font-weight: 300; +} + +.dcl-order-table-header { + border-bottom: 1px solid #eee; + padding: 15px 10px; + font-size: 16px; + color: #333; + font-weight: 300; +} + +.dcl-order-table-content { + border-bottom: 1px solid #eee; + padding: 15px 10px; + font-size: 18px; + font-weight: 600; +} + +.dcl-order-table-total { + border-bottom: 4px solid #eee; + padding-top: 15px; + padding-bottom: 20px; + font-size: 20px; + font-weight: 600; +} + +.dcl-order-table-total span { + font-size: 13px; + color: #999; + font-weight: 400; +} + +.dcl-order-table-total .tbl-total { + text-align: right; + color: #000; +} + +.tbl-no-padding { + padding: 0px; +} + +.card-warning-content { + font-weight: 300; + border: 1px solid #a1a1a1; + border-radius: 3px; + padding: 5px; + margin-bottom: 15px; +} + +.card-warning-error { + border: 1px solid #EB4D5C; + color: #EB4D5C; +} + +.card-warning-addtional-margin { + margin-top: 15px; +} + +.stripe-payment-btn { + outline: none; + width: auto; + float: right; + font-style: normal; + font-weight: 300; + position: absolute; + padding-left: 30px; + padding-right: 30px; + right: 0; +} + +.card-cvc-element label { + padding-left: 10px; +} + +.card-element { + margin-bottom: 10px; +} + +.card-element label { + width: 100%; + margin-bottom: 0px; +} + +.my-input { + border-bottom: 1px solid #ccc; +} + +.card-cvc-element .my-input { + padding-left: 10px; +} + +#card-errors { + clear: both; + padding: 0 0 10px; + color: #eb4d5c; +} + +.credit-card-goup { + padding: 0; +} + +@media (max-width: 767px) { + .dcl-order-sec { + padding: 10px 5px 30px; + border-bottom: 4px solid #eee; + } + + .dcl-billing-sec { + margin-top: 30px; + margin-bottom: 30px; + padding: 5px; + } + + .dcl-billing { + margin-top: 20px; + margin-bottom: 40px; + } + + .tbl-header { + border-bottom: 1px solid #eee; + padding-top: 10px; + padding-bottom: 10px; + margin-right: -15px; + } + + .dcl-order-table-total .tbl-total { + margin-left: -15px; + } + + .dcl-order-table-total .tbl-tot { + margin-right: -15px; + } + + .tbl-content { + border-bottom: 1px solid #eee; + padding-top: 10px; + padding-bottom: 10px; + margin-left: -15px; + } + + .dcl-order-table-header { + border-bottom: 0px solid #eee; + padding: 10px 0; + text-align: left; + } + + .dcl-order-table-content { + border-bottom: 0px solid #eee; + padding: 10px 0; + text-align: right; + font-size: 16px; + } + + .dcl-order-table-total { + font-size: 18px; + color: #000; + padding: 10px 0; + border-bottom: 0px solid #eee; + } + + .card-expiry-element { + padding-right: 10px; + } + + .card-cvc-element { + padding-left: 10px; + } + + #billing-form .form-control { + box-shadow: none !important; + font-weight: 400; + } } @media (min-width: 768px) { - .dcl-payment-grid { - display: flex; - align-items: stretch; - flex-wrap: wrap; - } - .dcl-payment-box { - width: 50%; - position: relative; - padding: 0 30px; - } - .dcl-payment-box:nth-child(2) { - order: 1; - } - .dcl-payment-box:nth-child(4) { - order: 2; - } - .dcl-payment-section { - padding: 15px 10px; - margin-bottom: 0; - border-bottom-width: 5px; - } - .dcl-payment-box:nth-child(2n) .dcl-payment-section { - border-bottom: none; - } - .dcl-payment-box:nth-child(1):after, - .dcl-payment-box:nth-child(2):after { - content: ' '; - display: block; - background: #eee; - width: 1px; - position: absolute; - right: 0; - z-index: 2; - top: 20px; - bottom: 20px; - } + .dcl-billing { + padding-right: 65px; + border-right: 1px solid #eee; + } + + .dcl-creditcard { + padding-left: 65px; + } + + .dcl-order-table-total .tbl-total, + .dcl-order-table-total .tbl-tot { + padding: 0 10px; + } + + .tbl-header-center, + .tbl-content-center { + text-align: center; + } + + .tbl-header-right, + .tbl-content-right { + text-align: right; + } } + +@media (min-width: 1200px) { + .dcl-order-container { + width: 990px; + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; + } +} \ No newline at end of file diff --git a/hosting/static/hosting/js/initial.js b/hosting/static/hosting/js/initial.js index 7159da9a..9c1c226e 100644 --- a/hosting/static/hosting/js/initial.js +++ b/hosting/static/hosting/js/initial.js @@ -224,9 +224,13 @@ $( document ).ready(function() { if(typeof window.ssdUnitPrice === 'undefined'){ window.ssdUnitPrice = 0.6; } + if(typeof window.discountAmount === 'undefined'){ + window.discountAmount = 0; + } var total = (cardPricing['cpu'].value * window.coresUnitPrice) + (cardPricing['ram'].value * window.ramUnitPrice) + - (cardPricing['storage'].value * window.ssdUnitPrice); + (cardPricing['storage'].value * window.ssdUnitPrice) - + window.discountAmount; total = parseFloat(total.toFixed(2)); $("#total").text(total); } diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 2568aafc..ec50528d 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -127,6 +127,7 @@ <span>{% trans "Disk space" %}: </span> <span class="pull-right">{{vm.disk_size}} GB</span> </p> + <hr> {% if vm.vat > 0 %} <p> <strong>{% trans "Subtotal" %}: </strong> @@ -137,6 +138,13 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} + {% if vm_pricing.discount_amount %} + <p class="text-primary"> + {%trans "Discount" as discount_name %} + <span>{{ vm_pricing.discount_name|default:discount_name }}: </span> + <span class="pull-right">- {{ vm_pricing.discount_amount }} CHF</span> + </p> + {% endif %} <p> <strong>{% trans "Total" %}</strong> <span class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</span> diff --git a/hosting/templates/hosting/payment.html b/hosting/templates/hosting/payment.html index ab6c6a65..afcf6373 100644 --- a/hosting/templates/hosting/payment.html +++ b/hosting/templates/hosting/payment.html @@ -9,159 +9,208 @@ <!-- Credit card form --> <div class="dcl-order-container"> <div class="payment-container"> - <div class="row"> - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 dcl-order-sec"> - <h3><strong>{%trans "Your Order" %}</strong></h3> - <div class="col-xs-6 col-sm-12 col-md-12 col-lg-12 dcl-order-table-header"> - <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1 tbl-header"> - {%trans "Cores" %} - </div> - <div class="col-xs-12 col-sm-3 col-md-4 col-lg-4 tbl-header"> - {%trans "Memory" %} - </div> - <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3 tbl-header"> - {%trans "Disk space" %} - </div> - <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 tbl-header"> - {%trans "Configuration" %} + <div class="dcl-order-sec"> + <h3><strong>{%trans "Your Order" %}</strong></h3> + <div class="row"> + <div class="col-xs-6 col-sm-12"> + <div class="dcl-order-table-header"> + <div class="row"> + <div class="col-sm-2"> + <div class="tbl-header"> + {%trans "Cores" %} + </div> + </div> + <div class="col-sm-4"> + <div class="tbl-header tbl-header-center"> + {%trans "Memory" %} + </div> + </div> + <div class="col-sm-3"> + <div class="tbl-header tbl-header-center"> + {%trans "Disk space" %} + </div> + </div> + <div class="col-sm-3"> + <div class="tbl-header tbl-header-right"> + {%trans "Configuration" %} + </div> + </div> + </div> </div> </div> - <div class="col-xs-6 col-sm-12 col-md-12 col-lg-12 dcl-order-table-content"> - <div class="col-xs-12 col-sm-2 col-md-1 col-lg-1 tbl-content"> - {{request.session.specs.cpu|floatformat}} - </div> - <div class="col-xs-12 col-sm-3 col-md-4 col-lg-4 tbl-content"> - {{request.session.specs.memory|floatformat}} GB - </div> - <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3 tbl-content"> - {{request.session.specs.disk_size|floatformat|intcomma}} GB - </div> - <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 tbl-content"> - {{request.session.template.name}} - </div> - </div> - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 dcl-order-table-total"> - <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 tbl-tot tbl-no-padding"> - {%trans "Total" %} <span>{% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}</span> - </div> - <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 tbl-no-padding"> - <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4"></div> - <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 tbl-total"> - {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} + <div class="col-xs-6 col-sm-12"> + <div class="dcl-order-table-content"> + <div class="row"> + <div class="col-sm-2"> + <div class="tbl-content"> + {{request.session.specs.cpu|floatformat}} + </div> + </div> + <div class="col-sm-4"> + <div class="tbl-content tbl-content-center"> + {{request.session.specs.memory|floatformat}} GB + </div> + </div> + <div class="col-sm-3"> + <div class="tbl-content tbl-content-center"> + {{request.session.specs.disk_size|floatformat|intcomma}} GB + </div> + </div> + <div class="col-sm-3"> + <div class="tbl-content tbl-content-right"> + {{request.session.template.name}} + </div> + </div> </div> </div> </div> </div> - </div> - <div class="row"> - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 dcl-billing-sec"> - <div class="col-xs-12 col-sm-5 col-md-6 billing dcl-billing"> - <h3><b>{%trans "Billing Address"%}</b></h3> - <hr> - <form role="form" id="billing-form" method="post" action="" novalidate> - {% for field in form %} - {% csrf_token %} - {% bootstrap_field field show_label=False type='fields'%} - {% endfor %} - </form> + <div class="dcl-order-table-total"> + <div class="row"> + <div class="col-xs-6"> + <div class="tbl-tot"> + {%trans "Total" %} + <span>{% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}</span> + </div> + </div> + <div class="col-xs-6"> + <div class="tbl-total"> + {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} + </div> + </div> </div> - <div class="col-xs-12 col-sm-7 col-md-6 creditcard-box dcl-creditcard"> - <h3><b>{%trans "Credit Card"%}</b></h3> - <hr> - <div> - <p> - {% blocktrans %}Please fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %} - </p> + {% if vm_pricing.discount_amount %} + <hr class="thin-hr"> + <div class="row"> + <div class="col-xs-6"> + <div class="tbl-tot"> + {%trans "Discount" as discount_name %} + {{ vm_pricing.discount_name|default:discount_name }} <br> + <span>({% trans "Will be applied at checkout" %})</span> + </div> + </div> + <div class="col-xs-6 text-right"> + <div class="tbl-total"> + <div class="text-primary">- {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %}</div> + </div> + </div> + </div> + {% endif %} + </div> + </div> + <div class="dcl-billing-sec"> + <div class="row"> + <div class="col-sm-5 col-md-6"> + <div class="billing dcl-billing"> + <h3><b>{%trans "Billing Address"%}</b></h3> + <hr> + <form role="form" id="billing-form" method="post" action="" novalidate> + {% for field in form %} + {% csrf_token %} + {% bootstrap_field field show_label=False type='fields'%} + {% endfor %} + </form> + </div> + </div> + <div class="col-sm-7 col-md-6"> + <div class="creditcard-box dcl-creditcard"> + <h3><b>{%trans "Credit Card"%}</b></h3> + <hr> <div> - {% if credit_card_data.last4 %} - <form role="form" id="payment-form-with-creditcard" novalidate> - <h5 class="billing-head">Credit Card</h5> - <h5 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h5> - <h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5> - <input type="hidden" name="credit_card_needed" value="false"/> - </form> - {% if not messages and not form.non_field_errors %} - <p class="card-warning-content card-warning-addtional-margin"> - {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} - </p> - {% endif %} - <div id='payment_error'> - {% for message in messages %} - {% if 'failed_payment' or 'make_charge_error' in message.tags %} - <ul class="list-unstyled"> - <li> - <p class="card-warning-content card-warning-error">{{ message|safe }}</p> - </li> - </ul> - {% endif %} - {% endfor %} - {% for error in form.non_field_errors %} - <p class="card-warning-content card-warning-error"> - {{ error|escape }} + <p> + {% blocktrans %}Please fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %} + </p> + <div> + {% if credit_card_data.last4 %} + <form role="form" id="payment-form-with-creditcard" novalidate> + <h5 class="billing-head">Credit Card</h5> + <h5 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h5> + <h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5> + <input type="hidden" name="credit_card_needed" value="false"/> + </form> + {% if not messages and not form.non_field_errors %} + <p class="card-warning-content card-warning-addtional-margin"> + {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} </p> - {% endfor %} - </div> - <div class="text-right"> - <button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button> - </div> - {% else %} - <form action="" id="payment-form-new" method="POST"> - <input type="hidden" name="token"/> - <div class="group"> - <div class="credit-card-goup"> - <div class="card-element card-number-element"> - <label>{%trans "Card Number" %}</label> - <div id="card-number-element" class="field my-input"></div> - </div> - <div class="row"> - <div class="col-xs-5 card-element card-expiry-element"> - <label>{%trans "Expiry Date" %}</label> - <div id="card-expiry-element" class="field my-input"></div> - </div> - <div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element"> - <label>{%trans "CVC" %}</label> - <div id="card-cvc-element" class="field my-input"></div> - </div> - </div> - <div class="card-element brand"> - <label>{%trans "Card Type" %}</label> - <i class="pf pf-credit-card" id="brand-icon"></i> - </div> - </div> - </div> - <div id="card-errors"></div> - {% if not messages and not form.non_field_errors %} - <p class="card-warning-content"> - {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} + {% endif %} + <div id='payment_error'> + {% for message in messages %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %} + <ul class="list-unstyled"> + <li> + <p class="card-warning-content card-warning-error">{{ message|safe }}</p> + </li> + </ul> + {% endif %} + {% endfor %} + {% for error in form.non_field_errors %} + <p class="card-warning-content card-warning-error"> + {{ error|escape }} </p> - {% endif %} - <div id='payment_error'> - {% for message in messages %} - {% if 'failed_payment' or 'make_charge_error' in message.tags %} - <ul class="list-unstyled"> - <li> - <p class="card-warning-content card-warning-error">{{ message|safe }}</p> - </li> - </ul> - {% endif %} - {% endfor %} - - {% for error in form.non_field_errors %} - <p class="card-warning-content card-warning-error"> - {{ error|escape }} + {% endfor %} + </div> + <div class="text-right"> + <button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button> + </div> + {% else %} + <form action="" id="payment-form-new" method="POST"> + <input type="hidden" name="token"/> + <div class="group"> + <div class="credit-card-goup"> + <div class="card-element card-number-element"> + <label>{%trans "Card Number" %}</label> + <div id="card-number-element" class="field my-input"></div> + </div> + <div class="row"> + <div class="col-xs-5 card-element card-expiry-element"> + <label>{%trans "Expiry Date" %}</label> + <div id="card-expiry-element" class="field my-input"></div> + </div> + <div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element"> + <label>{%trans "CVC" %}</label> + <div id="card-cvc-element" class="field my-input"></div> + </div> + </div> + <div class="card-element brand"> + <label>{%trans "Card Type" %}</label> + <i class="pf pf-credit-card" id="brand-icon"></i> + </div> + </div> + </div> + <div id="card-errors"></div> + {% if not messages and not form.non_field_errors %} + <p class="card-warning-content"> + {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %} </p> - {% endfor %} - </div> - <div class="text-right"> - <button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button> - </div> - </div> + {% endif %} + <div id='payment_error'> + {% for message in messages %} + {% if 'failed_payment' or 'make_charge_error' in message.tags %} + <ul class="list-unstyled"> + <li> + <p class="card-warning-content card-warning-error">{{ message|safe }}</p> + </li> + </ul> + {% endif %} + {% endfor %} - <div style="display:none;"> - <p class="payment-errors"></p> - </div> - </form> - {% endif %} + {% for error in form.non_field_errors %} + <p class="card-warning-content card-warning-error"> + {{ error|escape }} + </p> + {% endfor %} + </div> + <div class="text-right"> + <button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button> + </div> + </div> + + <div style="display:none;"> + <p class="payment-errors"></p> + </div> + </form> + {% endif %} + </div> </div> </div> </div> diff --git a/hosting/views.py b/hosting/views.py index 495efd5c..1353229a 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -652,7 +652,10 @@ class PaymentVMView(LoginRequiredMixin, FormView): }) context.update({ - 'stripe_key': settings.STRIPE_API_PUBLIC_KEY + 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, + 'vm_pricing': VMPricing.get_vm_pricing_by_name( + self.request.session['specs']['pricing_name'] + ) }) return context @@ -806,6 +809,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['cc_brand'] = card_details.get('response_object').get( 'cc_brand') context['vm'] = self.request.session.get('specs') + context['vm_pricing'] = VMPricing.get_vm_pricing_by_name( + self.request.session['specs']['pricing_name'] + ), return context @method_decorator(decorators) diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index 04ed658a..b6e267a2 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -107,10 +107,13 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0, ) return None - price = ((decimal.Decimal(cpu) * pricing.cores_unit_price) + - (decimal.Decimal(memory) * pricing.ram_unit_price) + - (decimal.Decimal(ssd_size) * pricing.ssd_unit_price) + - (decimal.Decimal(hdd_size) * pricing.hdd_unit_price)) + price = ( + (decimal.Decimal(cpu) * pricing.cores_unit_price) + + (decimal.Decimal(memory) * pricing.ram_unit_price) + + (decimal.Decimal(ssd_size) * pricing.ssd_unit_price) + + (decimal.Decimal(hdd_size) * pricing.hdd_unit_price) - + pricing.discount_amount + ) if pricing.vat_inclusive: vat = decimal.Decimal(0) vat_percent = decimal.Decimal(0) From 7a72cc02abc9db3dc7d13322f2e5bafd8bc48fca Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 05:22:05 +0530 Subject: [PATCH 02/18] translations --- .../locale/de/LC_MESSAGES/django.po | 12 +++++++- dynamicweb/settings/base.py | 4 +++ hosting/locale/de/LC_MESSAGES/django.po | 28 +++++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 50dbfbe8..cd92b339 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-17 19:26+0000\n" +"POT-Creation-Date: 2018-05-07 05:15+0530\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User <coder.purple+25@gmail.com>'\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -19,6 +19,9 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Translated-Using: django-rosetta 0.8.1\n" +msgid "CMS Favicon" +msgstr "" + #, python-format msgid "Your New VM %(vm_name)s at Data Center Light" msgstr "Deine neue VM %(vm_name)s bei Data Center Light" @@ -140,6 +143,9 @@ msgstr "Monat" msgid "VAT included" msgstr "MwSt. inklusive" +msgid "Discount" +msgstr "Rabatt" + msgid "Hosted in Switzerland" msgstr "Standort: Schweiz" @@ -314,6 +320,9 @@ msgstr "exkl. Mehrwertsteuer" msgid "Month" msgstr "Monat" +msgid "Will be applied at checkout" +msgstr "wird an der Kasse angewendet" + msgid "Credit Card" msgstr "Kreditkarte" @@ -386,6 +395,7 @@ msgstr "Zwischensumme" msgid "VAT" msgstr "Mehrwertsteuer" +#, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " "with the fee of %(vm_total_price)s CHF/month" diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index da3f0941..f540e998 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -267,6 +267,10 @@ LANGUAGES = ( LANGUAGE_CODE = 'en-us' +LOCALE_PATHS = [ + os.path.join(PROJECT_DIR, 'digitalglarus/locale'), +] + CMS_PLACEHOLDER_CONF = { 'logo_image': { 'name': 'Logo Image', diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 118245e5..42e46314 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-21 00:23+0000\n" +"POT-Creation-Date: 2018-05-07 05:15+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -365,13 +365,25 @@ msgstr "Arbeitsspeicher" msgid "Disk space" msgstr "Festplattenkapazität" +msgid "Subtotal" +msgstr "Zwischensumme" + +msgid "VAT" +msgstr "Mehrwertsteuer" + +msgid "Discount" +msgstr "Rabatt" + msgid "Total" msgstr "Gesamt" -#, python-format +#, fuzzy, python-format +#| msgid "" +#| "By clicking \"Place order\" this plan will charge your credit card " +#| "account with the fee of %(vm_price)sCHF/month" msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with the fee of %(vm_price)sCHF/month" +"with the fee of %(vm_price|intcomma)sCHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)sCHF " "pro Monat belastet" @@ -421,6 +433,12 @@ msgstr "Konfiguration" msgid "including VAT" msgstr "inkl. Mehrwertsteuer" +msgid "excluding VAT" +msgstr "exkl. Mehrwertsteuer" + +msgid "Will be applied at checkout" +msgstr "wird an der Kasse angewendet" + msgid "Billing Address" msgstr "Rechnungsadresse" @@ -699,6 +717,10 @@ msgstr "Ungültige RAM-Grösse" msgid "Invalid storage size" msgstr "Ungültige Speicher-Grösse" +#, python-brace-format +msgid "Incorrect pricing name. Please contact support{support_email}" +msgstr "" + msgid "" "We could not find the requested VM. Please " "contact Data Center Light Support." From 2ff8c250340e8710958711c441894e2e11f5c371 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 06:11:44 +0530 Subject: [PATCH 03/18] exclude discount from total price --- datacenterlight/models.py | 17 +++++++++++------ .../datacenterlight/order_detail.html | 2 +- datacenterlight/views.py | 8 +++----- hosting/views.py | 19 +++++++++---------- utils/hosting_utils.py | 6 +++--- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/datacenterlight/models.py b/datacenterlight/models.py index 56a19f03..ff7eeb8d 100644 --- a/datacenterlight/models.py +++ b/datacenterlight/models.py @@ -36,22 +36,27 @@ class VMPricing(models.Model): ) discount_name = models.CharField(max_length=255, null=True, blank=True) discount_amount = models.DecimalField( - max_digits=4, decimal_places=2, default=0 + max_digits=6, decimal_places=2, default=0 ) def __str__(self): - return self.name + ' => ' + ' - '.join([ + display_str = self.name + ' => ' + ' - '.join([ '{}/Core'.format(self.cores_unit_price.normalize()), '{}/GB RAM'.format(self.ram_unit_price.normalize()), '{}/GB SSD'.format(self.ssd_unit_price.normalize()), '{}/GB HDD'.format(self.hdd_unit_price.normalize()), '{}% VAT'.format(self.vat_percentage.normalize()) if not self.vat_inclusive else 'VAT-Incl', - '{} {}'.format( - self.discount_amount if self.discount_amount else '', - self.discount_name if self.discount_name else 'Discount' - ), ]) + if self.discount_amount: + display_str = ' - '.join([ + display_str, + '{} {}'.format( + self.discount_amount, + self.discount_name if self.discount_name else 'Discount' + ) + ]) + return display_str @classmethod def get_vm_pricing_by_name(cls, name): diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 13d2c61e..3b269377 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -76,7 +76,7 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} - {% if vm_pricing.discount_amount %} + {% if vm.discount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} <span>{{ vm_pricing.discount_name|default:discount_name }}: </span> diff --git a/datacenterlight/views.py b/datacenterlight/views.py index bc5ea49e..8f4c886f 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -158,7 +158,7 @@ class IndexView(CreateView): ) return HttpResponseRedirect(referer_url + "#order_form") - price, vat, vat_percent = get_vm_price_with_vat( + price, vat, vat_percent, discount = get_vm_price_with_vat( cpu=cores, memory=memory, ssd_size=storage, @@ -171,7 +171,8 @@ class IndexView(CreateView): 'price': price, 'vat': vat, 'vat_percent': vat_percent, - 'total_price': price + vat, + 'discount': discount, + 'total_price': price + vat - discount, 'pricing_name': vm_pricing_name } request.session['specs'] = specs @@ -388,9 +389,6 @@ class OrderConfirmationView(DetailView): request.session.get('billing_address_data') ), 'cms_integration': get_cms_integration('default'), - 'vm_pricing': VMPricing.get_vm_pricing_by_name( - self.request.session['specs']['pricing_name'] - ), } return render(request, self.template_name, context) diff --git a/hosting/views.py b/hosting/views.py index 1353229a..99897841 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -655,7 +655,7 @@ class PaymentVMView(LoginRequiredMixin, FormView): 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'vm_pricing': VMPricing.get_vm_pricing_by_name( self.request.session['specs']['pricing_name'] - ) + ), }) return context @@ -753,7 +753,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm'] = vm_detail.__dict__ context['vm']['name'] = '{}-{}'.format( context['vm']['configuration'], context['vm']['vm_id']) - price, vat, vat_percent = get_vm_price_with_vat( + price, vat, vat_percent, discount = get_vm_price_with_vat( cpu=context['vm']['cores'], ssd_size=context['vm']['disk_size'], memory=context['vm']['memory'], @@ -762,8 +762,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): ) context['vm']['vat'] = vat context['vm']['price'] = price + context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent - context['vm']['total_price'] = price + vat + context['vm']['total_price'] = price + vat - discount context['subscription_end_date'] = vm_detail.end_date() except VMDetail.DoesNotExist: try: @@ -772,7 +773,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): ) vm = manager.get_vm(obj.vm_id) context['vm'] = VirtualMachineSerializer(vm).data - price, vat, vat_percent = get_vm_price_with_vat( + price, vat, vat_percent, discount = get_vm_price_with_vat( cpu=context['vm']['cores'], ssd_size=context['vm']['disk_size'], memory=context['vm']['memory'], @@ -781,8 +782,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): ) context['vm']['vat'] = vat context['vm']['price'] = price + context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent - context['vm']['total_price'] = price + vat + context['vm']['total_price'] = price + vat - discount except WrongIdError: messages.error( self.request, @@ -809,9 +811,6 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['cc_brand'] = card_details.get('response_object').get( 'cc_brand') context['vm'] = self.request.session.get('specs') - context['vm_pricing'] = VMPricing.get_vm_pricing_by_name( - self.request.session['specs']['pricing_name'] - ), return context @method_decorator(decorators) @@ -1071,7 +1070,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): extra_tags='storage') return redirect(CreateVirtualMachinesView.as_view()) - price, vat, vat_percent = get_vm_price_with_vat( + price, vat, vat_percent, discount = get_vm_price_with_vat( cpu=cores, memory=memory, ssd_size=storage, @@ -1085,7 +1084,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): 'price': price, 'vat': vat, 'vat_percent': vat_percent, - 'total_price': price + vat, + 'total_price': price + vat - discount, 'pricing_name': vm_pricing_name } diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index b6e267a2..9e96634f 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -111,8 +111,7 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0, (decimal.Decimal(cpu) * pricing.cores_unit_price) + (decimal.Decimal(memory) * pricing.ram_unit_price) + (decimal.Decimal(ssd_size) * pricing.ssd_unit_price) + - (decimal.Decimal(hdd_size) * pricing.hdd_unit_price) - - pricing.discount_amount + (decimal.Decimal(hdd_size) * pricing.hdd_unit_price) ) if pricing.vat_inclusive: vat = decimal.Decimal(0) @@ -124,4 +123,5 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0, cents = decimal.Decimal('.01') price = price.quantize(cents, decimal.ROUND_HALF_UP) vat = vat.quantize(cents, decimal.ROUND_HALF_UP) - return float(price), float(vat), float(vat_percent) + discount = pricing.discount_amount + return float(price), float(vat), float(vat_percent), float(discount) From eeed9b2e7214aacd2e1e3152de3d5628434083fb Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 06:25:50 +0530 Subject: [PATCH 04/18] discount name in templates --- .../templates/datacenterlight/order_detail.html | 4 ++-- datacenterlight/views.py | 2 +- hosting/templates/hosting/order_detail.html | 6 +++--- hosting/views.py | 7 ++++--- utils/hosting_utils.py | 7 +++++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 3b269377..1bedbb44 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -79,8 +79,8 @@ {% if vm.discount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} - <span>{{ vm_pricing.discount_name|default:discount_name }}: </span> - <span class="pull-right">- {{ vm_pricing.discount_amount }} CHF</span> + <span>{{ vm.discount.name|default:discount_name }}: </span> + <span class="pull-right">- {{ discount.amount }} CHF</span> </p> {% endif %} <p> diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 8f4c886f..79411fbb 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -172,7 +172,7 @@ class IndexView(CreateView): 'vat': vat, 'vat_percent': vat_percent, 'discount': discount, - 'total_price': price + vat - discount, + 'total_price': price + vat - discount.amount, 'pricing_name': vm_pricing_name } request.session['specs'] = specs diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index ec50528d..1ed75bd9 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -138,11 +138,11 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} - {% if vm_pricing.discount_amount %} + {% if vm.discount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} - <span>{{ vm_pricing.discount_name|default:discount_name }}: </span> - <span class="pull-right">- {{ vm_pricing.discount_amount }} CHF</span> + <span>{{ vm.discount.name|default:discount_name }}: </span> + <span class="pull-right">- {{ discount.amount }} CHF</span> </p> {% endif %} <p> diff --git a/hosting/views.py b/hosting/views.py index 99897841..7b3cc357 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -764,7 +764,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm']['price'] = price context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent - context['vm']['total_price'] = price + vat - discount + context['vm']['total_price'] = price + vat - discount.amount context['subscription_end_date'] = vm_detail.end_date() except VMDetail.DoesNotExist: try: @@ -784,7 +784,8 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm']['price'] = price context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent - context['vm']['total_price'] = price + vat - discount + context['vm']['total_price'] = price + \ + vat - discount.amount except WrongIdError: messages.error( self.request, @@ -1084,7 +1085,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): 'price': price, 'vat': vat, 'vat_percent': vat_percent, - 'total_price': price + vat - discount, + 'total_price': price + vat - discount.amount, 'pricing_name': vm_pricing_name } diff --git a/utils/hosting_utils.py b/utils/hosting_utils.py index 9e96634f..36964867 100644 --- a/utils/hosting_utils.py +++ b/utils/hosting_utils.py @@ -123,5 +123,8 @@ def get_vm_price_with_vat(cpu, memory, ssd_size, hdd_size=0, cents = decimal.Decimal('.01') price = price.quantize(cents, decimal.ROUND_HALF_UP) vat = vat.quantize(cents, decimal.ROUND_HALF_UP) - discount = pricing.discount_amount - return float(price), float(vat), float(vat_percent), float(discount) + discount = { + 'name': pricing.discount_name, + 'amount': float(pricing.discount_amount), + } + return float(price), float(vat), float(vat_percent), discount From 3d2ce279548809c1de71ab6b13d4fdb343a20931 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 06:29:53 +0530 Subject: [PATCH 05/18] fix discount amount --- datacenterlight/views.py | 2 +- hosting/views.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 79411fbb..ec10a341 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -172,7 +172,7 @@ class IndexView(CreateView): 'vat': vat, 'vat_percent': vat_percent, 'discount': discount, - 'total_price': price + vat - discount.amount, + 'total_price': price + vat - discount['amount'], 'pricing_name': vm_pricing_name } request.session['specs'] = specs diff --git a/hosting/views.py b/hosting/views.py index 7b3cc357..ec583a9b 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -764,7 +764,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm']['price'] = price context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent - context['vm']['total_price'] = price + vat - discount.amount + context['vm']['total_price'] = price + vat - discount['amount'] context['subscription_end_date'] = vm_detail.end_date() except VMDetail.DoesNotExist: try: @@ -785,7 +785,7 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): context['vm']['discount'] = discount context['vm']['vat_percent'] = vat_percent context['vm']['total_price'] = price + \ - vat - discount.amount + vat - discount['amount'] except WrongIdError: messages.error( self.request, @@ -1085,7 +1085,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): 'price': price, 'vat': vat, 'vat_percent': vat_percent, - 'total_price': price + vat - discount.amount, + 'total_price': price + vat - discount['amount'], 'pricing_name': vm_pricing_name } From 0fdb88b8aa5659dafdd709f81edffb95bb7c4e80 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 07:50:32 +0530 Subject: [PATCH 06/18] invoice discount amount fix --- datacenterlight/migrations/0022_auto_20180506_1950.py | 5 +++-- datacenterlight/templates/datacenterlight/order_detail.html | 4 ++-- hosting/templates/hosting/order_detail.html | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/datacenterlight/migrations/0022_auto_20180506_1950.py b/datacenterlight/migrations/0022_auto_20180506_1950.py index dd79b825..a5554a58 100644 --- a/datacenterlight/migrations/0022_auto_20180506_1950.py +++ b/datacenterlight/migrations/0022_auto_20180506_1950.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-05-06 14:20 +# Generated by Django 1.9.4 on 2018-05-07 02:19 from __future__ import unicode_literals from django.db import migrations, models @@ -15,7 +15,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name='vmpricing', name='discount_amount', - field=models.DecimalField(decimal_places=2, default=0, max_digits=4), + field=models.DecimalField( + decimal_places=2, default=0, max_digits=6), ), migrations.AddField( model_name='vmpricing', diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 1bedbb44..fbe7ff0f 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -76,11 +76,11 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} - {% if vm.discount > 0 %} + {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} <span>{{ vm.discount.name|default:discount_name }}: </span> - <span class="pull-right">- {{ discount.amount }} CHF</span> + <span class="pull-right">- {{ vm.discount.amount }} CHF</span> </p> {% endif %} <p> diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 1ed75bd9..11aa3474 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -138,11 +138,11 @@ <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> </p> {% endif %} - {% if vm.discount > 0 %} + {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} <span>{{ vm.discount.name|default:discount_name }}: </span> - <span class="pull-right">- {{ discount.amount }} CHF</span> + <span class="pull-right">- {{ vm.discount.amount }} CHF</span> </p> {% endif %} <p> From 55cbe3244a4625558804f491ea296ce26b48d3ff Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Mon, 7 May 2018 09:14:31 +0530 Subject: [PATCH 07/18] fix testing error --- hosting/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index ec583a9b..7623ed90 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -654,7 +654,7 @@ class PaymentVMView(LoginRequiredMixin, FormView): context.update({ 'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'vm_pricing': VMPricing.get_vm_pricing_by_name( - self.request.session['specs']['pricing_name'] + self.request.session.get('specs', {}).get('pricing_name') ), }) @@ -1010,7 +1010,6 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): @method_decorator(decorators) def get(self, request, *args, **kwargs): - print(get_cms_integration('default')) context = { 'templates': VMTemplate.objects.all(), 'cms_integration': get_cms_integration('default'), From b351cb9aa04d6d9f1f3675c3c99646144660cf75 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Thu, 10 May 2018 21:25:38 +0530 Subject: [PATCH 08/18] translation fix --- hosting/locale/de/LC_MESSAGES/django.po | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 42e46314..1404b594 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -377,10 +377,7 @@ msgstr "Rabatt" msgid "Total" msgstr "Gesamt" -#, fuzzy, python-format -#| msgid "" -#| "By clicking \"Place order\" this plan will charge your credit card " -#| "account with the fee of %(vm_price)sCHF/month" +#, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " "with the fee of %(vm_price|intcomma)sCHF/month" From f3ffbd96e5d1d31b60d51e378c4c9e23188bdcef Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Thu, 10 May 2018 21:26:47 +0530 Subject: [PATCH 09/18] translation fix --- hosting/locale/de/LC_MESSAGES/django.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 1404b594..b981d408 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -382,7 +382,7 @@ msgid "" "By clicking \"Place order\" this plan will charge your credit card account " "with the fee of %(vm_price|intcomma)sCHF/month" msgstr "" -"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)sCHF " +"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price|intcomma)sCHF " "pro Monat belastet" msgid "Place order" From 73e3dce8d495196005359aa8cb2880595cb2152f Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Fri, 11 May 2018 17:18:19 +0530 Subject: [PATCH 10/18] order detail page font format --- .../static/datacenterlight/css/hosting.css | 2 +- .../templates/datacenterlight/order_detail.html | 12 ++++++------ hosting/static/hosting/css/order.css | 2 +- hosting/templates/hosting/order_detail.html | 16 ++++++++-------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/datacenterlight/static/datacenterlight/css/hosting.css b/datacenterlight/static/datacenterlight/css/hosting.css index b4c5909c..87c40329 100644 --- a/datacenterlight/static/datacenterlight/css/hosting.css +++ b/datacenterlight/static/datacenterlight/css/hosting.css @@ -482,6 +482,7 @@ margin: 100px auto 40px; border: 1px solid #ccc; padding: 30px 30px 20px; + color: #595959; } .order-detail-container .dashboard-title-thin { @@ -515,7 +516,6 @@ .order-detail-container p { margin-bottom: 5px; - color: #595959; } .order-detail-container hr { diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index fbe7ff0f..4b52d4d5 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -59,33 +59,33 @@ </p> <p> <span>{% trans "Memory" %}: </span> - <span class="pull-right">{{vm.memory|intcomma}} GB</span> + <strong class="pull-right">{{vm.memory|intcomma}} GB</strong> </p> <p> <span>{% trans "Disk space" %}: </span> - <span class="pull-right">{{vm.disk_size|intcomma}} GB</span> + <strong class="pull-right">{{vm.disk_size|intcomma}} GB</strong> </p> <hr> {% if vm.vat > 0 %} <p> <strong>{% trans "Subtotal" %}: </strong> - <span class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</span> + <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> </p> <p> <span>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%): </span> - <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> + <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> </p> {% endif %} {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} <span>{{ vm.discount.name|default:discount_name }}: </span> - <span class="pull-right">- {{ vm.discount.amount }} CHF</span> + <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> </p> {% endif %} <p> <strong>{% trans "Total" %}</strong> - <span class="pull-right">{{vm.total_price|floatformat:2|intcomma}} CHF</span> + <strong class="pull-right">{{vm.total_price|floatformat:2|intcomma}} CHF</strong> </p> </div> </div> diff --git a/hosting/static/hosting/css/order.css b/hosting/static/hosting/css/order.css index 27a67f3e..5d39f24b 100644 --- a/hosting/static/hosting/css/order.css +++ b/hosting/static/hosting/css/order.css @@ -3,6 +3,7 @@ margin: 100px auto 40px; border: 1px solid #ccc; padding: 15px; + color: #595959; } @media(min-width: 768px) { @@ -60,7 +61,6 @@ .order-detail-container p { margin-bottom: 5px; - color: #595959; } .order-detail-container hr { diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 11aa3474..d08a7151 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -114,40 +114,40 @@ <p> <span>{% trans "Cores" %}: </span> {% if vm.cores %} - <span class="pull-right">{{vm.cores|floatformat}}</span> + <strong class="pull-right">{{vm.cores|floatformat}}</strong> {% else %} - <span class="pull-right">{{vm.cpu|floatformat}}</span> + <strong class="pull-right">{{vm.cpu|floatformat}}</strong> {% endif %} </p> <p> <span>{% trans "Memory" %}: </span> - <span class="pull-right">{{vm.memory}} GB</span> + <strong class="pull-right">{{vm.memory}} GB</strong> </p> <p> <span>{% trans "Disk space" %}: </span> - <span class="pull-right">{{vm.disk_size}} GB</span> + <strong class="pull-right">{{vm.disk_size}} GB</strong> </p> <hr> {% if vm.vat > 0 %} <p> <strong>{% trans "Subtotal" %}: </strong> - <span class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</span> + <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> </p> <p> <span>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%): </span> - <span class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</span> + <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> </p> {% endif %} {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} <span>{{ vm.discount.name|default:discount_name }}: </span> - <span class="pull-right">- {{ vm.discount.amount }} CHF</span> + <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> </p> {% endif %} <p> <strong>{% trans "Total" %}</strong> - <span class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</span> + <strong class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</strong> </p> </div> </div> From a14407182ff3983859b43e05bcc5fc790a42773c Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Fri, 11 May 2018 17:21:02 +0530 Subject: [PATCH 11/18] font weight for discount name --- datacenterlight/templates/datacenterlight/order_detail.html | 4 ++-- hosting/templates/hosting/order_detail.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 4b52d4d5..dfa6634e 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -55,7 +55,7 @@ <div class="col-sm-6"> <p> <span>{% trans "Cores" %}: </span> - <span class="pull-right">{{vm.cpu|floatformat}}</span> + <strong class="pull-right">{{vm.cpu|floatformat}}</strong> </p> <p> <span>{% trans "Memory" %}: </span> @@ -79,7 +79,7 @@ {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} - <span>{{ vm.discount.name|default:discount_name }}: </span> + <strong>{{ vm.discount.name|default:discount_name }}: </strong> <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> </p> {% endif %} diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index d08a7151..9dea5359 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -141,7 +141,7 @@ {% if vm.discount.amount > 0 %} <p class="text-primary"> {%trans "Discount" as discount_name %} - <span>{{ vm.discount.name|default:discount_name }}: </span> + <strong>{{ vm.discount.name|default:discount_name }}: </strong> <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> </p> {% endif %} From 30deae5a201ec75ad0e7047d8e9949e2cfde142a Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Fri, 11 May 2018 17:25:44 +0530 Subject: [PATCH 12/18] strong color fix --- datacenterlight/static/datacenterlight/css/hosting.css | 4 ---- hosting/static/hosting/css/order.css | 4 ---- 2 files changed, 8 deletions(-) diff --git a/datacenterlight/static/datacenterlight/css/hosting.css b/datacenterlight/static/datacenterlight/css/hosting.css index 87c40329..047f4922 100644 --- a/datacenterlight/static/datacenterlight/css/hosting.css +++ b/datacenterlight/static/datacenterlight/css/hosting.css @@ -504,10 +504,6 @@ margin-bottom: 15px; } -.order-detail-container .order-details strong { - color: #595959; -} - .order-detail-container h4 { font-size: 16px; font-weight: bold; diff --git a/hosting/static/hosting/css/order.css b/hosting/static/hosting/css/order.css index 5d39f24b..fa932798 100644 --- a/hosting/static/hosting/css/order.css +++ b/hosting/static/hosting/css/order.css @@ -49,10 +49,6 @@ margin-bottom: 15px; } -.order-detail-container .order-details strong { - color: #595959; -} - .order-detail-container h4 { font-size: 16px; font-weight: bold; From 8044e0c2a0f30c057d1ed69d61b2410e3e608c38 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Fri, 11 May 2018 17:47:27 +0530 Subject: [PATCH 13/18] calculator discount text modified --- .../templates/datacenterlight/includes/_calculator_form.html | 3 +-- hosting/views.py | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html index dfc0bf22..4b4aa04f 100644 --- a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html +++ b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html @@ -24,8 +24,7 @@ <p> {% if vm_pricing.vat_inclusive %}{% trans "VAT included" %} <br>{% endif %} {% if vm_pricing.discount_amount %} - {% trans "Discount" as discount_name %} - {{ vm_pricing.discount_amount }} CHF <strong>{{ vm_pricing.discount_name|default:discount_name }}</strong> included + You save {{ vm_pricing.discount_amount }} CHF {% endif %} </p> </div> diff --git a/hosting/views.py b/hosting/views.py index 7623ed90..8a4defda 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1081,6 +1081,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View): 'cpu': cores, 'memory': memory, 'disk_size': storage, + 'discount': discount, 'price': price, 'vat': vat, 'vat_percent': vat_percent, From 55889499df0527fd1ae957352a5b7a782b03b0f8 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Sat, 12 May 2018 02:47:27 +0530 Subject: [PATCH 14/18] order detail style fix --- .../static/datacenterlight/css/hosting.css | 16 +++++++ .../datacenterlight/order_detail.html | 45 ++++++++++--------- hosting/static/hosting/css/order.css | 16 +++++++ hosting/templates/hosting/order_detail.html | 45 ++++++++++--------- 4 files changed, 82 insertions(+), 40 deletions(-) diff --git a/datacenterlight/static/datacenterlight/css/hosting.css b/datacenterlight/static/datacenterlight/css/hosting.css index 047f4922..0f16ab77 100644 --- a/datacenterlight/static/datacenterlight/css/hosting.css +++ b/datacenterlight/static/datacenterlight/css/hosting.css @@ -518,6 +518,22 @@ margin: 15px 0; } +.order-detail-container .thin-hr { + margin: 10px 0; +} + +.order-detail-container .subtotal-price { + font-size: 16px; +} + +.order-detail-container .subtotal-price .text-primary { + font-size: 17px; +} + +.order-detail-container .total-price { + font-size: 18px; +} + @media (max-width: 767px) { .order-detail-container { padding: 15px; diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index dfa6634e..5515435a 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -65,32 +65,37 @@ <span>{% trans "Disk space" %}: </span> <strong class="pull-right">{{vm.disk_size|intcomma}} GB</strong> </p> - <hr> - {% if vm.vat > 0 %} - <p> - <strong>{% trans "Subtotal" %}: </strong> - <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> - </p> - <p> - <span>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%): </span> - <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> - </p> + <hr class="thin-hr"> + {% if vm.vat > 0 or vm.discount.amount > 0 %} + <div class="subtotal-price"> + {% if vm.vat > 0 %} + <p> + <strong class="text-lg">{% trans "Subtotal" %} </strong> + <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> + </p> + <p> + <small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) </small> + <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> + </p> + {% endif %} + {% if vm.discount.amount > 0 %} + <p class="text-primary"> + {%trans "Discount" as discount_name %} + <strong>{{ vm.discount.name|default:discount_name }} </strong> + <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> + </p> + {% endif %} + </div> + <hr class="thin-hr"> {% endif %} - {% if vm.discount.amount > 0 %} - <p class="text-primary"> - {%trans "Discount" as discount_name %} - <strong>{{ vm.discount.name|default:discount_name }}: </strong> - <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> - </p> - {% endif %} - <p> - <strong>{% trans "Total" %}</strong> + <p class="total-price"> + <strong>{% trans "Total" %} </strong> <strong class="pull-right">{{vm.total_price|floatformat:2|intcomma}} CHF</strong> </p> </div> </div> </div> - <hr> + <hr class="thin-hr"> </div> <form id="virtual_machine_create_form" action="" method="POST"> {% csrf_token %} diff --git a/hosting/static/hosting/css/order.css b/hosting/static/hosting/css/order.css index fa932798..8aafb8a8 100644 --- a/hosting/static/hosting/css/order.css +++ b/hosting/static/hosting/css/order.css @@ -63,6 +63,22 @@ margin: 15px 0; } +.order-detail-container .thin-hr { + margin: 10px 0; +} + +.order-detail-container .subtotal-price { + font-size: 16px; +} + +.order-detail-container .subtotal-price .text-primary { + font-size: 17px; +} + +.order-detail-container .total-price { + font-size: 18px; +} + @media (max-width: 767px) { .order-confirm-btn { text-align: center; diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 9dea5359..d84ed3d3 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -127,32 +127,37 @@ <span>{% trans "Disk space" %}: </span> <strong class="pull-right">{{vm.disk_size}} GB</strong> </p> - <hr> - {% if vm.vat > 0 %} - <p> - <strong>{% trans "Subtotal" %}: </strong> - <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> - </p> - <p> - <span>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%): </span> - <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> - </p> + <hr class="thin-hr"> + {% if vm.vat > 0 or vm.discount.amount > 0 %} + <div class="subtotal-price"> + {% if vm.vat > 0 %} + <p> + <strong>{% trans "Subtotal" %} </strong> + <strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong> + </p> + <p> + <small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) </small> + <strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong> + </p> + {% endif %} + {% if vm.discount.amount > 0 %} + <p class="text-primary"> + {%trans "Discount" as discount_name %} + <strong>{{ vm.discount.name|default:discount_name }} </strong> + <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> + </p> + {% endif %} + </div> + <hr class="thin-hr"> {% endif %} - {% if vm.discount.amount > 0 %} - <p class="text-primary"> - {%trans "Discount" as discount_name %} - <strong>{{ vm.discount.name|default:discount_name }}: </strong> - <strong class="pull-right">- {{ vm.discount.amount }} CHF</strong> - </p> - {% endif %} - <p> - <strong>{% trans "Total" %}</strong> + <p class="total-price"> + <strong>{% trans "Total" %} </strong> <strong class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</strong> </p> </div> </div> </div> - <hr> + <hr class="thin-hr"> </div> {% if not order %} {% block submit_btn %} From 39f7898259b2ff627103bf8f69bf9b18426a2f3c Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Sat, 12 May 2018 03:15:07 +0530 Subject: [PATCH 15/18] edit order detail footer text --- datacenterlight/locale/de/LC_MESSAGES/django.po | 10 +++++----- .../templates/datacenterlight/order_detail.html | 2 +- hosting/locale/de/LC_MESSAGES/django.po | 8 ++++---- hosting/templates/hosting/order_detail.html | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index cd92b339..9ac4f59a 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-07 05:15+0530\n" +"POT-Creation-Date: 2018-05-12 03:12+0530\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User <coder.purple+25@gmail.com>'\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -143,9 +143,6 @@ msgstr "Monat" msgid "VAT included" msgstr "MwSt. inklusive" -msgid "Discount" -msgstr "Rabatt" - msgid "Hosted in Switzerland" msgstr "Standort: Schweiz" @@ -320,6 +317,9 @@ msgstr "exkl. Mehrwertsteuer" msgid "Month" msgstr "Monat" +msgid "Discount" +msgstr "Rabatt" + msgid "Will be applied at checkout" msgstr "wird an der Kasse angewendet" @@ -398,7 +398,7 @@ msgstr "Mehrwertsteuer" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with the fee of %(vm_total_price)s CHF/month" +"with %(vm_total_price)s CHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " "%(vm_total_price)s CHF pro Monat belastet" diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 5515435a..8480e132 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -101,7 +101,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with the fee of {{vm_total_price}} CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-toggle="modal" data-target="#createvm-modal"> diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index b981d408..9ee836ec 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-07 05:15+0530\n" +"POT-Creation-Date: 2018-05-12 03:12+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -380,10 +380,10 @@ msgstr "Gesamt" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with the fee of %(vm_price|intcomma)sCHF/month" +"with %(vm_price|intcomma)sCHF/month" msgstr "" -"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price|intcomma)sCHF " -"pro Monat belastet" +"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " +"%(vm_price|intcomma)sCHF pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index d84ed3d3..a87548e8 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -165,7 +165,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with the fee of {{ vm_price|intcomma }}CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price|intcomma }}CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal"> From 20f1df8a7056e713b39495a17448dd8b64fd19ec Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Sat, 12 May 2018 03:39:38 +0530 Subject: [PATCH 16/18] blocktrans variable fix --- datacenterlight/locale/de/LC_MESSAGES/django.po | 6 +++--- datacenterlight/templates/datacenterlight/order_detail.html | 2 +- hosting/locale/de/LC_MESSAGES/django.po | 6 +++--- hosting/templates/hosting/order_detail.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 9ac4f59a..bc35d6aa 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-12 03:12+0530\n" +"POT-Creation-Date: 2018-05-12 03:37+0530\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User <coder.purple+25@gmail.com>'\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -398,10 +398,10 @@ msgstr "Mehrwertsteuer" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with %(vm_total_price)s CHF/month" +"with %(vm.total_price|floatformat:2|intcomma)s CHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " -"%(vm_total_price)s CHF pro Monat belastet" +"%(vm.total_price|floatformat:2|intcomma)s CHF pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 8480e132..0311733d 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -101,7 +101,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans %}By clicking "Place order" this plan will charge your credit card account with {{ vm.total_price|floatformat:2|intcomma }} CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-toggle="modal" data-target="#createvm-modal"> diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index 9ee836ec..be7fddd8 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-12 03:12+0530\n" +"POT-Creation-Date: 2018-05-12 03:37+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -380,10 +380,10 @@ msgstr "Gesamt" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with %(vm_price|intcomma)sCHF/month" +"with %(vm.total_price|floatformat:2|intcomma)sCHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " -"%(vm_price|intcomma)sCHF pro Monat belastet" +"%(vm.total_price|floatformat:2|intcomma)sCHF pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index a87548e8..d85645f0 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -165,7 +165,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price|intcomma }}CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans %}By clicking "Place order" this plan will charge your credit card account with {{ vm.total_price|floatformat:2|intcomma }}CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal"> From f39f95e1f7aa3fc909c3d63eef267e8a1c82806e Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Sat, 12 May 2018 03:47:54 +0530 Subject: [PATCH 17/18] remove template filter from translation --- datacenterlight/locale/de/LC_MESSAGES/django.po | 6 +++--- datacenterlight/templates/datacenterlight/order_detail.html | 2 +- hosting/locale/de/LC_MESSAGES/django.po | 6 +++--- hosting/templates/hosting/order_detail.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index bc35d6aa..a092641d 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-12 03:37+0530\n" +"POT-Creation-Date: 2018-05-12 03:46+0530\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User <coder.purple+25@gmail.com>'\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -398,10 +398,10 @@ msgstr "Mehrwertsteuer" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with %(vm.total_price|floatformat:2|intcomma)s CHF/month" +"with %(vm_total_price)s CHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " -"%(vm.total_price|floatformat:2|intcomma)s CHF pro Monat belastet" +"%(vm_total_price)s CHF pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 0311733d..8480e132 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -101,7 +101,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans %}By clicking "Place order" this plan will charge your credit card account with {{ vm.total_price|floatformat:2|intcomma }} CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-toggle="modal" data-target="#createvm-modal"> diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index be7fddd8..bc612e52 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-12 03:37+0530\n" +"POT-Creation-Date: 2018-05-12 03:46+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -380,10 +380,10 @@ msgstr "Gesamt" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with %(vm.total_price|floatformat:2|intcomma)sCHF/month" +"with %(vm_price)sCHF/month" msgstr "" "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " -"%(vm.total_price|floatformat:2|intcomma)sCHF pro Monat belastet" +"%(vm_price)sCHF pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index d85645f0..12d8a77d 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -165,7 +165,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans %}By clicking "Place order" this plan will charge your credit card account with {{ vm.total_price|floatformat:2|intcomma }}CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans with vm_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price }}CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal"> From b09604d30f6840159b5d33f5216840d46e73ce43 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari <tiwariav@gmail.com> Date: Sat, 12 May 2018 03:56:04 +0530 Subject: [PATCH 18/18] add space befor CHF --- hosting/locale/de/LC_MESSAGES/django.po | 8 ++++---- hosting/templates/hosting/order_detail.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hosting/locale/de/LC_MESSAGES/django.po b/hosting/locale/de/LC_MESSAGES/django.po index bc612e52..d61d09c0 100644 --- a/hosting/locale/de/LC_MESSAGES/django.po +++ b/hosting/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-12 03:46+0530\n" +"POT-Creation-Date: 2018-05-12 03:53+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -380,10 +380,10 @@ msgstr "Gesamt" #, python-format msgid "" "By clicking \"Place order\" this plan will charge your credit card account " -"with %(vm_price)sCHF/month" +"with %(vm_price)s CHF/month" msgstr "" -"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " -"%(vm_price)sCHF pro Monat belastet" +"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)s CHF " +"pro Monat belastet" msgid "Place order" msgstr "Bestellen" diff --git a/hosting/templates/hosting/order_detail.html b/hosting/templates/hosting/order_detail.html index 12d8a77d..7def5b49 100644 --- a/hosting/templates/hosting/order_detail.html +++ b/hosting/templates/hosting/order_detail.html @@ -165,7 +165,7 @@ {% csrf_token %} <div class="row"> <div class="col-sm-8"> - <div class="dcl-place-order-text">{% blocktrans with vm_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price }}CHF/month{% endblocktrans %}.</div> + <div class="dcl-place-order-text">{% blocktrans with vm_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price }} CHF/month{% endblocktrans %}.</div> </div> <div class="col-sm-4 order-confirm-btn text-right"> <button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal">