mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improvements fo reactivity
This commit is contained in:
parent
6f5a08f87d
commit
aa5695ac45
@ -25,23 +25,23 @@ class PaymentMethod extends Component
|
|||||||
|
|
||||||
public $methods = [];
|
public $methods = [];
|
||||||
|
|
||||||
public $isLoading = false;
|
public $isLoading = true;
|
||||||
|
|
||||||
// public function placeholder()
|
public function placeholder()
|
||||||
// {
|
{
|
||||||
// return <<<'HTML'
|
return <<<'HTML'
|
||||||
// <div class="flex items-center justify-center min-h-screen">
|
<div class="flex items-center justify-center min-h-screen">
|
||||||
// <svg class="animate-spin h-10 w-10 text-gray-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
<svg class="animate-spin h-10 w-10 text-gray-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||||
// <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||||
// <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||||
// </svg>
|
</svg>
|
||||||
// </div>
|
</div>
|
||||||
// HTML;
|
HTML;
|
||||||
// }
|
}
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
// $this->isLoading = true;
|
|
||||||
$this->invoice = $this->context['invoice'];
|
$this->invoice = $this->context['invoice'];
|
||||||
$this->variables = $this->context['variables'];
|
$this->variables = $this->context['variables'];
|
||||||
|
|
||||||
@ -49,13 +49,13 @@ class PaymentMethod extends Component
|
|||||||
|
|
||||||
$this->methods = $this->invoice->client->service()->getPaymentMethods($this->invoice->balance);
|
$this->methods = $this->invoice->client->service()->getPaymentMethods($this->invoice->balance);
|
||||||
|
|
||||||
// $this->isLoading = false;
|
|
||||||
// $this->dispatch('loadingCompleted');
|
|
||||||
|
|
||||||
if(count($this->methods) == 1) {
|
if(count($this->methods) == 1) {
|
||||||
$this->dispatch('singlePaymentMethodFound', company_gateway_id: $this->methods[0]['company_gateway_id'], gateway_type_id: $this->methods[0]['gateway_type_id'], amount: $this->invoice->balance);
|
$this->dispatch('singlePaymentMethodFound', company_gateway_id: $this->methods[0]['company_gateway_id'], gateway_type_id: $this->methods[0]['gateway_type_id'], amount: $this->invoice->balance);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->isLoading = false;
|
||||||
|
$this->dispatch('loadingCompleted');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
@ -34,6 +34,9 @@ class ProcessPayment extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
nlog($this->isLoading);
|
||||||
|
|
||||||
|
nlog("inside Process Payment");
|
||||||
MultiDB::setDb($this->context['invoice']->company->db);
|
MultiDB::setDb($this->context['invoice']->company->db);
|
||||||
|
|
||||||
$invitation = InvoiceInvitation::find($this->context['invitation_id']);
|
$invitation = InvoiceInvitation::find($this->context['invitation_id']);
|
||||||
@ -114,6 +117,7 @@ class ProcessPayment extends Component
|
|||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
nlog($this->isLoading);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +88,9 @@ class InvoicePay extends Component
|
|||||||
#[On('payment-method-selected')]
|
#[On('payment-method-selected')]
|
||||||
public function paymentMethodSelected($company_gateway_id, $gateway_type_id, $amount)
|
public function paymentMethodSelected($company_gateway_id, $gateway_type_id, $amount)
|
||||||
{
|
{
|
||||||
|
nlog("payment method selected inside InvoicePay");
|
||||||
|
|
||||||
|
$this->payment_method_accepted = true;
|
||||||
|
|
||||||
$this->context['company_gateway_id'] = $company_gateway_id;
|
$this->context['company_gateway_id'] = $company_gateway_id;
|
||||||
$this->context['gateway_type_id'] = $gateway_type_id;
|
$this->context['gateway_type_id'] = $gateway_type_id;
|
||||||
@ -98,8 +101,7 @@ class InvoicePay extends Component
|
|||||||
$this->context['invitation_id'] = $this->invitation_id;
|
$this->context['invitation_id'] = $this->invitation_id;
|
||||||
|
|
||||||
// $this->invite = \App\Models\InvoiceInvitation::withTrashed()->find($this->invitation_id)->withoutRelations();
|
// $this->invite = \App\Models\InvoiceInvitation::withTrashed()->find($this->invitation_id)->withoutRelations();
|
||||||
$this->payment_method_accepted =true;
|
$this->component();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,13 +121,16 @@ class InvoicePay extends Component
|
|||||||
return PaymentMethod::class;
|
return PaymentMethod::class;
|
||||||
|
|
||||||
// if($this->ready)
|
// if($this->ready)
|
||||||
|
|
||||||
|
nlog("computed");
|
||||||
|
|
||||||
return ProcessPayment::class;
|
return ProcessPayment::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Computed()]
|
#[Computed()]
|
||||||
public function componentUniqueId(): string
|
public function componentUniqueId(): string
|
||||||
{
|
{
|
||||||
return "purchase-".md5(time());
|
return "purchase-".md5(microtime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user