2013-11-26 13:45:07 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
|
2014-04-17 16:48:56 +02:00
|
|
|
{{ Former::open()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }}
|
2013-12-04 17:20:14 +01:00
|
|
|
{{ Former::populate($account) }}
|
|
|
|
|
2013-11-28 13:15:34 +01:00
|
|
|
{{ Former::legend('Payment Gateway') }}
|
2014-04-13 07:28:16 +02:00
|
|
|
|
2013-11-28 13:15:34 +01:00
|
|
|
@if ($accountGateway)
|
|
|
|
{{ Former::populateField('gateway_id', $accountGateway->gateway_id) }}
|
2014-04-13 00:49:18 +02:00
|
|
|
{{ Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) }}
|
2013-11-28 13:15:34 +01:00
|
|
|
@foreach ($accountGateway->fields as $field => $junk)
|
2014-03-19 09:49:33 +01:00
|
|
|
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
|
|
|
|
{{-- do nothing --}}
|
2014-01-09 00:22:56 +01:00
|
|
|
@else
|
|
|
|
{{ Former::populateField($accountGateway->gateway_id.'_'.$field, $config->$field) }}
|
|
|
|
@endif
|
2013-11-28 13:15:34 +01:00
|
|
|
@endforeach
|
|
|
|
@endif
|
2014-06-22 21:08:52 +02:00
|
|
|
|
|
|
|
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
|
|
|
|
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
|
|
|
|
<div class="two-column">
|
2014-06-23 04:15:24 +02:00
|
|
|
{{ Former::checkboxes('creditCardType_id')
|
2014-06-22 21:08:52 +02:00
|
|
|
->label('Accepted Credit Cards')
|
2014-06-23 04:15:24 +02:00
|
|
|
->checkboxes($creditCardTypes)
|
2014-06-22 21:08:52 +02:00
|
|
|
->class('creditcard-types')
|
|
|
|
}}
|
|
|
|
</div>
|
2014-04-13 00:49:18 +02:00
|
|
|
|
|
|
|
<div class="two-column">
|
2014-04-13 15:34:58 +02:00
|
|
|
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')
|
|
|
|
->radios($recommendedGateways)->class('recommended-gateway')
|
|
|
|
}}
|
2014-04-13 00:49:18 +02:00
|
|
|
</div>
|
2013-11-26 13:45:07 +01:00
|
|
|
|
2014-03-26 01:59:33 +01:00
|
|
|
{{ Former::select('gateway_id')->label('PayPal & Other Gateways')->addOption('', '')
|
|
|
|
->dataClass('gateway-dropdown')
|
2014-04-13 00:49:18 +02:00
|
|
|
->fromQuery($dropdownGateways, 'name', 'id')
|
2014-03-26 01:59:33 +01:00
|
|
|
->onchange('setFieldsShown()'); }}
|
2013-11-28 13:15:34 +01:00
|
|
|
|
|
|
|
@foreach ($gateways as $gateway)
|
2013-11-26 13:45:07 +01:00
|
|
|
|
2014-03-26 01:59:33 +01:00
|
|
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
2013-11-26 13:45:07 +01:00
|
|
|
@foreach ($gateway->fields as $field => $details)
|
2013-11-28 13:15:34 +01:00
|
|
|
|
2014-03-18 22:25:54 +01:00
|
|
|
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
|
2013-11-28 13:15:34 +01:00
|
|
|
{{-- do nothing --}}
|
|
|
|
@elseif ($field == 'testMode' || $field == 'developerMode')
|
2014-02-02 21:37:37 +01:00
|
|
|
{{-- Former::checkbox($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field))->text('Enable') --}}
|
2014-03-17 19:05:01 +01:00
|
|
|
@elseif ($field == 'username' || $field == 'password')
|
|
|
|
{{ Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) }}
|
2013-11-28 13:15:34 +01:00
|
|
|
@else
|
2013-12-07 21:33:07 +01:00
|
|
|
{{ Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) }}
|
2013-11-26 13:45:07 +01:00
|
|
|
@endif
|
2013-11-28 13:15:34 +01:00
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
@endforeach
|
|
|
|
</div>
|
2013-11-28 13:15:34 +01:00
|
|
|
|
2013-11-26 13:45:07 +01:00
|
|
|
@endforeach
|
|
|
|
|
2014-02-27 12:42:23 +01:00
|
|
|
{{ Former::actions( Button::lg_success_submit('Save')->append_with_icon('floppy-disk') ) }}
|
2013-11-26 13:45:07 +01:00
|
|
|
{{ Former::close() }}
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2013-11-28 13:15:34 +01:00
|
|
|
function setFieldsShown() {
|
2014-04-13 00:49:18 +02:00
|
|
|
var recommendedVal = $('input:radio[name=recommendedGateway_id]:checked').val();
|
|
|
|
var gatewayVal = $('#gateway_id').val();
|
|
|
|
var val = recommendedVal && recommendedVal != 1000000 ? recommendedVal : gatewayVal;
|
2014-03-30 00:42:37 +01:00
|
|
|
|
2014-03-26 01:59:33 +01:00
|
|
|
$('.gateway-fields').hide();
|
|
|
|
$('#gateway_' + val + '_div').show();
|
2014-03-30 00:42:37 +01:00
|
|
|
|
2014-04-13 00:49:18 +02:00
|
|
|
$('#gateway_id').parent().parent().hide();
|
|
|
|
if(!$('input:radio[name=recommendedGateway_id][value!=1000000]:checked').val())
|
2014-03-30 00:42:37 +01:00
|
|
|
{
|
2014-04-13 00:49:18 +02:00
|
|
|
$('.recommended-gateway[value=1000000]').attr('checked', true);
|
|
|
|
$('#gateway_id').parent().parent().show();
|
2014-03-30 00:42:37 +01:00
|
|
|
}
|
2013-11-28 13:15:34 +01:00
|
|
|
}
|
2013-11-26 13:45:07 +01:00
|
|
|
|
2014-05-11 20:24:30 +02:00
|
|
|
function gatewayLink(url) {
|
2014-05-25 20:38:40 +02:00
|
|
|
var host = new URL(url).hostname;
|
|
|
|
if (host) {
|
|
|
|
openUrl(url, '/affiliate/' + host);
|
|
|
|
}
|
2014-05-11 20:24:30 +02:00
|
|
|
}
|
|
|
|
|
2014-03-26 01:59:33 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('.recommended-gateway').change(
|
|
|
|
function(){
|
|
|
|
var recVal = $(this).val();
|
2014-04-13 00:49:18 +02:00
|
|
|
|
|
|
|
if(recVal == 1000000)
|
|
|
|
{
|
|
|
|
$('#gateway_id').parent().parent().show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#gateway_id').parent().parent().hide();
|
|
|
|
}
|
|
|
|
|
2014-03-26 01:59:33 +01:00
|
|
|
setFieldsShown();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2014-04-13 00:49:18 +02:00
|
|
|
$('.recommended-gateway[other != true]').each(function(){
|
2014-03-26 01:59:33 +01:00
|
|
|
var contents = $(this).parent().contents();
|
|
|
|
contents[contents.length - 1].nodeValue = '';
|
|
|
|
$(this).after('<img src="' +$(this).attr('data-imageUrl') + '" /><br />');
|
2014-05-11 20:24:30 +02:00
|
|
|
$(this).parent().children().last().after('<a href="#" onclick="gatewayLink(\'' + $(this).attr('data-siteUrl') + '\')">Create an account</a>');
|
2014-03-26 01:59:33 +01:00
|
|
|
});
|
2014-06-22 21:08:52 +02:00
|
|
|
|
|
|
|
// 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 />');
|
|
|
|
});
|
2014-03-26 01:59:33 +01:00
|
|
|
|
|
|
|
|
2013-11-28 13:15:34 +01:00
|
|
|
setFieldsShown();
|
2014-03-30 01:21:37 +01:00
|
|
|
$('.two-column .form-group .col-lg-8').removeClass('col-lg-8');
|
|
|
|
$('.two-column .form-group .col-sm-8').removeClass('col-sm-8');
|
2013-11-26 13:45:07 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|