From daf885cc4a112688e48246a2d242bb2148387b56 Mon Sep 17 00:00:00 2001 From: Jonathan Rosenbaum Date: Thu, 3 Aug 2017 20:03:27 +0000 Subject: [PATCH] Shows original price and redeemed volunteer hours for saved transaction when edit button is pressed. --- css/transactions.css | 1 + js/transaction.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/css/transactions.css b/css/transactions.css index 25e490b..6aab0e6 100644 --- a/css/transactions.css +++ b/css/transactions.css @@ -137,4 +137,5 @@ input[value=Save]:focus, input[value=Close]:focus { #original_price { display: none; + color: blueviolet; } \ No newline at end of file diff --git a/js/transaction.js b/js/transaction.js index cd37d49..2b2dc36 100644 --- a/js/transaction.js +++ b/js/transaction.js @@ -765,7 +765,21 @@ $(function() { $("#paid_label").text("Amount Owed:"); } - // show original amount for transaction using volunteer / membership benefits + // show original price for transaction using volunteer / membership benefits + $.post("json/transaction.php", { transaction_benefits: 1 }, function (data) { + var obj = $.parseJSON(data); + + // Volunteer benefits + if ( obj.transactions_with_volunteer_benefits[$("#trans_type_info").text()] === true ) { + $.post("json/transaction.php",{ history_select: 1, transaction_id: transaction_id }, function(data) { + var obj = $.parseJSON(data); + var history = obj[obj.length - 1]; + $("#original_price").text(history.original_price).show(); + $("#volunteer_hours").text(history.redeemed_hours).show(); + + }); + + }); // show original price // Things to do before pressing the save / close button