1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Fixes for required fields

This commit is contained in:
David Bomba 2022-03-08 23:33:20 +11:00
parent 6a34ee3064
commit 6c2c0bd408
5 changed files with 21 additions and 8 deletions

View File

@ -28,6 +28,8 @@ class RequiredClientInfo extends Component
*/ */
public $contact; public $contact;
public $client;
/** /**
* @var array * @var array
*/ */
@ -65,14 +67,23 @@ class RequiredClientInfo extends Component
]; ];
public $client_address_array = [ public $client_address_array = [
'address_line_1', 'address1',
'address_line_2', 'address2',
'city', 'city',
'state', 'state',
'postal_code', 'postal_code',
'country_id', 'country_id',
]; ];
protected $rules = [
'client.address1' => '',
'client.address2' => '',
'client.city' => '',
'client.state' => '',
'client.postal_code' => '',
'client.country_id' => '',
];
public $show_form = false; public $show_form = false;
public $company; public $company;
@ -80,6 +91,8 @@ class RequiredClientInfo extends Component
public function mount() public function mount()
{ {
MultiDB::setDb($this->company->db); MultiDB::setDb($this->company->db);
$this->client = $this->contact->client;
} }
public function handleSubmit(array $data): bool public function handleSubmit(array $data): bool

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=9a36ebbddb8dd0aa91b1"} {"/livewire.js":"/livewire.js?id=940557fc56b15ccb9a2d"}

View File

@ -15,7 +15,7 @@
@if(!array_key_exists('filled', $field)) @if(!array_key_exists('filled', $field))
@component('portal.ninja2020.components.general.card-element', ['title' => $field['label']]) @component('portal.ninja2020.components.general.card-element', ['title' => $field['label']])
@if($field['name'] == 'client_country_id' || $field['name'] == 'client_shipping_country_id') @if($field['name'] == 'client_country_id' || $field['name'] == 'client_shipping_country_id')
<select id="client_country" class="input w-full form-select" name="{{ $field['name'] }}"> <select id="client_country" class="input w-full form-select" name="{{ $field['name'] }}" wire:model="{{ str_replace(["client_","_line_"], ["client.",""], $field['name']) }}">
<option value="none"></option> <option value="none"></option>
@foreach($countries as $country) @foreach($countries as $country)
@ -25,7 +25,7 @@
@endforeach @endforeach
</select> </select>
@else @else
<input class="input w-full" type="{{ $field['type'] ?? 'text' }}" name="{{ $field['name'] }}"> <input class="input w-full" type="{{ $field['type'] ?? 'text' }}" name="{{ $field['name'] }}" wire:model="{{ str_replace(["client_","_line_"], ["client.",""], $field['name']) }}">
@endif @endif
@if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors'))) @if(session()->has('validation_errors') && array_key_exists($field['name'], session('validation_errors')))