youyesyet/resources/templates/auto/form-addresses-Address.html
2018-07-15 12:42:32 +01:00

279 lines
8.9 KiB
HTML

{% extends "base.html" %}
<!-- File form-addresses-Address.html generated 2018-07-15T11:36:36.868Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block extra-head %}
{% script "/js/lib/node_modules/selectize/dist/js/standalone/selectize.min.js" %}
{% style "/js/lib/node_modules/selectize/dist/css/selectize.css" %}
{% endblock %}
{% block content %}
<div id='content' class='edit'>
<form action='{{servlet-context}}/form-addresses-Address' method='POST'>
{% csrf-field %}
<input id='id' name='id' type='hidden' value='{{record.id}}'/>
<p class='widget'>
<label for='address'>
Address
</label>
{% if {{record.address}} %}
{% ifmemberof admin %}
<input id='address' name='address' type='string' value='{{record.address}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='address' name='address' class='pseudo-widget disabled'>
{{record.address}}
</span>
{% else %}
<span id='address' name='address' class='pseudo-widget not-authorised'>
You are not permitted to view address of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<input id='address' name='address' type='string' value='{{record.address}}' maxlength='256' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='address' name='address' class='pseudo-widget disabled'>
{{record.address}}
</span>
{% else %}
<span id='address' name='address' class='pseudo-widget not-authorised'>
You are not permitted to view address of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='postcode'>
Postcode
</label>
{% if {{record.postcode}} %}
{% ifmemberof admin %}
<input id='postcode' name='postcode' type='string' value='{{record.postcode}}' maxlength='16' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='postcode' name='postcode' class='pseudo-widget disabled'>
{{record.postcode}}
</span>
{% else %}
<span id='postcode' name='postcode' class='pseudo-widget not-authorised'>
You are not permitted to view postcode of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<input id='postcode' name='postcode' type='string' value='{{record.postcode}}' maxlength='16' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='postcode' name='postcode' class='pseudo-widget disabled'>
{{record.postcode}}
</span>
{% else %}
<span id='postcode' name='postcode' class='pseudo-widget not-authorised'>
You are not permitted to view postcode of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='phone'>
Phone
</label>
{% if {{record.phone}} %}
{% ifmemberof admin %}
<input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='phone' name='phone' class='pseudo-widget disabled'>
{{record.phone}}
</span>
{% else %}
<span id='phone' name='phone' class='pseudo-widget not-authorised'>
You are not permitted to view phone of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='phone' name='phone' class='pseudo-widget disabled'>
{{record.phone}}
</span>
{% else %}
<span id='phone' name='phone' class='pseudo-widget not-authorised'>
You are not permitted to view phone of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='district_id'>
District_id
</label>
{% if {{record.district_id}} %}
{% ifmemberof admin %}
<select id='district_id' name='district_id'>
{% for option in district_id %}<option value='{{option.id}}' {% ifequal record.district_id option.id%}selected='selected'{% endifequal %}>{{option.name}}</option>{% endfor %}
</select>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='district_id' name='district_id' class='pseudo-widget disabled'>
{{record.district_id}}
</span>
{% else %}
<span id='district_id' name='district_id' class='pseudo-widget not-authorised'>
You are not permitted to view district_id of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<select id='district_id' name='district_id'>
{% for option in district_id %}<option value='{{option.id}}' {% ifequal record.district_id option.id%}selected='selected'{% endifequal %}>{{option.name}}</option>{% endfor %}
</select>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='district_id' name='district_id' class='pseudo-widget disabled'>
{{record.district_id}}
</span>
{% else %}
<span id='district_id' name='district_id' class='pseudo-widget not-authorised'>
You are not permitted to view district_id of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='latitude'>
Latitude
</label>
{% if {{record.latitude}} %}
{% ifmemberof admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='latitude' name='latitude' class='pseudo-widget disabled'>
{{record.latitude}}
</span>
{% else %}
<span id='latitude' name='latitude' class='pseudo-widget not-authorised'>
You are not permitted to view latitude of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='latitude' name='latitude' class='pseudo-widget disabled'>
{{record.latitude}}
</span>
{% else %}
<span id='latitude' name='latitude' class='pseudo-widget not-authorised'>
You are not permitted to view latitude of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='longitude'>
Longitude
</label>
{% if {{record.longitude}} %}
{% ifmemberof admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='longitude' name='longitude' class='pseudo-widget disabled'>
{{record.longitude}}
</span>
{% else %}
<span id='longitude' name='longitude' class='pseudo-widget not-authorised'>
You are not permitted to view longitude of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='longitude' name='longitude' class='pseudo-widget disabled'>
{{record.longitude}}
</span>
{% else %}
<span id='longitude' name='longitude' class='pseudo-widget not-authorised'>
You are not permitted to view longitude of addresses
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
{% ifmemberof admin %}
<p class='widget action-safe'>
<label for='save-button' class='action-safe'>
To save this addresses record
</label>
<input id='save-button' name='save-button' class='action-safe' type='submit' value='Save!'/>
</p>
{% endifmemberof %}
{% ifmemberof admin %}
<p class='widget action-dangerous'>
<label for='delete-button' class='action-dangerous'>
To delete this addresses record
</label>
<input id='delete-button' name='delete-button' class='action-dangerous' type='submit' value='Delete!'/>
</p>
{% endifmemberof %}
</form>
</div>
{% endblock %}
{% block extra-tail %}
<script type='text/javascript'>
/**
* selectize one select widget. Substitute the actual id of the widget for `district_id`,
* and the current value for {{record.district_id}}.
*/
$('#district_id').selectize({
valueField: 'id',
labelField: 'name',
searchField: 'name',
hideSelected: false,
create: false,
load: function(query, callback) {
console.log('Desperately seeking ' + query);
if (query === null || !query.length) return callback();
$.ajax({
url: '/json/auto/search-strings-electors?name=' + query,
type: 'GET',
dataType: 'jsonp',
error: function() {
console.log( 'Query ' + query + ' failed.');
callback();
},
success: function(res) {
console.log('Received ' + res + ' records for ' + query);
callback(res);
}
});
}
})[0].selectize.setValue({{record.district_id}}, true);
</script>
{% endblock %}