ldc-supportweb/resources/views/users/stats.blade.php
2022-02-11 11:13:54 +01:00

49 lines
No EOL
2 KiB
PHP

@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 = 260;
if (strpos($index, '2021') !== false) {
$workdays = 105;
}
$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