dynamicweb/hosting/templates/hosting/order_detail.html

205 lines
9 KiB
HTML
Raw Normal View History

{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% load i18n %}
{% load 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-20 20:53:08 +00:00
<div class="dashboard-container-options">
2017-09-21 09:33:00 +00:00
<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>
2017-09-20 20:53:08 +00:00
</div>
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>
<strong>{% trans "Invoice Date" %}:</strong>
2017-09-20 21:20:07 +00:00
<span id="order-created_at">
2017-09-20 17:36:51 +00:00
{% if order %}
2017-09-20 21:20:07 +00:00
{{order.created_at|date:'Y-m-d H:i'}}
2017-09-20 17:36:51 +00:00
{% else %}
2017-09-20 21:20:07 +00:00
{% now "Y-m-d H:i" %}
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-21 14:02:22 +00:00
{{cc_brand|default:'Card'}} {% trans "ending in" %} ****
2017-09-20 21:20:07 +00:00
{{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>
<strong>{% trans "Product" %}:</strong> {{vm.name}}
</p>
<div class="row">
<div class="col-sm-6">
{% comment %}
<p>
<span>{% trans "Period" %}</span>
2017-09-21 12:15:12 +00:00
<span class="pull-right">{{}}</span>
2017-09-21 09:33:00 +00:00
</p>
{% endcomment %}
<p>
<span>{% trans "Cores" %}</span>
2017-09-21 14:02:22 +00:00
{% if vm.cores %}
<span class="pull-right">{{vm.cores|floatformat}}</span>
{% else %}
<span class="pull-right">{{vm.cpu|floatformat}}</span>
{% endif %}
2017-09-21 09:33:00 +00:00
</p>
<p>
<span>{% trans "Memory" %}</span>
<span class="pull-right">{{vm.memory}} GB</span>
</p>
<p>
<span>{% trans "Disk space" %}</span>
<span class="pull-right">{{vm.disk_size}} GB</span>
</p>
<p>
<span>{% trans "Total" %}</span>
<span class="pull-right">{{vm.price}} CHF</span>
</p>
</div>
2017-09-20 21:20:07 +00:00
</div>
</div>
2017-09-21 09:33:00 +00:00
{% if not order %}
<hr>
2017-09-20 17:36:51 +00:00
{% endif %}
</div>
{% if not order %}
<form method="post" id="virtual_machine_create_form">
{% csrf_token %}
<div class="row">
<div class="col-sm-8">
2017-09-21 09:33:00 +00:00
<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 }}CHF/month{% endblocktrans %}.</div>
2017-09-20 17:36:51 +00:00
</div>
2017-09-21 09:33:00 +00:00
<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">
{% trans "Place order" %}
2017-09-20 17:36:51 +00:00
</button>
</div>
</div>
</form>
{% 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-09-16 10:05:31 +00:00
2017-06-21 18:24:38 +00:00
window.onload = function () {
2017-09-15 16:11:22 +00:00
var locale_date = moment.utc(document.getElementById("order-created_at").textContent, 'YYYY-MM-DD HH:mm').toDate();
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");
document.getElementById('order-created_at').innerHTML = locale_date;
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 %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
<script src="{% static 'hosting/js/html2pdf.js' %}"></script>
<script src="{% static 'hosting/js/order.js' %}"></script>
{% endblock js_extra %}