Skip to content

Commit

Permalink
Merge pull request #175 from meomancer/164
Browse files Browse the repository at this point in the history
update invoice layout
  • Loading branch information
meomancer authored Dec 6, 2016
2 parents 8a103c4 + c3111a9 commit a0f3a12
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 9 deletions.
5 changes: 1 addition & 4 deletions deployment/docker/REQUIREMENTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ mezzanine-slides
OWSLib==0.12
psycopg2
raven==5.8.1
requests==2.0.0
# Raven pinned to 3.3.7 - see
# https://github.com/getsentry/raven-python/issues/337

requests==2.0.0
Binary file added django_project/kartoza_theme/static/img/save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions django_project/kartoza_theme/templates/shop/billing_shipping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{% extends "shop/checkout.html" %}
{% load staticfiles i18n mezzanine_tags %}

{% block extra_head %}
{{ block.super }}
<script src="{% static "cartridge/js/shipping_fields.js" %}"></script>
{% endblock %}

{% block fields %}
{% if request.cart.has_items %}
{% if not request.user.is_authenticated %}
{% ifinstalled mezzanine.accounts %}
<p>
{% url "login" as login_url %}
{% url "signup" as signup_url %}
{% with request.path as next %}
{% blocktrans %}
If you have an existing account or would like to create one, please
<a href="{{ login_url }}?next={{ next }}">log in</a> or
<a href="{{ signup_url }}?next={{ next }}">sign up</a>.
{% endblocktrans %}
{% endwith %}
</p>
{% endifinstalled %}
{% endif %}

{% errors_for form %}

<fieldset>
<legend>{% trans "Billing Details" %}</legend>
{% fields_for form.billing_detail_fields %}
</fieldset>

<fieldset>
<legend>{% trans "Delivery Details" %}</legend>
{% fields_for form.same_billing_shipping_field %}
<div id="shipping_fields">{% fields_for form.shipping_detail_fields %}</div>
{% fields_for form.additional_instructions_field %}
{% fields_for form.remember_field %}
</fieldset>

{% if not settings.SHOP_CHECKOUT_STEPS_SPLIT and settings.SHOP_PAYMENT_STEP_ENABLED %}
{% include "shop/includes/payment_fields.html" %}
{% endif %}

{% fields_for form.other_fields %}

{% endif %}
{% endblock %}


{% block extra_js %}
<script>
$(document).ready(function () {
var phone_pattern = '^0.*$';
{# billing #}
$phone_label = $('.input_id_billing_detail_phone label');
$phone_label.html($phone_label.html() + " <i>(with leading 0)</i>");
$phone_input = $('.input_id_billing_detail_phone input');
$phone_input.attr('pattern', phone_pattern);
{# shipping #}
$phone_label = $('.input_id_shipping_detail_phone label');
$phone_label.html($phone_label.html() + " <i>(with leading 0)</i>");
$phone_input = $('.input_id_shipping_detail_phone input');
$phone_input.attr('pattern', phone_pattern);
});
</script>
{% endblock %}
10 changes: 5 additions & 5 deletions django_project/kartoza_theme/templates/shop/complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
<form class="order-complete-form" method="post"
action="{% url "shop_invoice_resend" order.id %}?next={{ request.path }}">
{% csrf_token %}
{% if has_pdf %}
<a class="btn btn-primary"
href="{% url "shop_invoice" order.id %}?format=pdf">{% trans "Download PDF invoice" %}</a>
{% endif %}
<a class="btn btn-default" target="_blank"
{# {% if has_pdf %}#}
{# <a class="btn btn-primary"#}
{# href="{% url "shop_invoice" order.id %}?format=pdf">{% trans "Download PDF invoice" %}</a>#}
{# {% endif %}#}
<a class="btn btn-primary" target="_blank"
href="{% url "shop_invoice" order.id %}">{% trans "View invoice in your browser" %}</a>
<br>
<br>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{% load shop_tags i18n %}

{% block extra_css %}
<style>
table {
border-collapse: collapse
}

a {
text-decoration: none;
}

.container {
margin: auto;
padding-bottom: 20px;
width: 800px;
}

.left-title {
color: #8C8B8B;
font-size: 42px;
font-family: 'Leto', sans-serif;
font-weight: 900;
}

.left-title img {
margin-top: 5px;
height: 46px;
width: 55px;
}

.left-title-desc {
font-size: 12px;
}

.big-title {
color: #8C8B8B;
font-size: 36px;
font-weight: bold;
margin-top: 10px;
margin-bottom: 12px;
}

.right-title .big-title {
margin-top: 20px;
}

.bordered th, .bordered td {
border: solid 1px #8C8B8B;
}

.bordered th {
background-color: #ededed;
}

.borderless th, .borderless td {
border: none;
}

.borderless th {
background-color: white;
}

.download-button {
background: #384452;
border-radius: 50%;
bottom: 20px;
cursor: pointer;
height: 20px;
position: absolute;
right: 20px;
width: 20px;
padding: 20px;
}

.download-button img {
width: 20px;
height: 20px;
}

.download-button:hover {
background: #3e6693;

}

</style>
{% endblock %}
<div class="download-button" onClick="window.print()">
<img src="/static/img/save.png">
</div>
<div class="container">
<table width="100%" cellspacing="0" cellpadding="10">
<tr>
<td align="left" width="60%" valign="top" style="padding-right: 30px;">
<span class="left-title"><img src="/static/img/kartoza-logo-only.png"> Kartoza</span>
<p class="left-title-desc">
<b>Company registration no</b>: 2014/109067/07
<br>
<b>Address</b>: Block C Top floor Unit 9C, Carpe Diem, 26 Quantum
Street, Technopark,
Stellenbosch, 7600, South Africa
<br>
<b>VAT Number</b>: 4450266806
<br>
<b>Tel</b>: +27 (0)21 880 0990 / +27 (0)73 768 8108 / +27 (0)87 809 2702 Fax: +27 (0)86 564 4056
<br>
<b>Web</b>: <a href="http://kartoza.com" target="_blank">http://kartoza.com</a>
<br>
<b>Email</b>: [email protected]
</p>
</td>
<td align="right" width="40%" class="right-title" valign="top">
<div class="big-title">Tax Invoice</div>
<table width="100%" cellspacing="0" cellpadding="10" class="bordered">
<tr>
<th>{% trans "Order ID" %} #</th>
<th>Date</th>
</tr>
<tr>
<td align="center">{{ order.id }}</td>
<td align="center">{{ order.time }}</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<br>
<table class="bordered" width="100%" cellspacing="0" cellpadding="10">
<tr>
<th align="left" width="50%">{% trans "Billing Details" %}</th>
<th align="left" width="50%">{% trans "Shipping Details" %}</th>
</tr>
<tr>
<td valign="top">
<table class="borderless" border="0">
{% for field, value in order_billing_detail_fields %}
<tr>
<td>{{ field }}&nbsp;&nbsp;&nbsp;</td>
<td>: {{ value }}</td>
</tr>
{% endfor %}
</table>
</td>
<td valign="top">
<table class="borderless" border="0">
{% for field, value in order_shipping_detail_fields %}
<tr>
<td>{{ field }}&nbsp;&nbsp;&nbsp;</td>
<td>: {{ value }}</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
</table>

<br>
<div class="big-title">{% trans "Items Ordered" %}</div>
<br>
<table class="bordered" width="100%" border="1" cellspacing="0" cellpadding="10">
<tr>
<th align="left">{% trans "Item" %}</th>
<th align="right">{% trans "Unit Price" %}</th>
<th align="right">{% trans "Qty" %}</th>
<th align="right">{% trans "Price" %}</th>
</tr>
{% for item in order.items.all %}
<tr>
<td>{{ item.description }}</td>
<td align="right" valign="top">{{ item.unit_price|currency }}</td>
<td align="right" valign="top">{{ item.quantity }}</td>
<td align="right" valign="top">{{ item.total_price|currency }}</td>
</tr>
{% endfor %}
{% order_totals_in_table %}
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% load shop_tags i18n %}

<tr>
<td class="borderless"></td>
<td colspan="2" align="right">{% trans "Sub total" %}</td>
<td align="right">{{ item_total|currency }}</td>
</tr>
{% if tax_total %}
<tr>
<td class="borderless"></td>
<td colspan="2" align="right">
{% if tax_type %}
{{ tax_type }}
{% else %}
{% trans "Tax" %}:
{% endif %}
</td>
<td align="right">{{ tax_total|currency }}</td>
</tr>
{% endif %}

{% if shipping_type or shipping_total %}
<tr>
<td class="borderless"></td>
<td colspan="2" align="right">
{% if shipping_type %}
{{ shipping_type }}
{% else %}
{% trans "Shipping" %}
{% endif %}
</td>
<td align="right">{{ shipping_total|currency }}</td>
</tr>
{% endif %}
{% if order_total_before_discount %}
<tr>
<td></td>
<td colspan="2" align="right">
{% trans "Total" %}
</td>
<td align="right">{{ order_total_before_discount|currency }}</td>
</tr>
{% else %}
<tr>
<td colspan="3" align="right">
{% trans "Total" %}
</td>
<td align="right">{{ order_total|currency }}</td>
</tr>
{% endif %}
{% if discount_total %}
<tr>
<td></td>
<td colspan="2" align="right">
{% if discount_type %}
{{ discount_type }}
{% else %}
{% trans "Discount" %}
{% endif %}
</td>
<td align="right">-{{ discount_total|currency }}</td>
</tr>
<tr>
<td colspan="3" align="right">
{% trans "Total" %}
</td>
<td align="right">{{ order_total|currency }}</td>
</tr>
{% endif %}
8 changes: 8 additions & 0 deletions django_project/kartoza_theme/templatetags/shop_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def order_totals(context):
return _order_totals(context)


@register.inclusion_tag("shop/includes/order_totals_in_table.html", takes_context=True)
def order_totals_in_table(context):
"""
HTML version of order_totals.
"""
return _order_totals(context)


@register.inclusion_tag("shop/includes/order_totals.txt", takes_context=True)
def order_totals_text(context):
"""
Expand Down

0 comments on commit a0f3a12

Please sign in to comment.