forked from indico/indico
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve room stats page style and features
* Template style boost and clean up * Displays pending bookings in the table * Allows occupancy stats since ever
- Loading branch information
Showing
7 changed files
with
197 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
257 changes: 140 additions & 117 deletions
257
indico/MaKaC/webinterface/tpls/RoomBookingRoomStats.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,165 @@ | ||
<table cellpadding="0" cellspacing="0" border="0" width="80%"> | ||
<tr> | ||
<td class="bottomvtab" width="100%"> | ||
<table width="100%" cellpadding="0" cellspacing="0" class="htab" border="0"> | ||
<tr> | ||
<td class="maincell"> | ||
<span class="formTitle" style="border-bottom-width: 0px">Room</span><br /> | ||
<br /> | ||
<table width="96%" align="left" border="0"> | ||
<!-- LOCATION --> | ||
<tr> | ||
<td width="24%" class="titleUpCellTD"><span class="titleCellFormat">Location</span></td> | ||
<td width="76%"> | ||
<table width="100%"> | ||
<tr> | ||
<td class="subFieldWidth" align="right" valign="top"><small>Location </small></td> | ||
<td align="left" class="blacktext">${ room.location.name }</td> | ||
</tr> | ||
<tr> | ||
<td class="subFieldWidth" align="right" valign="top"><small>Name </small></td> | ||
<td align="left" class="blacktext">${ room.name }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top"><small>Site </small></td> | ||
<td align="left" class="blacktext">${ room.site }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top"><small>Building </small></td> | ||
<td align="left" class="blacktext"><a href="https://maps.cern.ch/mapsearch/mapsearch.htm?no=[${ room.building }]" title="Show on map">${ room.building }</a></td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top"><small>Floor </small></td> | ||
<td align="left" class="blacktext">${ room.floor }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top"><small>Room </small></td> | ||
<td align="left" class="blacktext">${ room.number }</td> | ||
</tr> | ||
</table> | ||
</td> | ||
<td width="20%" align="right" class="thumbnail"> | ||
% if room.has_photo: | ||
<a href="${ room.large_photo_url }" nofollow="lightbox" title="${ room.photo_id }"> | ||
<img border="1px" height="100" src="${ room.small_photo_url }" alt="${ str( room.photo_id ) }"/> | ||
</a> | ||
% endif | ||
</td> | ||
</tr> | ||
<tr><td> </td></tr> | ||
<tr> | ||
<td width="24%" class="titleUpCellTD"><span class="titleCellFormat">Stats</span></td> | ||
<td width="76%"> | ||
<!-- ============== Key Performance Indicators ================= --> | ||
<!-- =========================================================== --> | ||
<a name="kpi"></a> | ||
<table width="80%" align="center" border="0" style="border-left: 1px solid #777777"> | ||
<h2 class="page-title"> | ||
${ _('Room statistics') } | ||
</h2> | ||
|
||
<table> | ||
<tr> | ||
<td colspan="5" class="groupTitle">Key Performance Indicators</td> | ||
</tr> | ||
<tr> | ||
<td class="titleUpCellTD" style="width: 100px;"><span class="titleCellFormat">Average occupancy</span></td> | ||
<td bgcolor="white" valign="top" class="blacktext" style="padding-left: 12px;"> | ||
<table> | ||
<tr> | ||
<form action="${ url_for('rooms.roomBooking-roomStats', roomLocation=room.location.name, roomID=room.id) }"> | ||
<td bgcolor="white" valign="top" style="padding-left: 12px;"> | ||
<select name="period" onChange="this.form.submit();"> | ||
% if period=="pastmonth": | ||
<option value="pastmonth" selected> past 30 days | ||
<option value="thisyear"> from beginning of this year | ||
% endif | ||
% if period=="thisyear": | ||
<option value="pastmonth"> past 30 days | ||
<option value="thisyear" selected> from beginning of this year | ||
<td> | ||
% if room.has_photo: | ||
<a href="${ room.large_photo_url }" nofollow="lightbox"> | ||
<img border="1px" height="100" src="${ room.small_photo_url }"/> | ||
</a> | ||
% endif | ||
</select> | ||
</td> | ||
</form> | ||
</tr> | ||
<tr> | ||
<td> | ||
<span style="background-color: #C9FFC9; font-weight: bold;"> | ||
${ '{0:.02f}%'.format(occupancy) } | ||
</span> | ||
${inlineContextHelp('Average room occupancy over the selected period during working hours (8H30-17H30, Monday-Friday including holidays).' )} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr><td> </td></tr> | ||
<tr> | ||
<td class="titleUpCellTD" style="width: 100px;"><span class="titleCellFormat">Bookings</span></td> | ||
<td bgcolor="white" valign="top" class="blacktext" style="padding-left: 12px;"> | ||
</td> | ||
<td> | ||
<table> | ||
<tr> | ||
<td>Total:</td> | ||
<td> | ||
${ room.reservations.count() } | ||
${inlineContextHelp('Total number of bookings including archival, cancelled and rejected.' )} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top"> | ||
${ ('Location') } | ||
</td> | ||
<td align="left" class="blacktext"> | ||
${ room.location.name } | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top">${ _('Name') }</td> | ||
<td align="left" class="blacktext">${ room.name }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top">${ _('Site') }</td> | ||
<td align="left" class="blacktext">${ room.site }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top">${ _('Building') }</td> | ||
<td align="left" class="blacktext"> | ||
<a href="https://maps.cern.ch/mapsearch/mapsearch.htm?no=[${ room.building }]" title="Show on map"> | ||
${ room.building } | ||
</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top">${ _('Floor') }</td> | ||
<td align="left" class="blacktext">${ room.floor }</td> | ||
</tr> | ||
<tr> | ||
<td align="right" valign="top">${ _('Room') }</td> | ||
<td align="left" class="blacktext">${ room.number }</td> | ||
</tr> | ||
</table> | ||
<br /> | ||
<table> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
|
||
<h2 class="group-title"> | ||
${ _('Key Performance Indicators') } | ||
</h2> | ||
|
||
<div class="i-box-group horz"> | ||
<div class="i-box titled"> | ||
<div class="i-box-header"> | ||
<div class="i-box-title"> | ||
${ _('Booking stats') } | ||
</div> | ||
</div> | ||
<div class="i-box-content"> | ||
<table class="booking-stats" cellspacing="0"> | ||
<tr> | ||
<td style="width: 70px;"></td> | ||
<td style="width: 70px;">Valid</td> | ||
<td style="width: 70px;">Cancelled</td> | ||
<td style="width: 70px;">Rejected</td> | ||
<td></td> | ||
<td>${ _('Valid') }</td> | ||
<td>${ _('Pending') }</td> | ||
<td>${ _('Cancelled') }</td> | ||
<td>${ _('Rejected') }</td> | ||
<td>${ _('Total') }</td> | ||
</tr> | ||
<tr> | ||
<td>${ _('Active') }</td> | ||
<td><span style="background-color: #C9FFC9; font-weight: bold;">${ stats['active']['valid'] }</span></td> | ||
<td class="active-valid"> | ||
${ stats['active']['valid'] } | ||
</td> | ||
<td>${ stats['active']['pending'] }</td> | ||
<td>${ stats['active']['cancelled'] }</td> | ||
<td>${ stats['active']['rejected'] }</td> | ||
<td> | ||
${ stats['active']['valid'] + \ | ||
stats['active']['cancelled'] + \ | ||
stats['active']['rejected'] } | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>${ _('Archived') }</td> | ||
<td>${ stats['archived']['valid'] }</td> | ||
<td>${ stats['archived']['pending'] }</td> | ||
<td>${ stats['archived']['cancelled'] }</td> | ||
<td>${ stats['archived']['rejected'] }</td> | ||
<td> | ||
${ stats['archived']['valid'] + \ | ||
stats['archived']['cancelled'] + \ | ||
stats['archived']['rejected'] } | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>${ _('Total') }</td> | ||
<td>${ stats['active']['valid'] + stats['archived']['valid'] }</td> | ||
<td>${ stats['active']['pending'] + stats['archived']['pending'] }</td> | ||
<td>${ stats['active']['cancelled'] + stats['archived']['cancelled'] }</td> | ||
<td>${ stats['active']['rejected'] + stats['archived']['rejected'] }</td> | ||
<td class="total-bookings"> | ||
${ stats['active']['valid'] + stats['archived']['valid'] + \ | ||
stats['active']['pending'] + stats['archived']['pending'] + \ | ||
stats['active']['cancelled'] + stats['archived']['cancelled'] + \ | ||
stats['active']['rejected'] + stats['archived']['rejected'] } | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</div> | ||
</div> | ||
<div class="i-box titled" style="width:500px"> | ||
<div class="i-box-header"> | ||
<div class="i-box-title"> | ||
${ _('Occupancy') } | ||
</div> | ||
<div class="i-box-buttons toolbar thin"> | ||
<div class="group i-selection"> | ||
% for key, text in period_options: | ||
<% checked = 'checked' if period == key else '' %> | ||
<input type="radio" id="${ key }" name="period" value="${ key }" ${ checked }> | ||
<label for="${ key }" class="i-button">${ text }</label> | ||
% endfor | ||
</div> | ||
</div> | ||
</div> | ||
<div class="i-box-content"> | ||
<table class="occupancy-stats" cellspacing="0"> | ||
<tr> | ||
<td class="occupancy-period"> | ||
${ _('Average room occupancy in weekdays from 8:30 to 17:30') } | ||
% if period == 'pastmonth': | ||
${ _('over the past 30 days') }. | ||
% elif period == 'thisyear': | ||
${ _('since the beginning of this year') }. | ||
% else: | ||
${ _('since the first booking ever registered') }. | ||
% endif | ||
</td> | ||
<td class="occupancy-value"> | ||
${ '{0:.02f}'.format(occupancy) }<small>%</small> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
$(function(){ | ||
$('input[name=period]').on('change', function(e) { | ||
var url_template = ${ url_rule_to_js('rooms.roomBooking-roomStats') | n,j }; | ||
location.href = build_url(url_template, { | ||
roomLocation: ${ room.location.name | n, j}, | ||
roomID: ${ room.id | n, j }, | ||
period: this.value | ||
}); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters