diff --git a/app/Http/Controllers/OnlinePaymentController.php b/app/Http/Controllers/OnlinePaymentController.php index ec35dfb68c71..d31078956c7c 100644 --- a/app/Http/Controllers/OnlinePaymentController.php +++ b/app/Http/Controllers/OnlinePaymentController.php @@ -330,6 +330,8 @@ class OnlinePaymentController extends BaseController $data = [ 'currency_id' => $account->currency_id, 'contact' => Input::all(), + 'custom_value1' => Input::get('custom_client1'), + 'custom_value2' => Input::get('custom_client2'), ]; $client = $clientRepo->save($data, $client); } @@ -343,6 +345,8 @@ class OnlinePaymentController extends BaseController 'start_date' => Input::get('start_date', date('Y-m-d')), 'tax_rate1' => $account->default_tax_rate ? $account->default_tax_rate->rate : 0, 'tax_name1' => $account->default_tax_rate ? $account->default_tax_rate->name : '', + 'custom_text_value1' => Input::get('custom_invoice1'), + 'custom_text_value2' => Input::get('custom_invoice2'), 'invoice_items' => [[ 'product_key' => $product->product_key, 'notes' => $product->notes, @@ -350,6 +354,8 @@ class OnlinePaymentController extends BaseController 'qty' => 1, 'tax_rate1' => $product->default_tax_rate ? $product->default_tax_rate->rate : 0, 'tax_name1' => $product->default_tax_rate ? $product->default_tax_rate->name : '', + 'custom_value1' => Input::get('custom_product1') ?: $product->custom_value1, + 'custom_value2' => Input::get('custom_product2') ?: $product->custom_value2, ]], ]; $invoice = $invoiceService->save($data); diff --git a/app/Ninja/Presenters/AccountPresenter.php b/app/Ninja/Presenters/AccountPresenter.php index 8dce6bdcd1b1..187e9f16f245 100644 --- a/app/Ninja/Presenters/AccountPresenter.php +++ b/app/Ninja/Presenters/AccountPresenter.php @@ -149,4 +149,28 @@ class AccountPresenter extends Presenter return $options; } + + public function customTextFields() + { + $fields = [ + 'custom_client_label1' => 'custom_client1', + 'custom_client_label2' => 'custom_client2', + 'custom_invoice_text_label1' => 'custom_invoice1', + 'custom_invoice_text_label2' => 'custom_invoice2', + 'custom_invoice_item_label1' => 'custom_product1', + 'custom_invoice_item_label2' => 'custom_product2', + ]; + $data = []; + + foreach ($fields as $key => $val) { + if ($this->$key) { + $data[$this->$key] = [ + 'value' => $val, + 'name' => $val, + ]; + } + } + + return $data; + } } diff --git a/resources/views/accounts/client_portal.blade.php b/resources/views/accounts/client_portal.blade.php index ac316345e8d1..7f46129eb260 100644 --- a/resources/views/accounts/client_portal.blade.php +++ b/resources/views/accounts/client_portal.blade.php @@ -240,6 +240,12 @@ ->inlineHelp('buy_now_buttons_warning') ->addGroupClass('product-select') !!} + @if (count($account->present()->customTextFields)) + {!! Former::inline_checkboxes('custom_fields') + ->onchange('updateBuyNowButtons()') + ->checkboxes($account->present()->customTextFields) !!} + @endif + {!! Former::inline_radios('landing_page') ->onchange('showPaymentTypes();updateBuyNowButtons();') ->radios([ @@ -426,6 +432,13 @@ iframe.src = '{{ rtrim(SITE_URL ,'/') }}/view/' var form = '