diff --git a/app/Modules/ClientCreateForm/Http/Livewire/ClientCreateLivewire.php b/app/Modules/ClientCreateForm/Http/Livewire/ClientCreateLivewire.php index e40f1c0..5776345 100644 --- a/app/Modules/ClientCreateForm/Http/Livewire/ClientCreateLivewire.php +++ b/app/Modules/ClientCreateForm/Http/Livewire/ClientCreateLivewire.php @@ -79,7 +79,6 @@ public function mount() $this->agentId = $this->availableAgents[0]['id']; } - $this->setCurrentContactIndex(0); } @@ -168,6 +167,9 @@ public function updated($propertyName) { $this->status = FormStatus::IN_PROCESS; $this->validateOnly($propertyName); + if ($propertyName === 'complexId') { + $this->dispatch('client_form_complex_updated', complexId: $this->complexId); + } try { $this->validate(); diff --git a/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php b/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php index 0548c88..932fbfd 100644 --- a/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php +++ b/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php @@ -4,6 +4,7 @@ use Livewire\Component; use Livewire\Attributes\Reactive; +use Livewire\Attributes\On; use Modules\Main\Models\Complex; class Plan7SelectorLivewire extends Component @@ -27,6 +28,7 @@ public function mount() $this->containerId = $this->containerId . '__' . $this->complexId; $this->load(); } + #[On('client_form_complex_updated')] public function load() { if ($plan7ApiData = Complex::find($this->complexId)->getPlan7ApiData()) { $this->apiSummary = 'https://plan7.ru/catalog/exp/json/summary/?token=' . $plan7ApiData->token . '&zk=' . $plan7ApiData->zk; @@ -35,13 +37,6 @@ public function load() { $this->getData(); } } - public function updating($property, $value) - { - if ($property == 'complexId') { - $this->load(); - } - } - private function getSummary() { $URL = $this->apiSummary; $opt = []; @@ -80,7 +75,6 @@ public function setHouse($id) public function setRoom($id) { $this->room = $this->allObjects['data'][$id]; - //$this->filter['id'] = $id; } public function unsetRoom() { $this->room = false; diff --git a/app/Modules/Plan7/Views/livewire/selector.blade.php b/app/Modules/Plan7/Views/livewire/selector.blade.php index 2a58ef0..523a786 100644 --- a/app/Modules/Plan7/Views/livewire/selector.blade.php +++ b/app/Modules/Plan7/Views/livewire/selector.blade.php @@ -15,6 +15,7 @@ @endif
+ {{ $cAct }} -