diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index 36bf35237512..d5b75448e884 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -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); diff --git a/app/Http/Middleware/Locale.php b/app/Http/Middleware/Locale.php index e43d6d7ff7ee..771d926f87dc 100644 --- a/app/Http/Middleware/Locale.php +++ b/app/Http/Middleware/Locale.php @@ -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{ diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 0c52bb90819c..4cf6aa938587 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -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; diff --git a/app/Services/Client/PaymentMethod.php b/app/Services/Client/PaymentMethod.php index 4eee1a235ef2..4a18387d2215 100644 --- a/app/Services/Client/PaymentMethod.php +++ b/app/Services/Client/PaymentMethod.php @@ -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(); } diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 5a6a2a23921e..7065705c28bb 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -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 */ diff --git a/resources/views/portal/ninja2020/invoices/show.blade.php b/resources/views/portal/ninja2020/invoices/show.blade.php index a9401ca1ef16..f374b14593ad 100644 --- a/resources/views/portal/ninja2020/invoices/show.blade.php +++ b/resources/views/portal/ninja2020/invoices/show.blade.php @@ -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); - // }); - @endsection