form select type of device in the list of device. Step 1

This commit is contained in:
Cayo Puigdefabregas 2022-03-04 13:00:51 +01:00
parent ceb63b4eb3
commit 95a8b13a6b
2 changed files with 15 additions and 2 deletions

View file

@ -42,7 +42,13 @@ class DeviceListMix(View):
def get_context(self, lot_id):
# TODO @cayop adding filter
# https://github.com/eReuse/devicehub-teal/blob/testing/ereuse_devicehub/resources/device/views.py#L56
filter_types = ['Desktop', 'Laptop', 'Server']
import pdb; pdb.set_trace()
type_device = {
None: ['Desktop', 'Laptop', 'Server'],
'Computer': ['Computer'],
'Monitor': ['Monitor'],
}
filter_types = type_device[request.get('filter')]
lots = Lot.query.outerjoin(Trade) \
.filter(or_(Trade.user_from == g.user,
Trade.user_to == g.user,

View file

@ -279,10 +279,17 @@
<div class="tab-content pt-2">
<h5 class="card-title">Computers</h5>
<form method="get">
<select class="form-data" name="filter">
<option value="Computer">Computer</option>
<option value="Monitor">Monitor</option>
</select>
<input type="submit" class="btn btn-primary" value="Search" />
</form>
<table class="table">
<thead>
<tr>
<th scope="col">Select all</th>
<th scope="col">Select</th>
<th scope="col">Title</th>
<th scope="col">DHID</th>
<th scope="col">Tags</th>