mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
Add basics of eboutic, still need to implement the ET API to get bank payment
This commit is contained in:
49
eboutic/templates/eboutic/eboutic_main.jinja
Normal file
49
eboutic/templates/eboutic/eboutic_main.jinja
Normal file
@ -0,0 +1,49 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% macro add_product(id, content) %}
|
||||
<form method="post" action="{{ url('eboutic:main') }}" class="inline" style="display:inline">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="add_product">
|
||||
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro del_product(id, content) %}
|
||||
<form method="post" action="{{ url('eboutic:main') }}" class="inline" style="display:inline">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="del_product">
|
||||
<button type="submit" name="product_id" value="{{ id }}"> {{ content }} </button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Eboutic{% endtrans %}</h3>
|
||||
|
||||
<div id="basket">
|
||||
<p>{% trans %}Basket: {% endtrans %}</p>
|
||||
<ul>
|
||||
{% for id,infos in request.session['basket']|dictsort %}
|
||||
{% set product = eboutic.products.filter(id=id).first() %}
|
||||
{% set s = infos['qty'] * infos['price'] / 100 %}
|
||||
<li>{{ del_product(id, '-') }} {{ infos['qty'] }} {{ add_product(id, '+') }} {{ product.name }}: {{ "%0.2f"|format(s) }} €</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket_total) }} €</strong></p>
|
||||
<form method="post" action="{{ url('eboutic:command') }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="ask_payment">
|
||||
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<p><strong>{% trans %}Products: {% endtrans %}</strong>
|
||||
{% for p in eboutic.products.all() %}
|
||||
{{ add_product(p.id, p.name) }}
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
42
eboutic/templates/eboutic/eboutic_makecommand.jinja
Normal file
42
eboutic/templates/eboutic/eboutic_makecommand.jinja
Normal file
@ -0,0 +1,42 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Eboutic{% endtrans %}</h3>
|
||||
|
||||
<div>
|
||||
<p>{% trans %}Basket: {% endtrans %}</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Article</td>
|
||||
<td>Quantity</td>
|
||||
<td>Unit price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in basket.items.all() %}
|
||||
<tr>
|
||||
<td>{{ item.product_name }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.product_unit_price }} €</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tbody>
|
||||
</table>
|
||||
<form method="post" action="{{ url('eboutic:command') }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="pay_with_credit_card">
|
||||
<input type="submit" value="{% trans %}Pay with credit card{% endtrans %}" />
|
||||
</form>
|
||||
<form method="post" action="{{ url('eboutic:pay_with_sith') }}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="action" value="pay_with_sith_account">
|
||||
<input type="submit" value="{% trans %}Pay with Sith account{% endtrans %}" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
19
eboutic/templates/eboutic/eboutic_payment_result.jinja
Normal file
19
eboutic/templates/eboutic/eboutic_payment_result.jinja
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Eboutic{% endtrans %}</h3>
|
||||
|
||||
<div>
|
||||
{% if not_enough %}
|
||||
{% trans %}Payment failed{% endtrans %}
|
||||
{% else %}
|
||||
{% trans %}Payment successful{% endtrans %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user