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
|
<div>
<h1>{{lang_mainHeader}}</h1>
<table class="table table-condensed locations" style="margin-bottom:0px">
<tr>
<th>{{lang_locationName}}</th>
<th width=10>{{lang_locationID}}</th>
<th width=80>{{lang_locationInUse}}</th>
<th width=50>{{lang_locationIsHidden}}</th>
<th width=50>{{lang_openingTime}}</th>
<th width=50>{{lang_locationSettings}}</th>
</tr>
{{#list}}
<tr class="tablerow" onclick="{{#hasPcs}}slxOpenLocationInfo(this, {{locationid}}){{/hasPcs}}">
<td><div style="display:inline-block;width:{{depth}}em"></div>{{#hasPcs}}<a>{{/hasPcs}}{{locationname}}</td>
<td align="center">[{{locationid}}]</td>
<td align="center">{{#hasPcs}}{{inUse}} / {{total}}{{/hasPcs}}</td>
<td id={{locationid}} onclick="event.cancelBubble = true;" align="center"></td>
<script>
var cbh = document.getElementById('{{locationid}}');
var cb = document.createElement('input');
cb.type = 'checkbox';
cbh.appendChild(cb);
cb.id = 'cb' + {{locationid}};
cb.value = {{hidden}};
if ({{hidden}} == 1) {
cb.checked = true;
}
cb.addEventListener("click", function() { cbClick(this, {{locationid}}); });
</script>
<td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" onclick="loadTimeModal({{locationid}}, '{{locationname}}');">{{lang_openingTime}}</a></td>
<td onclick="event.cancelBubble = true;"><a class="btn btn-sm btn-default" role="button" onclick="loadConfigModal({{locationid}}, '{{locationname}}');">{{lang_locationSettings}}</a></td>
</tr>
{{/list}}
</table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" id="myModalHeader"></div>
<div class="modal-body" id="myModalBody"></div>
<div class="modal-footer">
<a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var lastPcSubTable = false;
function cbClick(cb, locID) {
var value;
if (cb.checked == true) {
value = 1;
} else {
value = 0;
}
window.location.href = "?do=locationinfo&action=hide&id=" + locID + "&value=" + value;
}
function slxOpenLocationInfo(e, locationId) {
if (lastPcSubTable !== false) {
lastPcSubTable.hide();
$(lastPcSubTable).prev().removeClass('active slx-bold');
}
var existing = $('#subtable' + locationId);
if (existing.length > 0) {
if (existing.is(lastPcSubTable)) {
lastPcSubTable = false;
} else {
existing.show();
$(e).closest('tr').addClass('active slx-bold');
lastPcSubTable = existing;
}
return;
}
var td = $('<td>').attr('colspan', '3').css('padding', '0px 0px 12px');
var tr = $('<tr>').attr('id', 'subtable' + locationId);
tr.append(td);
$(e).closest('tr').addClass('active slx-bold').after(tr);
td.load("?do=locationinfo&action=pcsubtable&id=" + locationId);
lastPcSubTable = tr;
}
function loadTimeModal(locationId, locationName) {
$('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight","Bold");
$('#myModal').modal('show');
$('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId);
}
function loadConfigModal(locationId, locationName) {
$('#myModalHeader').text("[" + locationId + "] " + locationName).css("font-weight","Bold");
$('#myModal').modal('show');
$('#myModalBody').load("?do=locationinfo&action=config&id=" + locationId);
}
</script>
|