added new blade component for payment_method ( #8669hjyqw )
This commit is contained in:
parent
831864f29a
commit
6b2cba6e61
81
app/View/Components/PaymentMethod.php
Normal file
81
app/View/Components/PaymentMethod.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Abstracts\View\Component;
|
||||
use App\Utilities\Modules;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PaymentMethod extends Component
|
||||
{
|
||||
public $code, $method;
|
||||
|
||||
public $payment_methods;
|
||||
|
||||
public $payment_method;
|
||||
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
$code = null, $method = null, string $payment_method = null, array $payment_methods = [], $type = null
|
||||
) {
|
||||
$this->code = $code;
|
||||
$this->method = $method;
|
||||
$this->type = $type;
|
||||
|
||||
$this->payment_methods = $this->getPaymentMethods($payment_methods, $type);
|
||||
$this->payment_method = $this->getPaymentMethod($payment_method, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.payment_method');
|
||||
}
|
||||
|
||||
protected function getPaymentMethods($payment_methods, $type)
|
||||
{
|
||||
if (! empty($payment_methods)) {
|
||||
return $payment_methods;
|
||||
}
|
||||
|
||||
// check here protal or admin panel..
|
||||
if (empty($type)) {
|
||||
$type = Str::contains(request()->route()->getName(), 'portal') ? 'customer' : 'all';
|
||||
}
|
||||
|
||||
$payment_methods = Modules::getPaymentMethods($type);
|
||||
|
||||
return $payment_methods;
|
||||
}
|
||||
|
||||
protected function getPaymentMethod($payment_method, $code)
|
||||
{
|
||||
if (! empty($payment_methods)) {
|
||||
return $payment_methods;
|
||||
}
|
||||
|
||||
if (! empty($this->payment_methods[$code])) {
|
||||
return $this->payment_methods[$code];
|
||||
}
|
||||
|
||||
if (! empty($this->payment_methods[$this->method])) {
|
||||
return $this->payment_methods[$this->method];
|
||||
}
|
||||
|
||||
if (! empty($this->payment_methods[$payment_method])) {
|
||||
return $this->payment_methods[$payment_method];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
5
resources/views/components/payment_method.blade.php
Normal file
5
resources/views/components/payment_method.blade.php
Normal file
@ -0,0 +1,5 @@
|
||||
@if (! empty($payment_method))
|
||||
{!! $payment_method !!}
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
@ -132,11 +132,7 @@
|
||||
</td>
|
||||
|
||||
<td valign="top" class="border-bottom-dashed-black" style="width:70%; margin: 0px; padding: 8px 0 0 0; font-size: 12px;">
|
||||
@if (! empty($payment_methods[$transaction->payment_method]))
|
||||
{!! $payment_methods[$transaction->payment_method] !!}
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
||||
<x-payment-method :method="$transaction->payment_method" />
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
|
@ -214,11 +214,7 @@
|
||||
</td>
|
||||
|
||||
<td valign="top" valign="top" class="border-bottom-dashed-black" style="width:70%; margin: 0px; padding: 8px 0 0 0; font-size: 12px;">
|
||||
@if (! empty($payment_methods[$transfer->expense_transaction->payment_method]))
|
||||
{!! $payment_methods[$transfer->expense_transaction->payment_method] !!}
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
||||
<x-payment-method :method="$transfer->expense_transaction->payment_method" />
|
||||
</td>
|
||||
</tr>
|
||||
@stack('payment_method_input_end')
|
||||
|
@ -30,11 +30,7 @@
|
||||
</td>
|
||||
|
||||
<td valign="top" style="width:70%; margin: 0px; padding: 8px 0 8px 0; font-size: 12px; border-bottom:1px solid #adadad;">
|
||||
@if (! empty($payment_methods[$transfer->expense_transaction->payment_method]))
|
||||
{!! $payment_methods[$transfer->expense_transaction->payment_method] !!}
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
||||
<x-payment-method :method="$transfer->expense_transaction->payment_method" />
|
||||
</td>
|
||||
</tr>
|
||||
@stack('payment_method_input_end')
|
||||
|
@ -41,11 +41,7 @@
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="w-4/12 sm:w-3/12">
|
||||
@if (! empty($payment_methods[$item->payment_method]))
|
||||
{!! $payment_methods[$item->payment_method] !!}
|
||||
@else
|
||||
<x-empty-data />
|
||||
@endif
|
||||
<x-payment-method :method="$item->payment_method" type="customer" />
|
||||
</x-table.td>
|
||||
|
||||
<x-table.td class="w-3/12" hidden-mobile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user