242 lines
7.8 KiB
HTML
242 lines
7.8 KiB
HTML
{% extends "base.html" %}
|
|
<!-- File form-visits-Visit.html generated 2018-07-10T15:25:24.201Z 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-visits-Visit' method='POST'>
|
|
{% csrf-field %}
|
|
<p class='widget'>
|
|
<label for='id'>
|
|
Id
|
|
</label>
|
|
{% if {{record.id}} %}
|
|
{% ifmemberof admin %}
|
|
<input id='id' name='id' type='number' value='{{record.id}}' maxlength='' size='16'/>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='id' name='id' class='pseudo-widget disabled'>
|
|
{{record.id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='id' name='id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% else %}
|
|
{% ifmemberof admin %}
|
|
<input id='id' name='id' type='number' value='{{record.id}}' maxlength='' size='16'/>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='id' name='id' class='pseudo-widget disabled'>
|
|
{{record.id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='id' name='id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% endif %}
|
|
</p>
|
|
<p class='widget'>
|
|
<label for='address_id'>
|
|
Address_id
|
|
</label>
|
|
{% if {{record.address_id}} %}
|
|
{% ifmemberof admin %}
|
|
<select id='address_id' name='address_id'>
|
|
{% for option in address_id %}<option value='{{option.id}}' {% ifequal record.address_id option.id%}selected{% endifequal %}>{{option.address}} {{option.postcode}}</option>{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='address_id' name='address_id' class='pseudo-widget disabled'>
|
|
{{record.address_id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='address_id' name='address_id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view address_id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% else %}
|
|
{% ifmemberof admin %}
|
|
<select id='address_id' name='address_id'>
|
|
{% for option in address_id %}<option value='{{option.id}}' {% ifequal record.address_id option.id%}selected{% endifequal %}>{{option.address}} {{option.postcode}}</option>{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='address_id' name='address_id' class='pseudo-widget disabled'>
|
|
{{record.address_id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='address_id' name='address_id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view address_id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% endif %}
|
|
</p>
|
|
<p class='widget'>
|
|
<label for='canvasser_id'>
|
|
Canvasser_id
|
|
</label>
|
|
{% if {{record.canvasser_id}} %}
|
|
{% ifmemberof admin %}
|
|
<select id='canvasser_id' name='canvasser_id'>
|
|
{% for option in canvasser_id %}<option value='{{option.id}}' {% ifequal record.canvasser_id option.id%}selected{% endifequal %}>{{option.username}} {{option.fullname}} {{option.address_id}} {{option.phone}} {{option.email}}</option>{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='canvasser_id' name='canvasser_id' class='pseudo-widget disabled'>
|
|
{{record.canvasser_id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='canvasser_id' name='canvasser_id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view canvasser_id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% else %}
|
|
{% ifmemberof admin %}
|
|
<select id='canvasser_id' name='canvasser_id'>
|
|
{% for option in canvasser_id %}<option value='{{option.id}}' {% ifequal record.canvasser_id option.id%}selected{% endifequal %}>{{option.username}} {{option.fullname}} {{option.address_id}} {{option.phone}} {{option.email}}</option>{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='canvasser_id' name='canvasser_id' class='pseudo-widget disabled'>
|
|
{{record.canvasser_id}}
|
|
</span>
|
|
{% else %}
|
|
<span id='canvasser_id' name='canvasser_id' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view canvasser_id of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% endif %}
|
|
</p>
|
|
<p class='widget'>
|
|
<label for='date'>
|
|
Date
|
|
</label>
|
|
{% if {{record.date}} %}
|
|
{% ifmemberof admin %}
|
|
<input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='date' name='date' class='pseudo-widget disabled'>
|
|
{{record.date}}
|
|
</span>
|
|
{% else %}
|
|
<span id='date' name='date' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view date of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% else %}
|
|
{% ifmemberof admin %}
|
|
<input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/>
|
|
{% else %}
|
|
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers admin %}
|
|
<span id='date' name='date' class='pseudo-widget disabled'>
|
|
{{record.date}}
|
|
</span>
|
|
{% else %}
|
|
<span id='date' name='date' class='pseudo-widget not-authorised'>
|
|
You are not permitted to view date of visits
|
|
</span>
|
|
{% endifmemberof %}
|
|
{% endifmemberof %}
|
|
{% endif %}
|
|
</p>
|
|
{% ifmemberof admin %}
|
|
<p class='widget action-safe'>
|
|
<label for='save-button' class='action-safe'>
|
|
To save this visits 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 visits 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 `address_id`.
|
|
*/
|
|
$('#address_id').selectize({
|
|
valueField: 'id',
|
|
labelField: 'name',
|
|
searchField: 'name',
|
|
options: [],
|
|
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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
/**
|
|
* selectize one select widget. Substitute the actual id of the widget for `canvasser_id`.
|
|
*/
|
|
$('#canvasser_id').selectize({
|
|
valueField: 'id',
|
|
labelField: 'name',
|
|
searchField: 'name',
|
|
options: [],
|
|
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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|