From a6f921740d1ca8e9f32abdf247843de1385f271e Mon Sep 17 00:00:00 2001 From: John Costa Date: Mon, 17 Apr 2017 19:48:25 -0400 Subject: [PATCH] temporary fix for some issues --- WebContent/html/javascript/listing.jsp | 4 ++-- WebContent/html/javascript/request.jsp | 22 +++++++++++++++++++++- WebContent/html/javascript/statistics.jsp | 18 +++++++++--------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/WebContent/html/javascript/listing.jsp b/WebContent/html/javascript/listing.jsp index ff995e1..99e3733 100644 --- a/WebContent/html/javascript/listing.jsp +++ b/WebContent/html/javascript/listing.jsp @@ -38,7 +38,7 @@ function showAll(){ var part1 = "nhpup.popup('"; var part2 = "');" for(var i = 0; i < devices.length; i++){ - html += '
' + devices[i].name + '

' + devices[i].description + '



'; + html += '
' + devices[i].name + '

' + devices[i].description + '



'; } document.getElementById('devContainer').innerHTML = html; var anchors = document.getElementsByClassName('availableAnchor'); @@ -67,7 +67,7 @@ function show(deviceArray){ var part2 = "');" for (var i = 0; i < deviceArray.length; i++) { - html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' + html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' } document.getElementById('devContainer').innerHTML = html; var anchors = document.getElementsByClassName('availableAnchor'); diff --git a/WebContent/html/javascript/request.jsp b/WebContent/html/javascript/request.jsp index 6e050fe..21f9d45 100644 --- a/WebContent/html/javascript/request.jsp +++ b/WebContent/html/javascript/request.jsp @@ -28,12 +28,32 @@ for(var a = 0; a < hardwareOptions.length; a++){ for(var a = 0; a < softwareOptions.length; a++){ softwareOptions[a].addEventListener('click', refresh); } +showAll(); // searchbar listener var searchbar = document.getElementsByName('searchBar'); searchbar[0].onkeyup = refresh; function refresh() { show(fuzzyFilter(filter(devices))); } + +function showAll(){ + var html = ''; + var part1 = "nhpup.popup('"; + var part2 = "');" + for(var i = 0; i < devices.length; i++){ + html += '
' + devices[i].name + '

' + devices[i].description + '



'; + } + + if(html.localeCompare("")==0) + html += "

There are no devices with the search criteria: " + this.textContent + "

"; + + document.getElementById('devContainer').innerHTML = html; + + var requestbuttons = document.getElementsByClassName('requestbutton'); + for(var i = 0; i < requestbuttons.length; i++) { + requestbuttons[i].addEventListener('click',addToCart); + } +} //when an option is selected, show a new list of devices based on what the user asked for function show(deviceArray){ // var type = this.getAttribute('data-type'); @@ -41,7 +61,7 @@ function show(deviceArray){ var part1 = "nhpup.popup('"; var part2 = "');" for (var i = 0; i < deviceArray.length; i++) { - html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' + html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' } if(html.localeCompare("")==0) diff --git a/WebContent/html/javascript/statistics.jsp b/WebContent/html/javascript/statistics.jsp index c5de328..dc510ba 100644 --- a/WebContent/html/javascript/statistics.jsp +++ b/WebContent/html/javascript/statistics.jsp @@ -36,20 +36,20 @@ function displayData() { //data for info section availableDevices = statistics[0].count; loanDevices = statistics[1].count; + unavailDevices = statistics[2].count; + + //old categories //lostDevices = statistics[2].count; //returnDevices = statistics[6].count; //umbrella divisions //pendingDevices = statistics[0].count; - unavailDevices = statistics[2].count; - html += '
Total Devices: '+ totalDevices + '
Available Devices: ' + availableDevices + '
Loaned Devices: ' + loanDevices + - '
Returning Devices: ' + returnDevices + - '
Lost Devices: ' + lostDevices + - '
' + '
Permanent Devices: ' + unavailDevices + + ''; // Load the Visualization API and the corechart package. google.charts.load('current', {'packages':['corechart']}); @@ -65,10 +65,10 @@ function displayData() { // Create the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Status'); - data.addColumn('number', 'Count'); - data.addRows([['Available Devices', availableDevices],['Unavailable Devices',unavailDevices], - ['Loaned Devices',loanDevices]]); - + data.addColumn('number', 'Count'); + for (var i = 0; i