@extends('layouts.app') @section('content')
| Name | Role | Sent | Expires | Actions | |
|---|---|---|---|---|---|
| {{ $invitation->name }} | {{ $invitation->email }} | @if($invitation->role === 'hr') HR @elseif($invitation->role === 'manager') Manager @else Staff @endif | {{ $invitation->created_at->diffForHumans() }} | {{ $invitation->expires_at->diffForHumans() }} |
|
| {{ __('Name') }} | {{ __('Email') }} | {{ __('Role') }} | {{ __('Assigned Websites') }} | {{ __('Actions') }} |
|---|---|---|---|---|
| {{ $user->name }} | {{ $user->email }} | @if($user->role === 'hr') Company Admin @elseif($user->role === 'manager') Manager @else Staff @endif | {{ $user->assignedWebsites->count() }} {{ __('websites') }} |
@php
$canEdit = false;
$currentUserRole = auth()->user()->role;
// Super admin can edit everyone
if (auth()->user()->isSuperAdmin()) {
$canEdit = true;
}
// HR (Company Admin) can edit managers and staff, but not other HRs
elseif ($currentUserRole === 'hr' && in_array($user->role, ['manager', 'staff'])) {
$canEdit = true;
}
// Manager can only edit staff
elseif ($currentUserRole === 'manager' && $user->role === 'staff') {
$canEdit = true;
}
// Users can always edit their own profile
elseif ($user->id === auth()->id()) {
$canEdit = true;
}
@endphp
@if($canEdit)
{{ __('Edit') }}
@else
@endif
@if($user->id !== auth()->id() && $canEdit)
@endif
|
| {{ __('No users found.') }} | ||||