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()
|
||||
{
|
||||
$api = $this->to->provider->API($this->to);
|
||||
$accounts = Account::get();
|
||||
$accounts = Account::with(['user'])->get();
|
||||
|
||||
foreach ($api->getCustomers() as $customer) {
|
||||
$ao = NULL;
|
||||
@ -54,7 +54,7 @@ class AccountingAccountSync implements ShouldQueue
|
||||
$ao = $x->pop();
|
||||
|
||||
// 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();
|
||||
|
||||
} else {
|
||||
|
@ -45,13 +45,6 @@ class Account extends Model implements IDs
|
||||
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
|
||||
*/
|
||||
@ -85,6 +78,13 @@ class Account extends Model implements IDs
|
||||
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)
|
||||
{
|
||||
$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)
|
||||
<div class="col-12 col-sm-4 col-md-3">
|
||||
<div class="col-12 col-sm-4 col-md-2">
|
||||
<div class="info-box">
|
||||
<span class="info-box-icon bg-primary elevation-1"><i class="fas fa-user"></i></span>
|
||||
|
||||
@ -11,7 +27,7 @@
|
||||
</div>
|
||||
@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">
|
||||
<span class="info-box-icon bg-info"><i class="fas fa-clone"></i></span>
|
||||
|
||||
@ -23,7 +39,7 @@
|
||||
</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">
|
||||
<span class="info-box-icon bg-danger"><i class="fas fa-dollar-sign"></i></span>
|
||||
|
||||
@ -34,7 +50,7 @@
|
||||
</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">
|
||||
<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>
|
||||
|
||||
@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')
|
||||
<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
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user