diff --git a/app/Modules/ClientCreateForm/Views/livewire/form.blade.php b/app/Modules/ClientCreateForm/Views/livewire/form.blade.php index df416a7..e599f85 100644 --- a/app/Modules/ClientCreateForm/Views/livewire/form.blade.php +++ b/app/Modules/ClientCreateForm/Views/livewire/form.blade.php @@ -161,7 +161,16 @@ class="bi bi-plus-circle" viewBox="0 0 16 16"> {{ $message }} @enderror + + @if($complexId) +
+ +
+ +
+
+ @endif @if (count($availableAgents) > 1)
diff --git a/app/Modules/Plan7/Config/config.php b/app/Modules/Plan7/Config/config.php new file mode 100644 index 0000000..ce09543 --- /dev/null +++ b/app/Modules/Plan7/Config/config.php @@ -0,0 +1,5 @@ +get(); + return view('docs::index', [ + 'docs' => $docs + ]); + } + public function download(Document $document) + { + $ext = explode('.', $document->path); + $ext = end($ext); + return Storage::download($document->path, $document->name . '.' . $ext); + } +} \ No newline at end of file diff --git a/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php b/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php new file mode 100644 index 0000000..ec91cc8 --- /dev/null +++ b/app/Modules/Plan7/Http/Livewire/Plan7SelectorLivewire.php @@ -0,0 +1,92 @@ +containerId = $containerId; + $this->getData(); + } + private function getData() + { + $URL = $this->api; + $opt = []; + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $URL); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $fields = http_build_query($opt); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $fields); + $out = curl_exec($curl); + $this->allObjects = json_decode($out, true); + $this->types = $this->allObjects['values']['type']; + $this->access = $this->allObjects['values']['access']; + curl_close($curl); + } + + public function setHouse($id) + { + $this->bs = $id; + $this->room = null; + } + + public function setRoom($id) + { + $this->room = $this->allObjects['data'][$id]; + } + + public function start() { + $this->mode = 'select'; + $this->getData(); + } + public function done() { + $this->mode = 'selected'; + $this->bs = null; + $this->room = null; + } + public function render() + { + $objs = []; + if (!$this->bs && !$this->room) { + foreach ($this->allObjects['values']['bs'] as $key => $house) { + $objs[] = [ + 'mode' => 'bs', + 'id' => $house['id'], + 'name' => $house['name'], + ]; + } + } elseif ($this->bs && !$this->room) { + foreach ($this->allObjects['data'] as $key => $room) { + if ($room['access'] != 0) { + $room['mode'] = 'room'; + $objs[] = $room; + } + } + } elseif ($this->bs && $this->room) { + foreach ($this->allObjects['data'] as $key => $room) { + if ($room['id'] == $this->room['id']) { + $room['mode'] = 'room'; + $objs[] = $room; + } + } + } + return view('plan7::livewire.selector', [ + 'objs' => $objs + ]); + } + + +} \ No newline at end of file diff --git a/app/Modules/Plan7/Models/Plan7Selector.php b/app/Modules/Plan7/Models/Plan7Selector.php new file mode 100644 index 0000000..2430963 --- /dev/null +++ b/app/Modules/Plan7/Models/Plan7Selector.php @@ -0,0 +1,9 @@ +app->register(RouteServiceProvider::class); + } + + public function boot() + { + $this->registerViews(); + $this->registerLivewireViews(); + $this->registerMigrations(); + $this->registerConfig(); + $this->registerComponent(); + $this->registerLivewire(); + } + + protected function registerViews() + { + $moduleViewsPath = __DIR__ . '/../Views'; + $this->loadViewsFrom( + $moduleViewsPath, + strtolower($this->moduleName) + ); + } + + protected function registerLivewireViews() + { + $moduleViewsPath = __DIR__ . '/../Views/livewire'; + $this->loadViewsFrom( + $moduleViewsPath, + strtolower($this->moduleName) + ); + } + + protected function registerMigrations() + { + $this->loadMigrationsFrom( + app_path('Modules/' . $this->moduleName . '/Database/Migrations') + ); + } + + protected function registerConfig() + { + $path = app_path('Modules/' . $this->moduleName . '/Config/config.php'); + $this->mergeConfigFrom( + $path, + strtolower($this->moduleName) + ); + } + + protected function registerLivewire() + { + Livewire::component('plan7Selector', \Modules\Plan7\Http\Livewire\Plan7SelectorLivewire::class); + } + + protected function registerComponent() + { + //Blade::component('document', \Modules\Plan7\Http\Components\DocumentComponent::class); + } +} \ No newline at end of file diff --git a/app/Modules/Plan7/Providers/RouteServiceProvider.php b/app/Modules/Plan7/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..d5cce70 --- /dev/null +++ b/app/Modules/Plan7/Providers/RouteServiceProvider.php @@ -0,0 +1,24 @@ +registerWebRoutes(); + } + + protected function registerWebRoutes() + { + //Add Web Routes with web Guard + Route::middleware('web') + //Set Default Controllers Namespace + ->namespace('Modules\\Plan7\\Http\\Controllers') + ->group(app_path('Modules/Plan7/Routes/web.php')); + } +} \ No newline at end of file diff --git a/app/Modules/Plan7/Routes/web.php b/app/Modules/Plan7/Routes/web.php new file mode 100644 index 0000000..536347e --- /dev/null +++ b/app/Modules/Plan7/Routes/web.php @@ -0,0 +1,12 @@ +group(function () +{ + + Route::get('/doc', [DocsController::class, 'index'])->name('docs.index'); + Route::get('/docs/{document}/download', [DocsController::class, 'download'])->name('docs.download'); + +}); \ No newline at end of file diff --git a/app/Modules/Plan7/Views/index.blade.php b/app/Modules/Plan7/Views/index.blade.php new file mode 100644 index 0000000..68e95b8 --- /dev/null +++ b/app/Modules/Plan7/Views/index.blade.php @@ -0,0 +1,12 @@ +@php($title = 'Документы') +@extends('layouts.app') +@section('content') +
+ @foreach ($docs as $document) +
+
+
+ @endforeach +
+
+@endsection diff --git a/app/Modules/Plan7/Views/livewire/selector.blade.php b/app/Modules/Plan7/Views/livewire/selector.blade.php new file mode 100644 index 0000000..bd24dc9 --- /dev/null +++ b/app/Modules/Plan7/Views/livewire/selector.blade.php @@ -0,0 +1,67 @@ +
+ + + + + +
\ No newline at end of file diff --git a/resources/views/user/dashboard.blade.php b/resources/views/user/dashboard.blade.php index 99e9b49..0974e83 100644 --- a/resources/views/user/dashboard.blade.php +++ b/resources/views/user/dashboard.blade.php @@ -132,4 +132,5 @@ class="" alt="..."> + @livewire('plan7Selector') @endsection