Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
clj13001 committed Apr 23, 2017
2 parents c5bd266 + 5493da4 commit 2cb1955
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions WebContent/html/javascript/request.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ for(var a = 0; a < softwareOptions.length; a++){
// searchbar listener
var searchbar = document.getElementsByName('searchBar');
searchbar[0].onkeyup = refresh;
// populate page with all devices by default
show(devices);
function refresh() {
show(fuzzyFilter(filter(devices)));
}
Expand Down
19 changes: 14 additions & 5 deletions WebContent/html/webpages/shoppingCart.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ pageEncoding="ISO-8859-1"%>
</div>
<div class="form-group row">
<label for="timeNeeded">When will you be able to return it?</label><br/>
<input type="date" class="form-control" name="timeNeeded" style="width:20%; margin:0% auto" required/>
<input type="date" class="form-control" id="datePicker" name="timeNeeded" style="width:20%; margin:0% auto" required/>
</div>
<div class="form-group row">
<label for="urgent">This is an urgent request</label>
<input type = "checkbox" name = "checkboxes" value="urgent"><br>
<label for="urgent">This is a permanent loan</label>
<input type = "checkbox" name = "checkboxes" value = "perm">
</div>
<button type="submit" class="btn btn-primary" name="Submit">Submit</button>
<button type="submit" class="btn btn-primary" id = "Submit" name="Submit">Submit</button>
</form>
</div>

Expand Down Expand Up @@ -228,6 +228,7 @@ var orderForm = document.getElementById('orderInfoModal');
var orderFormCloseButton = document.getElementById('closeOrderForm');
orderFormCloseButton.addEventListener('click',hidePopup);
// done applying event listeners
document.getElementById('datePicker').valueAsDate = new Date();
var employee = {
id:"",
Expand Down Expand Up @@ -325,15 +326,23 @@ function changeStatus(){
// These functions just redirect button pressed to call the showPopup method with the appropriate parameter
function orderSelected_showPopup() {
showPopup("false");
showPopup(false);
}
function orderAll_showPopup() {
showPopup("true");
showPopup(true);
}
// Opens order form and calls autofill method. Parameter is actually a string, not a boolean, because it will be put into a text field.
// It indicaties which button was used to call the method.
// If true, submitting the form will order everything in the cart. If false it only orders selected devices.
function showPopup(orderAllBool){
if(checked.length==0 && !orderAllBool){
$('#Submit').attr('disabled',true);
$('#Submit').attr('title',"There aren't any devices selected to order!");
}
else{
$('#Submit').attr('disabled',false);
$('#Submit').removeAttr('title');
}
orderForm.style.display = "block";
autoFillFields(orderAllBool);
}
Expand Down Expand Up @@ -374,7 +383,7 @@ function autoFillFields(orderAllBool) {
// and fill in the location sub-fieds
forceUpdateLocationMetadata();
// finally mark hidden orderAll field appropriately
document.orderForm.orderAll.value=orderAllBool;
document.orderForm.orderAll.value=orderAllBool?"true":"false";
// Also, this is where I'm going to restrict the date input to the future
var dtToday = new Date();
Expand Down

0 comments on commit 2cb1955

Please sign in to comment.