diff --git a/app/Chat/chat.php b/app/Chat/chat.php new file mode 100644 index 000000000..e69de29bb diff --git a/app/Chat/chat_api/config.php b/app/Chat/chat_api/config.php new file mode 100644 index 000000000..e69de29bb diff --git a/app/Chat/chat_api/fetchMessages.php b/app/Chat/chat_api/fetchMessages.php new file mode 100644 index 000000000..e69de29bb diff --git a/app/Chat/chat_api/sendMessage.php b/app/Chat/chat_api/sendMessage.php new file mode 100644 index 000000000..e69de29bb diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php new file mode 100644 index 000000000..3f9789c0f --- /dev/null +++ b/app/Http/Controllers/ChatController.php @@ -0,0 +1,29 @@ +get(); + } + + public function sendMessage(Request $request, $projeto_id) + { + return Mensagem::create([ + 'projeto_id' => $projeto_id, + 'usuario' => $request->usuario, + 'mensagem' => $request->mensagem, + ]); + } + +} diff --git a/app/Models/Mensagem.php b/app/Models/Mensagem.php new file mode 100644 index 000000000..a4a09ffe0 --- /dev/null +++ b/app/Models/Mensagem.php @@ -0,0 +1,16 @@ +id(); + $table->unsignedBigInteger('projeto_id'); + $table->string('usuario'); + $table->text('mensagem'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('mensagens'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 60b145157..a3b4921b4 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -18,7 +18,7 @@ public function run() $this->call(BasesSearchSeeder::class); $this->call(PermissionSeeder::class); - DB::table('levels')->insert([ + DB::table('levels')->insert([ ['id_level' => 1, 'level' => 'Administrator'], ['id_level' => 2, 'level' => 'Viewer'], ['id_level' => 3, 'level' => 'Researcher'], @@ -31,21 +31,26 @@ public function run() ['id_module' => 4, 'description' => 'Export'], ['id_module' => 5, 'description' => 'Super Administrator'], ]); + + // Refatoração e adição de linguagens extras: DB::table('language')->insert([ - 'description' => 'Portuguese', - ]); - DB::table('language')->insert([ - 'description' => 'English', - ]); - DB::table('language')->insert([ - 'description' => 'Spanish', - ]); - DB::table('language')->insert([ - 'description' => 'French', - ]); - DB::table('language')->insert([ - 'description' => 'Russian', + ['description' => 'Portuguese'], + ['description' => 'English'], + ['description' => 'Spanish'], + ['description' => 'French'], + ['description' => 'Russian'], + ['description' => 'German'], + ['description' => 'Chinese'], + ['description' => 'Italian'], + ['description' => 'Japanese'], + ['description' => 'Arabic'], + ['description' => 'Dutch'], + ['description' => 'Korean'], + ['description' => 'Hindi'], + ['description' => 'Greek'], + ['description' => 'Turkish'], ]); + DB::table('study_type')->insert([ ['id_study_type' => 1, 'description' => 'Book'], ['id_study_type' => 2, 'description' => 'Thesis'], @@ -89,6 +94,5 @@ public function run() ['description' => 'Unclassified'], ['description' => 'Removed'], ]); - } } diff --git a/resources/views/chat.blade.php b/resources/views/chat.blade.php new file mode 100644 index 000000000..be4b43f27 --- /dev/null +++ b/resources/views/chat.blade.php @@ -0,0 +1,50 @@ + + + + + Chat Projeto {{ $projeto_id }} + + + +
+ +
+
+ + + + + diff --git a/resources/views/components/chat.blade.php b/resources/views/components/chat.blade.php new file mode 100644 index 000000000..91dd6dc5c --- /dev/null +++ b/resources/views/components/chat.blade.php @@ -0,0 +1,85 @@ +
+
+ Chat do Projeto + +
+ +
+ + diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index bfeffb5f2..816e30ec3 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,240 +1,329 @@ - - - - - - - - Thoth :: Tool for SLR - - - - - - - - - - - - - - - - - - - - - - @if(request()->is('register')) - - @endif - - - - - - - - - @livewireStyles - - - - @guest - @yield("content") - @endguest - @auth + + + + + + + + Thoth :: Tool for SLR + + + + + + + + + + + + + + + + + + + + + + @if(request()->is('register')) + + @endif + + + + + + + + + @livewireStyles + + + + @guest + @yield("content") + @endguest + + @auth @if (in_array(request()->route()->getName(),["login", "register", "reset-password", "change-password","message"])) - @yield("content") + @yield("content") @else - @if (! in_array(request()->route()->getName(),["profile", "home", "about", "help", "database-manager"])) -
- @elseif (in_array(request()->route()->getName(),["profile-static", "profile"])) -
- -
- @endif - @include("layouts.navbars.auth.sidenav") -
-
- @yield("content") -
-
+ @if (! in_array(request()->route()->getName(),["profile", "home", "about", "help", "database-manager"])) +
+ @elseif (in_array(request()->route()->getName(),["profile-static", "profile"])) +
+ > + +
@endif -@endauth + @include("layouts.navbars.auth.sidenav") +
+
+ @yield("content") +
+
+ @include("components.fixed-plugin") + @endif + @endauth -{{--Incluído fora do @auth: aparece para todos --}} -@include("components.fixed-plugin") + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + @stack("js") + + + + +
+ +
+ - - - - - - - - @stack("js") - - - -
- + }); + + + + + {{-- Search input js logic --}} + + + + @stack("scripts") + @livewireScripts + + + @auth + + @endauth + + + + @auth + +
+
+ Chat do Projeto +
- + }, 5000); + }); + + @endauth + - {{-- Search input js logic --}} - - {{-- --}} - - @stack("scripts") - @livewireScripts - + diff --git a/routes/web.php b/routes/web.php index bcb60ecfd..62740bfa6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -38,6 +38,7 @@ use App\Livewire\Planning\Databases\DatabaseManager; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; +use App\Http\Controllers\ChatController; //analisar esta 2 próximas linhas use App\Livewire\Planning\Databases\Databases; @@ -58,6 +59,10 @@ | */ +Route::get('/chat/{projeto_id}', [ChatController::class, 'index']); +Route::get('/chat/{projeto_id}/messages', [ChatController::class, 'fetchMessages']); +Route::post('/chat/{projeto_id}/messages', [ChatController::class, 'sendMessage']); + Route::middleware(Localization::class)->get('/', function () { return view('welcome'); });