Merge branch 'trunk'
This commit is contained in:
commit
1b4025ff48
8 changed files with 102 additions and 25 deletions
21
.env.example
21
.env.example
|
|
@ -20,29 +20,12 @@ QUEUE_CONNECTION=sync
|
|||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_ADDRESS=noreply-sw@ldc.fr
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
MAIL_LIST_SERVICEWEB=informatique.internet@ldc.fr
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
MAIL_LIST_SERVICEWEB=equipe.web@ldc.fr
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Models\Schedule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Kwaadpepper\CrudPolicies\Traits\CrudController;
|
||||
|
||||
class UserController extends Controller
|
||||
|
|
@ -31,4 +33,33 @@ class UserController extends Controller
|
|||
$request = new Request(['email' => $user->email]);
|
||||
return app(ForgotPasswordController::class)->sendResetLinkEmail($request);
|
||||
}
|
||||
|
||||
public function stats()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$stats = [];
|
||||
|
||||
for ($i = 2021; $i <= date('Y'); $i++) {
|
||||
$start = $i . '-03-01';
|
||||
$end = $i + 1 . '-02-' . $this->getLastDayFebruary($i + 1);
|
||||
|
||||
$datas = $user->schedules()->selectRaw('count(id) as nb, activity')
|
||||
->whereBetween('date', [$start, $end])
|
||||
->groupBy('activity')
|
||||
->orderBy('activity', 'ASC')
|
||||
->get();
|
||||
|
||||
$stats[sprintf("%d/%d", $i, $i + 1)] = $datas;
|
||||
}
|
||||
|
||||
return view('users.stats', ['stats' => $stats]);
|
||||
}
|
||||
|
||||
private function getLastDayFebruary($year)
|
||||
{
|
||||
if ((is_int($year / 4) && !is_int($year / 100)) || is_int($year / 400)) {
|
||||
return 29;
|
||||
}
|
||||
return 28;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,11 @@ class User extends Authenticatable
|
|||
return $this->belongsToMany(Site::class);
|
||||
}
|
||||
|
||||
public function schedules()
|
||||
{
|
||||
return $this->hasMany(Schedule::class);
|
||||
}
|
||||
|
||||
public function sendMailConfirm()
|
||||
{
|
||||
dispatch(new SendUserCreatedEmail($this));
|
||||
|
|
|
|||
4
resources/sass/_bootswatch.scss
vendored
4
resources/sass/_bootswatch.scss
vendored
|
|
@ -151,6 +151,10 @@ $web-font-path: "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,w
|
|||
@include box-shadow(none);
|
||||
}
|
||||
|
||||
.user-dropdown {
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
border-color: shade-color($breadcrumb-bg, 10%);
|
||||
@include shadow();
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
<p>Le ticket n°{{ $ticket->id }} à été mis à jour :</p>
|
||||
<ul>
|
||||
<li>Projet : {{ $ticket->site->name }}</li>
|
||||
<li>Type : {{ $ticket->label }}</li>
|
||||
<li>Type : {{ $ticket->type->label }}</li>
|
||||
<li>Créé par : {{ $ticket->user->name }}</li>
|
||||
</ul>
|
||||
<p>{!! clean(nl2br($corpsMaj)) !!}</p>
|
||||
<p>Lien vers le ticket : <a href="{{ route('ticket.show', $ticket->id) }}" target="_blank">Ouvrir dans un nouvel onglet</a></p>
|
||||
<p>Lien vers le ticket : <a href="{{ route('ticket.show', $ticket->id) }}" target="_blank">Ouvrir dans un nouvel onglet</a></p>
|
||||
|
|
@ -59,17 +59,21 @@
|
|||
<ul class="navbar-nav ms-auto me-2">
|
||||
<!-- Authentication Links -->
|
||||
@auth
|
||||
<li class="nav-item dropdown">
|
||||
<li class="nav-item dropdown user-dropdown">
|
||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ __('Bonjour') }} {{ Auth::user()->name }} <span class="caret"></span>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||
@if (Auth::user()->role->value === Role::developper()->value)
|
||||
<a class="dropdown-item" href="{{ route('users.stats') }}">
|
||||
{{ __('Statistiques') }}
|
||||
</a>
|
||||
@endif
|
||||
<a class="dropdown-item" href="{{ route('users.passwordReset') }}">
|
||||
{{ __('Identifiants') }}
|
||||
</a>
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="event.preventDefault();
|
||||
<a class="dropdown-item" href="#" onclick="event.preventDefault();
|
||||
document.getElementById('logout-form').submit();">
|
||||
{{ __('Déconnexion') }}
|
||||
</a>
|
||||
|
|
@ -90,4 +94,4 @@
|
|||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
49
resources/views/users/stats.blade.php
Normal file
49
resources/views/users/stats.blade.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
@extends('layout.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ __('Statistiques') }}</div>
|
||||
|
||||
<div class="card-body">
|
||||
@foreach ($stats as $index => $stat)
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>{{ $index }}</th>
|
||||
<th>{{ __('Jour(s)') }}</th>
|
||||
<th>%</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$workdays = 203;
|
||||
if (strpos($index, '2021') !== false) {
|
||||
$workdays = 92;
|
||||
}
|
||||
$sum = 0;
|
||||
@endphp
|
||||
@foreach ($stat as $data)
|
||||
<tr style="background-color: {{ CellType::make($data->activity->value)->value }};">
|
||||
<td><b>{{ $data->activity->label }}</b></td>
|
||||
<td><b>{{ $data->nb * 0.25 }}</b></td>
|
||||
<td>{{ round((($data->nb * 0.25) / $workdays) * 100) }}%</td>
|
||||
</tr>
|
||||
@php $sum += $data->nb; @endphp
|
||||
@endforeach
|
||||
<tr>
|
||||
<td><b>{{ __('Total') }}</b></td>
|
||||
<td><b>{{ $sum * 0.25 }} / {{ $workdays }}</b></td>
|
||||
<td><b>{{ round((($sum * 0.25) / $workdays) * 100) }}%</b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -43,6 +43,7 @@ Route::middleware(['auth'])->group(function () {
|
|||
Route::view('/users/change-password', 'users.passwordReset')->name('users.passwordReset');
|
||||
Route::post('/users/change-password', [UserController::class, 'passwordResetSubmit'])
|
||||
->name('users.passwordResetSubmit');
|
||||
Route::get('/users/stats', [UserController::class, 'stats'])->name('users.stats');
|
||||
|
||||
// Ticket
|
||||
Route::resource('ticket', TicketController::class)->except(['destroy']);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue