Skip to content

Commit

Permalink
Merge pull request #92 from TeamSevenWeb/final-touches-for-better-ux
Browse files Browse the repository at this point in the history
Final touches for better ux
  • Loading branch information
amechkarov authored Mar 19, 2024
2 parents 1b7ea94 + d5f086f commit 9e1e19e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ create table virtual_wallet.transfers
direction int not null,
date date not null,
constraint transfers_card_fk2
foreign key (card) references virtual_wallet.cards (card_id),
foreign key (card) references virtual_wallet.cards (card_id) ON DELETE CASCADE,
constraint transfers_direction_fk3
foreign key (direction) references virtual_wallet.transfer_directions (direction_id),
constraint transfers_wallet_fk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,15 @@ public String showCardsPage(HttpSession session, Model model) {
return "redirect:/auth/login";
}
}

@GetMapping("/delete/{id}")
public String deleteCard(@PathVariable int id,HttpSession session) {
try {
User holder = authenticationHelper.tryGetCurrentUser(session);
cardService.delete(holder,id);
return "redirect:/users/cards";
}catch (AuthenticationException | AuthorizationException e) {
return "redirect:/auth/login";
}
}
}
9 changes: 8 additions & 1 deletion src/main/resources/templates/CardsView.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,18 @@ <h1 th:if="${userCards.isEmpty()}" class="text-uppercase mb-0 font-aquire" th:te
<br/><br/>
<span class="font-aquire" th:text="${card.expirationDate}"></span>
<br/><br/>
<i th:if="${card.number.startsWith('6')}" class="enlarged-fab fab fa-cc-discover"></i> <!-- Discover -->
<i th:if="${card.number.startsWith('6')}" class="enlarged-fab fab fa-cc-discover">
</i> <!-- Discover -->
<i th:if="${card.number.startsWith('5')}" class="enlarged-fab fab fa-cc-mastercard"></i> <!-- Mastercard -->
<i th:if="${card.number.startsWith('4')}" class="enlarged-fab fab fa-cc-visa"></i> <!-- VISA -->
<i th:if="${card.number.startsWith('3')}" class="enlarged-fab fab fa-cc-amex"></i> <!-- AMEX -->
<i th:unless="${card.number.startsWith('6') or card.number.startsWith('5') or card.number.startsWith('4') or card.number.startsWith('3')}" class="enlarged-fab fab fa-credit-card"></i> <!-- Default icon (Credit Card) -->
<br/><br/>
<a th:href="@{|${requestURI}/delete/${card.id}|}" href="#"
class="post-delete-button">Delete
<i class="fab fa-free-code-camp"></i>
</a>
<br/><br/>
</div>
</div>
</div>
Expand Down

0 comments on commit 9e1e19e

Please sign in to comment.