-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
198 additions
and
218 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
var rootUrl = 'http://localhost:8080/DWP-P2-DR/app/claimant' | ||
/** | ||
* Created by Leo on 16/07/2017. | ||
*/ | ||
|
||
$(document) | ||
.ready( | ||
function() { | ||
if (window.location.href == "http://localhost:8080/TaxCredit/tcpage1.html") { | ||
var mess = document.getElementById('output').innerHTML; | ||
if (!localStorage.message){ | ||
document.getElementById('output').innerHTML = "Hello and welcome to the Tax Credit Application page"; | ||
} else { | ||
document.getElementById('output').innerHTML = localStorage.message; | ||
} | ||
} | ||
}); | ||
$('#btnFindClaimantbyNino').click(function() { | ||
findClaimantByNino(); | ||
return false; | ||
}); | ||
function submit_feedback(){ | ||
var stars = document.getElementsByClassName('active'); | ||
var rating = stars.length; | ||
|
||
|
||
function findClaimantByNino() { | ||
var url = window.location.href.split('/'); | ||
var service = url[url.length - 1]; | ||
console.log(service); | ||
var data = {dm: service, stars: rating}; | ||
console.log(data); | ||
$.ajax({ | ||
statusCode: { | ||
500: function() { | ||
alert("error"); | ||
} | ||
}, | ||
type : "POST", | ||
url : "/firebase", | ||
data: JSON.stringify(data), | ||
success: function(result) { | ||
console.log("Success!"); | ||
}, | ||
error: function(error) { | ||
console.log(error); | ||
} | ||
}); | ||
// var data_1 = JSON.stringify(data); | ||
// console.log(data_1); | ||
window.location.replace('/pages/thankyou'); | ||
} | ||
|
||
var nino = $('#nino').val(); | ||
localStorage.setItem("nino", nino); | ||
// Could be global. Takes the place of all following error callbacks. | ||
$(function() { | ||
$.ajaxSetup({ | ||
error : function(jqXHR, exception) { | ||
message="Incorrect National Insurance number. Please try again" | ||
localStorage.setItem("message", message); | ||
if (jqXHR.status === 0) { | ||
console.log('Not connect.\n Verify Network.'); | ||
} else if (jqXHR.status == 404) { | ||
console.log('404: requested page not found. [404]'); | ||
} else if (jqXHR.status == 500) { | ||
console.log('500: internal Server Error [500].'); | ||
} else if (exception === 'parsererror') { | ||
console.log('parsererrr: requested JSON parse failed.'); | ||
} else if (exception === 'timeout') { | ||
console.log('timeout: time out error.'); | ||
} else if (exception === 'abort') { | ||
console.log('abort: AJAX request aborted.'); | ||
} else { | ||
console.log('Uncaught Error.\n' + jqXHR.responseText); | ||
} | ||
} | ||
}); | ||
}); | ||
document.getElementById('submit').addEventListener('click', submit_feedback) | ||
|
||
document.getElementById('ninoForm').submit(); | ||
var stars = document.getElementsByClassName('fa-star') | ||
Array.prototype.forEach.call(stars, function(star){ | ||
star.addEventListener('click', choose_rating) | ||
}) | ||
|
||
function choose_rating(event){ | ||
console.log(event.target.id) | ||
var id = event.target.id | ||
var stars = document.getElementsByClassName('fa-star') | ||
Array.prototype.forEach.call(stars, function(star){ | ||
star.classList.remove("active") | ||
if (star.id <= id){ | ||
star.classList.add("active") | ||
} | ||
}) | ||
} | ||
|
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var rootUrl = 'http://localhost:8080/DWP-P2-DR/app/claimant' | ||
|
||
$(document) | ||
.ready( | ||
function() { | ||
if (window.location.href == "http://localhost:8080/TaxCredit/tcpage1.html") { | ||
var mess = document.getElementById('output').innerHTML; | ||
if (!localStorage.message){ | ||
document.getElementById('output').innerHTML = "Hello and welcome to the Tax Credit Application page"; | ||
} else { | ||
document.getElementById('output').innerHTML = localStorage.message; | ||
} | ||
} | ||
}); | ||
$('#btnFindClaimantbyNino').click(function() { | ||
findClaimantByNino(); | ||
return false; | ||
}); | ||
|
||
|
||
function findClaimantByNino() { | ||
|
||
var nino = $('#nino').val(); | ||
localStorage.setItem("nino", nino); | ||
// Could be global. Takes the place of all following error callbacks. | ||
$(function() { | ||
$.ajaxSetup({ | ||
error : function(jqXHR, exception) { | ||
message="Incorrect National Insurance number. Please try again" | ||
localStorage.setItem("message", message); | ||
if (jqXHR.status === 0) { | ||
console.log('Not connect.\n Verify Network.'); | ||
} else if (jqXHR.status == 404) { | ||
console.log('404: requested page not found. [404]'); | ||
} else if (jqXHR.status == 500) { | ||
console.log('500: internal Server Error [500].'); | ||
} else if (exception === 'parsererror') { | ||
console.log('parsererrr: requested JSON parse failed.'); | ||
} else if (exception === 'timeout') { | ||
console.log('timeout: time out error.'); | ||
} else if (exception === 'abort') { | ||
console.log('abort: AJAX request aborted.'); | ||
} else { | ||
console.log('Uncaught Error.\n' + jqXHR.responseText); | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
document.getElementById('ninoForm').submit(); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters