@extends('layouts.app') @section('title', 'Attendance Rule Details') @section('content') @php /* |-------------------------------------------------------------------------- | Safe Time Formatter |-------------------------------------------------------------------------- | | Your AttendanceRule model casts time fields as datetime, so normally | these values are Carbon instances. This helper also safely handles | string values if the cast is changed later. | */ $formatTime = function ($time) { if (blank($time)) { return '—'; } try { return $time instanceof \Carbon\CarbonInterface ? $time->format('h:i A') : \Carbon\Carbon::parse($time)->format('h:i A'); } catch (\Throwable $exception) { return (string) $time; } }; $schoolStart = $attendanceRule->school_start_time; $schoolEnd = $attendanceRule->school_end_time; $workingDuration = null; if ($schoolStart && $schoolEnd) { try { $start = $schoolStart instanceof \Carbon\CarbonInterface ? $schoolStart->copy() : \Carbon\Carbon::parse($schoolStart); $end = $schoolEnd instanceof \Carbon\CarbonInterface ? $schoolEnd->copy() : \Carbon\Carbon::parse($schoolEnd); $workingDuration = $start->diffInMinutes($end); } catch (\Throwable $exception) { $workingDuration = null; } } $workingHours = $workingDuration !== null ? floor($workingDuration / 60) : null; $workingMinutes = $workingDuration !== null ? $workingDuration % 60 : null; @endphp
{{-- ============================================================ Page Header ============================================================ --}}

{{ $attendanceRule->name }}

@if($attendanceRule->is_active) Active @else Inactive @endif

Attendance timing, threshold and processing configuration.

All Attendance Rules @can('attendance-rules.edit') Edit Attendance Rule @endcan
{{-- ============================================================ Summary Cards ============================================================ --}}
{{-- Academic Year --}}

Academic Year

{{ $attendanceRule->academicYear?->name ?? '—' }}

{{-- School Start --}}

School Starts

{{ $formatTime($attendanceRule->school_start_time) }}

{{-- School End --}}

School Ends

{{ $formatTime($attendanceRule->school_end_time) }}

{{-- Grace Period --}}

Grace Period

{{ number_format($attendanceRule->grace_minutes) }} min

{{-- ============================================================ Main Information ============================================================ --}}
{{-- Attendance Rule Information --}}

Attendance Rule Information

General information and school timing configuration.

{{-- Rule Name --}}
Rule Name
{{ $attendanceRule->name }}
{{-- Academic Year --}}
Academic Year
{{ $attendanceRule->academicYear?->name ?? '—' }}
{{-- Check-In Start --}}
Check-In Start Time
{{ $formatTime($attendanceRule->check_in_start_time) }}
{{-- Check-In End --}}
Check-In End Time
{{ $formatTime($attendanceRule->check_in_end_time) }}
{{-- School Start --}}
School Start Time
{{ $formatTime($attendanceRule->school_start_time) }}
{{-- School End --}}
School End Time
{{ $formatTime($attendanceRule->school_end_time) }}
{{-- Checkout Start --}}
Check-Out Start Time
{{ $formatTime($attendanceRule->check_out_start_time) }}
{{-- Auto Checkout Time --}}
Auto Checkout Time
{{ $formatTime($attendanceRule->auto_checkout_time) }}
{{-- Status --}}
Record Status
@if($attendanceRule->is_active) Active @else Inactive @endif
{{-- Created --}}
Created At
{{ $attendanceRule->created_at?->format('d M Y, h:i A') ?? '—' }}
{{-- Last Updated --}}
Last Updated
{{ $attendanceRule->updated_at?->format('d M Y, h:i A') ?? '—' }}
{{-- ======================================================== School Day Overview ======================================================== --}}

School Day Overview

Quick overview of the configured school schedule.

{{-- Duration --}}

Scheduled Duration

@if($workingDuration !== null) {{ $workingHours }}h {{ $workingMinutes }}m @else — @endif

Based on configured school start and end time.

{{-- Timeline --}}
{{-- Check-In Opens --}}

Check-In Opens

{{ $formatTime($attendanceRule->check_in_start_time) }}

{{-- School Starts --}}

School Starts

{{ $formatTime($attendanceRule->school_start_time) }}

{{-- Checkout Opens --}}

Check-Out Opens

{{ $formatTime($attendanceRule->check_out_start_time) }}

{{-- School Ends --}}

School Ends

{{ $formatTime($attendanceRule->school_end_time) }}

{{-- ============================================================ Attendance Thresholds ============================================================ --}}

Attendance Thresholds

Time thresholds used when calculating attendance status.

{{-- Grace --}}

Grace Period

{{ number_format($attendanceRule->grace_minutes) }} min

{{-- Late --}}

Late After

{{ number_format($attendanceRule->late_after_minutes) }} min

{{-- Half Day --}}

Half Day After

{{ number_format($attendanceRule->half_day_after_minutes) }} min

{{-- Minimum Working --}}

Minimum Working

{{ number_format($attendanceRule->minimum_working_minutes) }} min

{{-- Early Leave --}}

Early Leave Before

{{ number_format($attendanceRule->early_leave_before_minutes) }} min

{{-- ============================================================ Processing Settings + Management ============================================================ --}}
{{-- Attendance Processing --}}

Attendance Processing

Behaviour enabled for attendance recording and correction.

{{-- Auto Checkout --}}

Automatic Checkout

Automatically checkout students without a checkout punch.

@if($attendanceRule->auto_checkout) Enabled @else Disabled @endif
{{-- Manual Attendance --}}

Manual Attendance

Authorized users can record attendance manually.

@if($attendanceRule->allow_manual_attendance) Allowed @else Not Allowed @endif
{{-- Manual Correction --}}

Manual Correction

Authorized users can correct attendance records.

@if($attendanceRule->allow_manual_correction) Allowed @else Not Allowed @endif
{{-- Multiple Punch --}}

Multiple Punch

Allow multiple attendance punches during the same day.

@if($attendanceRule->allow_multiple_punch) Allowed @else Not Allowed @endif
{{-- ======================================================== Record Management ======================================================== --}}

Record Management

Manage this attendance rule record.

@can('attendance-rules.edit')

Edit Attendance Rule

Update timing, thresholds and processing settings.

@endcan @can('attendance-rules.delete')
@csrf @method('DELETE')
@endcan
@endsection @push('scripts') @endpush