mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 12:29:24 +00:00
Addition of the ShoppingList view to know the item to buy
This commit is contained in:
34
stock/templates/stock/shopping_list_items.jinja
Normal file
34
stock/templates/stock/shopping_list_items.jinja
Normal file
@ -0,0 +1,34 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}{{ shoppinglist }}'s items{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if current_tab == "stocks" %}
|
||||
<a href="{{ url('stock:shoppinglist_list', stock_id=shoppinglist.stock_owner.id)}}">{% trans %}Back{% endtrans %}</a>
|
||||
{% endif %}
|
||||
|
||||
<h3>{{ shoppinglist.name }}</h3>
|
||||
{% for t in ProductType.objects.order_by('name') %}
|
||||
{% if shoppinglist.items_to_buy.filter(type=t) %}
|
||||
<h4>{{ t }}</h4>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{% trans %}Name{% endtrans %}</td>
|
||||
<td>{% trans %}Number{% endtrans %}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for i in shoppinglist.items_to_buy.filter(type=t).order_by('name') %}
|
||||
<tr>
|
||||
<td>{{ i.name }}</td>
|
||||
<td>{{ i.tobuy_quantity }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
@ -7,7 +7,7 @@
|
||||
{% block content %}
|
||||
{% if current_tab == "stocks" %}
|
||||
<p><a href="{{ url('stock:new_item', stock_id=stock.id)}}">{% trans %}New item{% endtrans %}</a></p>
|
||||
<h5><a href="{{ url('stock:shopping_list', stock_id=stock.id)}}">{% trans %}Shopping list{% endtrans %}</a></h5>
|
||||
<h5><a href="{{ url('stock:shoppinglist_list', stock_id=stock.id)}}">{% trans %}Shopping list{% endtrans %}</a></h5>
|
||||
{% endif %}
|
||||
{% if stock %}
|
||||
<h3>{{ stock }}</h3>
|
||||
|
@ -13,6 +13,7 @@
|
||||
{% if user.can_edit(s) %}
|
||||
<a href="{{ url('stock:items_list', stock_id=s.id) }}">{{s}}</a>
|
||||
- <a href="{{ url('stock:edit', stock_id=s.id) }}">Edit</a>
|
||||
- <a href="{{ url('stock:shoppinglist_list', stock_id=s.id)}}">{% trans %}Shopping lists{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
@ -1,11 +0,0 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{{stock}}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{{stock}}</h3>
|
||||
<a href="{{ url('stock:new_item', stock_id=stock.id) }}">{% trans %}New Item{% endtrans %}</a>
|
||||
{% endblock %}
|
||||
|
@ -5,6 +5,60 @@ Shopping list for {{ stock }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Shopping list for {{ stock }}</h3>
|
||||
{% if current_tab == "stocks" %}
|
||||
<a href="{{ url('stock:shoppinglist_create', stock_id=stock.id)}}">{% trans %}Do shopping{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<h3>{% trans s=stock %}Shopping lists history for {{ s }}{% endtrans %}</h3>
|
||||
|
||||
<h4>To do</h4>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{% trans %}Date{% endtrans %}</td>
|
||||
<td>{% trans %}Name{% endtrans %}</td>
|
||||
<td>{% trans %}Number of items{% endtrans %}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for s in shoppinglist_list.filter(todo=True).filter(stock_owner=stock).order_by('-date') %}
|
||||
<tr>
|
||||
<td>{{ s.date|localtime|date("Y-m-d H:i") }}</td>
|
||||
<td><a href="{{ url('stock:shoppinglist_items', stock_id=stock.id, shoppinglist_id=s.id)}}">{{ s.name }}</a></td>
|
||||
<td>{{ s.items_to_buy.count() }}</td>
|
||||
<td>
|
||||
<a href="{{ url('stock:shoppinglist_set_done', stock_id=stock.id, shoppinglist_id=s.id)}}">{% trans %}Mark as done{% endtrans %}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url('stock:shoppinglist_delete', stock_id=stock.id, shoppinglist_id=s.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4>Done</h4>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{% trans %}Date{% endtrans %}</td>
|
||||
<td>{% trans %}Name{% endtrans %}</td>
|
||||
<td>{% trans %}Number of items{% endtrans %}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for s in shoppinglist_list.filter(todo=False).filter(stock_owner=stock).order_by('-date') %}
|
||||
<tr>
|
||||
<td>{{ s.date|localtime|date("Y-m-d H:i") }}</td>
|
||||
<td><a href="{{ url('stock:shoppinglist_items', stock_id=stock.id, shoppinglist_id=s.id)}}">{{ s.name }}</a></td>
|
||||
<td>{{ s.items_to_buy.count() }}</td>
|
||||
<td>
|
||||
<a href="{{ url('stock:shoppinglist_set_todo', stock_id=stock.id, shoppinglist_id=s.id)}}">{% trans %}Mark as todo{% endtrans %}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url('stock:shoppinglist_delete', stock_id=stock.id, shoppinglist_id=s.id)}}">{% trans %}Delete{% endtrans %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user