@extends('accounts.nav')
@section('content')
@parent
{!! Former::open($url)->method($method)->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
{!! Former::populate($account) !!}
{!! Former::legend($title) !!}
@if ($accountGateway)
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
@if ($config)
@foreach ($accountGateway->fields as $field => $junk)
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
{{-- do nothing --}}
@elseif (isset($config->$field))
{{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }}
@endif
@endforeach
@endif
@endif
{!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
->checkboxes($creditCardTypes)->class('creditcard-types')
!!}
{!! Former::radios('recommendedGateway_id')->label('Recommended Gateway')
->radios($recommendedGateways)->class('recommended-gateway')
!!}
{!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '')
->dataClass('gateway-dropdown')
->fromQuery($gateways, 'name', 'id')
->onchange('setFieldsShown()'); !!}
@foreach ($gateways as $gateway)
@foreach ($gateway->fields as $field => $details)
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
{{-- do nothing --}}
@elseif ($field == 'testMode' || $field == 'developerMode')
{{-- Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable') --}}
@elseif ($field == 'username' || $field == 'password')
{!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!}
@else
{!! Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) !!}
@endif
@endforeach
@if ($gateway->getHelp())
@endif
@if ($gateway->id == GATEWAY_STRIPE)
{!! Former::select('token_billing_type_id')->options($tokenBillingOptions)->help(trans('texts.token_billing_help')) !!}
@endif
@endforeach
{!! Former::actions(
Button::success('Save')->submit()->large()->appendIcon(Icon::create('floppy-disk')),
$countGateways > 0 ? Button::lg_default_link('company/payments', 'Cancel')->append_with_icon('remove-circle') : false) !!}
{!! Former::close() !!}
@stop