diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index f3731531734d..bbe92d1e7be0 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -516,9 +516,10 @@ class CompanySettings extends BaseSettings public $quote_late_fee_amount1 = 0; public $quote_late_fee_percent1 = 0; - + public string $payment_flow = 'default'; //smooth public static $casts = [ + 'payment_flow' => 'string', 'enable_quote_reminder1' => 'bool', 'quote_num_days_reminder1' => 'int', 'quote_schedule_reminder1' => 'string', diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index ca2f7fee3152..2a22627d8491 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -79,13 +79,16 @@ class InvoiceController extends Controller 'hash' => $hash, 'variables' => $variables, 'invoices' => [$invoice->hashed_id], + 'db' => $invoice->company->db, ]; if ($request->query('mode') === 'fullscreen') { return render('invoices.show-fullscreen', $data); } - return $this->render('invoices.show_smooth', $data); + return auth()->guard('contact')->user()->client->getSetting('payment_flow') == 'default' ? $this->render('invoices.show', $data) : $this->render('invoices.show_smooth', $data); + + // return $this->render('invoices.show_smooth', $data); } public function showBlob($hash) @@ -237,9 +240,12 @@ class InvoiceController extends Controller 'hashed_ids' => $invoices->pluck('hashed_id'), 'total' => $total, 'variables' => $variables, + 'invitation' => $invitation, + 'db' => $invitation->company->db, ]; - return $this->render('invoices.payment', $data); + // return $this->render('invoices.payment', $data); + return auth()->guard('contact')->user()->client->getSetting('payment_flow') === 'default' ? $this->render('invoices.payment', $data) : $this->render('invoices.show_smooth_multi', $data); } /** diff --git a/app/Livewire/Flow2/InvoicePay.php b/app/Livewire/Flow2/InvoicePay.php index a7154a7eac7e..6a71c98d6ec8 100644 --- a/app/Livewire/Flow2/InvoicePay.php +++ b/app/Livewire/Flow2/InvoicePay.php @@ -238,9 +238,12 @@ class InvoicePay extends Component $this->setContext('settings', $settings); // $this->context['settings'] = $settings; $this->setContext('db', $this->db); // $this->context['db'] = $this->db; - $invoices = Invoice::find($this->transformKeys($this->invoices)); + nlog($this->invoices); + + if(is_array($this->invoices)) + $this->invoices = Invoice::find($this->transformKeys($this->invoices)); - $invoices = $invoices->filter(function ($i) { + $invoices = $this->invoices->filter(function ($i) { $i = $i->service() ->markSent() ->removeUnpaidGatewayFees() diff --git a/app/Livewire/Flow2/InvoiceSummary.php b/app/Livewire/Flow2/InvoiceSummary.php index cf0f346d9030..51681737b240 100644 --- a/app/Livewire/Flow2/InvoiceSummary.php +++ b/app/Livewire/Flow2/InvoiceSummary.php @@ -20,12 +20,12 @@ class InvoiceSummary extends Component { use WithSecureContext; - public $invoice; + public $invoices; public function mount() { //@TODO for a single invoice - show all details, for multi-invoices, only show the summaries - $this->invoice = $this->getContext()['invitation']->invoice; // $this->context['invitation']->invoice; + $this->invoices = $this->getContext()['invoices']; // $this->context['invitation']->invoice; } #[On(self::CONTEXT_UPDATE)] @@ -33,13 +33,15 @@ class InvoiceSummary extends Component { // refactor logic for updating the price for eg if it changes with under/over pay - $this->invoice = $this->getContext()['invitation']->invoice; + $this->invoices = $this->getContext()['invoices']; } public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View { - return render('flow2.invoice-summary', [ - 'invoice' => $this->invoice + return render('flow2.invoices-summary', [ + 'invoice' => $this->invoices, + 'client' => $this->invoices->first()->client, ]); + } } diff --git a/app/Livewire/Flow2/Terms.php b/app/Livewire/Flow2/Terms.php index 8aedbb4ec96a..95de13bd3ae9 100644 --- a/app/Livewire/Flow2/Terms.php +++ b/app/Livewire/Flow2/Terms.php @@ -25,7 +25,7 @@ class Terms extends Component public function mount() { - $this->invoice = $this->getContext()['invoice']; + $this->invoice = $this->getContext()['invoices']->first(); $this->variables = $this->getContext()['variables']; } diff --git a/app/Services/ClientPortal/LivewireInstantPayment.php b/app/Services/ClientPortal/LivewireInstantPayment.php index 43bd6d2bdc96..91cf490d2635 100644 --- a/app/Services/ClientPortal/LivewireInstantPayment.php +++ b/app/Services/ClientPortal/LivewireInstantPayment.php @@ -89,6 +89,8 @@ class LivewireInstantPayment public function run() { + nlog($this->data); + $company_gateway = CompanyGateway::query()->find($this->data['company_gateway_id']); if ($this->data['company_gateway_id'] == CompanyGateway::GATEWAY_CREDIT) { diff --git a/resources/views/portal/ninja2020/flow2/invoice-summary.blade.php b/resources/views/portal/ninja2020/flow2/invoice-summary.blade.php deleted file mode 100644 index 005637a57f6f..000000000000 --- a/resources/views/portal/ninja2020/flow2/invoice-summary.blade.php +++ /dev/null @@ -1,67 +0,0 @@ -
{{ ctrans('texts.date') }}: {{ $invoice->translateDate($invoice->date, $invoice->client->date_format(), $invoice->client->locale()) }}
-