diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php
index 517e6d0..e7e3ac5 100644
--- a/app/Http/Controllers/IndexController.php
+++ b/app/Http/Controllers/IndexController.php
@@ -2,11 +2,18 @@
namespace App\Http\Controllers;
+use App\Models\Predio;
+
class IndexController extends Controller
{
public function index(){
- return view('index');
+ $predios = Predio::with([
+ 'racks' => fn ($q) => $q->orderBy('nome'),
+ 'racks.equipamentos' => fn ($q) => $q->orderBy('ordem'),
+ ])->orderBy('nome')->get();
+
+ return view('index',['predios' => $predios]);
}
}
diff --git a/config/laravel-usp-theme.php b/config/laravel-usp-theme.php
index f11504d..d947b70 100644
--- a/config/laravel-usp-theme.php
+++ b/config/laravel-usp-theme.php
@@ -3,7 +3,12 @@
$menu = [
[
- 'text' => ' Prédios',
+ 'text' => ' Home',
+ 'url' => config('app.url') . '/',
+ 'can' => 'user',
+ ],
+ [
+ 'text' => ' Prédios',
'url' => config('app.url') . '/predios',
'can' => 'admin',
],
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index f1ed288..5b95233 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -2,6 +2,41 @@
@section('content')
-Sistema rede
+@forelse($predios as $predio)
+
Prédio: {{ $predio->nome }}
+
+
+ @forelse($predio->racks as $rack)
+
+
+
+
+ @forelse($rack->equipamentos as $equipamento)
+ -
+ @can('admin')
+
+ {{ $equipamento->hostname }}
+
+ @else
+ {{ $equipamento->hostname }}
+ @endcan
+
+ @empty
+ - Sem equipamentos
+ @endforelse
+
+
+
+ @empty
+
+
Nenhum rack cadastrado neste prédio.
+
+ @endforelse
+
+@empty
+ Nenhum prédio cadastrado ainda.
+@endforelse
@endsection('content')
\ No newline at end of file
diff --git a/resources/views/racks/show.blade.php b/resources/views/racks/show.blade.php
index 0796f23..35a0cf6 100644
--- a/resources/views/racks/show.blade.php
+++ b/resources/views/racks/show.blade.php
@@ -54,9 +54,11 @@
+ @can('admin')
Ver
+ @endcan
Editar
diff --git a/tests/Browser/CriarEquipamentoTest.php b/tests/Browser/CriarEquipamentoTest.php
index 8b6324e..e2e4936 100644
--- a/tests/Browser/CriarEquipamentoTest.php
+++ b/tests/Browser/CriarEquipamentoTest.php
@@ -19,7 +19,7 @@ public function test_criar_equipamento(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai para lista de prédios
$browser->clickLink('Prédios')
diff --git a/tests/Browser/CriarModeloSwitchTest.php b/tests/Browser/CriarModeloSwitchTest.php
index bab1d1f..c0e1bb4 100644
--- a/tests/Browser/CriarModeloSwitchTest.php
+++ b/tests/Browser/CriarModeloSwitchTest.php
@@ -19,7 +19,7 @@ public function test_criar_modelo_siwtch(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai para lista de modelos de switch
$browser->clickLink('Modelos de Switch')
diff --git a/tests/Browser/CriarPatchPanelTest.php b/tests/Browser/CriarPatchPanelTest.php
index fe34780..9998b25 100644
--- a/tests/Browser/CriarPatchPanelTest.php
+++ b/tests/Browser/CriarPatchPanelTest.php
@@ -19,7 +19,7 @@ public function test_criar_patch_panel(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Navega até o rack
$browser->clickLink('Prédios')
diff --git a/tests/Browser/CriarPredioTest.php b/tests/Browser/CriarPredioTest.php
index e0d6ce3..faa775b 100644
--- a/tests/Browser/CriarPredioTest.php
+++ b/tests/Browser/CriarPredioTest.php
@@ -21,7 +21,7 @@ public function test_criar_predio(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai diretamente para a lista de prédios
$browser->clickLink('Prédios')
->assertPathIs('/predios');
diff --git a/tests/Browser/CriarRackTest.php b/tests/Browser/CriarRackTest.php
index 309d4f0..17c5057 100644
--- a/tests/Browser/CriarRackTest.php
+++ b/tests/Browser/CriarRackTest.php
@@ -19,7 +19,7 @@ public function test__criar_rack(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai diretamente para a lista de prédios
$browser->clickLink('Prédios')
->waitForLocation('/predios', 5)
diff --git a/tests/Browser/CriarSalaTest.php b/tests/Browser/CriarSalaTest.php
index 5c248c1..63311bd 100644
--- a/tests/Browser/CriarSalaTest.php
+++ b/tests/Browser/CriarSalaTest.php
@@ -19,7 +19,7 @@ public function test_criar_sala(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai diretamente para a lista de prédios
$browser->clickLink('Prédios')
->waitForLocation('/predios', 5)
diff --git a/tests/Browser/CriarTipoPortaTest.php b/tests/Browser/CriarTipoPortaTest.php
index d0280bb..d09e4c0 100644
--- a/tests/Browser/CriarTipoPortaTest.php
+++ b/tests/Browser/CriarTipoPortaTest.php
@@ -19,7 +19,7 @@ public function test_criar_tipo_porta(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede', 5);
+ ->waitForText('Rede', 5);
// Vai diretamente para a lista de tipo de portas
$browser->clickLink('Tipos de Porta')
->waitForLocation('/tipo-portas', 5);
diff --git a/tests/Browser/IndexTest.php b/tests/Browser/IndexTest.php
index 1d159d5..1ac913a 100644
--- a/tests/Browser/IndexTest.php
+++ b/tests/Browser/IndexTest.php
@@ -15,7 +15,7 @@ public function test_index(): void
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
- ->assertSee('Sistema rede');
+ ->assertSee('Rede');
});
}
}
diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php
index e3d3efc..3df9a9b 100644
--- a/tests/Browser/LoginTest.php
+++ b/tests/Browser/LoginTest.php
@@ -19,7 +19,7 @@ public function test_login(): void
->type('#callback', 'http://rede/callback')
->type('#loginUsuario', '1111')
->press('Login')
- ->waitForText('Sistema rede')
+ ->waitForText('Rede')
->assertSee('Sair');
});
}
|