-
Notifications
You must be signed in to change notification settings - Fork 4
/
standard_report.html
64 lines (56 loc) · 1.88 KB
/
standard_report.html
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
{% extends '_layout.html' %}
{% load bootstrap3 %}
{% load static %}
{% load utils %}
{% block title %}Reports{% endblock %}
{% block content %}
<div class="row">
<h1 class="col-sm-12">
<span>Standard Report</span>
</h1>
</div>
<div class="container" style="margin-bottom:20px;">
</div>
<form action="" method="POST" style="width: 50%">
{% csrf_token %}
<div class="form-group">
<label class="control-label" for="id_service">Service</label>
<select name="service" class="form-control" title="" id="id_service" multiple="multiple">
{% for service in services %}
<option value="{{ service.id }}" class="{{ service.id }}">{{ service.name }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label class="control-label" for="id_component">Component</label>
<select name="component" class="form-control" title="" id="id_component" multiple="multiple">
{% for component in components %}
<option value="{{ component.id }}" class="{{ component.service.id }}">{{ component.name }}</option>
{% endfor %}
</select>
</div>
<input class="btn btn-primary" type="submit" value="Generate Excel"/>
<a href="{% url 'home' %}"
class="btn btn-default">Cancel</a>
</form>
{% endblock %}
{% block scripts %}
<script>
$(document).ready(function () {
var allOptions = $('#id_component option')
$('#id_service').change(function () {
$('#id_component option').remove()
var classes = [];
$('#id_service option:selected').each(function( index ) {
classes.push($(this).prop('class'));
});
var opts = allOptions.filter( function(index) {
return $.inArray($(this).prop('class'), classes) > -1;
});
$.each(opts, function (i, j) {
$(j).appendTo('#id_component');
});
});
});
</script>
{% endblock %}