dynamicweb/hosting/templates/hosting/order_detail.html

246 lines
12 KiB
HTML
Raw Normal View History

{% extends "hosting/base_short.html" %}
2018-03-27 14:08:09 +00:00
{% load staticfiles bootstrap3 humanize i18n custom_tags %}
2017-09-01 21:39:02 +00:00
{% block content %}
2017-09-21 09:33:00 +00:00
<div id="order-detail{{order.pk}}" class="order-detail-container">
2017-09-15 16:11:22 +00:00
{% if messages %}
2017-09-19 09:33:06 +00:00
<div class="alert alert-warning">
{% for message in messages %}
2017-09-20 17:36:51 +00:00
<span>{{ message }}</span>
2017-09-19 09:33:06 +00:00
{% endfor %}
</div>
{% endif %}
{% if not error %}
2017-09-20 19:49:38 +00:00
<div class="dashboard-container-head">
<h1 class="dashboard-title-thin">
<img src="{% static 'hosting/img/billing.svg' %}" class="un-icon">{% blocktrans with page_header_text=page_header_text|default:"Invoice" %}{{page_header_text}}{% endblocktrans %}
</h1>
2017-09-25 19:34:38 +00:00
{% if order %}
<div class="dashboard-container-options">
<button type="button" class="btn-plain btn-pdf" data-target="#order-detail{{order.pk}}"><img src="{% static 'hosting/img/icon-pdf.svg' %}" class="svg-img"></button>
<button type="button" class="btn-plain btn-print"><img src="{% static 'hosting/img/icon-print.svg' %}" class="svg-img"></button>
</div>
{% endif %}
2017-09-20 19:49:38 +00:00
</div>
2017-09-20 21:20:07 +00:00
<div class="order-details">
{% if order %}
2017-09-21 09:33:00 +00:00
<p>
<strong>{% trans "Order #" %} {{order.id}}</strong>
</p>
2017-09-21 11:52:02 +00:00
{% endif %}
2017-09-21 09:33:00 +00:00
<p>
2017-09-25 22:12:10 +00:00
<strong>{% trans "Date" %}:</strong>
2017-10-05 22:41:40 +00:00
<span class="locale_date">
2017-09-20 17:36:51 +00:00
{% if order %}
2017-10-05 22:41:40 +00:00
{{order.created_at|date:'Y-m-d h:i a'}}
2017-09-20 17:36:51 +00:00
{% else %}
2017-10-05 22:41:40 +00:00
{% now "Y-m-d h:i a" %}
2017-09-20 17:36:51 +00:00
{% endif %}
2017-09-20 21:20:07 +00:00
</span>
2017-09-21 09:33:00 +00:00
</p>
2017-09-20 21:20:07 +00:00
{% if order %}
2017-09-21 11:52:02 +00:00
<p>
<strong>{% trans "Status" %}: </strong>
<strong>
{% if vm.terminated_at %}
<span class="vm-color-failed">{% trans "Terminated" %}</span>
{% elif order.status == 'Approved' %}
2017-09-21 11:52:02 +00:00
<span class="vm-color-online">{% trans "Approved" %}</span>
{% else %}
<span class="vm-status-failed">{% trans "Declined" %}</span>
{% endif %}
</strong>
</p>
2017-09-20 21:20:07 +00:00
{% endif %}
<hr>
<div>
2017-09-20 17:36:51 +00:00
<address>
2017-09-20 21:20:07 +00:00
<h4>{% trans "Billed to" %}:</h4>
2017-09-21 09:33:00 +00:00
<p>
2017-09-20 21:20:07 +00:00
{% if order %}
{{user.name}}<br>
2017-09-21 09:33:00 +00:00
{{order.billing_address.street_address}}, {{order.billing_address.postal_code}}<br>
{{order.billing_address.city}}, {{order.billing_address.country}}
2017-09-20 21:20:07 +00:00
{% else %}
{% with request.session.billing_address_data as billing_address %}
2017-09-21 09:33:00 +00:00
{{billing_address.cardholder_name}}<br>
{{billing_address.street_address}}, {{billing_address.postal_code}}<br>
{{billing_address.city}}, {{billing_address.country}}
2017-09-20 21:20:07 +00:00
{% endwith %}
{% endif %}
2017-09-21 09:33:00 +00:00
</p>
2017-09-20 21:20:07 +00:00
</address>
</div>
<hr>
<div>
<h4>{% trans "Payment method" %}:</h4>
2017-09-21 09:33:00 +00:00
<p>
2017-09-20 17:36:51 +00:00
{% if order %}
2017-09-20 21:20:07 +00:00
{{order.cc_brand}} {% trans "ending in" %} ****
{{order.last4}}<br>
{{user.email}}
2017-09-19 09:33:06 +00:00
{% else %}
2017-09-27 21:35:47 +00:00
{{cc_brand|default:_('Credit Card')}} {% trans "ending in" %} ****{{cc_last4}}<br>
2017-09-21 13:47:10 +00:00
{% if request.user.is_authenticated %}
{{request.user.email}}
{% else %}
{{request.session.user.email}}
{% endif %}
2017-09-19 09:33:06 +00:00
{% endif %}
2017-09-21 09:33:00 +00:00
</p>
</div>
2017-09-21 09:33:00 +00:00
<hr>
2017-09-20 21:20:07 +00:00
<div>
2017-09-21 09:33:00 +00:00
<h4>{% trans "Order summary" %}</h4>
<p>
2017-09-25 22:27:07 +00:00
<strong>{% trans "Product" %}:</strong>&nbsp;
{% if vm.name %}
{{ vm.name }}
{% else %}
{{ request.session.template.name }}
{% endif %}
2017-09-21 09:33:00 +00:00
</p>
<div class="row">
<div class="col-sm-6">
2017-09-27 21:17:58 +00:00
{% if vm.created_at %}
<p>
<span>{% trans "Period" %}: </span>
2017-10-05 22:41:40 +00:00
<span>
2017-10-05 22:50:38 +00:00
<span class="locale_date" data-format="YYYY/MM/DD">{{ vm.created_at|date:'Y-m-d h:i a' }}</span> - <span class="locale_date" data-format="YYYY/MM/DD">{{ subscription_end_date|date:'Y-m-d h:i a' }}</span>
2017-10-05 22:41:40 +00:00
</span>
2017-09-27 21:17:58 +00:00
</p>
{% endif %}
2017-09-21 09:33:00 +00:00
<p>
2017-09-27 21:09:55 +00:00
<span>{% trans "Cores" %}: </span>
2017-09-21 14:02:22 +00:00
{% if vm.cores %}
2018-05-11 11:48:19 +00:00
<strong class="pull-right">{{vm.cores|floatformat}}</strong>
2017-09-21 14:02:22 +00:00
{% else %}
2018-05-11 11:48:19 +00:00
<strong class="pull-right">{{vm.cpu|floatformat}}</strong>
2017-09-21 14:02:22 +00:00
{% endif %}
2017-09-21 09:33:00 +00:00
</p>
<p>
2017-09-27 21:09:55 +00:00
<span>{% trans "Memory" %}: </span>
2018-05-11 11:48:19 +00:00
<strong class="pull-right">{{vm.memory}} GB</strong>
2017-09-21 09:33:00 +00:00
</p>
<p>
2017-09-27 21:09:55 +00:00
<span>{% trans "Disk space" %}: </span>
2018-05-11 11:48:19 +00:00
<strong class="pull-right">{{vm.disk_size}} GB</strong>
2017-09-21 09:33:00 +00:00
</p>
2018-05-11 21:17:27 +00:00
<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 %}
2018-05-11 21:17:27 +00:00
<p class="total-price">
<strong>{% trans "Total" %} </strong>
2018-05-11 11:48:19 +00:00
<strong class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</strong>
2017-09-21 09:33:00 +00:00
</p>
</div>
2017-09-20 21:20:07 +00:00
</div>
</div>
2018-05-11 21:17:27 +00:00
<hr class="thin-hr">
2017-09-20 17:36:51 +00:00
</div>
{% if not order %}
2017-09-25 21:59:38 +00:00
{% block submit_btn %}
<form method="post" id="virtual_machine_create_form">
{% 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>
2017-09-25 21:59:38 +00:00
</div>
<div class="col-sm-4 order-confirm-btn text-right">
2017-09-25 21:48:19 +00:00
<button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal">
{% trans "Place order" %}
</button>
2017-09-25 21:59:38 +00:00
</div>
2017-09-20 17:36:51 +00:00
</div>
2017-09-25 21:59:38 +00:00
</form>
{% endblock submit_btn %}
2017-12-10 19:17:55 +00:00
{% else %}
<div class="order_detail_footer">
<strong>ungleich glarus ag</strong>&nbsp;&nbsp;Bahnhofstrasse 1, 8783 Linthal, Switzerland<br>
www.datacenterlight.ch&nbsp;&nbsp;|&nbsp;&nbsp;info@datacenterlight.ch&nbsp;&nbsp;|&nbsp;&nbsp;<small>CHE-156.970.649 MWST</small>
2017-12-10 19:17:55 +00:00
</div>
2017-09-20 17:36:51 +00:00
{% endif %}
{% endif %}
</div>
2017-09-21 09:33:00 +00:00
2017-09-21 13:47:10 +00:00
{% if order %}
2017-09-21 09:33:00 +00:00
<div class="text-center" style="margin-bottom: 50px;">
<a class="btn btn-vm-back" href="{% url 'hosting:orders' %}">{% trans "BACK TO LIST" %}</a>
</div>
{% endif %}
{% if not order %}
<!-- Create VM Modal -->
<div class="modal fade" id="createvm-modal" tabindex="-1" role="dialog"
aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
2017-09-15 07:15:11 +00:00
</div>
2017-09-21 09:33:00 +00:00
<div class="modal-body">
<div class="modal-icon">
<i class="fa fa-cog fa-spin fa-3x fa-fw"></i>
<span class="sr-only">{% trans "Processing..." %}</span>
</div>
<h4 class="modal-title" id="createvm-modal-title"></h4>
2017-09-21 09:33:00 +00:00
<div class="modal-text" id="createvm-modal-body">
{% trans "Hold tight, we are processing your request" %}
</div>
<div class="modal-footer">
2017-09-27 20:39:03 +00:00
<a id="createvm-modal-done-btn" class="btn btn-success btn-ok btn-wide hide" href="{% url 'hosting:virtual_machines' %}">{% trans "OK" %}</a>
<button id="createvm-modal-close-btn" type="button" class="btn btn-danger btn-ok btn-wide hide" data-dismiss="modal" aria-label="create-vm-close">{% trans "Close" %}</button>
2017-09-21 09:33:00 +00:00
</div>
2017-09-15 07:15:11 +00:00
</div>
</div>
</div>
</div>
2017-09-21 09:33:00 +00:00
<!-- / Create VM Modal -->
{% endif %}
2017-09-01 21:39:02 +00:00
<script type="text/javascript">
2017-09-16 10:05:31 +00:00
{% trans "Some problem encountered. Please try again later." as err_msg %}
2017-09-20 21:20:07 +00:00
var create_vm_error_message = '{{err_msg|safe}}';
2017-06-21 18:24:38 +00:00
window.onload = function () {
2017-10-05 22:41:40 +00:00
var locale_dates = document.getElementsByClassName("locale_date");
2017-10-05 22:50:38 +00:00
var formats = ['YYYY-MM-DD hh:mm a']
2017-10-05 22:41:40 +00:00
var i;
for (i = 0; i < locale_dates.length; i++) {
var oldDate = moment.utc(locale_dates[i].textContent, formats);
var outputFormat = locale_dates[i].getAttribute('data-format') || oldDate._f;
locale_dates[i].innerHTML = oldDate.local().format(outputFormat);
locale_dates[i].className += ' done';
}
2017-06-21 18:24:38 +00:00
};
2017-09-20 19:49:38 +00:00
</script>
{%endblock%}
2017-06-21 18:24:38 +00:00
2017-09-21 09:33:00 +00:00
{% block js_extra %}
2017-09-25 19:34:38 +00:00
{% if order %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script>
2018-02-06 20:53:23 +00:00
<script src="{% static 'hosting/js/html2canvas.min.js' %}"></script>
2018-02-07 14:00:53 +00:00
<script src="{% static 'hosting/js/html2pdf.min.js' %}"></script>
2017-09-25 19:34:38 +00:00
<script src="{% static 'hosting/js/order.js' %}"></script>
{% endif %}
{% endblock js_extra %}