Show accounting link on accounts that are linked
This commit is contained in:
parent
1deda523b4
commit
71b252843c
@ -40,7 +40,7 @@ class AccountingAccountSync implements ShouldQueue
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$api = $this->to->provider->API($this->to);
|
$api = $this->to->provider->API($this->to);
|
||||||
$accounts = Account::get();
|
$accounts = Account::with(['user'])->get();
|
||||||
|
|
||||||
foreach ($api->getCustomers() as $customer) {
|
foreach ($api->getCustomers() as $customer) {
|
||||||
$ao = NULL;
|
$ao = NULL;
|
||||||
@ -54,7 +54,7 @@ class AccountingAccountSync implements ShouldQueue
|
|||||||
$ao = $x->pop();
|
$ao = $x->pop();
|
||||||
|
|
||||||
// Look based on Name
|
// Look based on Name
|
||||||
} elseif (($x=$accounts->filter(function($item) use ($customer) { return $item->company == $customer->companyname || $item->name == $customer->fullname; }))->count() === 1) {
|
} elseif (($x=$accounts->filter(function($item) use ($customer) { return $item->company == $customer->companyname || $item->name == $customer->fullname || $item->user->email == $customer->email; }))->count() === 1) {
|
||||||
$ao = $x->pop();
|
$ao = $x->pop();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,13 +45,6 @@ class Account extends Model implements IDs
|
|||||||
return $this->hasMany(Charge::class);
|
return $this->hasMany(Charge::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providers()
|
|
||||||
{
|
|
||||||
return $this->belongsToMany(ProviderOauth::class,'account_provider')
|
|
||||||
->where('account_provider.site_id',$this->site_id)
|
|
||||||
->withPivot('ref','synctoken','created_at','updated_at');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the country the user belongs to
|
* Return the country the user belongs to
|
||||||
*/
|
*/
|
||||||
@ -85,6 +78,13 @@ class Account extends Model implements IDs
|
|||||||
return $this->hasMany(Payment::class);
|
return $this->hasMany(Payment::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function providers()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(ProviderOauth::class,'account_provider')
|
||||||
|
->where('account_provider.site_id',$this->site_id)
|
||||||
|
->withPivot('ref','synctoken','created_at','updated_at');
|
||||||
|
}
|
||||||
|
|
||||||
public function services($active=FALSE)
|
public function services($active=FALSE)
|
||||||
{
|
{
|
||||||
$query = $this->hasMany(Service::class);
|
$query = $this->hasMany(Service::class);
|
||||||
|
@ -1,5 +1,21 @@
|
|||||||
|
@if($o->my_accounts->count() <= 2 && $o->my_accounts->pluck('providers')->flatten()->count())
|
||||||
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-dark elevation-1"><i class="fas fa-file-invoice"></i></span>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">Accounting</span>
|
||||||
|
@foreach ($o->my_accounts as $ao)
|
||||||
|
@foreach($ao->providers as $po)
|
||||||
|
<span class="info-box-number"><a href="{{ url(($po->api_class())::url().'/customerdetail?nameId='.$po->pivot->ref) }}" target="{{ $po->name }}">{{ ucfirst($po->name) }}</a></span>
|
||||||
|
@endforeach
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($o->accounts->count() > 1)
|
@if ($o->accounts->count() > 1)
|
||||||
<div class="col-12 col-sm-4 col-md-3">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
||||||
|
|
||||||
@ -11,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="col-12 col-sm-4 col-md-3">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-info"><i class="fas fa-clone"></i></span>
|
<span class="info-box-icon bg-info"><i class="fas fa-clone"></i></span>
|
||||||
|
|
||||||
@ -23,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-4 col-md-3">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-danger"><i class="fas fa-dollar-sign"></i></span>
|
<span class="info-box-icon bg-danger"><i class="fas fa-dollar-sign"></i></span>
|
||||||
|
|
||||||
@ -34,7 +50,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-4 col-md-3">
|
<div class="col-12 col-sm-4 col-md-2">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-dark"><i class="fas fa-hashtag"></i></span>
|
<span class="info-box-icon bg-dark"><i class="fas fa-hashtag"></i></span>
|
||||||
|
|
||||||
|
@ -31,13 +31,11 @@
|
|||||||
--}}
|
--}}
|
||||||
<li class="nav-item"><a class="nav-link" href="#tab-futureinvoice" data-toggle="tab">Future Invoice</a></li>
|
<li class="nav-item"><a class="nav-link" href="#tab-futureinvoice" data-toggle="tab">Future Invoice</a></li>
|
||||||
|
|
||||||
@if ($o == $user)
|
|
||||||
@canany('reseller','wholesaler')
|
|
||||||
<li class="nav-item ml-auto"><a class="nav-link" href="#tab-reseller" data-toggle="tab">Reseller</a></li>
|
|
||||||
@endcanany
|
|
||||||
@endif
|
|
||||||
@canany('reseller','wholesaler')
|
@canany('reseller','wholesaler')
|
||||||
<li class="nav-item ml-auto"><a class="nav-link {{ session()->has('supplier_update') ? 'active' : '' }}" href="#tab-supplier" data-toggle="tab">Supplier</a></li>
|
<li class="nav-item ml-auto"><a class="nav-link {{ session()->has('supplier_update') ? 'active' : '' }}" href="#tab-supplier" data-toggle="tab">Supplier</a></li>
|
||||||
|
@if ($o == $user)
|
||||||
|
<li class="nav-item "><a class="nav-link" href="#tab-reseller" data-toggle="tab">Reseller</a></li>
|
||||||
|
@endif
|
||||||
@endcanany
|
@endcanany
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user