@php use App\Enums\UserAccountStatus; use Carbon\Carbon; $role = $user->roles()->first()->name ?? ''; // Status badge styling $statusBadgeClass = match($user->status) { UserAccountStatus::ACTIVE => $user->isUnderProbation() ? 'bg-warning' : 'bg-success', UserAccountStatus::ONBOARDING => 'bg-info', UserAccountStatus::SUSPENDED => 'bg-danger', UserAccountStatus::TERMINATED => 'bg-dark', UserAccountStatus::RELIEVED, UserAccountStatus::RETIRED => 'bg-secondary', UserAccountStatus::INACTIVE => 'bg-label-warning', default => 'bg-label-secondary' }; $statusLabel = match($user->status) { UserAccountStatus::ACTIVE => $user->isUnderProbation() ? __('On Probation') : __('Active'), UserAccountStatus::ONBOARDING => __('Onboarding'), UserAccountStatus::SUSPENDED => __('Suspended'), UserAccountStatus::TERMINATED => __('Terminated'), UserAccountStatus::RELIEVED => __('Relieved'), UserAccountStatus::RETIRED => __('Retired'), UserAccountStatus::INACTIVE => __('Inactive'), default => ucfirst($user->status->value) }; // Calculate tenure $joiningDate = Carbon::parse($user->date_of_joining); $tenureYears = (int) $joiningDate->diffInYears(now()); $tenureMonths = (int) ($joiningDate->copy()->addYears($tenureYears)->diffInMonths(now())); // Default tab based on status $defaultTab = $isExitedEmployee ? 'timeline' : 'overview'; @endphp @extends('layouts.layoutMaster') @section('title', __('Employee Details') . ' - ' . $user->getFullName()) @section('vendor-style') @vite([ 'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss', 'resources/assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.scss', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.scss', 'resources/assets/vendor/libs/select2/select2.scss', 'resources/assets/vendor/libs/flatpickr/flatpickr.scss', 'resources/assets/vendor/libs/apex-charts/apex-charts.scss' ]) @endsection @section('page-style') @vite([ 'resources/assets/vendor/scss/pages/page-user-view.scss', 'resources/assets/css/employee-view.css', 'resources/assets/scss/employee-timeline.scss' ]) @endsection @section('vendor-script') @vite([ 'resources/assets/vendor/libs/moment/moment.js', 'resources/assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js', 'resources/assets/vendor/libs/sweetalert2/sweetalert2.js', 'resources/assets/vendor/libs/select2/select2.js', 'resources/assets/vendor/libs/flatpickr/flatpickr.js', 'resources/assets/vendor/libs/apex-charts/apexcharts.js' ]) @endsection @section('content') {{-- Breadcrumb --}} {{-- Profile Header Card --}}
{{-- Profile Picture Section --}}
@if ($user->profile_picture) {{ $user->getFullName() }} @else
{{ $user->getInitials() }}
@endif @if (!$isExitedEmployee) @endif
{{-- Profile Info Section --}}

{{ $user->getFullName() }}

{{ $user->code }} {{ $statusLabel }} @if ($user->isUnderProbation() && $probationDaysRemaining !== null) {{ $probationDaysRemaining }} {{ __('days left') }} @endif
{{ $user->designation ? $user->designation->name : __('N/A') }}
{{ $user->team ? $user->team->name : __('N/A') }}
{{ $tenureYears }}y {{ $tenureMonths }}m {{ __('tenure') }}
{{ $user->email }} {{ $user->phone }}
{{-- Quick Actions Section --}}
@if (!$isExitedEmployee) {{-- Edit Dropdown --}} {{-- Actions Dropdown for ACTIVE (Not Probation) --}} @if ($user->status === UserAccountStatus::ACTIVE && !$user->isUnderProbation()) @endif {{-- Actions Dropdown for ACTIVE (Under Probation) --}} @if ($user->status === UserAccountStatus::ACTIVE && $user->isUnderProbation()) @endif {{-- Actions Dropdown for SUSPENDED --}} @if ($user->status === UserAccountStatus::SUSPENDED) @endif {{-- Actions Dropdown for INACTIVE --}} @if ($user->status === UserAccountStatus::INACTIVE) @endif {{-- Primary Button for TERMINATED --}} @if ($user->status === UserAccountStatus::TERMINATED) @endif @endif
{{-- Status-Based Alerts --}} @if ($user->status === UserAccountStatus::ONBOARDING) @endif @if ($user->isUnderProbation() && !$isExitedEmployee) @endif @if ($user->status === UserAccountStatus::SUSPENDED) @endif @if ($isExitedEmployee) @endif {{-- Main Content Tabs --}} {{-- Include Modals and Offcanvas --}} @include('_partials._modals.employees.edit_basic_info') @include('_partials._modals.employees.edit_work_info') @if (!$isExitedEmployee) @include('employees.modals.probation') @include('employees.modals.terminate') @include('employees.modals.suspend') @endif @endsection @section('page-script') @vite(['resources/js/main-helper.js', 'resources/assets/js/app/employee-view.js', 'resources/assets/js/app/employee-timeline.js']) @endsection