From 19e9f382e45bf00eb7e59a65398942da6e19ade3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Oct 2016 16:56:18 +0200 Subject: [PATCH] Add some rounding to make forms more neat. --- app/Http/Controllers/AccountController.php | 2 +- app/Support/ExpandedForm.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 7fed6c5cf0..4b0573363c 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -146,7 +146,7 @@ class AccountController extends Controller 'ccMonthlyPaymentDate' => $account->getMeta('ccMonthlyPaymentDate'), 'openingBalanceDate' => $openingBalanceDate, 'openingBalance' => $openingBalanceAmount, - 'virtualBalance' => round($account->virtual_balance, 2), + 'virtualBalance' => $account->virtual_balance, ]; Session::flash('preFilled', $preFilled); Session::flash('gaEventCategory', 'accounts'); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 495fd2d75c..caefbaf73d 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -40,10 +40,11 @@ class ExpandedForm */ public function amount(string $name, $value = null, array $options = []): string { - $label = $this->label($name, $options); - $options = $this->expandOptionArray($name, $label, $options); - $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = round($this->fillFieldValue($name, $value), 2); + var_dump($value); $options['step'] = 'any'; $options['min'] = '0.01'; $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); @@ -93,7 +94,7 @@ class ExpandedForm $label = $this->label($name, $options); $options = $this->expandOptionArray($name, $label, $options); $classes = $this->getHolderClasses($name); - $value = $this->fillFieldValue($name, $value); + $value = round($this->fillFieldValue($name, $value), 2); $options['step'] = 'any'; $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); $currencies = Amt::getAllCurrencies();