1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Hide partial field if using surcharge gateway fee

This commit is contained in:
Hillel Coren 2017-03-19 17:03:46 +02:00
parent ebc5fe0c3c
commit 81671152e5
6 changed files with 19 additions and 21 deletions

View File

@ -1190,13 +1190,6 @@ class AccountController extends BaseController
$account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date'));
$account->gateway_fee_location = Input::get('gateway_fee_location') ?: null;
/*
if ($account->gateway_fee_location) {
$taxField = $account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? 'custom_invoice_taxes1' : 'custom_invoice_taxes1';
$account->$taxField = false;
}
*/
$account->save();
event(new UserSettingsChanged());

View File

@ -396,6 +396,11 @@ class Account extends Eloquent
return $this->invoice_number_prefix != $this->quote_number_prefix;
}
public function hasGatewayFeeSurcharge()
{
return $this->gateway_fee_location == FEE_LOCATION_CHARGE1 || $this->gateway_fee_location == FEE_LOCATION_CHARGE2;
}
/**
* @return mixed
*/

View File

@ -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 or line item.<br/>Use \'Line item\' to support partial payments.',
'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.<br/>Use \'Line item\' to support partial/deposit payments.',
'gateway' => 'Gateway',
'gateway_fee_change_warning' => 'If there are unpaid invoices with fees applied they need to be removed to prevent duplicate fees.',
'gateway_fee_change_warning' => 'If there are unpaid invoices with fees they need to be removed to prevent duplicate fees from being charged.',
'fees_surcharge_help' => 'Customize surcharge :link.',
'label_and_taxes' => 'label and taxes'

View File

@ -238,20 +238,18 @@
->label(trans('texts.field_label'))
->placeholder($account->gateway_fee_location == FEE_LOCATION_CHARGE1 ? trans('texts.surcharge') : ' ')
->addGroupClass('pad-checkbox')
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE1 && false ? false :
Former::checkbox('custom_invoice_taxes1')
->value(1)
->raw() . trans('texts.charge_taxes')) !!}
->append(Former::checkbox('custom_invoice_taxes1')
->value(1)
->raw() . trans('texts.charge_taxes')) !!}
{!! Former::text('custom_invoice_label2')
->label(trans('texts.field_label'))
->placeholder($account->gateway_fee_location == FEE_LOCATION_CHARGE2 ? trans('texts.surcharge') : ' ')
->addGroupClass('pad-checkbox')
->append($account->gateway_fee_location == FEE_LOCATION_CHARGE2 && false ? false :
Former::checkbox('custom_invoice_taxes2')
->value(1)
->raw() . trans('texts.charge_taxes'))
->help(trans('texts.custom_invoice_charges_helps')) !!}
->append(Former::checkbox('custom_invoice_taxes2')
->value(1)
->raw() . trans('texts.charge_taxes'))
->help(trans('texts.custom_invoice_charges_helps')) !!}
</div>
</div>

View File

@ -172,7 +172,7 @@
@if ($account->gateway_fee_location == FEE_LOCATION_ITEM && !$account->invoice_item_taxes && $account->invoice_taxes && count($taxRates))
<br/>{{ trans('texts.fees_tax_help') }}
@endif
@if ($account->gateway_fee_location == FEE_LOCATION_CHARGE1 || $account->gateway_fee_location == 2)
@if ($account->hasGatewayFeeSurcharge())
<br/>{!! trans('texts.fees_surcharge_help', ['link' => link_to('/settings/invoice_settings#invoice_surcharges', trans('texts.label_and_taxes'), ['target' => '_blank'])]) !!}
@endif
</div>

View File

@ -158,8 +158,10 @@
->placeholder($invoice->exists || $invoice->isQuote() ? ' ' : $account->present()->dueDatePlaceholder())
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->appendIcon('calendar')->addGroupClass('due_date') !!}
{!! Former::text('partial')->data_bind("value: partial, valueUpdate: 'afterkeydown'")->onkeyup('onPartialChange()')
->addGroupClass('partial')!!}
@if (! $account->hasGatewayFeeSurcharge())
{!! Former::text('partial')->data_bind("value: partial, valueUpdate: 'afterkeydown'")->onkeyup('onPartialChange()')
->addGroupClass('partial')!!}
@endif
</div>
@if ($entityType == ENTITY_INVOICE)
<div data-bind="visible: is_recurring" style="display: none">