Staff Management

@if (auth()->user()->isCompanyAdmin()) Add New Staff @endif
Loading...
@if(session('success'))
{{ session('success') }}
@endif @if ($errors->any())
{{ $errors->first() }}
@endif @php $user = auth()->user(); $canViewSalary = $user->isCompanyAdmin() || $user->hasPermission('teams.staff.salary.view'); $canViewAdvance = $user->isCompanyAdmin() || $user->hasPermission('teams.staff.salary.advance.view'); $canManageAttendance = $user->isCompanyAdmin() || $user->hasPermission('teams.staff.attendance.bulk.manage'); @endphp @if ($canViewSalary || $canViewAdvance || $canManageAttendance)
@if ($canViewSalary) Salary @endif @if ($canViewAdvance) Advance @endif @if ($canManageAttendance) @endif
@endif
{{-- --}} @foreach ($staffs as $staff) {{-- --}} @endforeach
Staff Name EmailStatus Actions
{{ $staff->name }} {{ $staff->user?->email ?? '-' }} Active
{{-- View Detail Button --}} {{-- Increased from w-4 h-4 to w-5 h-5 for better visibility --}} {{-- Delete Button --}} @if (auth()->user()->isCompanyAdmin())
@csrf @method('DELETE')
@endif
@if(auth()->user()->isCompanyAdmin() && auth()->user()->hasPermission('teams.staff.attendance.bulk.manage'))
{{-- Filter Form --}} {{--
--}}
Present
Half Day
Leave
Absent
{{-- Main Attendance Form --}}
@csrf @php $selectedMonth = request('month', now()->format('Y-m')); try { $selectedMonthDate = \Carbon\Carbon::createFromFormat( 'Y-m', $selectedMonth, )->startOfMonth(); } catch (\Throwable $e) { $selectedMonthDate = now()->startOfMonth(); } $daysInMonth = $selectedMonthDate->daysInMonth; $currentMonth = $selectedMonthDate->format('M'); $workingDays = collect( $workingDays ?? ['mon', 'tue', 'wed', 'thu', 'fri', 'sat'], )->all(); $attendanceDaysCount = (int) ($attendanceDaysCount ?? 0); @endphp
@for ($i = 1; $i <= $daysInMonth; $i++) @php $cellDate = $selectedMonthDate->copy()->day($i)->toDateString(); $isToday = $cellDate === now()->toDateString(); $dayKey = strtolower( $selectedMonthDate->copy()->day($i)->format('D'), ); $isHoliday = isset($holidayDates[$cellDate]); $isWorkingDay = in_array($dayKey, $workingDays, true); @endphp @endfor @foreach ($staffs as $staff) @php $staffAttendanceByDate = $attendanceMap[$staff->id] ?? []; @endphp @for ($i = 1; $i <= $daysInMonth; $i++) @php $cellDate = $selectedMonthDate ->copy() ->day($i) ->toDateString(); $isEditableCell = $cellDate === now()->toDateString(); $dayKey = strtolower( $selectedMonthDate->copy()->day($i)->format('D'), ); $isHoliday = isset($holidayDates[$cellDate]); $isWorkingDay = in_array($dayKey, $workingDays, true); @endphp @endfor @endforeach
Emp ID Emp Name Supervisor {{ $i }}-{{ $currentMonth }} @if ($isHoliday)
Holiday
@elseif(!$isWorkingDay)
Off
@endif @if ($isToday)
@endif
Present Total Attnd %
{{ $staff->employee_id }} {{ $staff->name }} {{-- Modal Teleport --}} {{-- Hidden Inputs for Form Submission --}} Admin
{{ $attendanceDaysCount }}
{{-- Footer --}}

Tip: Use horizontal scroll. Name/ID are frozen.

Export Save Attendance Sheet
@if(auth()->user()->hasPermission('teams.staff.salary.manage'))

Staff Advances

+ New Advance
@forelse($advances as $advance) @empty @endforelse
Staff Name Emp ID Date Amount Notes
{{ $advance->staff?->name ?? '-' }} {{ $advance->staff?->employee_id ?? '-' }} {{ \Carbon\Carbon::parse($advance->advance_date)->format('d M Y') }} ₹{{ number_format($advance->amount, 2) }} {{ $advance->notes ?: '—' }}
No advances recorded yet.

Salary

@php $currentSalaryKey = now()->format('Y-m'); $previousSalaryKey = now()->subMonth()->format('Y-m'); @endphp
Staff Month Status Action
{{-- Salary detail modal --}}

Salary Detail

{{-- Advance detail modal --}}

Advance Details

@endif @endif