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->agentId = $this->availableAgents[0]['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->setCurrentContactIndex(0);
|
$this->setCurrentContactIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +167,9 @@ public function updated($propertyName)
|
|||||||
{
|
{
|
||||||
$this->status = FormStatus::IN_PROCESS;
|
$this->status = FormStatus::IN_PROCESS;
|
||||||
$this->validateOnly($propertyName);
|
$this->validateOnly($propertyName);
|
||||||
|
if ($propertyName === 'complexId') {
|
||||||
|
$this->dispatch('client_form_complex_updated', complexId: $this->complexId);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Livewire\Attributes\Reactive;
|
use Livewire\Attributes\Reactive;
|
||||||
|
use Livewire\Attributes\On;
|
||||||
use Modules\Main\Models\Complex;
|
use Modules\Main\Models\Complex;
|
||||||
|
|
||||||
class Plan7SelectorLivewire extends Component
|
class Plan7SelectorLivewire extends Component
|
||||||
@ -27,6 +28,7 @@ public function mount()
|
|||||||
$this->containerId = $this->containerId . '__' . $this->complexId;
|
$this->containerId = $this->containerId . '__' . $this->complexId;
|
||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
|
#[On('client_form_complex_updated')]
|
||||||
public function load() {
|
public function load() {
|
||||||
if ($plan7ApiData = Complex::find($this->complexId)->getPlan7ApiData()) {
|
if ($plan7ApiData = Complex::find($this->complexId)->getPlan7ApiData()) {
|
||||||
$this->apiSummary = 'https://plan7.ru/catalog/exp/json/summary/?token=' . $plan7ApiData->token . '&zk=' . $plan7ApiData->zk;
|
$this->apiSummary = 'https://plan7.ru/catalog/exp/json/summary/?token=' . $plan7ApiData->token . '&zk=' . $plan7ApiData->zk;
|
||||||
@ -35,13 +37,6 @@ public function load() {
|
|||||||
$this->getData();
|
$this->getData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function updating($property, $value)
|
|
||||||
{
|
|
||||||
if ($property == 'complexId') {
|
|
||||||
$this->load();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getSummary() {
|
private function getSummary() {
|
||||||
$URL = $this->apiSummary;
|
$URL = $this->apiSummary;
|
||||||
$opt = [];
|
$opt = [];
|
||||||
@ -80,7 +75,6 @@ public function setHouse($id)
|
|||||||
public function setRoom($id)
|
public function setRoom($id)
|
||||||
{
|
{
|
||||||
$this->room = $this->allObjects['data'][$id];
|
$this->room = $this->allObjects['data'][$id];
|
||||||
//$this->filter['id'] = $id;
|
|
||||||
}
|
}
|
||||||
public function unsetRoom() {
|
public function unsetRoom() {
|
||||||
$this->room = false;
|
$this->room = false;
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div>
|
<div>
|
||||||
|
{{ $cAct }}
|
||||||
<button type="button" wire:click="start()" class="btn btn-primary"
|
<button type="button" wire:click="start()" class="btn btn-primary"
|
||||||
onclick="plan7SelectorModal = new bootstrap.Modal(document.getElementById('plan7_selector_modal'), {});plan7SelectorModal.show()">
|
onclick="plan7SelectorModal = new bootstrap.Modal(document.getElementById('plan7_selector_modal'), {});plan7SelectorModal.show()">
|
||||||
@if($room)
|
@if($room)
|
||||||
@ -22,9 +23,7 @@
|
|||||||
@else
|
@else
|
||||||
Выбрать помещение
|
Выбрать помещение
|
||||||
@endif
|
@endif
|
||||||
[{{ $complexId }}]
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user