youyesyet/resources/templates/auto/form-teams-Team.html

384 lines
11 KiB
HTML

{% extends "base.html" %}
<!-- File form-teams-Team.html generated 2018-07-10T15:25:24.204Z 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-teams-Team' method='POST'>
{% csrf-field %}
<input id='id' name='id' type='hidden' value='{{record.id}}'/>
<p class='widget'>
<label for='name'>
Name
</label>
{% if {{record.name}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %}
<span id='name' name='name' class='pseudo-widget disabled'>
{{record.name}}
</span>
{% else %}
<span id='name' name='name' class='pseudo-widget not-authorised'>
You are not permitted to view name of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %}
<span id='name' name='name' class='pseudo-widget disabled'>
{{record.name}}
</span>
{% else %}
<span id='name' name='name' class='pseudo-widget not-authorised'>
You are not permitted to view name of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='district_id'>
District_id
</label>
{% if {{record.district_id}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='district_id' name='district_id'>
{% for option in district_id %}<option value='{{option.id}}' {% ifequal record.district_id option.id%}selected{% endifequal %}>{{option.name}}</option>{% endfor %}
</select>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='district_id' name='district_id'>
{% for option in district_id %}<option value='{{option.id}}' {% ifequal record.district_id option.id%}selected{% endifequal %}>{{option.name}}</option>{% endfor %}
</select>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='latitude'>
Latitude
</label>
{% if {{record.latitude}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='members'>
Members
</label>
{% if {{record.members}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='members' name='members' multiple='multiple'>
{% for option in members %}<option value='{{option.id}}' {% ifequal record.members 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 teamorganisers admin %}
<span id='members' name='members' class='pseudo-widget disabled'>
{{record.members}}
</span>
{% else %}
<span id='members' name='members' class='pseudo-widget not-authorised'>
You are not permitted to view members of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='members' name='members' multiple='multiple'>
{% for option in members %}<option value='{{option.id}}' {% ifequal record.members 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 teamorganisers admin %}
<span id='members' name='members' class='pseudo-widget disabled'>
{{record.members}}
</span>
{% else %}
<span id='members' name='members' class='pseudo-widget not-authorised'>
You are not permitted to view members of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='organisers'>
Organisers
</label>
{% if {{record.organisers}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='organisers' name='organisers' multiple='multiple'>
{% for option in organisers %}<option value='{{option.id}}' {% ifequal record.organisers 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 teamorganisers admin %}
<span id='organisers' name='organisers' class='pseudo-widget disabled'>
{{record.organisers}}
</span>
{% else %}
<span id='organisers' name='organisers' class='pseudo-widget not-authorised'>
You are not permitted to view organisers of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<select id='organisers' name='organisers' multiple='multiple'>
{% for option in organisers %}<option value='{{option.id}}' {% ifequal record.organisers 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 teamorganisers admin %}
<span id='organisers' name='organisers' class='pseudo-widget disabled'>
{{record.organisers}}
</span>
{% else %}
<span id='organisers' name='organisers' class='pseudo-widget not-authorised'>
You are not permitted to view organisers of teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
<p class='widget'>
<label for='longitude'>
Longitude
</label>
{% if {{record.longitude}} %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% else %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers 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 teams
</span>
{% endifmemberof %}
{% endifmemberof %}
{% endif %}
</p>
{% ifmemberof teamorganisers admin teamorganisers admin %}
<p class='widget action-safe'>
<label for='save-button' class='action-safe'>
To save this teams record
</label>
<input id='save-button' name='save-button' class='action-safe' type='submit' value='Save!'/>
</p>
{% endifmemberof %}
{% ifmemberof teamorganisers admin teamorganisers admin %}
<p class='widget action-dangerous'>
<label for='delete-button' class='action-dangerous'>
To delete this teams record
</label>
<input id='delete-button' name='delete-button' class='action-dangerous' type='submit' value='Delete!'/>
</p>
{% endifmemberof %}
</form>
<div class='auxlist'>
<h2>
Organisers
</h2>
<table>
<thead>
<tr>
<th>
Id
</th>
<th>
Fullname
</th>
<th>
Email
</th>
<th>
Phone
</th>
<th>
&nbsp;
</th>
</tr>
</thead>
<tbody>
{% for record in organisers %}
<tr>
<td>
{{ record.id }}
</td>
<td>
{{ record.fullname }}
</td>
<td>
{{ record.email }}
</td>
<td>
{{ record.phone }}
</td>
<td>
<a href='{{servlet-context}}/form-canvassers-Canvasser?id={{ record.id }}'>
View
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class='auxlist'>
<h2>
Members
</h2>
<table>
<thead>
<tr>
<th>
Id
</th>
<th>
Fullname
</th>
<th>
Email
</th>
<th>
Phone
</th>
<th>
&nbsp;
</th>
</tr>
</thead>
<tbody>
{% for record in members %}
<tr>
<td>
{{ record.id }}
</td>
<td>
{{ record.fullname }}
</td>
<td>
{{ record.email }}
</td>
<td>
{{ record.phone }}
</td>
<td>
<a href='{{servlet-context}}/form-canvassers-Canvasser?id={{ record.id }}'>
View
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
{% block extra-tail %}
<script type='text/javascript'>
/**
* selectize one select widget. Substitute the actual id of the widget for `district_id`.
*/
$('#district_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 %}