ldc-supportweb/resources/views/bo/pages/users/stats.blade.php
2023-08-14 09:23:39 +00:00

58 lines
1.9 KiB
PHP

@extends('layout.app')
@section('title', __('Statistiques'))
@section('description', __('Statistiques de l\':model :user', ['model' => Str::singular(__('models.classes.users')), 'user' => auth()->user()->name]))
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center">
@include('breadcrumbs.breadcrumb-body')
</div>
@foreach ($stats as $index => $stat)
<table class="table mt-3">
<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 class="{{ Str::slug('celltype-'. \App\Enums\Planning\CellTypeEnum::make($data->activity->value)->label()) }}">
<td><b>{{ $data->activity->label() }}</b></td>
<td class="w-25"><b>{{ $data->nb / Config::get('schedules.daySlots') }}</b></td>
<td class="w-25">{{ round((($data->nb / Config::get('schedules.daySlots')) / $workdays) * 100) }}%</td>
</tr>
@php $sum += $data->nb; @endphp
@endforeach
<tr>
<td><b>{{ __('Total') }}</b></td>
<td class="w-25"><b>{{ $sum / Config::get('schedules.daySlots') }} / {{ $workdays }}</b></td>
<td class="w-25"><b>{{ round((($sum / 8) / $workdays) * 100) }}%</b></td>
</tr>
</tbody>
</table>
@endforeach
@endsection
@push('styles')
<style nonce="{{ $nonce }}">
@foreach(\App\Enums\Planning\CellTypeEnum::cases() as $type)
.celltype-{{ Str::slug($type->label()) }} {
background-color: {{ $type->color() }};
border: 1px solid black;
td {
background-color: inherit;
}
}
@endforeach
</style>
@endpush