From 9b9140477c823d11747b614068da3a096184c3ae Mon Sep 17 00:00:00 2001 From: Samm Du Date: Sun, 12 Dec 2021 20:53:58 -0500 Subject: [PATCH] index on main: 9a2bf26 Merge pull request #24 from TLI-Group-1/formatting --- js/discover.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/discover.js b/js/discover.js index 573a642..4a3b8ee 100644 --- a/js/discover.js +++ b/js/discover.js @@ -250,6 +250,15 @@ function displayCarsOrOffers(listings) { item['term_mo'], item['total_sum'] ); + + // check to see if the offer is claimed + if (item['claimed'] === true) { + // set the claim button to claimed + let claimButton = document.querySelector( + 'button.claim-btn[name="' + item['offer_id'] + '"]' + ); + toggleButtonClaimed(claimButton); + } } // if there is an odd number of cars, add an invisible entry for visual pleasantness @@ -445,7 +454,7 @@ async function toggleClaimOffer(id) { await api.unclaimOffer(userID, id); } - // display the offer details + // set the claim button to claimed toggleButtonClaimed(claimButton); // update the claimed offers widget, fetch and display the user's claimed offers