mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:04:41 -04:00
Performance improvements for client portal
This commit is contained in:
parent
84c03e3db6
commit
9c106e8d0a
@ -43,7 +43,7 @@ class InvoicesTable extends Component
|
||||
$local_status = [];
|
||||
|
||||
$query = Invoice::query()
|
||||
->with('client.gateway_tokens','company','client.contacts')
|
||||
->with('client.gateway_tokens','client.contacts')
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', false);
|
||||
|
@ -33,7 +33,7 @@ class Locale
|
||||
$locale = $request->input('lang');
|
||||
App::setLocale($locale);
|
||||
} elseif (auth()->guard('contact')->user()) {
|
||||
App::setLocale(auth()->guard('contact')->user()->client->locale());
|
||||
App::setLocale(auth()->guard('contact')->user()->client()->setEagerLoads([])->first()->locale());
|
||||
} elseif (auth()->user()) {
|
||||
|
||||
try{
|
||||
|
@ -258,7 +258,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$payment->client_contact_id = $client_contact_id;
|
||||
$payment->saveQuietly();
|
||||
|
||||
/* Return early if the payment is no completed or pending*/
|
||||
/* Return early if the payment is not completed or pending*/
|
||||
if(!in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]) )
|
||||
return $payment;
|
||||
|
||||
|
@ -70,25 +70,24 @@ class PaymentMethod
|
||||
|
||||
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
$this->gateways =
|
||||
CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
->whereIn('id', $transformed_ids)
|
||||
->where('is_deleted', false)
|
||||
->whereNull('deleted_at')
|
||||
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
||||
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||
});
|
||||
})->get();
|
||||
|
||||
} else {
|
||||
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
$this->gateways = CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->whereNull('deleted_at')
|
||||
->where('is_deleted', false);
|
||||
->where('is_deleted', false)->get();
|
||||
|
||||
}
|
||||
|
||||
@ -106,25 +105,23 @@ class PaymentMethod
|
||||
|
||||
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
$this->gateways = CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
->whereIn('id', $transformed_ids)
|
||||
->where('is_deleted', false)
|
||||
->whereNull('deleted_at')
|
||||
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
||||
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||
});
|
||||
})->get();
|
||||
|
||||
} else {
|
||||
|
||||
$this->gateways = $this->client
|
||||
->company
|
||||
->company_gateways
|
||||
$this->gateways = CompanyGateway::with('gateway')
|
||||
->where('company_id', $this->client->company_id)
|
||||
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||
->whereNull('deleted_at')
|
||||
->where('is_deleted', false);
|
||||
->where('is_deleted', false)->get();
|
||||
|
||||
}
|
||||
|
||||
|
@ -87,23 +87,6 @@ class UpdateInvoicePayment
|
||||
|
||||
$this->payment->applied += $paid_amount;
|
||||
|
||||
// $invoice->service() //caution what if we amount paid was less than partial - we wipe it!
|
||||
// ->clearPartial()
|
||||
// ->updateBalance($paid_amount * -1)
|
||||
// ->updatePaidToDate($paid_amount)
|
||||
// ->updateStatus()
|
||||
// ->save();
|
||||
|
||||
// $invoice->refresh();
|
||||
|
||||
// $invoice->service()
|
||||
// ->touchPdf(true)
|
||||
// ->workFlow()
|
||||
// ->save();
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
/* Remove the event updater from within the loop to prevent race conditions */
|
||||
|
@ -105,18 +105,5 @@
|
||||
|
||||
var clipboard = new ClipboardJS('.btn');
|
||||
|
||||
// clipboard.on('success', function(e) {
|
||||
// console.info('Action:', e.action);
|
||||
// console.info('Text:', e.text);
|
||||
// console.info('Trigger:', e.trigger);
|
||||
|
||||
// e.clearSelection();
|
||||
// });
|
||||
|
||||
// clipboard.on('error', function(e) {
|
||||
// console.error('Action:', e.action);
|
||||
// console.error('Trigger:', e.trigger);
|
||||
// });
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
Loading…
x
Reference in New Issue
Block a user