From b6a0350952c34297c11bcdf85c71b4f86e6ca00d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 21 Sep 2019 14:18:08 +1000 Subject: [PATCH] Logic for modal display --- app/DataMapper/CompanySettings.php | 6 +++++- .../views/portal/default/invoices/payment.blade.php | 11 ++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 43e8a04dde3a..1f62678daa48 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -156,8 +156,12 @@ class CompanySettings extends BaseSettings public $enable_portal_password = false; public $show_accept_invoice_terms = false; public $show_accept_quote_terms = false; + public $require_invoice_signature = false; + public $require_quote_signature = false; public static $casts = [ + 'require_invoice_signature' => 'false', + 'require_quote_signature' => 'false', 'show_accept_quote_terms' => 'false', 'show_accept_invoice_terms' => 'false', 'timezone_id' => 'string', @@ -289,7 +293,7 @@ class CompanySettings extends BaseSettings foreach($company_settings as $key => $value) { - if(!property_exists($data, $key)) + if(!property_exists($settings, $key)) $settings->{$key} = self::castAttribute($key, $company_settings->{$key}); } diff --git a/resources/views/portal/default/invoices/payment.blade.php b/resources/views/portal/default/invoices/payment.blade.php index 2e8c08b54afa..4f062b2458bf 100644 --- a/resources/views/portal/default/invoices/payment.blade.php +++ b/resources/views/portal/default/invoices/payment.blade.php @@ -124,17 +124,14 @@ var terms_accepted = false; $('#pay_now').on('click', function(e) { //check if terms must be accepted - - @if(App\DataMapper\CompanySettings::duh()) - @endif @if($settings->show_accept_invoice_terms) - $('#terms_modal').modal('show'); + $('#terms_modal').modal('show'); @endif - //check if signature required - getSignature(); - + @if($settings->require_invoice_signature) + getSignature(); + @endif }); $('#terms_accepted').on('click', function(e){