Commit 39c527a2 authored by alissonalbuquerque's avatar alissonalbuquerque
Browse files

atualização de dashboard

parent 738ddd4b
<?php
namespace App\Http\Controllers;
use App\Queries\UnidadeQuery;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index() {
$user = Auth::user();
if($user->isTypeAdmin())
{
return view('dashboard', ['unidades' => UnidadeQuery::all(), 'unidade_index' => 1]);
}
}
}
......@@ -36,7 +36,9 @@ class UnidadeController extends Controller
*/
public function store(Request $request)
{
// dd($request);
return redirect('/dashboard');
}
/**
......
<a class="{{$css}}" href="{{$route}}">
<a class="{{$css}}" href="{{$route}}" id="{{$id}}">
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z" />
</svg>
{{$text}}
</a>
</a>
\ No newline at end of file
......@@ -89,11 +89,36 @@
<h1 class="h2">Gestão de Unidades</h1>
</div>
@include('components.buttons.btn-create', ['route' => '', 'css' => 'btn btn-primary', 'text' => 'Cadastrar Nova Unidade'])
@include('components.buttons.btn-create', ['route' => route('unidade_create'), 'id' => 'btn-create-unidade', 'css' => 'btn btn-primary', 'text' => 'Cadastrar Nova Unidade'])
@section('form-unidade-create')
@show
<div class="mt-4">
@include('components.tables.table', ['id' => 'table_unidades', 'css' => 'table'])
<table class="table table-hover">
<thead>
<tr>
<th scope="col"> # </th>
<th scope="col"> Nome </th>
<th scope="col"> Opções </th>
</tr>
</thead>
<tbody>
@foreach($unidades as $unidade)
<tr>
<td scope="row"> {{ $unidade_index++ }} </td>
<td> {{ $unidade->name }} </td>
<td>
@include('components.buttons.btn-edit', ['route' => route('unidade_edit', ['id' => $unidade->id])])
@include('components.buttons.btn-delete', ['route' => route('unidade_delete', ['id' => $unidade->id])])
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="tab-pane" id="diretoria" role="tabpanel" aria-labelledby="diretoria-tab">
<div
......
......@@ -68,4 +68,7 @@ $("#btn-update-perfil").on('click', () => {
$("#update-perfil-tab").click()
})
// $('#')
</script>
@extends('layouts.main')
@extends('dashboard')
@section('title', 'Unidade - Create')
@section('body')
@section('form-unidade-create')
<div class="mt-4">
<form action="{{ route('unidade_store') }}" method="post">
@method('POST')
@csrf
......@@ -14,4 +13,5 @@
<button type="submit" class="btn btn-primary"> Create </button>
</form>
</div>
@endsection
......@@ -2,6 +2,7 @@
use App\Http\Controllers\CampusController;
use App\Http\Controllers\CursoController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\UnidadeController;
use Illuminate\Support\Facades\Route;
......@@ -22,9 +23,7 @@ Route::get('/', function () {
return redirect()->route('login');
});
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth'])->name('dashboard');
Route::get('/dashboard', [DashboardController::class, 'index'])->middleware(['auth'])->name('dashboard');
Route::get('/campus/index', [CampusController::class, 'index'])->name('campus_index');
Route::get('/campus/create', [CampusController::class, 'create'])->name('campus_create');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment