Skip to content

Commit

Permalink
self-xdsd#300 Allow Invoice Payment Only If totalAmount >= 108 EUR
Browse files Browse the repository at this point in the history
  • Loading branch information
criske committed Jan 4, 2021
1 parent d932daf commit 5be3bde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main/resources/public/js/getAndAddContracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,17 @@ var projectContractsCount = -1;
+ "</a> ";
if (invoice.paymentTime == "null" && invoice.transactionId == "null") {
status = "Active";
if (parseFloat(invoice.totalAmount) > 0.0) {
var totalAmount = parseFloat(invoice.totalAmount.substring(0, invoice.totalAmount.length - 1))
if (totalAmount >= 108.0) {
payIcon = "<a href='#' title='Pay Invoice' class='payInvoice' "
+ "data-contributor='" + contract.id.contributorUsername + "' "
+ "data-role='" + contract.id.role + "' data-repo='" + contract.id.repoFullName + "'>"
+ "<i class='fa fa-credit-card fa-lg'></i>"
+ "</a>";
}
if(totalAmount === 0.0){
downloadLink = "";
}
} else {
status = "Paid";
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/public/js/wallets.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ function payInvoice(invoice, contract, payButton) {
*/
function newInvoiceAsTableRow(invoice) {
var status = "Active"
var downloadLink = "<a href='#' title='Download Invoice' class='downloadInvoice'>"
var totalAmount = parseFloat(invoice.totalAmount.substring(0, invoice.totalAmount.length - 1))
var downloadLink = totalAmount > 0.0 ? "<a href='#' title='Download Invoice' class='downloadInvoice'>"
+ "<i class='fa fa-file-pdf-o fa-lg'></i>"
+ "</a>";
+ "</a>": "";
return "<tr>" +
"<td>" + invoice.id + "</td>" +
"<td>" + invoice.createdAt.split('T')[0] + "</td>" +
Expand Down

0 comments on commit 5be3bde

Please sign in to comment.