Fixes for auto submitting the form

This commit is contained in:
Benjamin Beganović 2024-04-02 13:12:30 +02:00
parent 639708997d
commit c532a43e70

View File

@ -12,7 +12,6 @@
namespace App\Livewire;
use App\Models\Client;
use App\Models\Invoice;
use Livewire\Component;
use App\Libraries\MultiDB;
@ -187,6 +186,7 @@ class RequiredClientInfo extends Component
public $company_gateway_id;
public bool $form_only = false;
public $db;
public function mount()
@ -377,7 +377,6 @@ $_contact->push();
public function checkFields()
{
MultiDB::setDb($this->db);
$_contact = ClientContact::withTrashed()->find($this->contact_id);
@ -385,7 +384,10 @@ $_contact->push();
$_field = $this->mappings[$field['name']];
if (Str::startsWith($field['name'], 'client_')) {
if (empty($_contact->client->{$_field}) || is_null($_contact->client->{$_field}) || in_array($_field, $this->client_address_array)) {
if (empty($_contact->client->{$_field})
|| is_null($_contact->client->{$_field})
// || in_array($_field, $this->client_address_array)
) {
$this->show_form = true;
} else {
$this->fields[$index]['filled'] = true;