diff --git a/Gruntfile.js b/Gruntfile.js index 4691c1a9e569..3e358a158ca0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,7 +65,7 @@ module.exports = function(grunt) { 'public/js/lightbox.min.js', 'public/js/bootstrap-combobox.js', 'public/js/script.js', - 'public/js/pdf.pdfmake.js' + 'public/js/pdf.pdfmake.js', ], dest: 'public/js/built.js', nonull: true diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 8503d0b76494..540567d9b339 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -84,9 +84,10 @@ class AccountController extends BaseController } $user = false; - $guestKey = Input::get('guest_key'); + $guestKey = Input::get('guest_key'); // local storage key to login until registered + $prevUserId = Session::pull(PREV_USER_ID); // last user id used to link to new account - if ($guestKey) { + if ($guestKey && !$prevUserId) { $user = User::where('password', '=', $guestKey)->first(); if ($user && $user->registered) { @@ -99,6 +100,11 @@ class AccountController extends BaseController $user = $account->users()->first(); Session::forget(RECENTLY_VIEWED); + + if ($prevUserId) { + $users = $this->accountRepo->associateAccounts($user->id, $prevUserId); + Session::put(SESSION_USER_ACCOUNTS, $users); + } } Auth::login($user, true); @@ -154,6 +160,7 @@ class AccountController extends BaseController 'currencies' => Cache::get('currencies'), 'languages' => Cache::get('languages'), 'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id, + 'title' => trans('texts.company_details'), ]; return View::make('accounts.details', $data); @@ -166,21 +173,26 @@ class AccountController extends BaseController if ($count == 0) { return Redirect::to('gateways/create'); } else { - return View::make('accounts.payments', ['showAdd' => $count < 3]); + return View::make('accounts.payments', [ + 'showAdd' => $count < 3, + 'title' => trans('texts.online_payments') + ]); } } elseif ($section == ACCOUNT_NOTIFICATIONS) { $data = [ 'account' => Account::with('users')->findOrFail(Auth::user()->account_id), + 'title' => trans('texts.notifications'), ]; return View::make('accounts.notifications', $data); } elseif ($section == ACCOUNT_IMPORT_EXPORT) { - return View::make('accounts.import_export'); + return View::make('accounts.import_export', ['title' => trans('texts.import_export')]); } elseif ($section == ACCOUNT_ADVANCED_SETTINGS) { $account = Auth::user()->account; $data = [ 'account' => $account, 'feature' => $subSection, + 'title' => trans('texts.invoice_settings'), ]; if ($subSection == ACCOUNT_INVOICE_DESIGN) { @@ -212,17 +224,22 @@ class AccountController extends BaseController $data['invoice'] = $invoice; $data['invoiceDesigns'] = InvoiceDesign::availableDesigns(); $data['invoiceLabels'] = json_decode($account->invoice_labels) ?: []; + $data['title'] = trans('texts.invoice_design'); } else if ($subSection == ACCOUNT_EMAIL_TEMPLATES) { $data['invoiceEmail'] = $account->getEmailTemplate(ENTITY_INVOICE); $data['quoteEmail'] = $account->getEmailTemplate(ENTITY_QUOTE); $data['paymentEmail'] = $account->getEmailTemplate(ENTITY_PAYMENT); $data['emailFooter'] = $account->getEmailFooter(); + $data['title'] = trans('texts.email_templates'); + } else if ($subSection == ACCOUNT_USER_MANAGEMENT) { + $data['title'] = trans('texts.users_and_tokens'); } return View::make("accounts.{$subSection}", $data); } elseif ($section == ACCOUNT_PRODUCTS) { $data = [ 'account' => Auth::user()->account, + 'title' => trans('texts.product_library'), ]; return View::make('accounts.products', $data); @@ -704,8 +721,6 @@ class AccountController extends BaseController if (Utils::isNinja()) { $this->userMailer->sendConfirmation($user); - } else { - $this->accountRepo->registerUser($user); } $activities = Activity::scope()->get(); @@ -761,6 +776,7 @@ class AccountController extends BaseController } $account = Auth::user()->account; + $this->accountRepo->unlinkAccount($account); $account->forceDelete(); Auth::logout(); diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 4c55daeb868c..8c97cdf0c1d6 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -37,14 +37,12 @@ class AppController extends BaseController return Redirect::to('/'); } - $view = View::make('setup'); - - return Response::make($view); + return View::make('setup'); } public function doSetup() { - if (Utils::isNinja() || Utils::isDatabaseSetup()) { + if (Utils::isNinja() || (Utils::isDatabaseSetup() && Account::count() > 0)) { return Redirect::to('/'); } @@ -109,8 +107,6 @@ class AppController extends BaseController $account = $this->accountRepo->create($firstName, $lastName, $email, $password); $user = $account->users()->first(); - //Auth::login($user, true); - return Redirect::to('/login'); } diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 8cde7ad8190c..e17135fe7146 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -60,24 +60,32 @@ class AuthController extends Controller { public function postLoginWrapper(Request $request) { $userId = Auth::check() ? Auth::user()->id : null; + $user = User::where('email', '=', $request->input('email'))->first(); + + if ($user->failed_logins >= 3) { + Session::flash('error', 'These credentials do not match our records.'); + return redirect()->to('login'); + } + $response = self::postLogin($request); if (Auth::check()) { Event::fire(new UserLoggedIn()); - if (Utils::isPro()) { - $users = false; - // we're linking a new account - if ($userId && Auth::user()->id != $userId) { - $users = $this->accountRepo->associateAccounts($userId, Auth::user()->id); - Session::flash('message', trans('texts.associated_accounts')); - // check if other accounts are linked - } else { - $users = $this->accountRepo->loadAccounts(Auth::user()->id); - } - - Session::put(SESSION_USER_ACCOUNTS, $users); + $users = false; + // we're linking a new account + if ($userId && Auth::user()->id != $userId) { + $users = $this->accountRepo->associateAccounts($userId, Auth::user()->id); + Session::flash('message', trans('texts.associated_accounts')); + // check if other accounts are linked + } else { + $users = $this->accountRepo->loadAccounts(Auth::user()->id); } + + Session::put(SESSION_USER_ACCOUNTS, $users); + } elseif ($user) { + $user->failed_logins = $user->failed_logins + 1; + $user->save(); } return $response; @@ -85,6 +93,12 @@ class AuthController extends Controller { public function getLogoutWrapper() { + if (Auth::check() && !Auth::user()->registered) { + $account = Auth::user()->account; + $this->accountRepo->unlinkAccount($account); + $account->forceDelete(); + } + $response = self::getLogout(); Session::flush(); diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 7e3a5e84196a..9defb3e9af9c 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -83,6 +83,7 @@ class DashboardController extends BaseController 'activities' => $activities, 'pastDue' => $pastDue, 'upcoming' => $upcoming, + 'title' => trans('texts.dashboard'), ]; return View::make('dashboard', $data); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 49ebc9343c2c..a58245e0e25b 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -43,7 +43,8 @@ class HomeController extends BaseController public function invoiceNow() { - if (Auth::check() && Input::get('logout')) { + if (Auth::check() && Input::get('new_account')) { + Session::put(PREV_USER_ID, Auth::user()->id); Auth::user()->clearSession(); Auth::logout(); } diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index ff84d3b97e5b..a68841d580dd 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -460,10 +460,11 @@ class PaymentController extends BaseController $this->contactMailer->sendLicensePaymentConfirmation($name, $license->email, $affiliate->price, $license->license_key, $license->product_id); if (Session::has('return_url')) { - return Redirect::away(Session::get('return_url')."?license_key={$license->license_key}&product_id=".Session::get('product_id')); - } else { - return View::make('public.license', $data); + $data['redirectTo'] = Session::get('return_url')."?license_key={$license->license_key}&product_id=".Session::get('product_id'); + $data['message'] = "Redirecting to " . Session::get('return_url'); } + + return View::make('public.license', $data); } catch (\Exception $e) { $errorMessage = trans('texts.payment_error'); Session::flash('error', $errorMessage); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index b1746761b10f..bf654927442d 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -243,6 +243,7 @@ class ReportController extends BaseController 'reportType' => $reportType, 'enableChart' => $enableChart, 'enableReport' => $enableReport, + 'title' => trans('texts.charts_and_reports'), ]; return View::make('reports.chart_builder', $params); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 6a1b425ce4a1..dedd752190fb 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -301,11 +301,13 @@ class UserController extends BaseController * Log the user out of the application. * */ + /* public function logout() { if (Auth::check()) { if (!Auth::user()->registered) { $account = Auth::user()->account; + $this->accountRepo->unlinkAccount($account); $account->forceDelete(); } } @@ -315,7 +317,8 @@ class UserController extends BaseController return Redirect::to('/')->with('clearGuestKey', true); } - + */ + public function changePassword() { // check the current password is correct @@ -352,6 +355,10 @@ class UserController extends BaseController if ($account->hasUserId($newUserId) && $account->hasUserId($oldUserId)) { Auth::loginUsingId($newUserId); Auth::user()->account->loadLocalizationSettings(); + + // regenerate token to prevent open pages + // from saving under the wrong account + Session::put('_token', str_random(40)); } } @@ -360,7 +367,7 @@ class UserController extends BaseController public function unlinkAccount($userAccountId, $userId) { - $this->accountRepo->unlinkAccount($userAccountId, $userId); + $this->accountRepo->unlinkUser($userAccountId, $userId); $referer = Request::header('referer'); $users = $this->accountRepo->loadAccounts(Auth::user()->id); diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 329e1a2c36a4..8c5299311661 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -157,6 +157,14 @@ class StartupCheck } } - return $next($request); + if (preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) { + Session::flash('error', trans('texts.old_browser')); + } + + // for security prevent displaying within an iframe + $response = $next($request); + $response->headers->set('X-Frame-Options', 'DENY'); + + return $response; } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 8cf91232690a..0825afb383e4 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -354,6 +354,7 @@ define('EVENT_CREATE_PAYMENT', 4); define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN'); define('DEMO_ACCOUNT_ID', 'DEMO_ACCOUNT_ID'); +define('PREV_USER_ID', 'PREV_USER_ID'); define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h'); define('NINJA_GATEWAY_ID', GATEWAY_STRIPE); define('NINJA_GATEWAY_CONFIG', ''); @@ -364,6 +365,7 @@ define('NINJA_DATE', '2000-01-01'); define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'); define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/'); define('ZAPIER_URL', 'https://zapier.com/developer/invite/11276/85cf0ee4beae8e802c6c579eb4e351f1/'); +define('OUTDATE_BROWSER_URL', 'http://browsehappy.com/'); define('COUNT_FREE_DESIGNS', 4); define('PRODUCT_ONE_CLICK_INSTALL', 1); diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 55e1dced6774..08d529200753 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -61,7 +61,7 @@ class Utils public static function allowNewAccounts() { - return isset($_ENV['ALLOW_NEW_ACCOUNTS']) && $_ENV['ALLOW_NEW_ACCOUNTS'] == 'true'; + return Utils::isNinja() || (isset($_ENV['ALLOW_NEW_ACCOUNTS']) && $_ENV['ALLOW_NEW_ACCOUNTS'] == 'true'); } public static function isPro() diff --git a/app/Listeners/HandleUserLoggedIn.php b/app/Listeners/HandleUserLoggedIn.php index bea1ab4df4b5..26f7cc455fc7 100644 --- a/app/Listeners/HandleUserLoggedIn.php +++ b/app/Listeners/HandleUserLoggedIn.php @@ -3,6 +3,7 @@ use Utils; use Auth; use Carbon; +use Session; use App\Events\UserLoggedIn; use App\Ninja\Repositories\AccountRepository; use Illuminate\Queue\InteractsWithQueue; @@ -32,13 +33,16 @@ class HandleUserLoggedIn { { $account = Auth::user()->account; - if (!Utils::isNinja() && empty($account->last_login)) { + if (!Utils::isNinja() && Auth::user()->id == 1 && empty($account->last_login)) { $this->accountRepo->registerUser(Auth::user()); } $account->last_login = Carbon::now()->toDateTimeString(); $account->save(); + $users = $this->accountRepo->loadAccounts(Auth::user()->id); + Session::put(SESSION_USER_ACCOUNTS, $users); + $account->loadLocalizationSettings(); } diff --git a/app/Models/Account.php b/app/Models/Account.php index 068143286aee..bc96c70415b7 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -133,6 +133,13 @@ class Account extends Eloquent return false; } + /* + public function hasLogo() + { + file_exists($this->getLogoPath()); + } + */ + public function getLogoPath() { return 'logo/'.$this->account_key.'.jpg'; @@ -250,6 +257,7 @@ class Account extends Eloquent 'date', 'rate', 'hours', + 'balance', ]; foreach ($fields as $field) { diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 9a57ce13d39a..6207bfb14041 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -43,6 +43,11 @@ class Invoice extends EntityModel return $this->belongsTo('App\Models\InvoiceDesign'); } + public function recurring_invoice() + { + return $this->belongsTo('App\Models\Invoice'); + } + public function invitations() { return $this->hasMany('App\Models\Invitation')->orderBy('invitations.contact_id'); diff --git a/app/Models/User.php b/app/Models/User.php index 55dbac000fd8..98545d310001 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -201,4 +201,15 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon } } + public static function updateUser($user) + { + if ($user->password != !$user->getOriginal('password')) { + $user->failed_logins = 0; + } + } + } + +User::updating(function ($user) { + User::updateUser($user); +}); diff --git a/app/Ninja/Mailers/Mailer.php b/app/Ninja/Mailers/Mailer.php index 50a9c87b2cdf..47c7756ab59f 100644 --- a/app/Ninja/Mailers/Mailer.php +++ b/app/Ninja/Mailers/Mailer.php @@ -16,9 +16,10 @@ class Mailer try { Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) { + $replyEmail = $fromEmail; - $fromEmail = NINJA_FROM_EMAIL; - + $fromEmail = CONTACT_EMAIL; + if(isset($data['invoice_id'])) { $invoice = Invoice::with('account')->where('id', '=', $data['invoice_id'])->get()->first(); if($invoice->account->pdf_email_attachment && file_exists($invoice->getPDFPath())) { @@ -31,7 +32,7 @@ class Mailer $message->to($toEmail)->from($fromEmail, $fromName)->replyTo($replyEmail, $fromName)->subject($subject); }); - + return true; } catch (Exception $e) { $response = $e->getResponse()->getBody()->getContents(); diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index cf9dd153f856..98ef973f674f 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -294,6 +294,7 @@ class AccountRepository $item->account_id = $user->account->id; $item->account_name = $user->account->getDisplayName(); $item->pro_plan_paid = $user->account->pro_plan_paid; + $item->account_key = file_exists($user->account->getLogoPath()) ? $user->account->account_key : null; $data[] = $item; } @@ -363,11 +364,19 @@ class AccountRepository return $users; } - public function unlinkAccount($userAccountId, $userId) { + public function unlinkAccount($account) { + foreach ($account->users as $user) { + if ($userAccount = self::findUserAccounts($user->id)) { + $userAccount->removeUserId($user->id); + $userAccount->save(); + } + } + } + + public function unlinkUser($userAccountId, $userId) { $userAccount = UserAccount::whereId($userAccountId)->first(); - - if ($userAccount->hasUserId(Auth::user()->id)) { + if ($userAccount->hasUserId($userId)) { $userAccount->removeUserId($userId); $userAccount->save(); } diff --git a/database/migrations/2015_07_07_160257_support_locking_account.php b/database/migrations/2015_07_07_160257_support_locking_account.php new file mode 100644 index 000000000000..cb1ef96320fd --- /dev/null +++ b/database/migrations/2015_07_07_160257_support_locking_account.php @@ -0,0 +1,46 @@ +smallInteger('failed_logins')->nullable(); + }); + + Schema::table('account_gateways', function($table) + { + $table->boolean('show_address')->default(true)->nullable(); + $table->boolean('update_address')->default(true)->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function($table) + { + $table->dropColumn('failed_logins'); + }); + + Schema::table('account_gateways', function($table) + { + $table->dropColumn('show_address'); + $table->dropColumn('update_address'); + }); + } + +} diff --git a/public/fonts/fontawesome-webfont.woff2 b/public/fonts/fontawesome-webfont.woff2 new file mode 100644 index 000000000000..3311d585145b Binary files /dev/null and b/public/fonts/fontawesome-webfont.woff2 differ diff --git a/public/js/built.js b/public/js/built.js index 39f31977a55d..ba3b95aa1b05 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -32341,8 +32341,12 @@ function getInvoiceDetails(invoice) { {'due_date': invoice.due_date}, ]; + if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) { + fields.push({'total': formatMoney(invoice.amount, invoice.client.currency_id)}); + } + if (NINJA.parseFloat(invoice.partial)) { - fields.push({'total': formatMoney(invoice.total_amount, invoice.client.currency_id)}); + fields.push({'balance': formatMoney(invoice.total_amount, invoice.client.currency_id)}); } fields.push({'balance_due': formatMoney(invoice.balance_amount, invoice.client.currency_id)}) @@ -32398,12 +32402,16 @@ function displaySubtotals(doc, layout, invoice, y, rightAlignTitleX) } var paid = invoice.amount - invoice.balance; + if (paid) { + data.push({'total': formatMoney(invoice.amount, invoice.client.currency_id)}); + } + if (invoice.account.hide_paid_to_date != '1' || paid) { data.push({'paid_to_date': formatMoney(paid, invoice.client.currency_id)}); } if (NINJA.parseFloat(invoice.partial) && invoice.total_amount != invoice.subtotal_amount) { - data.push({'total': formatMoney(invoice.total_amount, invoice.client.currency_id)}); + data.push({'balance': formatMoney(invoice.total_amount, invoice.client.currency_id)}); } var options = { diff --git a/public/js/script.js b/public/js/script.js index acb0252b0a7a..637a09e0fa9b 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -705,8 +705,12 @@ function getInvoiceDetails(invoice) { {'due_date': invoice.due_date}, ]; + if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) { + fields.push({'total': formatMoney(invoice.amount, invoice.client.currency_id)}); + } + if (NINJA.parseFloat(invoice.partial)) { - fields.push({'total': formatMoney(invoice.total_amount, invoice.client.currency_id)}); + fields.push({'balance': formatMoney(invoice.total_amount, invoice.client.currency_id)}); } fields.push({'balance_due': formatMoney(invoice.balance_amount, invoice.client.currency_id)}) @@ -762,12 +766,16 @@ function displaySubtotals(doc, layout, invoice, y, rightAlignTitleX) } var paid = invoice.amount - invoice.balance; + if (paid) { + data.push({'total': formatMoney(invoice.amount, invoice.client.currency_id)}); + } + if (invoice.account.hide_paid_to_date != '1' || paid) { data.push({'paid_to_date': formatMoney(paid, invoice.client.currency_id)}); } if (NINJA.parseFloat(invoice.partial) && invoice.total_amount != invoice.subtotal_amount) { - data.push({'total': formatMoney(invoice.total_amount, invoice.client.currency_id)}); + data.push({'balance': formatMoney(invoice.total_amount, invoice.client.currency_id)}); } var options = { diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 2d600d31f970..728fd8c37690 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -705,5 +705,11 @@ return array( 'or' => 'or', 'email_error' => 'There was a problem sending the email', + 'created_by_recurring' => 'Created by recurring invoice :invoice', + 'confirm_recurring_timing' => 'Note: emails are sent at the start of the hour.', + 'old_browser' => 'Please use a newer browser', + 'payment_terms_help' => 'Sets the default invoice due date', + 'unlink_account' => 'Unlink Account', + 'unlink' => 'Unlink', ); diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index e96fbedc186a..76b315c84283 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -79,11 +79,11 @@ {!! Former::hidden('remember')->raw() !!}

-

{!! Button::success(trans(Utils::allowNewAccounts() ? 'texts.login' : 'texts.lets_go'))->large()->submit()->block() !!}

+

{!! Button::success(trans(Input::get('new_account') && Utils::allowNewAccounts() ? 'texts.login' : 'texts.lets_go'))->large()->submit()->block() !!}

- @if (Utils::allowNewAccounts()) + @if (Input::get('new_account') && Utils::allowNewAccounts())

- {{ trans('texts.or') }} -

-

{!! Button::primary(trans('texts.new_account'))->asLinkTo(URL::to('/invoice_now?logout=true'))->large()->submit()->block() !!}

+

{!! Button::primary(trans('texts.new_account'))->asLinkTo(URL::to('/invoice_now?new_account=true'))->large()->submit()->block() !!}

@endif @@ -110,12 +110,9 @@ @endif @if (Session::has('error')) -
{{ Session::get('error') }}
+
  • {{ Session::get('error') }}
  • @endif - - - {!! Former::close() !!} diff --git a/resources/views/clients/edit.blade.php b/resources/views/clients/edit.blade.php index fbd846089fa1..e3cf16d7ee14 100644 --- a/resources/views/clients/edit.blade.php +++ b/resources/views/clients/edit.blade.php @@ -8,7 +8,11 @@ @section('content')
    - {!! Former::open($url)->addClass('col-md-12 warn-on-exit')->method($method) !!} + {!! Former::open($url) + ->rules( + ['email' => 'email'] + )->addClass('col-md-12 warn-on-exit') + ->method($method) !!} @if ($client) {!! Former::populate($client) !!} @@ -100,7 +104,8 @@ {!! Former::select('currency_id')->addOption('','') ->fromQuery($currencies, 'name', 'id') !!} {!! Former::select('payment_terms')->addOption('','') - ->fromQuery($paymentTerms, 'name', 'num_days') !!} + ->fromQuery($paymentTerms, 'name', 'num_days') + ->help(trans('texts.payment_terms_help')) !!} {!! Former::select('size_id')->addOption('','') ->fromQuery($sizes, 'name', 'id') !!} {!! Former::select('industry_id')->addOption('','') diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index faafd48c15bb..f4fc371e66ce 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -186,13 +186,19 @@ }); } - function unlinkAccount(userAccountId, userId) { - if (confirm('{!! trans("texts.are_you_sure") !!}')) { - window.location = '{{ URL::to('/unlink_account') }}' + '/' + userAccountId + '/' + userId; - } + function showUnlink(userAccountId, userId) { + NINJA.unlink = { + 'userAccountId': userAccountId, + 'userId': userId + }; + $('#unlinkModal').modal('show'); return false; } + function unlinkAccount() { + window.location = '{{ URL::to('/unlink_account') }}' + '/' + NINJA.unlink.userAccountId + '/' + NINJA.unlink.userId; + } + function wordWrapText(value, width) { @if (Auth::user()->account->auto_wrap) @@ -242,7 +248,14 @@ $(".alert-hide").fadeOut(500); }, 2000); + $('#search').blur(function(){ + $('#search').css('width', '150px'); + $('ul.navbar-right').show(); + }); + $('#search').focus(function(){ + $('#search').css('width', '256px'); + $('ul.navbar-right').hide(); if (!window.hasOwnProperty('searchData')) { $.get('{{ URL::route('getSearchData') }}', function(data) { window.searchData = true; @@ -316,7 +329,7 @@ - +
    @@ -353,29 +366,42 @@ @@ -419,7 +445,7 @@ @@ -549,6 +575,28 @@ @endif +@if (Auth::check() && session(SESSION_USER_ACCOUNTS) && count(session(SESSION_USER_ACCOUNTS))) + +@endif + @if (Auth::check() && !Auth::user()->isPro()) @@ -118,6 +125,7 @@ FLUSH PRIVILEGES; + {!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => ''.trans('texts.terms_of_service').''])) !!} {!! Former::actions( Button::primary('Submit')->large()->submit() ) !!} {!! Former::close() !!} diff --git a/resources/views/user_account.blade.php b/resources/views/user_account.blade.php new file mode 100644 index 000000000000..47d03b3ce137 --- /dev/null +++ b/resources/views/user_account.blade.php @@ -0,0 +1,31 @@ +
  • + @if (isset($user_id) && $show_remove) + + @else + + @endif + + @if (isset($show_remove) && $show_remove) +
    + @endif + + @if (file_exists('logo/'.$account_key.'.jpg')) + + @else +
     
    + @endif + + @if (isset($selected) && $selected) + + @endif + + +
    {{ $user_name }}
    + + @if (isset($selected) && $selected) +
    + @endif + +
    + +
  • \ No newline at end of file