@if(auth()->user()->role === 'user')
@endif
{{-- Notifications désactivées temporairement --}}
{{--
--}}
{{-- TODO: Ajouter les routes support.create et support.contact
@if(auth()->user()->role === 'user')
@endif
--}}
Notifications
@forelse([] as $notification)
@php
// Déterminer le contexte (entreprise/franchise) selon le type de notification
$ticketId = null;
$contextLogo = asset('assets/Logo_reduit.png');
$contextName = '';
$contextType = '';
// Cas: notifications liées aux tickets
if (strpos($notification->url, '/support/ticket/') !== false) {
$ticketId = basename($notification->url);
$ticket = \App\Models\Ticket::find($ticketId);
if ($ticket) {
if ($ticket->company) {
$contextLogo = $ticket->company->logo ? asset('storage/' . $ticket->company->logo) : asset('assets/Logo_reduit.png');
$contextName = $ticket->company->name;
$contextType = 'Entreprise';
} elseif ($ticket->franchise) {
$contextLogo = $ticket->franchise->logo ? asset('storage/' . $ticket->franchise->logo) : asset('assets/Logo_reduit.png');
$contextName = $ticket->franchise->name;
$contextType = 'Franchise';
}
}
}
// Cas: notifications d'invitation franchise
if (in_array($notification->type, ['invitation_franchise', 'invitation_owner_franchise'])) {
$franchiseId = $notification->data['franchise_id'] ?? null;
if ($franchiseId) {
$franchise = \App\Models\Franchise::find($franchiseId);
if ($franchise) {
$contextLogo = $franchise->logo ? asset('storage/' . $franchise->logo) : asset('assets/Logo_reduit.png');
$contextName = $franchise->name;
$contextType = 'Franchise';
}
}
}
// Cas: notifications d'invitation entreprise
if (in_array($notification->type, ['invitation_company', 'invitation_owner_company'])) {
$companyId = $notification->data['company_id'] ?? null;
if ($companyId) {
$company = \App\Models\Company::find($companyId);
if ($company) {
$contextLogo = $company->logo ? asset('storage/' . $company->logo) : asset('assets/Logo_reduit.png');
$contextName = $company->name;
$contextType = 'Entreprise';
}
}
}
@endphp
@if(in_array($notification->type, ['invitation_franchise', 'invitation_owner_franchise', 'invitation_company', 'invitation_owner_company']))
@else
@if(!$notification->read)
@endif
@endif
@empty
@endforelse
@if(!$notification->read)
@endif
@if($contextLogo && $contextLogo !== '/assets/logo.png')
@else
@endif
Invitation à rejoindre
{{ $contextName }}
{{ $notification->message }}
{{ $notification->created_at->diffForHumans() }}
{{ $notification->title }}
{{ $notification->created_at->diffForHumans() }}
{{ Str::limit($notification->message, 85) }}
@if($contextName)
{{ $contextType }}
{{ $contextName }}
@endif
Aucune notification
Profil
@php
$canManageContextDropdown = false;
if (!empty($currentCompany)) {
$canManageContextDropdown = ($currentCompany->owner_user_id === auth()->id())
|| $currentCompany->owners()->where('users.id', auth()->id())->exists();
} elseif (!empty($currentFranchise)) {
$canManageContextDropdown = ($currentFranchise->owner_user_id === auth()->id())
|| $currentFranchise->owners()->where('users.id', auth()->id())->exists();
}
@endphp
@if($canManageContextDropdown)
Paramètres
@endif
Déconnexion
@yield('content')