Skip to content

Commit

Permalink
Merge pull request #124 from ZeusWPI/feature/120/order-button-on-loca…
Browse files Browse the repository at this point in the history
…tion-page

Adds a button on the location/ and locations/ page to start a new order
  • Loading branch information
TomNaessens authored May 30, 2019
2 parents 3465742 + 2d4ad2a commit 4e143b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/templates/location.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
<h3>Location: {{ location.name }}</h3>
<span class="glyphicon glyphicon-home"></span>: {{ location.address }} <br/>
<span class="glyphicon glyphicon-phone"></span>: {{ location.telephone }} <br/>
<span class="glyphicon glyphicon-link"></span>: <a href="{{ location.website}}">{{ location.website }}</a>
<span class="glyphicon glyphicon-link"></span>: <a href="{{ location.website}}">{{ location.website }}</a> <br/>
<a href="{{ url_for("order_bp.orders", location_id=location.id) }}" class="btn btn-primary btn-sm">Create order</a>
</div>
</div>
<div class="row">
<div class="col-md-push-1 col-md-10 darker">
<h3 id="order-title">Products</h3>
<table class="table table-hover table-condensed">
Expand Down
5 changes: 4 additions & 1 deletion app/templates/locations.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
<h3>Locations</h3>
<table class="table table-hover table-condensed">
<thead>
<tr><th>Name</th><th>Address</th><th></th></tr>
<tr><th>Name</th><th>Address</th><th></th><th></th><th></th></tr>
</thead>
<tbody>
{% for loc in locations -%}
<tr>
<td><a href="{{ url_for('location', id=loc.id) }}">{{ loc.name }}</a></td>
<td>{{ loc.address }}<td>
<td><a href="{{ loc.website}}"><span class="glyphicon glyphicon-link"></span></a></td>
<td>
<a href="{{ url_for("order_bp.orders", location_id=loc.id) }}" class="btn btn-primary btn-xs">Create order</a>
</td>
</tr>
{%- endfor %}
</tbody>
Expand Down
3 changes: 3 additions & 0 deletions app/views/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
def orders(form=None):
if form is None and not current_user.is_anonymous():
form = OrderForm()
location_id = request.args.get('location_id')
form.location_id.default = location_id
form.process()
form.populate()
return render_template('orders.html', orders=get_orders(), form=form)

Expand Down

0 comments on commit 4e143b9

Please sign in to comment.