Support filtering email notifications

This commit is contained in:
Hillel Coren 2018-05-14 20:12:25 +03:00
parent a70d4bc805
commit 2853351ca2
2 changed files with 6 additions and 1 deletions

View File

@ -1797,6 +1797,11 @@ class Account extends Eloquent
return $this->company->accounts->count() > 1; return $this->company->accounts->count() > 1;
} }
public function hasMultipleUsers()
{
return $this->users->count() > 1;
}
public function getPrimaryAccount() public function getPrimaryAccount()
{ {
return $this->company->accounts()->orderBy('id')->first(); return $this->company->accounts()->orderBy('id')->first();

View File

@ -14,7 +14,7 @@
{!! Former::checkbox('notify_paid')->label(' ')->text(trans('texts.email_paid'))->value(1) !!} {!! Former::checkbox('notify_paid')->label(' ')->text(trans('texts.email_paid'))->value(1) !!}
{!! Former::checkbox('notify_approved')->label(' ')->text(trans('texts.email_approved'))->value(1) !!} {!! Former::checkbox('notify_approved')->label(' ')->text(trans('texts.email_approved'))->value(1) !!}
@if (true || Auth()->user()->account->users->count() > 1) @if (Auth()->user()->account->hasMultipleUsers())
<br/> <br/>
{!! Former::radios('only_notify_owned')->radios([ {!! Former::radios('only_notify_owned')->radios([
trans('texts.all_invoices') => array('name' => 'only_notify_owned', 'value' => 0), trans('texts.all_invoices') => array('name' => 'only_notify_owned', 'value' => 0),