159 lines
3.4 KiB
HTML
159 lines
3.4 KiB
HTML
{% extends "base.html" %}
|
|
<!-- File list-addresses-Addresses.html generated 2018-07-15T19:59:46.657Z by adl.to-selmer-templates.
|
|
See [Application Description Language](https://github.com/simon-brooke/adl).-->
|
|
|
|
|
|
{% block back-links %}
|
|
<div>
|
|
<div class='back-link-container'>
|
|
<a id='prev-selector' class='back-link'>
|
|
Previous
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
{% block big-links %}
|
|
<div>
|
|
<div class='big-link-container'>
|
|
<a id='next-selector' role='button' class='big-link'>
|
|
Next
|
|
</a>
|
|
</div>
|
|
{% ifmemberof admin %}
|
|
<div class='big-link-container'>
|
|
<a href='{{servlet-context}}/form-addresses-Address' class='big-link'>
|
|
Add a new Address
|
|
</a>
|
|
</div>
|
|
{% endifmemberof %}
|
|
</div>
|
|
|
|
{% endblock %}
|
|
{% block content %}
|
|
<form id='list-addresses-Addresses' class='list' action='{{servlet-context}}/list-addresses-Addresses' method='POST'>
|
|
{% csrf-field %}
|
|
<input id='offset' name='offset' type='text' value='{{params.offset|default:0}}'/>
|
|
<input id='limit' name='limit' type='text' value='{{params.limit|default:50}}'/>
|
|
<table caption='addresses'>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
Id
|
|
</th>
|
|
<th>
|
|
Address
|
|
</th>
|
|
<th>
|
|
Postcode
|
|
</th>
|
|
<th>
|
|
Phone
|
|
</th>
|
|
<th>
|
|
District_id
|
|
</th>
|
|
<th>
|
|
Latitude
|
|
</th>
|
|
<th>
|
|
Longitude
|
|
</th>
|
|
<th>
|
|
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<th>
|
|
<input id='id' type='text' name='id' value='{{ params.id }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='address' type='text' name='address' value='{{ params.address }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='postcode' type='text' name='postcode' value='{{ params.postcode }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='phone' type='text' name='phone' value='{{ params.phone }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='district_id' type='text' name='district_id' value='{{ params.district_id }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='latitude' type='number' name='latitude' value='{{ params.latitude }}'/>
|
|
</th>
|
|
<th>
|
|
<input id='longitude' type='number' name='longitude' value='{{ params.longitude }}'/>
|
|
</th>
|
|
<th>
|
|
<input type='submit' id='search-widget' value='Search'/>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for record in records %}
|
|
<tr>
|
|
<td>
|
|
{{ record.id }}
|
|
</td>
|
|
<td>
|
|
{{ record.address }}
|
|
</td>
|
|
<td>
|
|
{{ record.postcode }}
|
|
</td>
|
|
<td>
|
|
{{ record.phone }}
|
|
</td>
|
|
<td>
|
|
<a href='{{servlet-context}}/form-districts-District?id={{ record.district_id }}'>
|
|
{{ record.district_id_expanded }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
{{ record.latitude }}
|
|
</td>
|
|
<td>
|
|
{{ record.longitude }}
|
|
</td>
|
|
<td>
|
|
<a href='{{servlet-context}}/form-addresses-Address?id={{ record.id }}'>
|
|
View
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
|
|
{% endblock %}
|
|
{% block extra-script %}
|
|
|
|
var form = document.getElementById('list-addresses-Addresses');
|
|
var ow = document.getElementById('offset');
|
|
var lw = document.getElementById('limit');
|
|
form.addEventListener('submit', function() {
|
|
ow.value='0';
|
|
});
|
|
|
|
var prevSelector = document.getElementById('prev-selector');
|
|
if (prevSelector != null) {
|
|
prevSelector.addEventListener('click', function () {
|
|
if (parseInt(ow.value)===0) {
|
|
window.location = '{{servlet-context}}/admin';
|
|
} else {
|
|
ow.value=(parseInt(ow.value)-parseInt(lw.value));
|
|
console.log('Updated offset to ' + ow.value);
|
|
form.submit();
|
|
}
|
|
});
|
|
}
|
|
|
|
document.getElementById('next-selector').addEventListener('click', function () {
|
|
ow.value=(parseInt(ow.value)+parseInt(lw.value));
|
|
console.log('Updated offset to ' + ow.value);
|
|
form.submit();
|
|
});
|
|
{% endblock %}
|