bug fixes

This commit is contained in:
Hillel Coren 2014-02-18 17:07:22 +02:00
parent 6c33946344
commit 284a90dd25
18 changed files with 136 additions and 103 deletions

View File

@ -74,11 +74,15 @@ class AccountController extends \BaseController {
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'sizes' => Size::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(),
'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(),
'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(),
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
];
return View::make('accounts.details', $data);
}
else if ($section == ACCOUNT_SETTINGS)
else if ($section == ACCOUNT_PAYMENTS)
{
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$accountGateway = null;
@ -95,10 +99,6 @@ class AccountController extends \BaseController {
'accountGateway' => $accountGateway,
'config' => json_decode($config),
'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)->get(),
'timezones' => Timezone::remember(DEFAULT_QUERY_CACHE)->orderBy('location')->get(),
'dateFormats' => DateFormat::remember(DEFAULT_QUERY_CACHE)->get(),
'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(),
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
];
foreach ($data['gateways'] as $gateway)
@ -111,15 +111,19 @@ class AccountController extends \BaseController {
}
}
return View::make('accounts.settings', $data);
return View::make('accounts.payments', $data);
}
else if ($section == ACCOUNT_IMPORT)
else if ($section == ACCOUNT_NOTIFICATIONS)
{
return View::make('accounts.import');
$data = [
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
];
return View::make('accounts.notifications', $data);
}
else if ($section == ACCOUNT_EXPORT)
else if ($section == ACCOUNT_IMPORT_EXPORT)
{
return View::make('accounts.export');
return View::make('accounts.import_export');
}
}
@ -129,11 +133,11 @@ class AccountController extends \BaseController {
{
return AccountController::saveDetails();
}
else if ($section == ACCOUNT_SETTINGS)
else if ($section == ACCOUNT_PAYMENTS)
{
return AccountController::saveSettings();
return AccountController::savePayments();
}
else if ($section == ACCOUNT_IMPORT)
else if ($section == ACCOUNT_IMPORT_EXPORT)
{
return AccountController::importFile();
}
@ -141,6 +145,10 @@ class AccountController extends \BaseController {
{
return AccountController::mapFile();
}
else if ($section == ACCOUNT_NOTIFICATIONS)
{
return AccountController::saveNotifications();
}
else if ($section == ACCOUNT_EXPORT)
{
return AccountController::export();
@ -306,7 +314,7 @@ class AccountController extends \BaseController {
if (count($csv->data) + Client::scope()->count() > MAX_NUM_CLIENTS)
{
Session::flash('error', "Sorry, this wll exceed the limit of " . MAX_NUM_CLIENTS . " clients");
return Redirect::to('account/import');
return Redirect::to('company/import_export');
}
Session::put('data', $csv->data);
@ -396,7 +404,24 @@ class AccountController extends \BaseController {
return View::make('accounts.import_map', $data);
}
private function saveSettings()
private function saveNotifications()
{
$account = Account::findOrFail(Auth::user()->account_id);
$account->invoice_terms = Input::get('invoice_terms');
$account->email_footer = Input::get('email_footer');
$account->save();
$user = Auth::user();
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
$user->notify_paid = Input::get('notify_paid');
$user->save();
Session::flash('message', 'Successfully updated settings');
return Redirect::to('company/notifications');
}
private function savePayments()
{
$rules = array();
@ -418,7 +443,7 @@ class AccountController extends \BaseController {
if ($validator->fails())
{
return Redirect::to('account/settings')
return Redirect::to('company/settings')
->withErrors($validator)
->withInput();
}
@ -427,24 +452,6 @@ class AccountController extends \BaseController {
$account = Account::findOrFail(Auth::user()->account_id);
$account->account_gateways()->forceDelete();
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
$account->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1;
$account->invoice_terms = Input::get('invoice_terms');
$account->email_footer = Input::get('email_footer');
$account->save();
$user = Auth::user();
$user->notify_sent = Input::get('notify_sent');
$user->notify_viewed = Input::get('notify_viewed');
$user->notify_paid = Input::get('notify_paid');
$user->save();
Event::fire('user.refresh');
if ($gatewayId)
{
$accountGateway = AccountGateway::createNew();
@ -455,15 +462,13 @@ class AccountController extends \BaseController {
{
$config->$field = trim(Input::get($gateway->id.'_'.$field));
}
//dd(Input::all());
//dd($config);
$accountGateway->config = json_encode($config);
$account->account_gateways()->save($accountGateway);
}
Session::flash('message', 'Successfully updated settings');
return Redirect::to('account/settings');
return Redirect::to('company/payments');
}
}
@ -478,7 +483,7 @@ class AccountController extends \BaseController {
if ($validator->fails())
{
return Redirect::to('account/details')
return Redirect::to('company/details')
->withErrors($validator)
->withInput();
}
@ -494,6 +499,10 @@ class AccountController extends \BaseController {
$account->country_id = Input::get('country_id') ? Input::get('country_id') : null;
$account->size_id = Input::get('size_id') ? Input::get('size_id') : null;
$account->industry_id = Input::get('industry_id') ? Input::get('industry_id') : null;
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
$account->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1;
$account->save();
$user = Auth::user();
@ -512,8 +521,10 @@ class AccountController extends \BaseController {
Image::make($path)->resize(120, 80, true, false)->save('logo/' . $account->account_key . '.jpg');
}
Event::fire('user.refresh');
Session::flash('message', 'Successfully updated details');
return Redirect::to('account/details');
return Redirect::to('company/details');
}
}

View File

@ -86,8 +86,8 @@ Route::group(array('before' => 'auth'), function()
{
Route::get('dashboard', 'DashboardController@index');
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
Route::get('account/{section?}', 'AccountController@showSection');
Route::post('account/{section?}', 'AccountController@doSection');
Route::get('company/{section?}', 'AccountController@showSection');
Route::post('company/{section?}', 'AccountController@doSection');
Route::post('user/setTheme', 'UserController@setTheme');
Route::resource('clients', 'ClientController');
@ -164,7 +164,7 @@ HTML::macro('breadcrumbs', function() {
for ($i=0; $i<count($crumbs); $i++) {
$crumb = trim($crumbs[$i]);
if (!$crumb) continue;
if ($crumb == 'account') return '';
if ($crumb == 'company') return '';
$name = ucwords($crumb);
if ($i==count($crumbs)-1)
{
@ -195,8 +195,9 @@ define('PERSON_CONTACT', 'contact');
define('PERSON_USER', 'user');
define('ACCOUNT_DETAILS', 'details');
define('ACCOUNT_SETTINGS', 'settings');
define('ACCOUNT_IMPORT', 'import');
define('ACCOUNT_NOTIFICATIONS', 'notifications');
define('ACCOUNT_IMPORT_EXPORT', 'import_export');
define('ACCOUNT_PAYMENTS', 'payments');
define('ACCOUNT_MAP', 'import_map');
define('ACCOUNT_EXPORT', 'export');

View File

@ -23,11 +23,15 @@
{{ Former::populateField('phone', $account->users()->first()->phone) }}
<div class="row">
<div class="col-md-6">
<div class="col-md-5">
{{ Former::legend('Account') }}
{{ Former::text('name') }}
{{ Former::file('logo')->max(2, 'MB')->accept('image')->wrap('test')->inlineHelp('Recommnded size: 120px width, 80px height') }}
{{ Former::select('size_id')->addOption('','')->label('Size')
->fromQuery($sizes, 'name', 'id') }}
{{ Former::select('industry_id')->addOption('','')->label('Industry')
->fromQuery($industries, 'name', 'id') }}
@if (file_exists($account->getLogoPath()))
<center>
@ -46,7 +50,7 @@
</div>
<div class="col-md-6">
<div class="col-md-5 col-md-offset-1">
{{ Former::legend('Users') }}
{{ Former::text('first_name') }}
@ -54,11 +58,17 @@
{{ Former::text('email') }}
{{ Former::text('phone') }}
{{ Former::legend('Additional Info') }}
{{ Former::select('size_id')->addOption('','')->label('Size')
->fromQuery($sizes, 'name', 'id') }}
{{ Former::select('industry_id')->addOption('','')->label('Industry')
->fromQuery($industries, 'name', 'id') }}
{{ Former::legend('Localization') }}
{{ Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('timezone_id')->addOption('','')->label('Timezone')
->fromQuery($timezones, 'location', 'id') }}
{{ Former::select('date_format_id')->addOption('','')->label('Date Format')
->fromQuery($dateFormats, 'label', 'id') }}
{{ Former::select('datetime_format_id')->addOption('','')->label('Date/Time Format')
->fromQuery($datetimeFormats, 'label', 'id') }}
</div>
</div>

View File

@ -1,12 +0,0 @@
@extends('accounts.nav')
@section('content')
@parent
{{ Former::open_for_files('account/import_map')->addClass('col-md-9 col-md-offset-1') }}
{{ Former::legend('Import Client Data') }}
{{ Former::file('file')->label('Select CSV file') }}
{{ Former::actions( Button::lg_primary_submit('Upload') ) }}
{{ Former::close() }}
@stop

View File

@ -0,0 +1,17 @@
@extends('accounts.nav')
@section('content')
@parent
{{ Former::open_for_files('company/import_map')->addClass('col-md-9 col-md-offset-1') }}
{{ Former::legend('Import Client Data') }}
{{ Former::file('file')->label('Select CSV file') }}
{{ Former::actions( Button::lg_primary_submit('Upload') ) }}
{{ Former::close() }}
{{ Former::open('company/export')->addClass('col-md-9 col-md-offset-1') }}
{{ Former::legend('Export Client Data') }}
{{ Former::actions( Button::lg_primary_submit('Download') ) }}
{{ Former::close() }}
@stop

View File

@ -3,7 +3,7 @@
@section('content')
@parent
{{ Former::open('account/import') }}
{{ Former::open('company/import_export') }}
{{ Former::legend('Import Clients') }}
@if ($headers)
@ -33,7 +33,7 @@
@endif
{{ Former::actions( Button::lg_primary_submit('Import'), '&nbsp;|&nbsp;', link_to('account/import', 'Cancel') ) }}
{{ Former::actions( Button::lg_primary_submit('Import'), '&nbsp;|&nbsp;', link_to('company/import', 'Cancel') ) }}
{{ Former::close() }}
<script type="text/javascript">

View File

@ -3,10 +3,10 @@
@section('content')
<ul class="nav nav-tabs nav nav-justified">
{{ HTML::nav_link('account/details', 'Details') }}
{{ HTML::nav_link('account/settings', 'Settings') }}
{{ HTML::nav_link('account/import', 'Import', 'account/import_map') }}
{{ HTML::nav_link('account/export', 'Export') }}
{{ HTML::nav_link('company/details', 'Company Details') }}
{{ HTML::nav_link('company/payments', 'Online Payments') }}
{{ HTML::nav_link('company/notifications', 'Notifications') }}
{{ HTML::nav_link('company/import_export', 'Import/Export', 'company/import_map') }}
</ul>
<p>&nbsp;</p>

View File

@ -0,0 +1,24 @@
@extends('accounts.nav')
@section('content')
@parent
{{ Former::open()->addClass('col-md-8 col-md-offset-2') }}
{{ Former::populate($account) }}
{{ Former::populateField('notify_sent', intval(Auth::user()->notify_sent)) }}
{{ Former::populateField('notify_viewed', intval(Auth::user()->notify_viewed)) }}
{{ Former::populateField('notify_paid', intval(Auth::user()->notify_paid)) }}
{{ Former::legend('Email Notifications') }}
{{ Former::checkbox('notify_sent')->label('&nbsp;')->text('Email me when an invoice is <b>sent</b>') }}
{{ Former::checkbox('notify_viewed')->label('&nbsp;')->text('Email me when an invoice is <b>viewed</b>') }}
{{ Former::checkbox('notify_paid')->label('&nbsp;')->text('Email me when an invoice is <b>paid</b>') }}
{{ Former::legend('Custom messages') }}
{{ Former::textarea('invoice_terms') }}
{{ Former::textarea('email_footer') }}
{{ Former::actions( Button::lg_primary_submit('Save') ) }}
{{ Former::close() }}
@stop

View File

@ -45,26 +45,6 @@
@endforeach
{{ Former::legend('Localization') }}
{{ Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('timezone_id')->addOption('','')->label('Timezone')
->fromQuery($timezones, 'location', 'id') }}
{{ Former::select('date_format_id')->addOption('','')->label('Date Format')
->fromQuery($dateFormats, 'label', 'id') }}
{{ Former::select('datetime_format_id')->addOption('','')->label('Date/Time Format')
->fromQuery($datetimeFormats, 'label', 'id') }}
{{ Former::legend('Email Notifications') }}
{{ Former::checkbox('notify_sent')->label('&nbsp;')->text('Email me when an invoice is <b>sent</b>') }}
{{ Former::checkbox('notify_viewed')->label('&nbsp;')->text('Email me when an invoice is <b>viewed</b>') }}
{{ Former::checkbox('notify_paid')->label('&nbsp;')->text('Email me when an invoice is <b>paid</b>') }}
{{ Former::legend('Custom messages') }}
{{ Former::textarea('invoice_terms') }}
{{ Former::textarea('email_footer') }}
{{ Former::actions( Button::lg_primary_submit('Save') ) }}
{{ Former::close() }}

View File

@ -12,7 +12,7 @@
To view your client invoice click the link below: <br/>
{{ $invoiceLink }} <p/>
To adjust your email notification settings please <a href="http://www.invoiceninja.com/account/settings">click here</a>.
To adjust your email notification settings please <a href="http://www.invoiceninja.com/company/settings">click here</a>.
</body>
</html>

View File

@ -6,4 +6,4 @@ A payment of {{ $paymentAmount }} was made by client {{ $clientName }} towards i
To view your client invoice click the link below:
{{ $invoiceLink }} <p/>
To adjust your email notification settings please visit http://www.invoiceninja.com/account/settings
To adjust your email notification settings please visit http://www.invoiceninja.com/company/settings

View File

@ -9,7 +9,7 @@
The following client {{ $clientName }} was emailed Invoice {{ $invoiceNumber }} for {{ $invoiceAmount}}.<p/>
To adjust your email notification settings please <a href="http://www.invoiceninja.com/account/settings">click here</a>.<p/>
To adjust your email notification settings please <a href="http://www.invoiceninja.com/company/settings">click here</a>.<p/>
</body>
</html>

View File

@ -2,4 +2,4 @@ Dear {{ $userName }},
The following client {{ $clientName }} was emailed Invoice {{ $invoiceNumber }} for {{ $invoiceAmount}}.
To adjust your email notification settings visit this link http://www.invoiceninja.com/account/settings
To adjust your email notification settings visit this link http://www.invoiceninja.com/company/settings

View File

@ -9,7 +9,7 @@
The following client {{ $clientName }} viewed Invoice {{ $invoiceNumber }} for {{ $invoiceAmount}}.<p/>
To adjust your email notification settings please <a href="http://www.invoiceninja.com/account/settings">click here</a>.<p/>
To adjust your email notification settings please <a href="http://www.invoiceninja.com/company/settings">click here</a>.<p/>
</body>
</html>

View File

@ -2,4 +2,4 @@ Dear {{ $userName }},
The following client {{ $clientName }} viewed Invoice {{ $invoiceNumber }} for {{ $invoiceAmount }}.
To adjust your email notification settings visit this link http://www.invoiceninja.com/account/settings
To adjust your email notification settings visit this link http://www.invoiceninja.com/company/settings

View File

@ -104,16 +104,17 @@
@if (Auth::check() && Auth::user()->registered)
{{ Auth::user()->getFullName() }}
@else
My Account
My Company
@endif
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>{{ link_to('account/details', 'Details') }}</li>
<li>{{ link_to('account/settings', 'Settings') }}</li>
<li>{{ link_to('account/import', 'Import') }}</li>
<li>{{ link_to('account/export', 'Export') }}</li>
<li>{{ link_to('company/details', 'Company Details') }}</li>
<li>{{ link_to('company/payments', 'Online Payments') }}</li>
<li>{{ link_to('company/notifications', 'Notifications') }}</li>
<li>{{ link_to('company/import_export', 'Import/Export') }}</li>
<li class="divider"></li>
<li>{{ link_to('#', 'Logout', array('onclick'=>'logout()')) }}</li>
</ul>

View File

@ -6,6 +6,9 @@
<link rel="canonical" href="https://www.invoiceninja.com/rocksteady"></link>
<link href="{{ asset('favicon.ico') }}" rel="icon" type="image/x-icon">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,900,100' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' rel='stylesheet' type='text/css'>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

View File

@ -6,8 +6,6 @@
<link href="{{ asset('images/apple-touch-icon-114x114-precomposed.png') }}" rel="apple-touch-icon-precomposed" sizes="114x114">
<link href="{{ asset('images/apple-touch-icon-72x72-precomposed.png') }}" rel="apple-touch-icon-precomposed" sizes="72x72">
<link href="{{ asset('images/apple-touch-icon-57x57-precomposed.png') }}" rel="apple-touch-icon-precomposed">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,900,100' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' rel='stylesheet' type='text/css'>
@stop
@section('body')