reference full blade path using render

This commit is contained in:
karneaud 2024-06-26 21:28:53 -04:00
parent eb3968a9eb
commit f03142a834
5 changed files with 20 additions and 15 deletions

View File

@ -5,18 +5,24 @@ namespace App\Http\ViewComposers\Components;
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 array $contact;
public function __construct(array $contact) {
$this->contact = $contact;
$this->attributes = $this->newAttributeBag(Arr::only($this->contact, $this->fields) );
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' => null
] )->all();
$this->attributes = $this->newAttributeBag(Arr::only($contact, $this->fields) );
}
private $fields = [
@ -37,7 +43,7 @@ class ContactComponent extends Component
public function render()
{
return $this->view('rotessa::components.contact', $this->attributes->getAttributes(), $this->defaults );
return render('gateways.rotessa.components.contact', array_merge($this->defaults, $this->attributes->getAttributes() ) );
}
}
@ -75,8 +81,7 @@ class AddressComponent extends Component
public function render()
{
return $this->view('rotessa::components.address', $this->attributes->getAttributes(), $this->defaults );
return render('gateways.rotessa.components.address',array_merge( $this->defaults, $this->attributes->getAttributes() ) );
}
}
@ -113,6 +118,6 @@ class AccountComponent extends Component
public function render()
{
return $this->view('rotessa::components.account', $this->attributes->getAttributes(), $this->defaults );
return render('gateways.rotessa.components.account', array_merge($this->attributes->getAttributes(), $this->defaults) );
}
}

View File

@ -4,13 +4,13 @@ use Illuminate\Support\Facades\View;
use App\DataProviders\CAProvinces;
use App\DataProviders\USStates;
View::composer(['rotessa::components.address','rotessa::components.banks.US.bank','rotessa::components.dropdowns.country.US'], function ($view) {
View::composer(['*.rotessa.components.address','*.rotessa.components.banks.US.bank','*.rotessa.components.dropdowns.country.US'], function ($view) {
$states = USStates::get();
$view->with('states', $states);
});
// CAProvinces View Composer
View::composer(['rotessa::components.address','rotessa::components.banks.CA.bank','rotessa::components.dropdowns.country.CA'], function ($view) {
View::composer(['*.rotessa.components.address','*.rotessa.components.banks.CA.bank','*.rotessa.components.dropdowns.country.CA'], function ($view) {
$provinces = CAProvinces::get();
$view->with('provinces', $provinces);
});

View File

@ -67,7 +67,7 @@ class PaymentMethod implements MethodInterface
];
$data['address'] = collect($data['client']->toArray())->merge(['country' => $data['client']->country->iso_3166_2 ])->all();
return view('rotessa::bank_transfer.authorize', $data);
return render('gateways.rotessa.bank_transfer.authorize', $data );
}
/**
* Handle the authorization page for Rotessa.
@ -128,7 +128,7 @@ class PaymentMethod implements MethodInterface
$data['frequency'] = Frequencies::getOnePayment();
$data['installments'] = 1;
$data['invoice_nums'] = $data['invoices']->pluck('invoice_number')->join(', ');
return view('rotessa::bank_transfer.pay', $data );
return render('gateways.rotessa.bank_transfer.pay', $data );
}
/**

View File

@ -28,4 +28,4 @@
<input type="hidden" name="authorization_type" id="authorization_type" value="{{ old('authorization_type',$authorization_type) }}" >
@include("rotessa::components.banks.$country.bank", compact('bank_account_type','routing_number','institution_number','transit_number'))
@include("portal.ninja2020.gateways.rotessa.components.banks.$country.bank", compact('bank_account_type','routing_number','institution_number','transit_number'))

View File

@ -59,4 +59,4 @@
</dd>
</div>
@include("rotessa::components.dropdowns.country.$country",compact('province_code'))
@include("portal.ninja2020.gateways.rotessa.components.dropdowns.country.$country",compact('province_code'))