-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathedit_operator.html
More file actions
executable file
·125 lines (107 loc) · 5.21 KB
/
Copy pathedit_operator.html
File metadata and controls
executable file
·125 lines (107 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{% extends 'mbtbase.html' %}
{% load static %}
{% block title %}Edit Operator Details{% endblock %}
{% block content %}
<form action="" class="fleet-edit-wrapper" method="post">
{% csrf_token %}
<label for="operator_name">Operator Name:</label>
<input type="text" name="operator_name" value="{{ operator.operator_name }}">
<label for="operator_code">Operator Code:</label>
<input type="text" name="operator_code" value="{{ operator.operator_code }}">
{% with details=operator.operator_details %}
<label for="website">Website:</label>
<input type="text" name="website" placeholder="Website" value="{{ details.website }}">
<label for="twitter">Twitter:</label>
<input type="text" name="twitter" placeholder="Twitter" value="{{ details.twitter }}">
<label for="type">Type:</label>
<select name="type" id="operator-type" style="margin-bottom: .5em;" onchange="toggleOperatorGame()">
{% for type in operator_types %}
<option value="{{ type }}" {% if type|stringformat:"s" == details.type %}selected{% endif %}>{{ type }}</option>
{% endfor %}
</select>
<small class="create-link-select2"><a href="/operator/create-type">Request A New Operator Type</a></small>
<div id="operator-game-container" style="display: none;">
<label for="operator-game">Game:</label>
<select name="game" id="operator-game">
<option value="" selected>None</option>
{% for game in games%}
<option value="{{ game.game_name }}" {% if operatorGame == game.game_name %}selected{% endif %}>
{{ game.game_name }}</option>
{% endfor %}
</select>
<small class="create-link-select2"><a href="/create/game/">Register A New Game</a></small>
</div>
{% if organisations %}
<label for="organisation">Organisation:</label>
<select name="organisation" id="" style="margin-bottom: .5em;">
<option value="">None</option>
{% for organisation in organisations %}
<option value="{{ organisation.id }}" {% if organisation == details.organisation %}selected{% endif %}>
{{ organisation }}</option>
{% endfor %}
</select>
{% endif %}
{% if groups %}
<label for="group">Group:</label>
<select name="group" id="" style="margin-bottom: .5em;">
<option value="">None</option>
{% for group in groups %}
<option value="{{ group.id }}" {% if group == operator.group %}selected{% endif %}>{{ group }}</option>
{% endfor %}
</select>
<small class="create-link-select2"><a href="/group/create">Create A New Group</a></small>
{% else %}
<label for="group">Group:</label>
<br>
<p>No groups available. <a href="{% url 'create_group' %}">Create a new group</a></p>
<br>
{% endif %}
<label for="operator_region">Operator Region:</label>
<select name="operator_region" id="operator_region" multiple>
{% for country, regions in regionData.items %}
<optgroup label="{{ country }}">
{% for r in regions %}
<option value="{{ r.id }}" {% if r in operator.region.all %}selected{% endif %}>{{ r.region_name }}</option>
{% endfor %}
</optgroup>
{% endfor %}
</select>
<small>Hold <strong>Ctrl</strong> (or <strong>Cmd</strong> on Mac) to select multiple regions</small>
<input type="text" name="transit_authorities" placeholder="Local Government Body"
value="{{ details.transit_authorities }}">
{% endwith %}
<label for="map">Map:</label>
<select name="map" id="map">
{% for map in mapTileSets %}
<option value="{{ map.id }}" {% if map.id == currentMap %}selected{% endif %}>{{ map.name }}</option>
{% endfor %}
</select>
<label for="show_livery_border">
<input type="checkbox" name="show_livery_border" {% if operator.show_livery_border %}checked{% endif %}>
Show Livery Border
</label>
<label for="show_trip_id">
<input type="checkbox" name="show_trip_id" {% if operator.show_trip_id %}checked{% endif %}>
Show Trip IDs
</label>
<button style="min-width: 150px;" class="btn delete-btn" type="button"
onclick='window.location.href="{% url 'reset_operator' operator.operator_slug %}"'>Reset Fleet</button>
<br><br><br>
<button style="min-width: 150px;" type="submit" class="btn">Save Changes</button>
<button style="min-width: 150px;" class="btn delete-btn" type="button"
onclick='window.location.href="{% url 'delete_operator' operator.operator_slug %}"'>Delete</button>
</form>
<script>
function toggleOperatorGame() {
const operatorTypeSelect = document.getElementById('operator-type');
const operatorGameContainer = document.getElementById('operator-game-container');
const selectedType = operatorTypeSelect.options[operatorTypeSelect.selectedIndex].text.toLowerCase();
operatorGameContainer.style.display = selectedType === 'in game operator' ? 'block' : 'none';
}
document.addEventListener('DOMContentLoaded', toggleOperatorGame);
</script>
{% endblock %}
{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/narrow.css' %}">
<link rel="stylesheet" href="{% static 'css/select2.css' %}">
{% endblock %}