@foreach ($categories as $index => $category)
@if($index === 0)
@php
if($category == 'Manager')
{
$catemployees = $employees->where('role', $category)->where('department_id', $department->id)->all();
$catemployees = array_values($catemployees);
// Initialize variables to keep track of current index
$currentIndex = request()->input('current', 0); // Default to 0
$totalManagers = count($catemployees) == 0 ? 1 : count($catemployees);
$currentIndex = $currentIndex % $totalManagers; // Wrap around if out of bounds
}
@endphp
Personal Information
@if($totalManagers > 1)
{{-- Navigation buttons --}}
{{-- Next Button --}}
@endif
{{-- Display current manager based on the index --}}
@foreach($catemployees as $index => $employee)
@if($index == $currentIndex)
Name
{{$employee->name ?? 'N/A'}}
Mobile Number
{{$employee->phn ?? 'N/A'}}
Email Address
{{$employee->email ?? 'N/A'}}
Date of Birth
{{\Carbon\Carbon::parse($employee->dob)->format('M d, Y') ?? 'N/A'}}
Marital Status
{{$employee->marital ?? 'N/A'}}
Gender
{{$employee->gender ?? 'N/A'}}
Nationality
{{$employee->nationality ?? 'N/A'}}
Address
{{$employee->address ?? 'N/A'}}
City
{{$employee->city ?? 'N/A'}}
State
{{$employee->state ?? 'N/A'}}
Zip Code
{{$employee->zip ?? 'N/A'}}
@endif
@endforeach
Task and Point Tabel
@foreach($categories as $category)
@if($category != 'Admin' && $category != 'Manager')
Category: {{$category}}
{{-- --}}
@foreach($targets as $lowTarget)
@if($lowTarget->category == $category)
1 Point
@if($lowTarget->product_id == null)
{{$lowTarget->custom}}
Will Get 1 Point
@else
Sell {{$lowTarget->product}}
Will Get 1 Point
@endif
@endif
@endforeach
@endif
@endforeach
@else
{{--
--}}
| Employee Name |
Employee ID |
Type |
@if($category == 'Admin')
Category |
@endif
Status |
{{-- Action | --}}
@php
if ($category == 'Admin')
{
$catemployees = $employees->where('role', $category)->where('department_id', $department->id)->all();
}
else
{
$catemployees = $employees->where('category', $category)->where('department_id', $department->id)->all();
}
@endphp
@foreach ($catemployees as $employee)
@if($employee->category == $category && $employee->role == 'Employee')
@if (!empty($employee->image))
@else
{{ strtoupper(implode('', array_merge(array_map(fn($part) => is_numeric($part) ? $part : $part[0], array_slice(explode(' ', $employee->name), 0, 2)),preg_match('/\d/', $employee->name, $matches) ? [$matches[0]] : []))) }}
@endif {{ $employee->name }}
|
{{ $employee->employee_id }} |
{{ $employee->role }}
|
@if ($employee->status == 0)
Pending
@elseif($employee->status == 1)
Inactive
@elseif($employee->status == 2)
Active
@endif
|
@elseif($employee->role == $category && $employee->department_id == $department->id)
@if (!empty($employee->image))
@else
{{ strtoupper(implode('', array_merge(array_map(fn($part) => is_numeric($part) ? $part : $part[0], array_slice(explode(' ', $employee->name), 0, 2)),preg_match('/\d/', $employee->name, $matches) ? [$matches[0]] : []))) }}
@endif
{{ $employee->name }} |
{{ $employee->employee_id }} |
{{ $employee->role }} |
{{ $employee->category }} |
@if ($employee->status == 0)
Pending
@elseif($employee->status == 1)
Inactive
@elseif($employee->status == 2)
Active
@endif
|
{{-- --}}
{{-- --}}
{{-- | --}}
@endif
@endforeach
@endif
@endforeach