ldc-mesbr-app/resources/views/maintenance/index.blade.php
2025-08-05 14:47:02 +02:00

104 lines
3.4 KiB
PHP

@extends('layouts.main')
@section('content')
<h2>
<i class="fas fa-cogs"></i>
{{ __('Maintenance') }}
</h2>
<div class="user-app">
<div class="heading">
<h5><i class="fas fa-users-cog"></i> {{ __('Gestion des utilisateurs') }}</h5>
<a href="{{ route('maintenance.user.create') }}" class="add-button"><i class="fas fa-plus-square"></i> {{ __('Ajouter') }}</a>
</div>
@if (isset($users) && count($users) > 0)
<table>
<thead>
<th>{{ __('Nom') }}</th>
<th>{{ __('Email') }}</th>
<th>{{ __('Rôle') }}</th>
<th>{{ __('Site liés') }}</th>
<th></th>
</thead>
@foreach ($users as $user)
<tr>
<td><a href="{{ route('maintenance.user.edit', $user) }}">{{ $user->name }}</a></td>
<td>{{ $user->email }}</td>
<td>{{ $user->roles }}</td>
<td class="sites">
@foreach ($user->sites as $site)
<p>{{ $site->site_nom }}</p>
@endforeach
</td>
@if (Auth::user()->id === $user->id)
<td></td>
@else
<td><a href="{{ route('maintenance.user.destroy', $user) }}"><i class="fas fa-times delete-icon"></i></a></td>
@endif
</tr>
@endforeach
<tfoot>
<tr>
<td colspan="5">
</td>
</tr>
</tfoot>
</table>
<form method="POST" id="delete-hidden">
@csrf
@method('DELETE')
</form>
@endif
</div>
<div class="error-log">
<h5><i class="fas fa-file-alt"></i> {{ __("Erreur d'appels") }} :</h5>
<canvas id="myChart" height="300" width="200"></canvas>
</div>
@endsection
@section('scripts')
<script src="{{ mix('js/Chart.js', 'build') }}" charset="utf-8"></script>
<script>
var truc = {!! json_encode($logs, JSON_UNESCAPED_SLASHES) !!};
var labels = [];
var errorCount = [];
$.each(truc, function(index, value) {
labels.push(value[0]);
errorCount.push(value[1]);
})
labels = labels.reverse();
errorCount = errorCount.reverse();
//---- GRAPH ERRORS
var ctx = document.getElementById("myChart").getContext('2d');
ctx.height = 300;
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: '{{ __("Erreurs") }}',,
data: errorCount,
backgroundColor: 'rgba(255, 0, 0, 0.2)',
borderColor: 'rgba(255,0,0,1)',
borderWidth: 1
}]
},
options: {
maintainAspectRatio: false,
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
stepSize: 1,
}
}]
}
}
});
</script>
@endsection