Affichage de la version dans la page Paramètres du site
Ajoute une section "Version du logiciel" dans admin/parametres avec : - version installée + date d'installation - bandeau de mise à jour disponible si nouvelle version détectée - badge "À jour" si à jour (même logique que le tableau de bord admin) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\SiteSettingsService;
|
use App\Services\SiteSettingsService;
|
||||||
|
use App\Services\UpdateService;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@@ -11,11 +12,19 @@ use Illuminate\View\View;
|
|||||||
|
|
||||||
class SettingController extends Controller
|
class SettingController extends Controller
|
||||||
{
|
{
|
||||||
public function index(): View
|
public function index(UpdateService $updates): View
|
||||||
{
|
{
|
||||||
|
$installedVersion = $updates->getInstalledVersion();
|
||||||
|
$latestRelease = $updates->fetchLatestRelease();
|
||||||
|
$updateAvailable = $latestRelease
|
||||||
|
&& version_compare($latestRelease['version'], $installedVersion, '>');
|
||||||
|
|
||||||
return view('admin.parametres.index', [
|
return view('admin.parametres.index', [
|
||||||
'logoUrl' => SiteSettingsService::logoUrl(),
|
'logoUrl' => SiteSettingsService::logoUrl(),
|
||||||
'registrationEnabled' => SiteSettingsService::registrationEnabled(),
|
'registrationEnabled' => SiteSettingsService::registrationEnabled(),
|
||||||
|
'installedVersion' => $installedVersion,
|
||||||
|
'latestRelease' => $latestRelease,
|
||||||
|
'updateAvailable' => $updateAvailable,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,53 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Version --}}
|
||||||
|
<div class="bg-white shadow rounded-lg p-6 space-y-4">
|
||||||
|
<h3 class="text-sm font-semibold text-gray-700 uppercase tracking-wide">Version du logiciel</h3>
|
||||||
|
|
||||||
|
@if($updateAvailable)
|
||||||
|
<div class="flex items-start gap-3 p-4 bg-indigo-50 border border-indigo-200 rounded-lg">
|
||||||
|
<svg class="w-5 h-5 text-indigo-500 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/>
|
||||||
|
</svg>
|
||||||
|
<div>
|
||||||
|
<p class="text-sm font-semibold text-indigo-800">
|
||||||
|
Mise à jour disponible : v{{ $latestRelease['version'] }}
|
||||||
|
</p>
|
||||||
|
@if($latestRelease['published_at'])
|
||||||
|
<p class="text-xs text-indigo-500 mt-0.5">
|
||||||
|
Publié {{ \Carbon\Carbon::parse($latestRelease['published_at'])->diffForHumans() }}
|
||||||
|
</p>
|
||||||
|
@endif
|
||||||
|
<p class="text-xs text-indigo-600 mt-2 font-mono bg-indigo-100 inline-block px-2 py-1 rounded">
|
||||||
|
php artisan app:update
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<p class="text-sm text-gray-700 font-medium">MesRelevés v{{ $installedVersion }}</p>
|
||||||
|
@php $installedAt = storage_path('installed'); @endphp
|
||||||
|
@if(file_exists($installedAt))
|
||||||
|
<p class="text-xs text-gray-400 mt-0.5">
|
||||||
|
Installé le {{ \Carbon\Carbon::createFromTimestamp(filemtime($installedAt))->isoFormat('LL') }}
|
||||||
|
</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@if(! $updateAvailable)
|
||||||
|
<span class="inline-flex items-center gap-1.5 text-xs text-green-700 bg-green-50 border border-green-200 px-3 py-1.5 rounded-full">
|
||||||
|
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 20 20">
|
||||||
|
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
||||||
|
</svg>
|
||||||
|
À jour
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Inscriptions --}}
|
{{-- Inscriptions --}}
|
||||||
<div class="bg-white shadow rounded-lg p-6 space-y-4">
|
<div class="bg-white shadow rounded-lg p-6 space-y-4">
|
||||||
<h3 class="text-sm font-semibold text-gray-700 uppercase tracking-wide">Inscriptions</h3>
|
<h3 class="text-sm font-semibold text-gray-700 uppercase tracking-wide">Inscriptions</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user