mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\ViewComposers\Components\Rotessa;
|
|
|
|
use App\DataProviders\CAProvinces;
|
|
use App\DataProviders\USStates;
|
|
use Illuminate\View\Component;
|
|
use App\Models\ClientContact;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\View\View;
|
|
|
|
|
|
// Contact Component
|
|
class ContactComponent extends Component
|
|
{
|
|
|
|
public function __construct(ClientContact $contact) {
|
|
|
|
$contact = collect($contact->client->contacts->firstWhere('is_primary', 1)->toArray())->merge([
|
|
'home_phone' =>$contact->client->phone,
|
|
'custom_identifier' => $contact->client->number,
|
|
'name' =>$contact->client->name,
|
|
'id' => $contact->client->contact_key,
|
|
] )->all();
|
|
|
|
$this->attributes = $this->newAttributeBag(Arr::only($contact, $this->fields) );
|
|
}
|
|
|
|
private $fields = [
|
|
'name',
|
|
'email',
|
|
'home_phone',
|
|
'phone',
|
|
'custom_identifier',
|
|
'customer_type' ,
|
|
'id'
|
|
];
|
|
|
|
private $defaults = [
|
|
'customer_type' => "Business",
|
|
'custom_identifier' => null,
|
|
'customer_id' => null
|
|
];
|
|
|
|
public function render()
|
|
{
|
|
\Debugbar::debug($this->attributes->getAttributes() + $this->defaults);
|
|
return render('gateways.rotessa.components.contact', $this->attributes->getAttributes() + $this->defaults );
|
|
}
|
|
}
|