diff --git a/WebContent/html/javascript/request.js b/WebContent/html/javascript/request.js index 94a01ad..62ebde9 100644 --- a/WebContent/html/javascript/request.js +++ b/WebContent/html/javascript/request.js @@ -1,5 +1,8 @@ //get all the option buttons -var options = document.getElementsByClassName('option'); + +var hardwareOptions = document.getElementsByClassName('hw-data-type'); +var softwareOptions = document.getElementsByClassName('sw-data-type'); + function ajaxFunction(){ var request; @@ -87,13 +90,17 @@ for(var a = 0; a < options.length; a++){ //when an option is selected, show a new list of devices based on what the user asked for function show(){ - //get the option that you selected - var type = this.getAttribute('data-type'); + + currentFilter = readFilter(); + selectedDevices = getDevices(currentFilter); //when connor is done with the database library getDevices should be redirected there + + + var html = ''; //iterate through the hardcoded device DB and select all the ones that match the selected option for(var i = 0; i < devices.length; i++){ - if((type.localeCompare(devices[i].hardware) == 0 || type.localeCompare(devices[i].software) == 0) && !isUnavailable(i)){ + if((hw_type.localeCompare(devices[i].hardware) == 0 && sw_type.localeCompare(devices[i].software) == 0) && !isUnavailable(i)){ html += '
' + devices[i].name + '

' + devices[i].description + '



' } } @@ -111,6 +118,13 @@ function show(){ } } +function readFilter() { + //Constrcts a filter object for use in the database library that corresponds to the checked optionsin the sidebar + var hw_type; + var sw_type; + +} + function addToCart(){ var id = this.getAttribute('id'); id = parseInt(id.replace(/[^0-9\.]/g,''),10); //this gets just the numerical value from the id! diff --git a/WebContent/html/webpages/requestPage.html b/WebContent/html/webpages/requestPage.html index e5c4d54..5b71bce 100644 --- a/WebContent/html/webpages/requestPage.html +++ b/WebContent/html/webpages/requestPage.html @@ -1,20 +1,20 @@ - - - - - - - + + + + + + + - Synchrony Financial + Synchrony Financial - - - - - - - + + - - - + + + -
-

Available Devices

-

Choose an option to the left to begin requesting!

-
+
+

Available Devices

+

Choose an option to the left to begin requesting!

+
-
+

Added to Cart

-
+
-
+

Already in Cart

-
- - - - +
+ + + + \ No newline at end of file