mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on L5
This commit is contained in:
parent
8fc578ef39
commit
424eb15870
@ -101,23 +101,6 @@ class AccountGatewayController extends BaseController
|
|||||||
$selectedCards = $accountGateway ? $accountGateway->accepted_credit_cards : 0;
|
$selectedCards = $accountGateway ? $accountGateway->accepted_credit_cards : 0;
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
// $recommendedGateways = Gateway::remember(DEFAULT_QUERY_CACHE)
|
|
||||||
// ->where('recommended', '=', '1')
|
|
||||||
$recommendedGateways = Gateway::where('recommended', '=', '1')
|
|
||||||
->orderBy('sort_order')
|
|
||||||
->get();
|
|
||||||
$recommendedGatewayArray = array();
|
|
||||||
|
|
||||||
foreach ($recommendedGateways as $recommendedGateway) {
|
|
||||||
$arrayItem = array(
|
|
||||||
'value' => $recommendedGateway->id,
|
|
||||||
'other' => 'false',
|
|
||||||
'data-imageUrl' => asset($recommendedGateway->getLogoUrl()),
|
|
||||||
'data-siteUrl' => $recommendedGateway->site_url,
|
|
||||||
);
|
|
||||||
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
$creditCardsArray = unserialize(CREDIT_CARDS);
|
$creditCardsArray = unserialize(CREDIT_CARDS);
|
||||||
$creditCards = [];
|
$creditCards = [];
|
||||||
foreach ($creditCardsArray as $card => $name) {
|
foreach ($creditCardsArray as $card => $name) {
|
||||||
@ -128,14 +111,6 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$otherItem = array(
|
|
||||||
'value' => 1000000,
|
|
||||||
'other' => 'true',
|
|
||||||
'data-imageUrl' => '',
|
|
||||||
'data-siteUrl' => '',
|
|
||||||
);
|
|
||||||
$recommendedGatewayArray['Other Options'] = $otherItem;
|
|
||||||
|
|
||||||
$account->load('account_gateways');
|
$account->load('account_gateways');
|
||||||
$currentGateways = $account->account_gateways;
|
$currentGateways = $account->account_gateways;
|
||||||
$gateways = Gateway::where('payment_library_id', '=', 1)->orderBy('name');
|
$gateways = Gateway::where('payment_library_id', '=', 1)->orderBy('name');
|
||||||
@ -172,7 +147,6 @@ class AccountGatewayController extends BaseController
|
|||||||
'accountGateway' => $accountGateway,
|
'accountGateway' => $accountGateway,
|
||||||
'config' => false,
|
'config' => false,
|
||||||
'gateways' => $gateways,
|
'gateways' => $gateways,
|
||||||
'recommendedGateways' => $recommendedGatewayArray,
|
|
||||||
'creditCardTypes' => $creditCards,
|
'creditCardTypes' => $creditCards,
|
||||||
'tokenBillingOptions' => $tokenBillingOptions,
|
'tokenBillingOptions' => $tokenBillingOptions,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
@ -200,9 +174,7 @@ class AccountGatewayController extends BaseController
|
|||||||
public function save($accountGatewayPublicId = false)
|
public function save($accountGatewayPublicId = false)
|
||||||
{
|
{
|
||||||
$rules = array();
|
$rules = array();
|
||||||
$recommendedId = Input::get('recommendedGateway_id');
|
$gatewayId = Input::get('gateway_id');
|
||||||
|
|
||||||
$gatewayId = ($recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId);
|
|
||||||
|
|
||||||
if (!$gatewayId) {
|
if (!$gatewayId) {
|
||||||
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
|
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
|
||||||
|
@ -6,6 +6,12 @@ use DB;
|
|||||||
use Datatable;
|
use Datatable;
|
||||||
use Utils;
|
use Utils;
|
||||||
use URL;
|
use URL;
|
||||||
|
use View;
|
||||||
|
use Input;
|
||||||
|
use Session;
|
||||||
|
use Redirect;
|
||||||
|
|
||||||
|
use App\Models\Product;
|
||||||
|
|
||||||
class ProductController extends BaseController
|
class ProductController extends BaseController
|
||||||
{
|
{
|
||||||
|
@ -174,6 +174,7 @@ class ConstantsSeeder extends Seeder
|
|||||||
DateFormat::create(array('format' => 'Y-M-d', 'picker_format' => 'yyyy-M-dd', 'label' => '2013-03-10'));
|
DateFormat::create(array('format' => 'Y-M-d', 'picker_format' => 'yyyy-M-dd', 'label' => '2013-03-10'));
|
||||||
|
|
||||||
PaymentLibrary::create(['name' => 'Omnipay']);
|
PaymentLibrary::create(['name' => 'Omnipay']);
|
||||||
|
PaymentLibrary::create(['name' => 'PHP-Payments [Deprecated]']);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
||||||
|
@ -22,26 +22,11 @@
|
|||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="two-column">
|
|
||||||
{!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
|
|
||||||
->checkboxes($creditCardTypes)->class('creditcard-types')
|
|
||||||
!!}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p/> <p/>
|
|
||||||
|
|
||||||
<div style="display:{{ $accountGateway ? 'none' : '' }}">
|
|
||||||
<div class="two-column" style="display:{{ $onlyPayPal ? 'none' : '' }}">
|
|
||||||
{!! Former::radios('recommendedGateway_id')->label('Recommended Gateway')
|
|
||||||
->radios($recommendedGateways)->class('recommended-gateway')
|
|
||||||
!!}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '')
|
{!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '')
|
||||||
->dataClass('gateway-dropdown')
|
->dataClass('gateway-dropdown')
|
||||||
->fromQuery($gateways, 'name', 'id')
|
->fromQuery($gateways, 'name', 'id')
|
||||||
->onchange('setFieldsShown()'); !!}
|
->onchange('setFieldsShown()'); !!}
|
||||||
</div>
|
|
||||||
|
|
||||||
@foreach ($gateways as $gateway)
|
@foreach ($gateways as $gateway)
|
||||||
|
|
||||||
@ -64,7 +49,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-lg-4 col-sm-4"></label>
|
<label class="control-label col-lg-4 col-sm-4"></label>
|
||||||
<div class="col-lg-8 col-sm-8 help-block">
|
<div class="col-lg-8 col-sm-8 help-block">
|
||||||
{{ $gateway->getHelp() }}
|
{!! $gateway->getHelp() !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@ -76,30 +61,25 @@
|
|||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
|
{!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
|
||||||
|
->checkboxes($creditCardTypes)->class('creditcard-types')
|
||||||
|
!!}
|
||||||
|
|
||||||
|
|
||||||
<p/> <p/>
|
<p/> <p/>
|
||||||
|
|
||||||
{!! Former::actions(
|
{!! Former::actions(
|
||||||
Button::success('Save')->submit()->large()->appendIcon(Icon::create('floppy-disk')),
|
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')),
|
||||||
$countGateways > 0 ? Button::lg_default_link('company/payments', 'Cancel')->append_with_icon('remove-circle') : false) !!}
|
$countGateways > 0 ? Button::normal(trans('texts.cancel'))->large()->asLinkTo('/company/payments')->appendIcon(Icon::create('remove-circle')) : false) !!}
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function setFieldsShown() {
|
function setFieldsShown() {
|
||||||
var recommendedVal = $('input:radio[name=recommendedGateway_id]:checked').val();
|
var val = $('#gateway_id').val();
|
||||||
var gatewayVal = $('#gateway_id').val();
|
|
||||||
var val = recommendedVal && recommendedVal != 1000000 ? recommendedVal : gatewayVal;
|
|
||||||
|
|
||||||
$('.gateway-fields').hide();
|
$('.gateway-fields').hide();
|
||||||
$('#gateway_' + val + '_div').show();
|
$('#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) {
|
function gatewayLink(url) {
|
||||||
@ -109,44 +89,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(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>
|
</script>
|
||||||
|
|
||||||
@stop
|
@stop
|
@ -62,9 +62,11 @@
|
|||||||
{!! Former::legend('users') !!}
|
{!! Former::legend('users') !!}
|
||||||
{!! Former::text('first_name') !!}
|
{!! Former::text('first_name') !!}
|
||||||
{!! Former::text('last_name') !!}
|
{!! Former::text('last_name') !!}
|
||||||
{!! Former::text('email') !!}
|
{!! Former::text('email') !!}
|
||||||
{!! Former::text('phone') !!}
|
{!! Former::text('phone') !!}
|
||||||
{!! Former::actions(Button::primary(trans('texts.change_password'), ['onclick'=>'showChangePassword()']))->small() !!}
|
@if (Auth::user()->confirmed)
|
||||||
|
{!! Former::actions( Button::primary(trans('texts.change_password'))->small()->withAttributes(['onclick'=>'showChangePassword()'])) !!}
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{!! Former::legend('localization') !!}
|
{!! Former::legend('localization') !!}
|
||||||
|
@ -3,28 +3,28 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
@parent
|
@parent
|
||||||
|
|
||||||
{{ Former::open($url)->method($method)
|
{!! Former::open($url)->method($method)
|
||||||
->rules(['product_key' => 'required|max:20'])
|
->rules(['product_key' => 'required|max:20'])
|
||||||
->addClass('col-md-8 col-md-offset-2 warn-on-exit') }}
|
->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!}
|
||||||
|
|
||||||
|
|
||||||
{{ Former::legend($title) }}
|
{!! Former::legend($title) !!}
|
||||||
|
|
||||||
@if ($product)
|
@if ($product)
|
||||||
{{ Former::populate($product) }}
|
{{ Former::populate($product) }}
|
||||||
{{ Former::populateField('cost', number_format($product->cost, 2, '.', '')) }}
|
{{ Former::populateField('cost', number_format($product->cost, 2, '.', '')) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{ Former::text('product_key')->label('texts.product') }}
|
{!! Former::text('product_key')->label('texts.product') !!}
|
||||||
{{ Former::textarea('notes')->data_bind("value: wrapped_notes, valueUpdate: 'afterkeydown'") }}
|
{!! Former::textarea('notes')->data_bind("value: wrapped_notes, valueUpdate: 'afterkeydown'") !!}
|
||||||
{{ Former::text('cost') }}
|
{!! Former::text('cost') !!}
|
||||||
|
|
||||||
{{ Former::actions(
|
{!! Former::actions(
|
||||||
Button::lg_success_submit(trans('texts.save'))->append_with_icon('floppy-disk'),
|
Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')),
|
||||||
Button::lg_default_link('company/products', trans('texts.cancel'))->append_with_icon('remove-circle')
|
Button::normal(trans('texts.cancel'))->large()->asLinkTo('/company/products')->appendIcon(Icon::create('remove-circle'))
|
||||||
) }}
|
) !!}
|
||||||
|
|
||||||
{{ Former::close() }}
|
{!! Former::close() !!}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user