search.html 4.21 KB
Newer Older
1
2
3
{% extends 'base.html' %}
{% load bt %}
{% load i18n %}
4
{% load bootstrap3 %}
Okhin's avatar
Okhin committed
5
{% block active_tab_search %}id="current"{% endblock %}
6
{% block styles %}
7
<link rel="stylesheet" href="/static/css/map.css" type="text/css" />
8
9
10
{% endblock %}

{% block head %}
11
<meta name="viewport" content="width=device-width, initial-scale=1.0">
12
13
14
{% endblock %}

{% block scripts %}
15
16
17
<script type="text/javascript">
var data={% if countryweights %}{{countryweights|safe}}{%else%}[]{% endif %};
var country="{{country}}";
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$('.metoo').submit(function(event) {
	event.preventDefault();
	var form = $(this);
	var pk = $(form).attr("id")
	var email = $(form).find("#email-" + pk).val();

	$.ajax({
		url: "/confirm/" + pk + "/" + email,
		success: function(data) {
			form.find("div").html(data);
		}
	});
});

Okhin's avatar
Okhin committed
32
33
$("#sortedList").tablesorter({
	theme: 'dropbox',
34
35
});
</script>
36
37
38
{% endblock %}

{% block content %}
39
40
41
42
43
44
45
46
47
<div class="row">
	<div class="col-xs-12 col-md-8">
		{% trans "Search through cases" %}
		<form method="get" class="form" action="/Search/">
			{% bootstrap_form form %}
			{% buttons %}
				<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
			{% endbuttons %}
		</form>
48

49
50
		{% if query %}
		<h3>Results</h3>
51

52
53
54
55
56
57
58
59
		<h2 id="stats-title">{% trans "Statistics" %}</h2>
		<ul id="stats">
			{% for t, n in stats %}
			<li class="stat"><dl><dt class="inline">{{t}}</dt><dd class="inline"><strong>{{n}}</strong></dd></dl></li>
			{% endfor %}
		</ul>
	</div>
	<div class="hidden-sm col-md-4" id="map"> </div>
60
</div>
61

Okhin's avatar
Okhin committed
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
<div class="table-responsive" id="table">
	<table class="table table-striped table-condensed tablesorter" id='sortedlist'>
		<thead>
			<tr>
				<th>{% trans "Status" %}</th>
				<th>{% trans "country" %}</th>
				<th>{% trans "operator" %}</th>
				<th>{% trans "contract" %}</th>
				<th>{% trans "resource" %}</th>
				<th>{% trans "type" %}</th>
				<th>{% trans "fixed / wireless" %}</th>
				<th>{% trans "confirmations" %}</th>
				<th></th>
			</tr>
		</thead>
		</thead>
		<tbody>
			{% for violation in object_list %}
				<tr class="{%if violation.state%}{{violation.state}}{%else%}new{%endif%}-status">
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{%if violation.state%}{{violation.state|status}}{%else%}{% trans "New" %}{%endif%}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.country|country }}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.operator }}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.contract }}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.resource_name }}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.type|type }}</a></td>
				<td><a class="cell-link" href="{{ violation.get_absolute_url }}">{{ violation.media|media }}</a></td>
				<td>{{ violation.confirmations }}</td>
				<td>
					<button role="button" class="btn btn-default" data-toggle="modal" data-target="#modal-{{ violation.pk }}">{% trans "Me too!" %}</button>
					<div class="modal fade" id="modal-{{ violation.pk }}" tabindex="-1" role="dialog" aria-labelledby="modal-label-{{ violation.pk }}" data-backdrop="false">
						<div class="modal-dialog">
							<div class="modal-content">
94
								<form method="post" class="metoo inline-from" action="/confirm/{{ violation.pk }}" id="i{{ violation.pk }}">
Okhin's avatar
Okhin committed
95
96
97
98
99
100
101
102
103
104
105
106
107
									<div class="modal-body">
										<div class="form-group">
											<label for="list-email-{{ violation.pk }}">{% trans "In order to <strong>confirm</strong> this report, please enter your email address" %}</label>
											<input type="text" name="email" id="list-email-{{ violation.pk }}" placeholder="email" />
											<input type="hidden" value="{{ violation.pk }}" />
											{% csrf_token %}
										</div>
										<div class="button-box">
											<button class="btn btn-success" type="submit">{% trans "OK" %}</button>
											<button class="btn btn-danger" type="button" data-dismiss="modal">{% trans "Close" %}</button>
										</div>
									</div>
								</form>
108
							</div>
Okhin's avatar
Okhin committed
109
						</div>
110
					</div>
Okhin's avatar
Okhin committed
111
112
113
114
115
116
				</td>
			</tr>
			{% endfor %}
		</tbody>
	</table>
	{% endif %}
Okhin's avatar
Okhin committed
117
</div>
118
{% endblock %}