From 814e6e1a62565e6673976d89e3989dd221944972 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 1 Jan 2018 15:31:05 +0200 Subject: [PATCH] Update amount when selecting invoice on /payments/create --- resources/views/payments/edit.blade.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/views/payments/edit.blade.php b/resources/views/payments/edit.blade.php index ad169c432fed..d9f612bf7fa6 100644 --- a/resources/views/payments/edit.blade.php +++ b/resources/views/payments/edit.blade.php @@ -354,8 +354,10 @@ formatMoneyInvoice(invoice.balance, invoice), invoice.public_id)); } $('select#invoice').combobox('refresh'); + $('#amount').val(''); if (window.model) { + model.amount(''); model.client_id(clientId); setTimeout(function() { model.updateExchangeRate(); @@ -375,12 +377,13 @@ var client = clientMap[invoice.client.public_id]; invoice.client = client; setComboboxValue($('.client-select'), client.public_id, getClientDisplayName(client)); - if (!parseFloat($('#amount').val())) { - var amount = parseFloat(invoice.balance); - $('#amount').val(amount.toFixed(2)); - model.amount(amount); - } - } + var amount = parseFloat(invoice.balance); + $('#amount').val(amount.toFixed(2)); + model.amount(amount); + } else { + $('#amount').val(''); + model.amount(''); + } model.client_id(client ? client.public_id : 0); setTimeout(function() { model.updateExchangeRate();