|
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | %> |
| 18 | +<%@ page import="org.labkey.api.view.HttpView" %> |
| 19 | +<%@ page import="org.labkey.api.view.JspView" %> |
18 | 20 | <%@ page import="org.labkey.api.view.template.ClientDependencies" %> |
| 21 | +<%@ page import="org.labkey.targetedms.TargetedMSController.InstrumentUtilizationBean" %> |
19 | 22 | <%@ page extends="org.labkey.api.jsp.JspBase" %> |
20 | 23 | <%! |
21 | 24 | @Override |
|
25 | 28 | dependencies.add("targetedms/yearCalendar"); |
26 | 29 | } |
27 | 30 | %> |
| 31 | +<% |
| 32 | + JspView<InstrumentUtilizationBean> me = HttpView.currentView(); |
| 33 | + InstrumentUtilizationBean bean = me.getModelBean(); |
| 34 | +%> |
28 | 35 |
|
29 | 36 | <style nonce="<%=getScriptNonce()%>"> |
30 | 37 | /* |
|
43 | 50 | } |
44 | 51 | </style> |
45 | 52 |
|
| 53 | +<ul class="nav nav-tabs" id="utilizationTabs" role="tablist"> |
| 54 | + <li class="active"><a href="#utilizationTabCalendar" data-utilization-tab="calendar">Utilization Calendar</a></li> |
| 55 | + <li><a href="#utilizationTabMonth" data-utilization-tab="month">Runs by Month</a></li> |
| 56 | + <li><a href="#utilizationTabDay" data-utilization-tab="day">Runs by Day</a></li> |
| 57 | +</ul> |
| 58 | + |
| 59 | +<div class="tab-content" style="padding-top: 15px;"> |
| 60 | + <div class="tab-pane active" id="utilizationTabCalendar"> |
| 61 | + <div style="text-align: center; width: 100%"> |
| 62 | + <label for="utilizationMonthNumberSelect">Display:</label> |
| 63 | + <select id="utilizationMonthNumberSelect"> |
| 64 | + <option value="1">1 month</option> |
| 65 | + <option value="4">4 months</option> |
| 66 | + <option value="12">12 months</option> |
| 67 | + </select> |
| 68 | + </div> |
| 69 | + |
| 70 | + <div id="instrumentUtilizationCalendarWrapper" style="min-height: 300px; max-width: 100%; overflow-x: auto;"> |
| 71 | + <div id="instrumentUtilizationCalendar"> |
| 72 | + Loading... |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + |
| 76 | + <div class="heatmap-footer-container"> |
| 77 | + <div class="heatmap-legend-container"> |
| 78 | + <div class="heatmap-legend-label" style="text-align: right">No data</div> |
| 79 | + <div class="heatmap-legend"> |
| 80 | + <div class="heatmap-legend-element"></div> |
| 81 | + <div class="heatmap-legend-element heatmap-shade0"></div> |
| 82 | + <div class="heatmap-legend-element heatmap-shade3"></div> |
| 83 | + <div class="heatmap-legend-element heatmap-shade6"></div> |
| 84 | + <div class="heatmap-legend-element heatmap-shade9"></div> |
| 85 | + <div class="heatmap-legend-element heatmap-shade13"></div> |
| 86 | + </div> |
| 87 | + <div class="heatmap-legend-label" id="heatmapFileLegendMax">Files acquired</div> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + |
| 92 | + <div class="tab-pane" id="utilizationTabMonth"> |
| 93 | + <div id="utilizationByMonthGrid" style="max-width: 100%; overflow-x: auto;"> |
| 94 | + <% me.include(bean.getByMonthView(), out); %> |
| 95 | + </div> |
| 96 | + </div> |
| 97 | + |
| 98 | + <div class="tab-pane" id="utilizationTabDay"> |
| 99 | + <div id="utilizationByDayGrid" style="max-width: 100%; overflow-x: auto;"> |
| 100 | + <% me.include(bean.getByDayView(), out); %> |
| 101 | + </div> |
| 102 | + </div> |
| 103 | +</div> |
| 104 | + |
| 105 | +<script type="text/javascript" nonce="<%=getScriptNonce()%>"> |
| 106 | +(function() { |
| 107 | + // Simple client-side tab switching. Panes are pre-rendered; we toggle Bootstrap's `active` class |
| 108 | + // (which drives .tab-pane visibility) so the calendar (default/active tab) initializes while |
| 109 | + // visible and the grids simply reveal on demand. |
| 110 | + const tabLinks = document.querySelectorAll('#utilizationTabs a[data-utilization-tab]'); |
| 111 | + const panes = { |
| 112 | + calendar: document.getElementById('utilizationTabCalendar'), |
| 113 | + month: document.getElementById('utilizationTabMonth'), |
| 114 | + day: document.getElementById('utilizationTabDay') |
| 115 | + }; |
| 116 | +
|
| 117 | + function activate(which) { |
| 118 | + for (const link of tabLinks) { |
| 119 | + const li = link.parentNode; |
| 120 | + li.classList.toggle('active', link.getAttribute('data-utilization-tab') === which); |
| 121 | + } |
| 122 | + for (const key in panes) { |
| 123 | + if (panes[key]) { |
| 124 | + panes[key].classList.toggle('active', key === which); |
| 125 | + } |
| 126 | + } |
| 127 | + } |
| 128 | +
|
| 129 | + for (const link of tabLinks) { |
| 130 | + link.addEventListener('click', function(e) { |
| 131 | + e.preventDefault(); |
| 132 | + activate(link.getAttribute('data-utilization-tab')); |
| 133 | + }); |
| 134 | + } |
| 135 | +})(); |
| 136 | +</script> |
| 137 | + |
46 | 138 | <script type="text/javascript" nonce="<%=getScriptNonce()%>"> |
47 | 139 | (function() { |
48 | 140 | let calendar = null; |
|
214 | 306 | }); |
215 | 307 | })(); |
216 | 308 | </script> |
217 | | - |
218 | | -<div style="text-align: center; width: 100%"> |
219 | | - <label for="utilizationMonthNumberSelect">Display:</label> |
220 | | - <select id="utilizationMonthNumberSelect"> |
221 | | - <option value="1">1 month</option> |
222 | | - <option value="4">4 months</option> |
223 | | - <option value="12">12 months</option> |
224 | | - </select> |
225 | | -</div> |
226 | | - |
227 | | -<div id="instrumentUtilizationCalendarWrapper" style="min-height: 300px; max-width: 100%; overflow-x: auto;"> |
228 | | - <div id="instrumentUtilizationCalendar"> |
229 | | - Loading... |
230 | | - </div> |
231 | | -</div> |
232 | | - |
233 | | -<div class="heatmap-footer-container"> |
234 | | - <div class="heatmap-legend-container"> |
235 | | - <div class="heatmap-legend-label" style="text-align: right">No data</div> |
236 | | - <div class="heatmap-legend"> |
237 | | - <div class="heatmap-legend-element"></div> |
238 | | - <div class="heatmap-legend-element heatmap-shade0"></div> |
239 | | - <div class="heatmap-legend-element heatmap-shade3"></div> |
240 | | - <div class="heatmap-legend-element heatmap-shade6"></div> |
241 | | - <div class="heatmap-legend-element heatmap-shade9"></div> |
242 | | - <div class="heatmap-legend-element heatmap-shade13"></div> |
243 | | - </div> |
244 | | - <div class="heatmap-legend-label" id="heatmapFileLegendMax">Files acquired</div> |
245 | | - </div> |
246 | | -</div> |
|
0 commit comments