Skip to content

Commit

Permalink
temporary fix for some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jic13003 committed Apr 17, 2017
1 parent bc54fee commit a6f9217
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
4 changes: 2 additions & 2 deletions WebContent/html/javascript/listing.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function showAll(){
var part1 = "nhpup.popup('";
var part2 = "');"
for(var i = 0; i < devices.length; i++){
html += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + devices[i].hardware + '<br><br>' + 'Manufacturer: ' + devices[i].manufacturer + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + devices[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i) + '"></div></div></div></a><br><br>';
html += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + devices[i].hardware + '<br><br>' + 'Manufacturer: ' + devices[i].manufacturer + '<br><br>' + 'Model: ' + devices[i].model + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + devices[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i) + '"></div></div></div></a><br><br>';
}
document.getElementById('devContainer').innerHTML = html;
var anchors = document.getElementsByClassName('availableAnchor');
Expand Down Expand Up @@ -67,7 +67,7 @@ function show(deviceArray){
var part2 = "');"
for (var i = 0; i < deviceArray.length; i++)
{
html += '<div class = "deviceContainer"><a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + part2 + '"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><div class = "availableAnchor" id = "' + (deviceArray[i].id) + '"></div></div></a></div><br><br>'
html += '<div class = "deviceContainer"><a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + '<br><br>' + 'Model: ' + deviceArray[i].model + part2 + '"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><div class = "availableAnchor" id = "' + (deviceArray[i].id) + '"></div></div></a></div><br><br>'
}
document.getElementById('devContainer').innerHTML = html;
var anchors = document.getElementsByClassName('availableAnchor');
Expand Down
22 changes: 21 additions & 1 deletion WebContent/html/javascript/request.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,40 @@ 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 += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + devices[i].hardware + '<br><br>' + 'Manufacturer: ' + devices[i].manufacturer + '<br><br>' + 'Model: ' + devices[i].model + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + devices[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i) + '"></div></div></div></a><br><br>';
}
if(html.localeCompare("")==0)
html += "<p>There are no devices with the search criteria: " + this.textContent + "</p>";
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');
var html = '';
var part1 = "nhpup.popup('";
var part2 = "');"
for (var i = 0; i < deviceArray.length; i++) {
html += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><button class = "requestbutton" id = "button' + (deviceArray[i].id) + '" type="button">Order device</button></div></div></a><br><br>'
html += '<a class = "divlink" href = "#" onmouseover = "' + part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + '<br><br>' + 'Model: ' + deviceArray[i].model + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><button class = "requestbutton" id = "button' + (deviceArray[i].id) + '" type="button">Order device</button></div></div></a><br><br>'
}
if(html.localeCompare("")==0)
Expand Down
18 changes: 9 additions & 9 deletions WebContent/html/javascript/statistics.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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 += '<div class = "info-container">Total Devices: '+ totalDevices +
'<br>Available Devices: ' + availableDevices +
'<br>Loaned Devices: ' + loanDevices +
'<br>Returning Devices: ' + returnDevices +
'<br>Lost Devices: ' + lostDevices +
'</div>'
'<br>Permanent Devices: ' + unavailDevices +
'</div>';
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart']});
Expand All @@ -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<statistics.length; i++){
data.addRow([statistics[i].status, statistics[i].count]); //fixed this to match the new database
}
// Set chart options
var options = {'title':'Chart of Devices',
'width':600,
Expand Down

0 comments on commit a6f9217

Please sign in to comment.