diff --git a/app/images/alert.jpg b/app/images/alert.jpg new file mode 100644 index 0000000..a0c349a Binary files /dev/null and b/app/images/alert.jpg differ diff --git a/app/paynow.css b/app/paynow.css index 634700a..01cf757 100644 --- a/app/paynow.css +++ b/app/paynow.css @@ -66,3 +66,9 @@ input { font-weight: 500; text-align: center; } + +.paynow .payment-status { + font-size: 75%; + font-weight: 500; + text-align: center; +} \ No newline at end of file diff --git a/app/paynow.js b/app/paynow.js index 459683b..edc6379 100644 --- a/app/paynow.js +++ b/app/paynow.js @@ -20,6 +20,8 @@ BACKEND_URL.pathname = '/api/v1/transactions' var BACKEND = BACKEND_URL.toString() console.log("BACKEND: " + BACKEND); +var STATUS_SETTLED = "Settled" + // Used to select random people photos function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1) + min); @@ -38,7 +40,9 @@ $("#paynowButton").click(function () { location: $('#formCountry').val(), contribution: $('#paymentAmount').val(), creditCardNumber: $('#ccNum').val(), - creditCardCVV: $('#ccCVV').val() + creditCardCVV: $('#ccCVV').val(), + id: getRandomInt(1, 9), + status: STATUS_SETTLED }; console.log("Sending : " + JSON.stringify(donateJSON)); @@ -101,12 +105,24 @@ function getDonations() { // console.log(donatorList.slice(0, (donatorList.length < 5 ? donatorList.length : 5))); var donator = ""; $.each(donatorList, function (index, value) { - + var status = value.status; + var amount = value.contribution; + donator = donator + `
` + value.name + `
- -` + value.contribution + `
-` + value.name + `
`; + if (status != STATUS_SETTLED) { + donator = donator + ``; + } + else { + donator = donator + ``; + } + donator = donator + `` + amount + `
`; + + if (status != STATUS_SETTLED) { + donator = donator + `Payment status: ` + status + `
`; + } + + donator = donator + ``; }); $("#paynow-results").html(donator);