diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 9a210c6c9e47..1acd1a3adb2f 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2416,9 +2416,9 @@ $LANG = array( 'online_payment_surcharge' => 'Online Payment Surcharge', 'gateway_fees' => 'Gateway Fees', 'fees_disabled' => 'Fees are disabled', - //'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].', 'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.
Use \'Line item\' to support partial payments.', 'gateway' => 'Gateway', + 'gateway_fee_change_warning' => 'If there are unpaid invoices with fees applied they need to be removed to prevent duplicate fees.', ); diff --git a/resources/views/accounts/payments.blade.php b/resources/views/accounts/payments.blade.php index c92ab6e9017f..9a4c9e7ab229 100644 --- a/resources/views/accounts/payments.blade.php +++ b/resources/views/accounts/payments.blade.php @@ -30,6 +30,7 @@ ->addOption(trans('texts.location_first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1) ->addOption(trans('texts.location_second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2) ->addOption(trans('texts.location_line_item'), FEE_LOCATION_ITEM) + ->onchange('onGatewayFeeChange()') ->help('gateway_fees_help') ->label('gateway_fees')!!}
@@ -57,7 +58,7 @@ ->setOptions('sPaginationType', 'bootstrap') ->setOptions('bFilter', false) ->setOptions('bAutoWidth', false) - ->setOptions('aoColumns', [[ "sWidth"=> "24%" ], ["sWidth"=> "27%"], ["sWidth"=> "27%"], ["sWidth"=> "20%"]]) + ->setOptions('aoColumns', [[ "sWidth"=> "20%" ], ["sWidth"=> "20%"], ["sWidth"=> "30%"], ["sWidth"=> "20%"]]) ->setOptions('aoColumnDefs', [['bSortable'=>false, 'aTargets'=>[1, 2, 3]]]) ->render('datatable') !!} @@ -372,6 +373,21 @@ onTaxRateChange(instance); } + function onGatewayFeeChange() + { + if (window.hasShownGatewayFeeWarning) { + return; + } + window.hasShownGatewayFeeWarning = true; + + var settingLocation = $('#gateway_fee_location').val(); + var accountLocation = '{{ $account->gateway_fee_location }}'; + + if (accountLocation && settingLocation && accountLocation != settingLocation) { + swal("{!! trans('texts.warning') !!}", "{!! trans('texts.gateway_fee_change_warning') !!}"); + } + } + @stop