Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#723: collection center #886

Merged
merged 1 commit into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions mainapp/templates/mainapp/collectioncenter_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ <h3>Collection Centers</h3>

<table class="table" id="collection-center-table">
<tr>
<th>Center Name <span><input class="search" id="search-name" type="text" name="search-name" /></span></th>
<th>Address <span><input class="search" id="search-address" type="text" name="search-address" /></span></th>
<th>Contacts <span><input class="search" id="search-contact" type="text" name="search-contact" /></span></th>
<th>Materials Collecting <span><input class="search" id="search-materials" type="text" name="search-materials" /></span></th>
<th>Center ID</th>
<th>Center Name <span><input class="search" id="search-name" type="text" name="search-name" /></span></th>
<th>Address <span><input class="search" id="search-address" type="text" name="search-address" /></span></th>
<th>Contacts <span><input class="search" id="search-contact" type="text" name="search-contact" /></span></th>
<th>Materials Collecting <span><input class="search" id="search-materials" type="text" name="search-materials" /></span></th>
</tr>
{% for center in filter.qs %}
<tr valign="top">
<td>{{ center.id }}</td>
<td>{{ center.name }}</td>
<td>{{ center.address }}</td>
<td>{{ center.contacts }}</td>
<td>{{ center.type_of_materials_collecting }}</td>
</tr>
{% empty %}
<tr><td colspan="4">No Collection Centers added yet.</td></tr>
<tr><td colspan="5">No Collection Centers added yet.</td></tr>
{% endfor %}
</table>

Expand Down Expand Up @@ -74,16 +76,16 @@ <h3>Collection Centers</h3>
el = $(el);
var tds = el.find("td");

var name = tds.eq(0).text().toLowerCase();
var name = tds.eq(1).text().toLowerCase();
var nameKey = $("#search-name").val().toLowerCase();

var address = tds.eq(1).text().toLowerCase();
var address = tds.eq(2).text().toLowerCase();
var addressKey = $("#search-address").val().toLowerCase();

var contact = tds.eq(2).text().toLowerCase();
var contact = tds.eq(3).text().toLowerCase();
var contactKey = $("#search-contact").val().toLowerCase();

var materials = tds.eq(3).text().toLowerCase();
var materials = tds.eq(4).text().toLowerCase();
var materialsKey = $("#search-materials").val().toLowerCase();


Expand Down
3 changes: 1 addition & 2 deletions mainapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class CollectionCenterListView(ListView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['filter'] = CollectionCenterFilter(
self.request.GET, queryset=CollectionCenter.objects.all()
self.request.GET, queryset=CollectionCenter.objects.all().order_by('-id')
)
return context

Expand All @@ -870,7 +870,6 @@ class Meta:
'type_of_materials_collecting',
'is_inside_kerala',
'district',
'lsg_type',
'lsg_name',
'ward_name',
'city',
Expand Down