plan7 selector - добавлена админка для сохранения api данных
This commit is contained in:
parent
53f2914d27
commit
4f376de0a5
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
{{ $cAct }}
|
||||
<button type="button" wire:click="start()" class="btn btn-primary"
|
||||
onclick="plan7SelectorModal = new bootstrap.Modal(document.getElementById('plan7_selector_modal'), {});plan7SelectorModal.show()">
|
||||
@if($room)
|
||||
@ -22,9 +23,7 @@
|
||||
@else
|
||||
Выбрать помещение
|
||||
@endif
|
||||
[{{ $complexId }}]
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user