From 4f376de0a522e69215c25bf0ae7fe64d542d179e Mon Sep 17 00:00:00 2001 From: developer Date: Fri, 3 Apr 2026 12:21:01 +0800 Subject: [PATCH] =?UTF-8?q?plan7=20selector=20-=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20api=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Livewire/ClientCreateLivewire.php | 4 +++- .../Plan7/Http/Livewire/Plan7SelectorLivewire.php | 10 ++-------- app/Modules/Plan7/Views/livewire/selector.blade.php | 3 +-- 3 files changed, 6 insertions(+), 11 deletions(-) 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 }} -