From e893d74b41e2beaadf7057d65511dfec9f98a98b Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 14 Dec 2015 23:05:17 +0200 Subject: [PATCH] Added company website --- app/Http/Controllers/AccountController.php | 1 + app/Http/Controllers/PublicClientController.php | 2 +- app/Libraries/Utils.php | 10 ++++++++++ app/Ninja/Presenters/AccountPresenter.php | 5 +++++ public/js/built.js | 1 + public/js/pdf.pdfmake.js | 1 + readme.md | 2 +- resources/views/accounts/details.blade.php | 3 ++- resources/views/emails/master.blade.php | 2 +- resources/views/invited/dashboard.blade.php | 8 ++++++++ 10 files changed, 31 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 1146fe4fc9..8b459675b8 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -642,6 +642,7 @@ class AccountController extends BaseController $account->id_number = trim(Input::get('id_number')); $account->vat_number = trim(Input::get('vat_number')); $account->work_email = trim(Input::get('work_email')); + $account->website = trim(Input::get('website')); $account->work_phone = trim(Input::get('work_phone')); $account->address1 = trim(Input::get('address1')); $account->address2 = trim(Input::get('address2')); diff --git a/app/Http/Controllers/PublicClientController.php b/app/Http/Controllers/PublicClientController.php index 1bdb091362..68b81f8b21 100644 --- a/app/Http/Controllers/PublicClientController.php +++ b/app/Http/Controllers/PublicClientController.php @@ -66,7 +66,7 @@ class PublicClientController extends BaseController return trans("texts.activity_{$model->activity_type_id}", $data); }) ->addColumn('balance', function ($model) { return Utils::formatMoney($model->balance, $model->currency_id, $model->country_id); }) - ->addColumn('adjustment', function ($model) { return $model->adjustment != 0 ? Utils::wrapAdjustment($model->adjustment, $model->currency_id) : ''; }) + ->addColumn('adjustment', function ($model) { return $model->adjustment != 0 ? Utils::wrapAdjustment($model->adjustment, $model->currency_id, $model->country_id) : ''; }) ->make(); } diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 3698d7ecfc..3f4e546578 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -887,4 +887,14 @@ class Utils return $interval->y == 0; } + + public static function addHttp($url) + { + if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { + $url = "http://" . $url; + } + + return $url; + } + } diff --git a/app/Ninja/Presenters/AccountPresenter.php b/app/Ninja/Presenters/AccountPresenter.php index a53f9f20c1..d955c76e5b 100644 --- a/app/Ninja/Presenters/AccountPresenter.php +++ b/app/Ninja/Presenters/AccountPresenter.php @@ -1,5 +1,6 @@ entity->name ?: trans('texts.untitled_account'); } + public function website() + { + return Utils::addHttp($this->entity->website); + } } \ No newline at end of file diff --git a/public/js/built.js b/public/js/built.js index 2fc7f3e049..f4251a1798 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -31287,6 +31287,7 @@ NINJA.accountDetails = function(invoice) { {text:account.name, style: ['accountName']}, {text:account.id_number}, {text:account.vat_number}, + {text:account.website}, {text:account.work_email}, {text:account.work_phone} ]; diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index 94fef3fc79..94254ec2bf 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -408,6 +408,7 @@ NINJA.accountDetails = function(invoice) { {text:account.name, style: ['accountName']}, {text:account.id_number}, {text:account.vat_number}, + {text:account.website}, {text:account.work_email}, {text:account.work_phone} ]; diff --git a/readme.md b/readme.md index e8e9f832fc..762f1bd698 100644 --- a/readme.md +++ b/readme.md @@ -48,7 +48,7 @@ There are two options: ### Documentation * [Ubuntu and Apache](http://blog.technerdservices.com/index.php/2015/04/techpop-how-to-install-invoice-ninja-on-ubuntu-14-04/) * [Debian and Nginx](https://www.rosehosting.com/blog/install-invoice-ninja-on-a-debian-7-vps/) -* [User Guide](https://www.invoiceninja.com/user-guide/) +* [User Guide](https://www.invoiceninja.com/app-user-guide/) * [Developer Guide](https://www.invoiceninja.com/knowledgebase/developer-guide/) * [API Documentation](https://www.invoiceninja.com/knowledgebase/api-documentation/) * [Support Forum](https://www.invoiceninja.com/forums/forum/support/) diff --git a/resources/views/accounts/details.blade.php b/resources/views/accounts/details.blade.php index 96036eee79..3c3fffcfca 100644 --- a/resources/views/accounts/details.blade.php +++ b/resources/views/accounts/details.blade.php @@ -22,7 +22,7 @@ ->addClass('warn-on-exit') ->autocomplete('on') ->rules([ - 'name' => 'required' + 'name' => 'required', ]) !!} {{ Former::populate($account) }} @@ -41,6 +41,7 @@ {!! Former::text('name') !!} {!! Former::text('id_number') !!} {!! Former::text('vat_number') !!} + {!! Former::text('website') !!} {!! Former::text('work_email') !!} {!! Former::text('work_phone') !!} {!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!} diff --git a/resources/views/emails/master.blade.php b/resources/views/emails/master.blade.php index b5386cb95f..f12bf04c96 100644 --- a/resources/views/emails/master.blade.php +++ b/resources/views/emails/master.blade.php @@ -71,7 +71,7 @@ @endif @if ($account->website) - {{ $account->website }} + {{ $account->website }} @endif

diff --git a/resources/views/invited/dashboard.blade.php b/resources/views/invited/dashboard.blade.php index 4189a79b1f..a5b698c46e 100644 --- a/resources/views/invited/dashboard.blade.php +++ b/resources/views/invited/dashboard.blade.php @@ -24,6 +24,8 @@ div.address-details { color: #666666; + font-size: 15px; + line-height: 1.8em; } div.col-md-4-left { @@ -108,8 +110,14 @@ @if ($account->getCityState()) {{ $account->getCityState() }}
@endif + @if ($account->country) + {{ $account->country->name }} + @endif
+ @if ($account->website) + {{ $account->website }}
+ @endif @if ($account->work_phone) {{ $account->work_phone }}
@endif