Minor fixes

This commit is contained in:
Hillel Coren 2016-03-03 21:39:15 +02:00
parent 9c5944e2c4
commit eb6cd45913
5 changed files with 45 additions and 28 deletions

View File

@ -78,9 +78,9 @@ class ClientController extends BaseController
public function store(CreateClientRequest $request) public function store(CreateClientRequest $request)
{ {
$client = $this->clientService->save($request->input()); $client = $this->clientService->save($request->input());
Session::flash('message', trans('texts.created_client')); Session::flash('message', trans('texts.created_client'));
return redirect()->to($client->getRoute()); return redirect()->to($client->getRoute());
} }
@ -109,7 +109,7 @@ class ClientController extends BaseController
['label' => trans('texts.enter_credit'), 'url' => '/credits/create/'.$client->public_id], ['label' => trans('texts.enter_credit'), 'url' => '/credits/create/'.$client->public_id],
['label' => trans('texts.enter_expense'), 'url' => '/expenses/create/0/'.$client->public_id] ['label' => trans('texts.enter_expense'), 'url' => '/expenses/create/0/'.$client->public_id]
); );
$data = array( $data = array(
'actionLinks' => $actionLinks, 'actionLinks' => $actionLinks,
'showBreadcrumbs' => false, 'showBreadcrumbs' => false,
@ -132,7 +132,7 @@ class ClientController extends BaseController
*/ */
public function create() public function create()
{ {
if (Client::scope()->count() > Auth::user()->getMaxNumClients()) { if (Client::scope()->withTrashed()->count() > Auth::user()->getMaxNumClients()) {
return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients()." clients"]); return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients()." clients"]);
} }
@ -200,9 +200,9 @@ class ClientController extends BaseController
public function update(UpdateClientRequest $request) public function update(UpdateClientRequest $request)
{ {
$client = $this->clientService->save($request->input()); $client = $this->clientService->save($request->input());
Session::flash('message', trans('texts.updated_client')); Session::flash('message', trans('texts.updated_client'));
return redirect()->to($client->getRoute()); return redirect()->to($client->getRoute());
} }

View File

@ -678,8 +678,9 @@ if (Utils::isNinjaDev()) {
*/ */
/* /*
if (Utils::isNinjaDev() && Auth::check() && Auth::user()->id === 1) if (Utils::isNinjaDev())
{ {
Auth::loginUsingId(1); //ini_set('memory_limit','1024M');
//Auth::loginUsingId(1);
} }
*/ */

View File

@ -75,7 +75,7 @@ class SubscriptionListener
{ {
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor); //$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
} }
public function createdExpense(ExpenseWasCreated $event) public function createdExpense(ExpenseWasCreated $event)
{ {
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense); //$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
@ -89,10 +89,15 @@ class SubscriptionListener
$manager = new Manager(); $manager = new Manager();
$manager->setSerializer(new ArraySerializer()); $manager->setSerializer(new ArraySerializer());
$manager->parseIncludes($include); $manager->parseIncludes($include);
$resource = new Item($entity, $transformer, $entity->getEntityType()); $resource = new Item($entity, $transformer, $entity->getEntityType());
$data = $manager->createData($resource)->toArray(); $data = $manager->createData($resource)->toArray();
// For legacy Zapier support
if (isset($data['client_id'])) {
$data['client_name'] = $entity->client->getDisplayName();
}
Utils::notifyZapier($subscription, $data); Utils::notifyZapier($subscription, $data);
} }
} }

View File

@ -51,7 +51,8 @@ class CurrenciesSeeder extends Seeder
['name' => 'Aruban Florin', 'code' => 'AWG', 'symbol' => 'Afl. ', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], ['name' => 'Aruban Florin', 'code' => 'AWG', 'symbol' => 'Afl. ', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'],
['name' => 'Turkish Lira', 'code' => 'TRY', 'symbol' => 'TL ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Turkish Lira', 'code' => 'TRY', 'symbol' => 'TL ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],
['name' => 'Romanian New Leu', 'code' => 'RON', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Romanian New Leu', 'code' => 'RON', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['name' => 'Croatian', 'code' => 'HKR', 'symbol' => 'kn', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Croatian Kuna', 'code' => 'HKR', 'symbol' => 'kn', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],
['name' => 'Saudi Riyal', 'code' => 'SAR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
]; ];
foreach ($currencies as $currency) { foreach ($currencies as $currency) {

View File

@ -14,7 +14,21 @@
// Disable the submit button to prevent repeated clicks // Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true); $form.find('button').prop('disabled', true);
Stripe.card.createToken($form, stripeResponseHandler); var data = {
name: $('#first_name').val() + ' ' + $('#last_name').val(),
address_line1: $('#address1').val(),
address_line2: $('#address2').val(),
address_city: $('#city').val(),
address_state: $('#state').val(),
address_zip: $('#postal_code').val(),
address_country: $("#country_id option:selected").text(),
number: $('#card_number').val(),
cvc: $('#cvv').val(),
exp_month: $('#expiration_month').val(),
exp_year: $('#expiration_year').val()
};
Stripe.card.createToken(data, stripeResponseHandler);
// Prevent the form from submitting with the default action // Prevent the form from submitting with the default action
return false; return false;
@ -53,7 +67,7 @@
}); });
</script> </script>
@endif @endif
@stop @stop
@section('content') @section('content')
@ -65,7 +79,7 @@
->addClass('payment-form') ->addClass('payment-form')
->rules(array( ->rules(array(
'first_name' => 'required', 'first_name' => 'required',
'last_name' => 'required', 'last_name' => 'required',
'card_number' => 'required', 'card_number' => 'required',
'expiration_month' => 'required', 'expiration_month' => 'required',
'expiration_year' => 'required', 'expiration_year' => 'required',
@ -84,7 +98,7 @@
{{ Former::populateField('first_name', $contact->first_name) }} {{ Former::populateField('first_name', $contact->first_name) }}
{{ Former::populateField('last_name', $contact->last_name) }} {{ Former::populateField('last_name', $contact->last_name) }}
@if (!$client->country_id && $client->account->country_id) @if (!$client->country_id && $client->account->country_id)
{{ Former::populateField('country_id', $client->account->country_id) }} {{ Former::populateField('country_id', $client->account->country_id) }}
@endif @endif
@endif @endif
@ -103,15 +117,15 @@
<h2>{{ $client->getDisplayName() }}</h2> <h2>{{ $client->getDisplayName() }}</h2>
<h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, true) }}</em></span></h3> <h3>{{ trans('texts.invoice') . ' ' . $invoiceNumber }}<span>|&nbsp; {{ trans('texts.amount_due') }}: <em>{{ $account->formatMoney($amount, $client, true) }}</em></span></h3>
@elseif ($paymentTitle) @elseif ($paymentTitle)
<h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2> <h2>{{ $paymentTitle }}<br/><small>{{ $paymentSubtitle }}</small></h2>
@endif @endif
</header> </header>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@if (Request::secure() || Utils::isNinjaDev()) @if (Request::secure() || Utils::isNinjaDev())
<div class="secure"> <div class="secure">
<h3>{{ trans('texts.secure_payment') }}</h3> <h3>{{ trans('texts.secure_payment') }}</h3>
<div>{{ trans('texts.256_encryption') }}</div> <div>{{ trans('texts.256_encryption') }}</div>
</div> </div>
@endif @endif
</div> </div>
@ -204,7 +218,6 @@
->id('card_number') ->id('card_number')
->placeholder(trans('texts.card_number')) ->placeholder(trans('texts.card_number'))
->autocomplete('cc-number') ->autocomplete('cc-number')
->data_stripe('number')
->label('') !!} ->label('') !!}
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
@ -212,7 +225,6 @@
->id('cvv') ->id('cvv')
->placeholder(trans('texts.cvv')) ->placeholder(trans('texts.cvv'))
->autocomplete('off') ->autocomplete('off')
->data_stripe('cvc')
->label('') !!} ->label('') !!}
</div> </div>
</div> </div>
@ -221,7 +233,6 @@
{!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_month') {!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_month')
->id('expiration_month') ->id('expiration_month')
->autocomplete('cc-exp-month') ->autocomplete('cc-exp-month')
->data_stripe('exp-month')
->placeholder(trans('texts.expiration_month')) ->placeholder(trans('texts.expiration_month'))
->addOption('01 - January', '1') ->addOption('01 - January', '1')
->addOption('02 - February', '2') ->addOption('02 - February', '2')
@ -241,7 +252,6 @@
{!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_year') {!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_year')
->id('expiration_year') ->id('expiration_year')
->autocomplete('cc-exp-year') ->autocomplete('cc-exp-year')
->data_stripe('exp-year')
->placeholder(trans('texts.expiration_year')) ->placeholder(trans('texts.expiration_year'))
->addOption('2016', '2016') ->addOption('2016', '2016')
->addOption('2017', '2017') ->addOption('2017', '2017')
@ -266,7 +276,7 @@
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label> <label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
<span class="help-block" style="font-size:15px">{!! trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}</span> <span class="help-block" style="font-size:15px">{!! trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}</span>
@endif @endif
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
@if (isset($acceptedCreditCardTypes)) @if (isset($acceptedCreditCardTypes))
@ -278,7 +288,7 @@
@endif @endif
</div> </div>
</div> </div>
<p>&nbsp;<br/>&nbsp;</p> <p>&nbsp;<br/>&nbsp;</p>
@ -291,8 +301,8 @@
</div> </div>
</div> </div>
</div> </div>
<p>&nbsp;</p> <p>&nbsp;</p>
<p>&nbsp;</p> <p>&nbsp;</p>
@ -302,7 +312,7 @@
{!! Former::close() !!} {!! Former::close() !!}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('select').change(function() { $('select').change(function() {
$(this).css({color:'#444444'}); $(this).css({color:'#444444'});