2015-03-16 22:45:25 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::open($url)->method($method)->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
|
|
|
|
{!! Former::populate($account) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::legend($title) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
@if ($accountGateway)
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
|
|
|
|
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@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
|
|
|
|
|
|
|
|
<div class="two-column">
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
|
2015-03-16 22:45:25 +01:00
|
|
|
->checkboxes($creditCardTypes)->class('creditcard-types')
|
2015-04-01 21:57:02 +02:00
|
|
|
!!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<p/> <p/>
|
|
|
|
|
|
|
|
<div style="display:{{ $accountGateway ? 'none' : '' }}">
|
|
|
|
<div class="two-column" style="display:{{ $onlyPayPal ? 'none' : '' }}">
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::radios('recommendedGateway_id')->label('Recommended Gateway')
|
2015-03-16 22:45:25 +01:00
|
|
|
->radios($recommendedGateways)->class('recommended-gateway')
|
2015-04-01 21:57:02 +02:00
|
|
|
!!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '')
|
2015-03-16 22:45:25 +01:00
|
|
|
->dataClass('gateway-dropdown')
|
|
|
|
->fromQuery($gateways, 'name', 'id')
|
2015-04-01 21:57:02 +02:00
|
|
|
->onchange('setFieldsShown()'); !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
@foreach ($gateways as $gateway)
|
|
|
|
|
|
|
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
|
|
|
@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')
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@else
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
|
|
|
|
@endforeach
|
|
|
|
|
|
|
|
@if ($gateway->getHelp())
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="control-label col-lg-4 col-sm-4"></label>
|
|
|
|
<div class="col-lg-8 col-sm-8 help-block">
|
|
|
|
{{ $gateway->getHelp() }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
|
|
|
@if ($gateway->id == GATEWAY_STRIPE)
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::select('token_billing_type_id')->options($tokenBillingOptions)->help(trans('texts.token_billing_help')) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@endforeach
|
|
|
|
|
|
|
|
<p/> <p/>
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! 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() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
function setFieldsShown() {
|
|
|
|
var recommendedVal = $('input:radio[name=recommendedGateway_id]:checked').val();
|
|
|
|
var gatewayVal = $('#gateway_id').val();
|
|
|
|
var val = recommendedVal && recommendedVal != 1000000 ? recommendedVal : gatewayVal;
|
|
|
|
|
|
|
|
$('.gateway-fields').hide();
|
|
|
|
$('#gateway_' + val + '_div').show();
|
|
|
|
|
|
|
|
$('#gateway_id').parent().parent().hide();
|
|
|
|
if(!$('input:radio[name=recommendedGateway_id][value!=1000000]:checked').val())
|
|
|
|
{
|
|
|
|
$('.recommended-gateway[value=1000000]').attr('checked', true);
|
|
|
|
$('#gateway_id').parent().parent().show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function gatewayLink(url) {
|
|
|
|
var host = new URL(url).hostname;
|
|
|
|
if (host) {
|
|
|
|
openUrl(url, '/affiliate/' + host);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.recommended-gateway').change(
|
|
|
|
function(){
|
|
|
|
var recVal = $(this).val();
|
|
|
|
|
|
|
|
if(recVal == 1000000)
|
|
|
|
{
|
|
|
|
$('#gateway_id').parent().parent().show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#gateway_id').parent().parent().hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
setFieldsShown();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
$('.recommended-gateway[other != true]').each(function(){
|
|
|
|
var contents = $(this).parent().contents();
|
|
|
|
contents[contents.length - 1].nodeValue = '';
|
|
|
|
$(this).after('<img src="' +$(this).attr('data-imageUrl') + '" /><br />');
|
|
|
|
$(this).parent().children().last().after('<a href="#" onclick="gatewayLink(\'' + $(this).attr('data-siteUrl') + '\')" style="padding-left:26px">Create an account</a>');
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: THIS IS JUST TO SHOW THE IMAGES, STYLE IS SET INLINE STYLE
|
|
|
|
$('.creditcard-types').each(function(){
|
|
|
|
var contents = $(this).parent().contents();
|
|
|
|
contents[contents.length - 1].nodeValue = '';
|
|
|
|
$(this).after('<img style="width: 60px; display: inline;" src="' +$(this).attr('data-imageUrl') + '" /><br />');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
setFieldsShown();
|
|
|
|
$('.two-column .form-group .col-lg-8').removeClass('col-lg-8');
|
|
|
|
$('.two-column .form-group .col-sm-8').removeClass('col-sm-8');
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|