Hide WePay credit card form if token billing is disabled

This commit is contained in:
Hillel Coren 2017-05-22 11:33:56 +03:00
parent b5ed7d9896
commit c433661d11

View File

@ -202,108 +202,112 @@
<p>&nbsp;<br/>&nbsp;</p> <p>&nbsp;<br/>&nbsp;</p>
@endif @endif
<div class="row"> @if ($accountGateway->isGateway(GATEWAY_WEPAY) && $account->token_billing_type_id === TOKEN_BILLING_DISABLED)
<div class="col-lg-{{ ($accountGateway->gateway_id == GATEWAY_BRAINTREE) ? 12 : 8 }}"> {{--- do nothing ---}}
@else
<div class="row">
<div class="col-lg-{{ ($accountGateway->gateway_id == GATEWAY_BRAINTREE) ? 12 : 8 }}">
<h3> <h3>
{{ trans('texts.billing_method') }} {{ trans('texts.billing_method') }}
@if (isset($acceptedCreditCardTypes)) @if (isset($acceptedCreditCardTypes))
&nbsp; &nbsp;
@foreach ($acceptedCreditCardTypes as $card) @foreach ($acceptedCreditCardTypes as $card)
<img src="{{ $card['source'] }}" alt="{{ $card['alt'] }}" style="width: 34px; display: inline; margin-left: 7px;"/> <img src="{{ $card['source'] }}" alt="{{ $card['alt'] }}" style="width: 34px; display: inline; margin-left: 7px;"/>
@endforeach @endforeach
@endif @endif
<br/> <br/>
</h3> </h3>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@if ($accountGateway->gateway_id == GATEWAY_BRAINTREE) @if ($accountGateway->gateway_id == GATEWAY_BRAINTREE)
<div id="card_number" class="braintree-hosted form-control"></div> <div id="card_number" class="braintree-hosted form-control"></div>
@else @else
{!! Former::text(!empty($tokenize) ? '' : 'card_number') {!! Former::text(!empty($tokenize) ? '' : 'card_number')
->id('card_number') ->id('card_number')
->placeholder(trans('texts.card_number')) ->placeholder(trans('texts.card_number'))
->autocomplete('cc-number') ->autocomplete('cc-number')
->label('') !!} ->label('') !!}
@endif @endif
</div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-md-5">
<div class="col-md-5"> @if ($accountGateway->gateway_id == GATEWAY_BRAINTREE)
@if ($accountGateway->gateway_id == GATEWAY_BRAINTREE) <div id="expiration_month" class="braintree-hosted form-control"></div>
<div id="expiration_month" class="braintree-hosted form-control"></div> @else
@else {!! Former::select(!empty($tokenize) ? '' : 'expiration_month')
{!! Former::select(!empty($tokenize) ? '' : 'expiration_month') ->id('expiration_month')
->id('expiration_month') ->autocomplete('cc-exp-month')
->autocomplete('cc-exp-month') ->placeholder(trans('texts.expiration_month'))
->placeholder(trans('texts.expiration_month')) ->addOption('01 - ' . trans('texts.january'), '1')
->addOption('01 - ' . trans('texts.january'), '1') ->addOption('02 - ' . trans('texts.february'), '2')
->addOption('02 - ' . trans('texts.february'), '2') ->addOption('03 - ' . trans('texts.march'), '3')
->addOption('03 - ' . trans('texts.march'), '3') ->addOption('04 - ' . trans('texts.april'), '4')
->addOption('04 - ' . trans('texts.april'), '4') ->addOption('05 - ' . trans('texts.may'), '5')
->addOption('05 - ' . trans('texts.may'), '5') ->addOption('06 - ' . trans('texts.june'), '6')
->addOption('06 - ' . trans('texts.june'), '6') ->addOption('07 - ' . trans('texts.july'), '7')
->addOption('07 - ' . trans('texts.july'), '7') ->addOption('08 - ' . trans('texts.august'), '8')
->addOption('08 - ' . trans('texts.august'), '8') ->addOption('09 - ' . trans('texts.september'), '9')
->addOption('09 - ' . trans('texts.september'), '9') ->addOption('10 - ' . trans('texts.october'), '10')
->addOption('10 - ' . trans('texts.october'), '10') ->addOption('11 - ' . trans('texts.november'), '11')
->addOption('11 - ' . trans('texts.november'), '11') ->addOption('12 - ' . trans('texts.december'), '12')->label('')
->addOption('12 - ' . trans('texts.december'), '12')->label('') !!}
!!} @endif
@endif </div>
</div> <div class="col-md-4">
<div class="col-md-4"> @if ($accountGateway->gateway_id == GATEWAY_BRAINTREE)
@if ($accountGateway->gateway_id == GATEWAY_BRAINTREE) <div id="expiration_year" class="braintree-hosted form-control"></div>
<div id="expiration_year" class="braintree-hosted form-control"></div> @else
@else {!! Former::select(!empty($tokenize) ? '' : 'expiration_year')
{!! Former::select(!empty($tokenize) ? '' : 'expiration_year') ->id('expiration_year')
->id('expiration_year') ->autocomplete('cc-exp-year')
->autocomplete('cc-exp-year') ->placeholder(trans('texts.expiration_year'))
->placeholder(trans('texts.expiration_year')) ->options(
->options( array_combine(
array_combine( range(date('Y'), date('Y') + 10),
range(date('Y'), date('Y') + 10), range(date('Y'), date('Y') + 10)
range(date('Y'), date('Y') + 10) )
) )
) ->label('') !!}
->label('') !!} @endif
@endif </div>
<div class="col-md-3">
@if ($accountGateway->gateway_id == GATEWAY_BRAINTREE)
<div id="cvv" class="braintree-hosted form-control"></div>
@else
{!! Former::text(!empty($tokenize) ? '' : 'cvv')
->id('cvv')
->placeholder(trans('texts.cvv'))
->autocomplete('off')
->label('') !!}
@endif
</div>
</div> </div>
<div class="col-md-3">
@if ($accountGateway->gateway_id == GATEWAY_BRAINTREE) <div class="row" style="padding-top:18px">
<div id="cvv" class="braintree-hosted form-control"></div>
@else <div class="col-md-12">
{!! Former::text(!empty($tokenize) ? '' : 'cvv') @if (isset($amount) && $client && $account->showTokenCheckbox($storageGateway/* will contain gateway id */))
->id('cvv') <input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
->placeholder(trans('texts.cvv')) <label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
->autocomplete('off') <span class="help-block" style="font-size:15px">
->label('') !!} @if ($storageGateway == GATEWAY_STRIPE)
@endif {!! trans('texts.token_billing_secure', ['link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}
@elseif ($storageGateway == GATEWAY_BRAINTREE)
{!! trans('texts.token_billing_secure', ['link' => link_to('https://www.braintreepayments.com/', 'Braintree', ['target' => '_blank'])]) !!}
@endif
</span>
@endif
</div>
</div> </div>
</div> </div>
<div class="col-lg-4">
<div class="row" style="padding-top:18px"> <div class='card-wrapper'></div>
<div class="col-md-12">
@if (isset($amount) && $client && $account->showTokenCheckbox($storageGateway/* will contain gateway id */))
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
<span class="help-block" style="font-size:15px">
@if ($storageGateway == GATEWAY_STRIPE)
{!! trans('texts.token_billing_secure', ['link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}
@elseif ($storageGateway == GATEWAY_BRAINTREE)
{!! trans('texts.token_billing_secure', ['link' => link_to('https://www.braintreepayments.com/', 'Braintree', ['target' => '_blank'])]) !!}
@endif
</span>
@endif
</div>
</div> </div>
</div> </div>
<div class="col-lg-4"> @endif
<div class='card-wrapper'></div>
</div>
</div>
<div class="col-md-12"> <div class="col-md-12">
<div id="js-error-message" style="display:none" class="alert alert-danger"></div> <div id="js-error-message" style="display:none" class="alert alert-danger"></div>