mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:44:28 -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 = [];
|
$local_status = [];
|
||||||
|
|
||||||
$query = Invoice::query()
|
$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')
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||||
->where('company_id', $this->company->id)
|
->where('company_id', $this->company->id)
|
||||||
->where('is_deleted', false);
|
->where('is_deleted', false);
|
||||||
|
@ -33,7 +33,7 @@ class Locale
|
|||||||
$locale = $request->input('lang');
|
$locale = $request->input('lang');
|
||||||
App::setLocale($locale);
|
App::setLocale($locale);
|
||||||
} elseif (auth()->guard('contact')->user()) {
|
} 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()) {
|
} elseif (auth()->user()) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
@ -258,7 +258,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$payment->client_contact_id = $client_contact_id;
|
$payment->client_contact_id = $client_contact_id;
|
||||||
$payment->saveQuietly();
|
$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]) )
|
if(!in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]) )
|
||||||
return $payment;
|
return $payment;
|
||||||
|
|
||||||
|
@ -70,25 +70,24 @@ class PaymentMethod
|
|||||||
|
|
||||||
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||||
|
|
||||||
$this->gateways = $this->client
|
$this->gateways =
|
||||||
->company
|
CompanyGateway::with('gateway')
|
||||||
->company_gateways
|
->where('company_id', $this->client->company_id)
|
||||||
->whereIn('id', $transformed_ids)
|
->whereIn('id', $transformed_ids)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
->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
|
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||||
});
|
})->get();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->gateways = $this->client
|
$this->gateways = CompanyGateway::with('gateway')
|
||||||
->company
|
->where('company_id', $this->client->company_id)
|
||||||
->company_gateways
|
|
||||||
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->whereNull('deleted_at')
|
->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));
|
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
|
||||||
|
|
||||||
$this->gateways = $this->client
|
$this->gateways = CompanyGateway::with('gateway')
|
||||||
->company
|
->where('company_id', $this->client->company_id)
|
||||||
->company_gateways
|
|
||||||
->whereIn('id', $transformed_ids)
|
->whereIn('id', $transformed_ids)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
|
->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
|
return array_search($model->id, $transformed_ids);// this closure sorts for us
|
||||||
});
|
})->get();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->gateways = $this->client
|
$this->gateways = CompanyGateway::with('gateway')
|
||||||
->company
|
->where('company_id', $this->client->company_id)
|
||||||
->company_gateways
|
|
||||||
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->where('is_deleted', false);
|
->where('is_deleted', false)->get();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,23 +87,6 @@ class UpdateInvoicePayment
|
|||||||
|
|
||||||
$this->payment->applied += $paid_amount;
|
$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 */
|
/* Remove the event updater from within the loop to prevent race conditions */
|
||||||
|
@ -105,18 +105,5 @@
|
|||||||
|
|
||||||
var clipboard = new ClipboardJS('.btn');
|
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>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user