Statistics
| Branch: | Tag: | Revision:

root / templates / edumanage / services.html @ 8e13bb07

History | View | Annotate | Download (5.9 kB)

1
{% extends "edumanage/welcome.html"%}
2
                        {% block crumbs %}
3
                                    <li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
4
                                    <li class="active">Services</li>
5
                                    {% endblock %}
6
{% load i18n %}
7
{% block extrahead %}
8
<script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
9
<script type="text/javascript" src="/static/js/datatables_bootstrap.js"></script>
10
<script type="text/javascript">
11
$(document).ready(function(){
12
         {% if services %}
13
var oTable = $('#table').dataTable({
14
        "sPaginationType": "bootstrap",
15
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
16
        "aoColumns": [{
17
        "bSearchable": true,
18
        "bSortable": true
19
    }, {
20
        "bSearchable": true,
21
        "bSortable": true
22
    }, {
23
        "bSearchable": true,
24
        "bSortable": true
25
    }, {
26
        "bSearchable": true,
27
        "bSortable": true
28
    }, {
29
        "bSearchable": true,
30
        "bSortable": true
31
    }, {
32
        "bVisible": true,
33
        "bSearchable": false,
34
        "bSortable": false
35
    }],
36
    "aaSorting": [[0, 'desc']],
37
    "iDisplayLength": 25,
38
    "oSearch": {"bSmart": false, "bRegex":true},
39
    "oLanguage": {
40
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "services" %}',
41
        "sProcessing":   "Processing...",
42
        "sZeroRecords": '{% trans "No records to display" %}',
43
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
44
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
45
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
46
        "sInfoPostFix":  "",
47
        "sSearch":       '{% trans "Search:" %}',
48
        "sUrl":          "",
49
        "oPaginate": {
50
            "sFirst":    '{% trans "First" %}',
51
            "sPrevious": '{% trans "Previous" %}',
52
            "sNext":     '{% trans "Next" %}',
53
            "sLast":     '{% trans "Last" %}'
54
        }
55
    }
56
});
57

58
oTable.fnDraw();
59
$('[id^=del_service_]').click(function(){
60
        server_id = (this.id).replace("del_service_", '');
61
        name = this.getAttribute("data-servicename");
62
        $("#mymodalbody").html("You are about to delete service: <b>"+name+"</b><br>Press Delete to proceed or Cancel to cancel deletion");
63
        $("#myModalLabel").html("Delete Service "+name);
64
        $('#myModal').modal('show');
65
        $(".modal-footer").show();
66
        $("#service_name_del").html(name)        
67
        return false;
68
});
69

70
$("#delserviceSubmit").click(function(){
71
        $.ajax({
72
                url:"{% url del-service %}/?service_pk="+server_id,
73
                type: "GET",
74
                success: function(data){
75
                        if (data.error){
76
                                $(".modal-footer").hide();
77
                                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
78
                        }
79
                        if (data.success){
80
                                $(".modal-footer").hide();
81
                                $("#mymodalbody").html("Service "+name+" successfully deleted");
82
                                window.setTimeout('location.reload()', 1000);
83
                                
84
                        }
85
                        }
86
                });
87
});
88
{% endif %}
89
});
90
</script>
91
{% endblock %}
92
                        {% block homeactive %}{% endblock %}
93
                    {% block servicesactive %}class="active"{% endblock %}
94
            {% block subcontent %}
95
              <h4>Services</h4>
96
              <hr>
97
              {% if messages %}
98
                        <table class="table table-condensed">
99
                                        
100
                                            {% for message in messages %}
101
                                            <tr {% if  %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
102
                                            {% endfor %}
103
                                        </table>
104
                          {% endif %}
105
              <div>{% if instdets.ertype == 2 or instdets.ertype == 3 %}<a href="{% url edit-services %}" class="btn btn-primary">Add new service</a>{% endif %}</div>
106
                      <div class="span10"></div>
107
              {% load tolocale %}
108
              {% if instdets.ertype == 2 or instdets.ertype == 3 %}
109
              {% if services %}
110
               <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
111
                       <thead>
112
                                        <tr>
113
                                        <th>Name</th>
114
                                        <th>Address</th>
115
                                        <th>SSID</th>
116
                                        <th>enc_level</th>
117
                                        <th>AP no</th>
118
                                        <th>Actions</th>
119
                                        </tr>
120
                                        </thead>
121
                                        <tbody>
122
                        {% for service in services %}
123
                              <tr class="GradeC">
124
                                <td><a href="{% url services service.pk %}">{% tolocale service LANGUAGE_CODE %}</a></td>
125
                                <td>{{service.address_street}}<br>{{service.address_city}}</td>
126
                                <td>{{service.SSID}}</td>
127
                                <td>{{service.enc_level}}</td>
128
                                <td>{{service.AP_no}}</td>
129
                                <td style="text-align: center;"><a href="{% url edit-services service.pk %}" class="btn btn-small">edit</a> <a href="#" id="del_service_{{service.pk}}" data-servicename="{% tolocale service LANGUAGE_CODE%}" class="btn btn-small btn-warning">delete</a></td>
130
                        </tr>
131
                              {% endfor %}
132
                              </tbody>
133
                      </table>
134
                      {% endif %}
135
              {% endif %}
136
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
137
<div class="modal-header">
138
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
139
<h3 id="myModalLabel">Delete Service</h3>
140
</div>
141
<div class="modal-body" id="mymodalbody">
142

    
143
</div>
144
<div class="modal-footer">
145
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
146
<a class="btn btn-warning" id="delserviceSubmit" href="#">Delete</a>
147
</div>
148
</div>
149

    
150
<div class="modal hide fade" id="servDets" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
151
<div class="modal-header">
152
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
153
<h3 id="myModalLabelservdets">Service Details</h3>
154
</div>
155
<div class="modal-body" id="servDetsbody">
156

    
157
</div>
158
<div class="modal-footer">
159
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
160
</div>
161
</div>
162
                {% endblock %}