diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php
index a8f523fca51c..34855b0a66ea 100644
--- a/app/Http/Controllers/ClientController.php
+++ b/app/Http/Controllers/ClientController.php
@@ -4,8 +4,13 @@ use Auth;
use Utils;
use View;
use URL;
+use Validator;
+use Input;
+use Session;
+use Redirect;
use App\Models\Client;
+use App\Models\Contact;
use App\Models\Invoice;
use App\Models\Size;
use App\Models\PaymentTerm;
@@ -103,13 +108,13 @@ class ClientController extends BaseController
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT);
$actionLinks = [
- [trans('texts.create_invoice'), URL::to('invoices/create/'.$client->public_id)],
- [trans('texts.enter_payment'), URL::to('payments/create/'.$client->public_id)],
- [trans('texts.enter_credit'), URL::to('credits/create/'.$client->public_id)],
- ];
+ ['label' => trans('texts.create_invoice'), 'url' => URL::to('invoices/create/'.$client->public_id)],
+ ['label' => trans('texts.enter_payment'), 'url' => URL::to('payments/create/'.$client->public_id)],
+ ['label' => trans('texts.enter_credit'), 'url' => URL::to('credits/create/'.$client->public_id)],
+ ];
if (Utils::isPro()) {
- array_unshift($actionLinks, [trans('texts.create_quote'), URL::to('quotes/create/'.$client->public_id)]);
+ array_unshift($actionLinks, ['label' => trans('texts.create_quote'), 'url' => URL::to('quotes/create/'.$client->public_id)]);
}
$data = array(
diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php
index d4a3420cfe7b..c895227772b5 100644
--- a/app/Http/Controllers/CreditController.php
+++ b/app/Http/Controllers/CreditController.php
@@ -6,6 +6,9 @@ use Redirect;
use Session;
use Utils;
use View;
+use Validator;
+
+use App\Models\Client;
use App\Ninja\Repositories\CreditRepository;
diff --git a/app/Models/Client.php b/app/Models/Client.php
index c13e3c5befd8..76dea58a475c 100644
--- a/app/Models/Client.php
+++ b/app/Models/Client.php
@@ -94,100 +94,6 @@ class Client extends EntityModel
return ENTITY_CLIENT;
}
- public function getAddress()
- {
- $str = '';
-
- if ($this->address1) {
- $str .= $this->address1.'
';
- }
- if ($this->address2) {
- $str .= $this->address2.'
';
- }
- if ($this->city) {
- $str .= $this->city.', ';
- }
- if ($this->state) {
- $str .= $this->state.' ';
- }
- if ($this->postal_code) {
- $str .= $this->postal_code;
- }
- if ($this->country) {
- $str .= '
'.$this->country->name;
- }
-
- if ($str) {
- $str = '
'.$str.'
'; - } - - return $str; - } - - public function getPhone() - { - $str = ''; - - if ($this->work_phone) { - $str .= ''.Utils::formatPhoneNumber($this->work_phone); - } - - return $str; - } - - public function getVatNumber() - { - $str = ''; - - if ($this->vat_number) { - $str .= ''.trans('texts.vat_number').': '.$this->vat_number; - } - - return $str; - } - - public function getNotes() - { - $str = ''; - - if ($this->private_notes) { - $str .= ''.$this->private_notes.''; - } - - return $str; - } - - public function getIndustry() - { - $str = ''; - - if ($this->client_industry) { - $str .= $this->client_industry->name.' '; - } - - if ($this->client_size) { - $str .= $this->client_size->name; - } - - return $str; - } - - public function getCustomFields() - { - $str = ''; - $account = $this->account; - - if ($account->custom_client_label1 && $this->custom_value1) { - $str .= "{$account->custom_client_label1}: {$this->custom_value1}'.$str.'
'; - } - - return $str; - } } diff --git a/resources/views/client.blade.php b/resources/views/client.blade.php index ebc46d293b64..499c8a30976f 100644 --- a/resources/views/client.blade.php +++ b/resources/views/client.blade.php @@ -73,7 +73,7 @@ function ContactsModel() { } @if ($client) - window.model = ko.mapping.fromJS({{ $client }}); + window.model = ko.mapping.fromJS({!! $client !!}); @else window.model = new ContactsModel(); addContact(); diff --git a/resources/views/clients/edit.blade.php b/resources/views/clients/edit.blade.php index 428c7708a324..997820d1726f 100644 --- a/resources/views/clients/edit.blade.php +++ b/resources/views/clients/edit.blade.php @@ -138,7 +138,7 @@ }); } - window.model = new ContactsModel({{ $client }}); + window.model = new ContactsModel({!! $client !!}); model.showContact = function(elem) { if (elem.nodeType === 1) $(elem).hide().slideDown() } model.hideContact = function(elem) { if (elem.nodeType === 1) $(elem).slideUp(function() { $(elem).remove(); }) } @@ -159,7 +159,7 @@{{ trans('texts.id_number').': '.$this->id_number }}
+{{ trans('texts.id_number').': '.$client->id_number }}
@endif -{{ $client->getVatNumber() }}
-{{ $client->getAddress() }}
-{{ $client->getCustomFields() }}
-{{ $client->getPhone() }}
-{{ $client->getNotes() }}
-{{ $client->getIndustry() }}
-{{ $client->getWebsite() }}
+ @if ($client->vat_number) +{{ trans('texts.vat_number').': '.$client->vat_number }}
+ @endif + + @if ($client->address1) + {{ $client->address1 }}{{ $client->private_notes }}
+ @endif + + @if ($client->client_industry) + {{ $client->client_industry->name }}{!! $client->getWebsite() !!}
+ @endif +{{ $client->payment_terms ? trans('texts.payment_terms') . ": Net " . $client->payment_terms : '' }}