diff --git a/html/imgs/ticket.png b/html/imgs/ticket.png
new file mode 100644
index 0000000..a0387e2
Binary files /dev/null and b/html/imgs/ticket.png differ
diff --git a/html/javascript/shoppingCart.js b/html/javascript/shoppingCart.js
index 990feb4..c79b018 100644
--- a/html/javascript/shoppingCart.js
+++ b/html/javascript/shoppingCart.js
@@ -1,8 +1,5 @@
//here are all the hardcoded devices
-var array = new Array;
-localStorage.setItem('unavailable',JSON.stringify(array));
-
var dev1 = {
id: 1,
name:"George",
@@ -82,7 +79,7 @@ function show(){
var id = cart[i]; //this gets the id value from the cart
for(var j = 0; j < devices.length; j++){ //iterate device list
if(devices[j].id === id){ //match the id's
- html += '
' + devices[j].name + '
'; //create listing of all the devices
+ html += '
'; //create listing of all the devices
break; //break out of loop when we match
}
}
@@ -98,6 +95,31 @@ function show(){
for(var i = 0; i < checkboxes.length; i++){ //iterate them
checkboxes[i].addEventListener('click',changeStatus); //when we click on a checkbox, it should add/remove the id from the selected array
}
+
+ var tickets = document.getElementsByClassName('ticket');
+ for(var i = 0; i < tickets.length; i++){
+ tickets[i].addEventListener('click',clickTicket);
+ }
+}
+
+/**
+This allows a ticket click to do the same thing as clicking on the checkbox.
+**/
+function clickTicket(){
+ var checkboxes = document.getElementsByClassName('deviceCheckbox');
+ var id = this.getAttribute('id');
+ id = parseInt(id.replace(/[^0-9\.]/g,''),10);
+ if(document.getElementById(id).checked == true){
+ document.getElementById(id).checked = false;
+ for(var i = 0; i < checked.length; i++){ //iterate checked array
+ if(id == checked[i]) //find the right checkbox
+ checked.splice(i,1); //remove from the array
+ }
+ }
+ else{
+ document.getElementById(id).checked = true;
+ checked.push(id);
+ }
}
/**
diff --git a/html/webpages/requestPage.html b/html/webpages/requestPage.html
index 600446f..5e11487 100644
--- a/html/webpages/requestPage.html
+++ b/html/webpages/requestPage.html
@@ -101,7 +101,7 @@