From 515f6fd131e5c2e2d3ec3f7e14a64a0dbbab4294 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 1 Apr 2015 22:57:02 +0300 Subject: [PATCH] Working on L5 --- app/Http/Controllers/AccountController.php | 10 ++- .../Controllers/AccountGatewayController.php | 5 ++ app/Http/Controllers/ReportController.php | 10 ++- app/Http/Controllers/TokenController.php | 10 +++ app/Http/Controllers/UserController.php | 3 + app/Listeners/HandleUserSettingsChanged.php | 2 + app/Models/Gateway.php | 4 - config/former.php | 2 +- .../views/accounts/account_gateway.blade.php | 37 ++++---- resources/views/accounts/details.blade.php | 90 +++++++++---------- .../views/accounts/email_templates.blade.php | 30 +++---- .../views/accounts/import_export.blade.php | 30 +++---- .../views/accounts/invoice_design.blade.php | 42 ++++----- .../views/accounts/invoice_settings.blade.php | 73 ++++++++------- resources/views/accounts/nav.blade.php | 12 +-- .../views/accounts/nav_advanced.blade.php | 10 +-- .../views/accounts/notifications.blade.php | 28 +++--- resources/views/accounts/payments.blade.php | 18 ++-- resources/views/accounts/products.blade.php | 21 +++-- resources/views/accounts/token.blade.php | 20 ++--- .../views/accounts/token_management.blade.php | 18 ++-- .../views/accounts/user_management.blade.php | 20 ++--- resources/views/clients/edit.blade.php | 2 +- resources/views/invoices/view.blade.php | 2 +- resources/views/list.blade.php | 2 +- resources/views/reports/d3.blade.php | 12 +-- .../views/reports/report_builder.blade.php | 40 ++++----- resources/views/users/edit.blade.php | 24 ++--- 28 files changed, 313 insertions(+), 264 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index c95278c362b1..59d0dc8e01b4 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -7,6 +7,8 @@ use Session; use Utils; use View; use Event; +use Validator; +use stdClass; use App\Models\Account; use App\Models\Country; @@ -17,6 +19,7 @@ use App\Models\Language; use App\Models\Size; use App\Models\Timezone; use App\Models\Industry; +use App\Models\InvoiceDesign; use App\Ninja\Repositories\AccountRepository; use App\Ninja\Mailers\UserMailer; use App\Ninja\Mailers\ContactMailer; @@ -203,8 +206,9 @@ class AccountController extends BaseController $invoice->invoice_items = [$invoiceItem]; $data['invoice'] = $invoice; - $data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()) - ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(); + //$data['invoiceDesigns'] = InvoiceDesign::remember(DEFAULT_QUERY_CACHE, 'invoice_designs_cache_'.Auth::user()->maxInvoiceDesignId()) + // ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(); + $data['invoiceDesigns'] = InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(); } else if ($subSection == ACCOUNT_EMAIL_TEMPLATES) { $data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE); $data['quoteEmail'] = $account->getEmailTemplate(ENTITY_QUOTE); @@ -297,7 +301,7 @@ class AccountController extends BaseController $account->quote_number_prefix = Input::get('quote_number_prefix'); $account->share_counter = Input::get('share_counter') ? true : false; - $account->pdf_email_attachment = Input::get('pdf_email_attachment') ? true : false; + //$account->pdf_email_attachment = Input::get('pdf_email_attachment') ? true : false; if (!$account->share_counter) { $account->quote_number_counter = Input::get('quote_number_counter'); diff --git a/app/Http/Controllers/AccountGatewayController.php b/app/Http/Controllers/AccountGatewayController.php index 2cde2a4c7b57..9dffc318f425 100644 --- a/app/Http/Controllers/AccountGatewayController.php +++ b/app/Http/Controllers/AccountGatewayController.php @@ -7,8 +7,13 @@ use Input; use Redirect; use Session; use View; +use Validator; +use stdClass; use App\Models\Gateway; +use App\Models\Account; +use App\Models\AccountGateway; + use App\Ninja\Repositories\AccountRepository; class AccountGatewayController extends BaseController diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 4352920d04fd..bfbeba8cc6ab 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -2,8 +2,16 @@ use Auth; use Input; +use Utils; +use DB; +use DateInterval; +use DatePeriod; +use Session; +use View; -class ReportController extends \BaseController +use App\Models\Account; + +class ReportController extends BaseController { public function d3() { diff --git a/app/Http/Controllers/TokenController.php b/app/Http/Controllers/TokenController.php index d6a488e3a4b1..15bdf43a8838 100644 --- a/app/Http/Controllers/TokenController.php +++ b/app/Http/Controllers/TokenController.php @@ -9,6 +9,16 @@ | */ +use Auth; +use Session; +use DB; +use Validator; +use Input; +use View; +use Redirect; + +use App\Models\AccountToken; + use App\Ninja\Repositories\AccountRepository; class TokenController extends BaseController diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index e325136c1b90..107a715cc3a6 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -7,6 +7,9 @@ use Input; use View; use Redirect; use Session; +use Utils; + +use App\Models\User; use App\Http\Requests; use App\Http\Controllers\Controller; diff --git a/app/Listeners/HandleUserSettingsChanged.php b/app/Listeners/HandleUserSettingsChanged.php index 8ebd1a9b3355..e01a010c9dd1 100644 --- a/app/Listeners/HandleUserSettingsChanged.php +++ b/app/Listeners/HandleUserSettingsChanged.php @@ -1,5 +1,7 @@ 'validation.attributes', + 'translate_from' => 'texts', // Whether text that comes out of the translated // should be capitalized (ex: email => Email) automatically diff --git a/resources/views/accounts/account_gateway.blade.php b/resources/views/accounts/account_gateway.blade.php index 9aa605664798..81f4f65dca35 100644 --- a/resources/views/accounts/account_gateway.blade.php +++ b/resources/views/accounts/account_gateway.blade.php @@ -3,14 +3,14 @@ @section('content') @parent - {{ Former::open($url)->method($method)->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} - {{ Former::populate($account) }} + {!! Former::open($url)->method($method)->rule()->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!} + {!! Former::populate($account) !!} - {{ Former::legend($title) }} + {!! Former::legend($title) !!} @if ($accountGateway) - {{ Former::populateField('gateway_id', $accountGateway->gateway_id) }} - {{ Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) }} + {!! 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'])) @@ -23,24 +23,24 @@ @endif
- {{ Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards') + {!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards') ->checkboxes($creditCardTypes)->class('creditcard-types') - }} + !!}

 

- {{ Former::radios('recommendedGateway_id')->label('Recommended Gateway') + {!! Former::radios('recommendedGateway_id')->label('Recommended Gateway') ->radios($recommendedGateways)->class('recommended-gateway') - }} + !!}
- {{ Former::select('gateway_id')->label('Select Gateway')->addOption('', '') + {!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '') ->dataClass('gateway-dropdown') ->fromQuery($gateways, 'name', 'id') - ->onchange('setFieldsShown()'); }} + ->onchange('setFieldsShown()'); !!}
@foreach ($gateways as $gateway) @@ -53,9 +53,9 @@ @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))) }} + {!! Former::text($gateway->id.'_'.$field)->label('API '. ucfirst(Utils::toSpaceCase($field))) !!} @else - {{ Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) }} + {!! Former::text($gateway->id.'_'.$field)->label(Utils::toSpaceCase($field)) !!} @endif @endforeach @@ -70,7 +70,7 @@ @endif @if ($gateway->id == GATEWAY_STRIPE) - {{ Former::select('token_billing_type_id')->options($tokenBillingOptions)->help(trans('texts.token_billing_help')) }} + {!! Former::select('token_billing_type_id')->options($tokenBillingOptions)->help(trans('texts.token_billing_help')) !!} @endif @@ -78,11 +78,10 @@

 

- {{ Former::actions( - Button::lg_success_submit('Save')->append_with_icon('floppy-disk'), - $countGateways > 0 ? Button::lg_default_link('company/payments', 'Cancel')->append_with_icon('remove-circle') : false - )}} - {{ Former::close() }} + {!! 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() !!} @endif - {{ Former::close() }} + {!! Former::close() !!} - + + @stop @section('content') @@ -12,8 +12,8 @@ @include('accounts.nav_advanced') @endif - {{ Former::close() }} + {!! Former::close() !!}

diff --git a/resources/views/accounts/invoice_settings.blade.php b/resources/views/accounts/invoice_settings.blade.php index beb4fef9e022..0e5127ff4a8d 100644 --- a/resources/views/accounts/invoice_settings.blade.php +++ b/resources/views/accounts/invoice_settings.blade.php @@ -1,53 +1,66 @@ @extends('accounts.nav') +@section('head') + @parent + + +@stop + @section('content') @parent @include('accounts.nav_advanced') - {{ Former::open()->addClass('col-md-8 col-md-offset-2 warn-on-exit') }} - {{ Former::populate($account) }} - {{ Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) }} - {{ Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) }} - {{ Former::populateField('share_counter', intval($account->share_counter)) }} + {!! Former::open()->addClass('col-md-8 col-md-offset-2 warn-on-exit') !!} + {!! Former::populate($account) !!} + {!! Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) !!} + {!! Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) !!} + {!! Former::populateField('share_counter', intval($account->share_counter)) !!} - {{ Former::legend('invoice_fields') }} - {{ Former::text('custom_invoice_label1')->label(trans('texts.field_label')) - ->append(Former::checkbox('custom_invoice_taxes1')->raw() . ' ' . trans('texts.charge_taxes')) }} - {{ Former::text('custom_invoice_label2')->label(trans('texts.field_label')) - ->append(Former::checkbox('custom_invoice_taxes2')->raw() . ' ' . trans('texts.charge_taxes')) }} + {!! Former::legend('invoice_fields') !!} + {!! Former::text('custom_invoice_label1')->label(trans('texts.field_label')) + ->append(Former::checkbox('custom_invoice_taxes1')->raw() . trans('texts.charge_taxes')) !!} + {!! Former::text('custom_invoice_label2')->label(trans('texts.field_label')) + ->append(Former::checkbox('custom_invoice_taxes2')->raw() . ' ' . trans('texts.charge_taxes')) !!}

 

- {{ Former::legend('client_fields') }} - {{ Former::text('custom_client_label1')->label(trans('texts.field_label')) }} - {{ Former::text('custom_client_label2')->label(trans('texts.field_label')) }} + {!! Former::legend('client_fields') !!} + {!! Former::text('custom_client_label1')->label(trans('texts.field_label')) !!} + {!! Former::text('custom_client_label2')->label(trans('texts.field_label')) !!}

 

- {{ Former::legend('company_fields') }} - {{ Former::text('custom_label1')->label(trans('texts.field_label')) }} - {{ Former::text('custom_value1')->label(trans('texts.field_value')) }} + {!! Former::legend('company_fields') !!} + {!! Former::text('custom_label1')->label(trans('texts.field_label')) !!} + {!! Former::text('custom_value1')->label(trans('texts.field_value')) !!}

 

- {{ Former::text('custom_label2')->label(trans('texts.field_label')) }} - {{ Former::text('custom_value2')->label(trans('texts.field_value')) }} + {!! Former::text('custom_label2')->label(trans('texts.field_label')) !!} + {!! Former::text('custom_value2')->label(trans('texts.field_value')) !!}

 

- {{ Former::legend('invoice_number') }} - {{ Former::text('invoice_number_prefix')->label(trans('texts.invoice_number_prefix')) }} - {{ Former::text('invoice_number_counter')->label(trans('texts.invoice_number_counter')) }} + {!! Former::legend('invoice_number') !!} + {!! Former::text('invoice_number_prefix')->label(trans('texts.invoice_number_prefix')) !!} + {!! Former::text('invoice_number_counter')->label(trans('texts.invoice_number_counter')) !!}

 

- {{ Former::legend('quote_number') }} - {{ Former::text('quote_number_prefix')->label(trans('texts.quote_number_prefix')) }} - {{ Former::text('quote_number_counter')->label(trans('texts.quote_number_counter')) - ->append(Former::checkbox('share_counter')->raw()->onclick('setQuoteNumberEnabled()') . ' ' . trans('texts.share_invoice_counter')) }} + {!! Former::legend('quote_number') !!} + {!! Former::text('quote_number_prefix')->label(trans('texts.quote_number_prefix')) !!} + {!! Former::text('quote_number_counter')->label(trans('texts.quote_number_counter')) + ->append(Former::checkbox('share_counter')->raw()->onclick('setQuoteNumberEnabled()') . ' ' . trans('texts.share_invoice_counter')) !!}

 

- {{ Former::legend('email_settings') }} - {{ Former::checkbox('pdf_email_attachment') }} + {!! Former::legend('email_settings') !!} + {!! Former::checkbox('pdf_email_attachment') !!}

 

@if (Auth::user()->isPro()) - {{ Former::actions( Button::lg_success_submit(trans('texts.save'))->append_with_icon('floppy-disk') ) }} + {!! Former::actions( Button::success(trans('texts.save'))->large()->submit()->appendIcon(Icon::create('floppy-disk'))) !!} @else @endif - {{ Former::close() }} + {!! Former::close() !!} +