From 5be3bde60aadcb2609db523f697d63c4efe17a39 Mon Sep 17 00:00:00 2001 From: cristianpela Date: Mon, 4 Jan 2021 19:35:46 +0200 Subject: [PATCH] #300 Allow Invoice Payment Only If totalAmount >= 108 EUR --- src/main/resources/public/js/getAndAddContracts.js | 6 +++++- src/main/resources/public/js/wallets.js | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/resources/public/js/getAndAddContracts.js b/src/main/resources/public/js/getAndAddContracts.js index b3466179..172922e9 100644 --- a/src/main/resources/public/js/getAndAddContracts.js +++ b/src/main/resources/public/js/getAndAddContracts.js @@ -157,13 +157,17 @@ var projectContractsCount = -1; + " "; 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 = "" + "" + ""; } + if(totalAmount === 0.0){ + downloadLink = ""; + } } else { status = "Paid"; } diff --git a/src/main/resources/public/js/wallets.js b/src/main/resources/public/js/wallets.js index baaa0710..3b06a04c 100644 --- a/src/main/resources/public/js/wallets.js +++ b/src/main/resources/public/js/wallets.js @@ -215,9 +215,10 @@ function payInvoice(invoice, contract, payButton) { */ function newInvoiceAsTableRow(invoice) { var status = "Active" - var downloadLink = "" + var totalAmount = parseFloat(invoice.totalAmount.substring(0, invoice.totalAmount.length - 1)) + var downloadLink = totalAmount > 0.0 ? "" + "" - + ""; + + "": ""; return "" + "" + invoice.id + "" + "" + invoice.createdAt.split('T')[0] + "" +