@extends('admin.admin_dashboard') @section('customcss') @endsection @section('admin')
{{-- Page Header --}}
@csrf @method('PUT')
{{-- LEFT PANEL: Employee Details & Master Shift Switches --}}
{{-- Profile Card --}}
Employee Details
@php $primary = (!empty($employee->primary_id) && $employee->primary_id !== '0' && $employee->primary_id !== 0) ? $employee->primary_id : '-'; $secondary = (!empty($employee->e_id) && $employee->e_id !== '0' && $employee->e_id !== 0) ? $employee->e_id : '-'; $post = $employee->postDetails->name ?? ($employee->post ?? '-'); $firstRule = $employeeWorkRules->first(); $effectiveFrom = $firstRule?->effective_from ?? date('Y-01-01'); $effectiveTo = $firstRule?->effective_to ?? null; @endphp
{{ $employee->name }}
{{ $post }}
Primary ID {{ $primary }}
Secondary ID {{ $secondary }}
Designation {{ $post }}

{{-- Effective Date Range --}}
Effective Period

{{-- Shifts Included --}}
Active Shifts for Employee

Turn on/off shifts for this employee:

@foreach($shifts as $shift) @php $isMorning = str_contains(strtolower($shift->name), 'morning'); $rule = $employeeWorkRules[$shift->id] ?? null; $isConfigured = $rule && $rule->is_active; @endphp
{{ $shift->name }} @if($rule) {{ $rule->is_active ? 'Active' : 'Inactive' }} @else Not Assigned @endif
@endforeach
{{-- RIGHT PANEL: Multi-Shift Weekly Schedule Builder --}}
{{-- Shift Nav Tabs --}}
@foreach($shifts as $idx => $shift) @php $isMorning = str_contains(strtolower($shift->name), 'morning'); $rule = $employeeWorkRules[$shift->id] ?? null; $isConfigured = $rule && $rule->is_active; $defaultStart = $isMorning ? '07:45' : '12:35'; $defaultEnd = $isMorning ? '12:35' : '17:30'; $tabId = "shift_tab_{$shift->id}"; $schedulesMap = $rule ? $rule->weeklySchedules->keyBy('day_of_week') : collect(); $days = [ 6 => 'Saturday', 0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday' ]; @endphp
{{-- Hidden Shift Enable Form Input --}} {{-- Shift Controls Header --}}
is_active) ? 'checked' : '' }}>
min
Working Days Summary
{{-- Shift Content Container --}}
{{-- QUICK PRESETS & TOOLBAR --}}
{{-- 7-DAY LIST FOR THIS SHIFT --}} @foreach($days as $day => $dayName) @php $s = $schedulesMap[$day] ?? null; $isOff = $s ? (bool)$s->is_off : ($day == 5); $startTime = $s && !$isOff ? $s->start_time : ($isOff ? '' : $defaultStart); $endTime = $s && !$isOff ? $s->end_time : ($isOff ? '' : $defaultEnd); @endphp
{{-- Day Name --}}
{{ $dayName }}
{{-- Start Time --}}
In
{{-- End Time --}}
Out
{{-- Calculated Duration --}}
{{ $isOff ? 'Off Day' : '0h 0m' }}
{{-- Off Day Toggle & Copy button --}}
@endforeach {{-- TOTAL SUMMARY BOX FOR THIS SHIFT --}}
{{ $shift->name }} Total Weekly: 0h 0m
(0 min total)
{{-- Shift Disabled Overlay Placeholder --}}
{{ $shift->name }} is Disabled for this Employee

This shift rule is currently not active for {{ $employee->name }}.

@endforeach
{{-- Card Footer with Actions --}}
@endsection @section('customjs') @endsection