summaryrefslogblamecommitdiffstats
path: root/modules-available/locationinfo/templates/location-info.html
blob: 22a961b6a78fa04323cfbf95fdb56898ae7a2476 (plain) (tree)
1
2
3
4
5
6
7
8
9


                            


                                                                         


                                                        

                                               
                 


             







                                                                                                                            

                                                                                               
                                                          
                                                 
 
                             
                            
 







                                                                                                    
                                                                                                                                                                   
             
 
         

        

                                                                 
 






                                                                          
 



                               



                             


































                                                                                              




                                                                               
         
<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=50>{{lang_locationInUse}}</th>
    <th width=50>{{lang_locationIsHidden}}</th>
    <th width=50>{{lang_locationSettings}}</th>
    <th width=1/>
	</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="loadModal({{locationid}});">{{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"></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', '2').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 loadModal(locationId) {
  $('#myModal').modal('show')
  $('#myModalBody').load("?do=locationinfo&action=timetable&id=" + locationId);
}
</script>