The Employee Calendar is a visual representation of all your work-related events in one centralized view. It displays your shifts, attendance records, leave dates, overtime, company events, and holidays in an easy-to-read calendar format.
Think of it as your personal work calendar that shows:
β
Multi-Month View - See up to 3 months at a time
β
Color-Coded Events - Different colors for different event types
β
Click for Details - Click any date to see detailed information
β
Filter Events - Show/hide specific event types
β
Print Ready - Print your calendar for offline reference
β
Export Functionality - Download as ICS file for Google Calendar, Outlook
β
Real-Time Updates - Calendar syncs with system changes
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EMPLOYEE CALENDAR β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β [View Controls] [Filter] [Export] [Print] β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β β
β β CALENDAR GRID (Days/Weeks/Month) β β
β β β β
β β Date cells with color-coded indicators β β
β β β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β [Legend] β
β π΅ Shift | β
Checked-In | ποΈ Leave | β° Overtime... β
β β
β [Previous] [Today] [Next] Month: December 2025 β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Option 1: From Dashboard
Dashboard β Left Menu β Calendar
β
Calendar Page Opens
Option 2: From Left Navigation Menu
Main Menu β Calendar Icon π
β
Calendar Page Opens
Option 3: Direct URL
https://dtr.company.com/employee/calendar
Option 4: From Other Pages
Any Employee Page β Calendar Link
β
Opens Calendar View
When you first open the calendar:
ββββββββββββββββββββββββββββββββββββββββ
β Loading Calendar... β
β β
β β³ Fetching your events β
β β³ Loading attendance records β
β β³ Loading shift information β
β β³ Loading leave data β
β β
β [Please wait] β
β β
ββββββββββββββββββββββββββββββββββββββββ
Typical load time: 1-3 seconds
Once loaded:
β
Calendar Ready
All your events visible
Ready for interaction
The calendar displays in Month View by default:
DECEMBER 2025
ββββββββββββββββββββββββββββββββββββ
β Sun Mon Tue Wed Thu Fri Sat β
ββββββββββββββββββββββββββββββββββββ€
β 1 2 β
β 3 4 5 6 7 8 9 β
β 10 11 12 13 14 15 16 β
β 17 18 19 20 21 22 23 β
β 24 25 26 27 28 29 30 β
β 31 β
ββββββββββββββββββββββββββββββββββββ
[β Previous] [Today] [Next βΆ]
Each date cell contains multiple pieces of information:
ββββββββββββββββββββββββ
β 4 β β Date number
β (Wed) β β Day of week (optional)
β β
β π΅ Morning 08-17:00 β β Shift (if assigned)
β β
Checked In β β Attendance status (if today)
β ποΈ Leave β β Special indicators
β β
β [Color Bar] β β Color-coded indicator
β β
ββββββββββββββββββββββββ
Dense Display (Less detail):
βββββββββββ
β 4 β β Just date
β π΅ β
β β Icons only
β [ββββ] β β Color bar
βββββββββββ
Top Bar Options:
[View Mode βΌ] [Filter βΌ] [Export βΌ] [Print]
| Control | Options | Purpose |
|---|---|---|
| View Mode | Month / Week / Day | Change calendar display |
| Filter | Shifts, Leaves, OT, etc | Show/hide event types |
| Export | ICS, PDF, CSV | Download calendar data |
| Print to printer | Physical copy |
Bottom Bar Navigation:
[β Previous Month] [Today] [Next Month βΆ]
Month: December 2025
Controls:
Shows what each color means:
CALENDAR LEGEND
βββββββββββββββββββββββββββββββββββββββββββ
π΅ Blue = Regular Shift Assigned
π‘ Yellow = Pending Approval (Shift/Leave/OT)
π΄ Red = On Approved Leave
π’ Green = Checked In (Attendance)
β¬ Gray = Off Day / Holiday
β Star = Company Event
π Pin = Shift Change Notification
Your assigned work shifts for the day.
Dec 4 (Wed)
π΅ Morning Shift (08:00 - 17:00)
Information Shown:
Click to see:
Days you've successfully checked in.
Dec 4 (Wed)
β
Checked In - 08:30 AM
β
Checked Out - 17:15 PM
Duration: 8h 45m
Status: APPROVED
Information Shown:
Days you've taken approved leave.
Dec 10-11 (Tue-Wed)
ποΈ Sick Leave (2 days)
Approved by: Team Lead & HR
Information Shown:
Overtime hours you've recorded.
Dec 5 (Fri)
β° Overtime: 2.5 hours
Reason: Project Deadline
Status: APPROVED
Information Shown:
Company-wide announcements and events.
Dec 8 (Sun)
β Company Foundation Day (Holiday)
All offices closed
Information Shown:
National and company holidays.
Dec 25 (Wed)
β¬ Christmas Holiday
Day off - No work required
Information Shown:
Items waiting for approval.
Dec 20-27 (Fri-Fri)
π‘ Vacation Leave (5 days) - PENDING
Awaiting: Team Lead Review
Submitted: 2 days ago
Information Shown:
Move Between Months:
[β Previous] [Next βΆ]
Click to go to Click to go to
November 2025 January 2026
[Today]
Jump directly to current month
(December 2025)
Navigation Behavior:
Timeline Example:
Oct 2025 β Sep 2025 β Aug 2025 β (Previous)
Dec 2025 β Jan 2026 β Feb 2026 β (Next)
Change How Calendar Displays:
[View Mode βΌ]
ββ Month (Default) β See full month
ββ Week β See single week
ββ Day β See single day
Shows entire month (28-31 days)
Each date cell shows multiple events
Good for: Planning ahead, seeing patterns
DECEMBER 2025
ββββββββββββββββββββββββββββββββ
β Sun Mon Tue Wed Thu Fri Sat β
β 1 2 β
β 3 4 5 6 7 8 9 β
β 10 11 12 13 14 15 16 β
β 17 18 19 20 21 22 23 β
β 24 25 26 27 28 29 30 β
β 31 β
ββββββββββββββββββββββββββββββββ
Shows single week (7 days)
More detail per day
Good for: Seeing hourly details, weekly planning
WEEK OF DEC 1-7, 2025
Mon 1 Tue 2 Wed 3 Thu 4 Fri 5 Sat 6 Sun 7
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
Morning Morning Morning Morning Morning OFF OFF
08-17 08-17 08-17 08-17 08-17
β
β
β
β
β°OT
Checked Checked Checked Pending
In In In +2.5h
Shows single day (24 hours)
Hourly breakdown
Good for: Seeing time details, shift specifics
DECEMBER 4, 2025 (WEDNESDAY)
Time Status Details
βββββββββββββββββββββββββββββββββββββ
08:00 Morning Shift Starts
08:30 β
Checked In System verified
12:00 Break Time 1 hour break
13:00 Break Ends Resume work
17:00 Shift Ends Expected end
17:15 β
Checked Out Shift complete
Duration: 8h 45m
Show/Hide Specific Event Types:
[Filter βΌ]
β Shifts β Checked = visible
β Attendance
β Leave
β Overtime
β Company Events
β Holidays
β Pending Approvals β Unchecked = hidden
Example - Hide Pending Items:
Before Filtering (All events shown):
ββββββββββββββββββββββββββββββββββββ
Dec 20: π‘ PENDING Vacation Leave
Dec 21: ποΈ Leave approved
After Filtering (Pending hidden):
ββββββββββββββββββββββββββββββββββββ
Dec 20: [Hidden]
Dec 21: ποΈ Leave approved
Use Cases:
| Filter | When to Use |
|---|---|
| Shifts Only | Planning work schedule |
| Attendance Only | Reviewing work history |
| Leaves Only | Managing time off |
| OT Only | Tracking extra hours |
| No Pending | Seeing finalized plans |
Jump to Specific Date:
[Go to Date] βΌ
ββ December 4 (Today)
ββ December 25 (Christmas)
ββ January 1, 2026 (New Year)
ββ [Custom Date...]
Select β Calendar jumps to that date
Step 1: Locate Date
Find the date you want to view on the calendar.
Step 2: Click the Date
Click on date cell β Details modal opens
Step 3: Modal Opens
ββββββββββββββββββββββββββββββββββββββββββ
β DECEMBER 4, 2025 (WEDNESDAY) β
ββββββββββββββββββββββββββββββββββββββββββ€
β β
β SHIFT INFORMATION β
β βββββββββββββββββββββββββββββββββββββ β
β Shift: Morning (08:00 - 17:00) β
β Workplace: Main Office - 3rd Floor β
β Workstation: Desk 5-A β
β β
β ATTENDANCE RECORDS β
β βββββββββββββββββββββββββββββββββββββ β
β Check-In: 08:30 AM β
β
β Check-Out: 17:15 PM β
β
β Duration: 8h 45m β
β Status: APPROVED β
β Location: 42.5m from office β
β
β β
β OTHER EVENTS FOR THIS DAY β
β βββββββββββββββββββββββββββββββββββββ β
β Team Standup: 10:00 AM (Meeting) β
β Client Call: 2:00 PM (Conference Rm) β
β β
β [Edit] [Export] [Print] [Close] β
β β
ββββββββββββββββββββββββββββββββββββββββββ
Shift Details:
Shift Name: Morning / Afternoon / Night
Start Time: 08:00 AM
End Time: 17:00 PM (5:00 PM)
Duration: 9 hours (includes 1 hour break)
Break Time: 12:00 PM - 1:00 PM
Workplace: Office address
Workstation: Your assigned desk
Attendance Details:
Check-In Time: 08:30 AM (timestamp)
Check-Out Time: 17:15 PM (timestamp)
Total Duration: 8 hours 45 minutes
Status: APPROVED / REMOTE / PENDING
Location: Distance from office (meters)
Verified By: GPS / Manual / Admin
Leave Details:
Leave Type: Sick / Vacation / Emergency
Date Range: Start date - End date
Days Approved: Number of days
Reason: Why leave was requested
Approvers: Team Lead name, HR name
Approval Date: When it was approved
Balance Impact: Days used / remaining
Overtime Details:
Date: Which date OT was worked
Hours: 2.5 hours
Reason: Why overtime was needed
Status: APPROVED / PENDING / REJECTED
Approver: Who approved it
Approval Date: When it was approved
Edit (If Applicable):
[Edit] button appears if event is editable
ββ Pending leaves β Can edit/cancel
ββ Pending OT β Can withdraw
ββ Future shifts β Can request swap
Export:
[Export] β Download as ICS file
ββ Add to Google Calendar
ββ Add to Outlook
ββ Add to Apple Calendar
ββ Add to other calendar apps
Print:
[Print] β Print event details
ββ Prints with formatting
ββ Includes timestamps
ββ Professional format
ββ Good for records
Close:
[Close] β Returns to calendar view
[X] button β Also closes modal
The calendar uses 7 main colors to represent different event types:
Color: #3B82F6 (Azure Blue)
Meaning: Your assigned work shift
Example: Morning (08:00-17:00)
Calendar Cell:
ββββββββββββββββ
β 4 β
β π΅ MORNING β
β 08:00-17:00 β
β [ββββββββ] β β Blue bar
ββββββββββββββββ
Color: #10B981 (Emerald Green)
Meaning: Successfully checked in for work
Example: β
Checked In - 08:30 AM
Calendar Cell:
ββββββββββββββββ
β 4 β
β π’ CHECKED INβ
β 08:30-17:15 β
β [ββββββββ] β β Green bar
ββββββββββββββββ
Color: #EF4444 (Bright Red)
Meaning: Approved leave - no work
Example: Sick Leave (2 days)
Calendar Cell:
ββββββββββββββββ
β 10-11 β
β π΄ LEAVE β
β Sick Leave β
β [ββββββββ] β β Red bar
ββββββββββββββββ
Color: #F97316 (Orange)
Meaning: Extra hours worked
Example: β° 2.5 hours OT
Calendar Cell:
ββββββββββββββββ
β 5 β
β π OVERTIME β
β +2.5 hours β
β [ββββββββ] β β Orange bar
ββββββββββββββββ
Color: #FBBF24 (Amber Yellow)
Meaning: Awaiting approval decision
Example: Pending Leave Request
Calendar Cell:
ββββββββββββββββ
β 20 β
β π‘ PENDING β
β Leave Requestβ
β [ββββββββ] β β Yellow bar
ββββββββββββββββ
Color: #9CA3AF (Light Gray)
Meaning: Day off, no work
Example: Weekend, Company Holiday
Calendar Cell:
ββββββββββββββββ
β 7 β
β β¬ OFF DAY β
β Weekend β
β [ββββββββ] β β Gray bar
ββββββββββββββββ
Color: #FBBF24 (Gold Yellow)
Meaning: Important company event
Example: β Company Founding Day
Calendar Cell:
ββββββββββββββββ
β 8 β
β β EVENT β
β Founding Day β
β [ββββββββ] β β Gold bar
ββββββββββββββββ
| Color | Meaning | Action |
|---|---|---|
| π΅ Blue | Shift assigned | Work as scheduled |
| π’ Green | Checked in | Record exists |
| π΄ Red | On leave | Rest day, no work |
| π Orange | Overtime worked | Extra hours logged |
| π‘ Yellow | Pending | Awaiting decision |
| β¬ Gray | Off/Holiday | No work required |
| β Gold | Company event | Important notice |
If day has multiple event types:
Date cell shows all relevant colors:
Dec 4
ββββββββββββββββββββββββββββ
β 4 (Wed) β
β β
β π΅ Morning Shift 08-17 β
β π’ Checked In 08:30-17:15β
β β° OT Pending +1.5h β
β β
β [π’π΅π ] Stacked bars β
β β
ββββββββββββββββββββββββββββ
All colors visible in cell
Multiple bars show multiple events
β DO:
Check Calendar Regularly
Morning: Check today's shift & events
Weekly: Review upcoming week
Monthly: Plan the month ahead
Export to Personal Calendar
Export shifts to Google Calendar
Get notifications on your phone
Never miss a shift or deadline
Track Attendance
Review daily check-in records
Ensure all days are properly recorded
Report discrepancies early
Plan Leave Early
Check calendar for busy periods
Request leave well in advance
Avoid blackout dates
Monitor Pending Items
Keep eye on pending approvals
Follow up if taking too long
Resubmit if rejected
For Shift Management:
β
Check assigned shift before arriving
β
Note shift changes (yellow indicators)
β
Plan travel time based on shift start
β Don't assume same shift every day
For Leave Planning:
β
Plan ahead (submit 2+ weeks early)
β
Check leave balance before requesting
β
Mark calendar when approved
β Don't submit at last minute
For Overtime:
β
Document reason for overtime
β
Request approval same day if possible
β
Keep records of extra work
β Don't assume OT is automatically approved
For Attendance:
β
Check in before shift start
β
Verify check-out at shift end
β
Report issues to Team Lead
β Don't rely on memory for times
Keyboard Shortcuts:
| Shortcut | Action |
|---|---|
| β β | Previous/Next month |
| T | Jump to today |
| M | Switch to month view |
| W | Switch to week view |
| D | Switch to day view |
| P | Print calendar |
| E | Export calendar |
| ? | Show help |
Symptom: Blank calendar or loading spinner stuck
Solutions:
Symptom: Expected events don't appear on calendar
Solutions:
[Filter βΌ] β Make sure event type is β checkedAre you looking in correct month?
[β Previous] or [Next βΆ] to navigateF5 or [Refresh] buttonPending events may be filtered outSymptom: Event shows unexpected color
Solutions:
Click date to see full details
Status determines colorLook at legend to confirm meaningEvent might be from different categorySymptom: Export button doesn't work
Solutions:
Use Chrome, Firefox, or Safari
Older IE may not support exportBrowser may need permission to download
Check popup blocker
Allow downloadsIf PDF fails, try ICS or CSVEnsure device has storage spaceSymptom: Calendar doesn't work well on phone
Solutions:
More readable in landscape modeSome features work better on desktopTry pinch-zoom to see detailsExport to Google Calendar for mobile
Get native app experienceQ: Can I share my calendar with manager?
A: Yes, export and share the ICS file or screenshot with your Team Lead.
Q: How far back does calendar show history?
A: Shows past 1 year and future 1 year by default. Contact IT for extended history.
Q: Can I sync with Outlook or Google Calendar?
A: Yes! Export as ICS file and import into your calendar app.
Q: Why is some event data missing?
A: Old records may be archived. Contact HR for historical data.
Q: Can I print multiple months at once?
A: Yes, select month range then print. Or export to PDF first.
Q: How often does calendar update?
A: Real-time. Changes appear within seconds of approval.
Q: Can I set calendar reminders?
A: Yes, export to Google Calendar which has built-in reminders.
Q: What if shift is wrong on calendar?
A: Contact HR or Team Lead to correct the assignment.
CalendarController
βββ ShiftServices
βββ LeaveRequestServices
βββ OvertimeServices
βββ AttendanceRecordServices
βββ HolidayServices
βββ CompanyEventServices
β
view('users.employee.calendar.index')
βββ Blade Template
βββ Alpine.js Components
βββ Calendar Library (FullCalendar/Similar)
βββ Event Rendering
βββ Shift Events
βββ Attendance Events
βββ Leave Events
βββ Overtime Events
βββ Holiday Events
βββ Company Event
User Visits: /employee/calendar
β
CalendarController@index
ββ Get all shifts for user
ββ Get all attendance records
ββ Get all leave requests
ββ Get all overtime requests
ββ Get all holidays
ββ Get all company events
β
Process & Format Data
ββ Convert to calendar events
ββ Add color coding
ββ Add click handlers
ββ Add metadata
ββ Format dates
β
Pass to Blade View
ββ JSON-encoded events array
β
Alpine.js / Calendar Library
ββ Render events on calendar
ββ Add interactivity
ββ Handle clicks
ββ Manage filters
β
User Interaction
ββ Click date β Show details modal
ββ Filter β Update displayed events
ββ Export β Generate ICS file
ββ Print β Print calendar
File: app/Http/Controllers/Web/Employee/CalendarController.php
index()public function index(
ShiftServices $shiftServices,
AttendanceRecordServices $attendanceServices,
LeaveRequestServices $leaveServices,
OvertimeServices $overtimeServices,
HolidayServices $holidayServices,
CompanyEventServices $eventServices
) {
$userId = auth()->user()->id;
// Get all events
$shifts = $shiftServices->getUserShifts($userId);
$attendances = $attendanceServices->getRecords($userId);
$leaves = $leaveServices->getApprovedLeaves($userId);
$overtimes = $overtimeServices->getApprovedOvertimes($userId);
$holidays = $holidayServices->getHolidays();
$events = $eventServices->getCompanyEvents();
// Format for calendar
$calendarEvents = $this->formatCalendarEvents([
'shifts' => $shifts,
'attendances' => $attendances,
'leaves' => $leaves,
'overtimes' => $overtimes,
'holidays' => $holidays,
'events' => $events
]);
return view('users.employee.calendar.index', [
'events' => json_encode($calendarEvents),
'userId' => $userId
]);
}
private function formatCalendarEvents($data)
{
$events = [];
// Format shifts as blue events
foreach ($data['shifts'] as $shift) {
$events[] = [
'id' => 'shift-' . $shift->id,
'title' => $shift->shift->name . ' (' .
$shift->shift->time_started . '-' .
$shift->shift->time_ended . ')',
'start' => $shift->date,
'color' => '#3B82F6', // Blue
'type' => 'shift',
'extendedProps' => [
'workplace' => $shift->workplace->name,
'workstation' => $shift->workstation->name,
'duration' => $shift->shift->duration
]
];
}
// Format attendances as green events
foreach ($data['attendances'] as $attendance) {
$events[] = [
'id' => 'attendance-' . $attendance->id,
'title' => 'β
Checked In - ' .
$attendance->clock_in->format('H:i A'),
'start' => $attendance->clock_in->format('Y-m-d'),
'color' => '#10B981', // Green
'type' => 'attendance',
'extendedProps' => [
'clockIn' => $attendance->clock_in,
'clockOut' => $attendance->clock_out,
'duration' => $attendance->duration_minutes,
'status' => $attendance->status
]
];
}
// Format leaves as red events
foreach ($data['leaves'] as $leave) {
$events[] = [
'id' => 'leave-' . $leave->id,
'title' => 'ποΈ ' . $leave->leave_type->name .
' (' . $leave->days . ' days)',
'start' => $leave->start_date,
'end' => $leave->end_date->addDay(),
'color' => '#EF4444', // Red
'type' => 'leave',
'extendedProps' => [
'leaveType' => $leave->leave_type->name,
'days' => $leave->days,
'reason' => $leave->reason
]
];
}
// Format overtimes as orange events
foreach ($data['overtimes'] as $overtime) {
$events[] = [
'id' => 'overtime-' . $overtime->id,
'title' => 'β° OT: ' . $overtime->hours . ' hours',
'start' => $overtime->date,
'color' => '#F97316', // Orange
'type' => 'overtime',
'extendedProps' => [
'hours' => $overtime->hours,
'reason' => $overtime->reason,
'status' => $overtime->status
]
];
}
// Format holidays as gray events
foreach ($data['holidays'] as $holiday) {
$events[] = [
'id' => 'holiday-' . $holiday->id,
'title' => 'β¬ ' . $holiday->name,
'start' => $holiday->date,
'color' => '#9CA3AF', // Gray
'type' => 'holiday',
'extendedProps' => [
'description' => $holiday->description
]
];
}
// Format company events as gold events
foreach ($data['events'] as $event) {
$events[] = [
'id' => 'event-' . $event->id,
'title' => 'β ' . $event->title,
'start' => $event->start_date,
'end' => $event->end_date,
'color' => '#FBBF24', // Gold
'type' => 'event',
'extendedProps' => [
'description' => $event->description,
'location' => $event->location
]
];
}
return $events;
}
class ShiftServices
{
public function getUserShifts($userId, $startDate = null, $endDate = null)
{
return UserShift::where('user_id', $userId)
->whereBetween('date', [$startDate, $endDate])
->with(['shift', 'workplace', 'workstation'])
->get();
}
}
class AttendanceRecordServices
{
public function getRecords($userId, $year = null)
{
$year = $year ?? now()->year;
return AttendanceRecord::where('user_id', $userId)
->whereYear('clock_in', $year)
->get();
}
}
class LeaveRequestServices
{
public function getApprovedLeaves($userId)
{
return LeaveRequest::where('user_id', $userId)
->where('status', 'APPROVED')
->with('leave_type')
->get();
}
}
File: resources/views/users/employee/calendar/index.blade.php
<x-employee-layout>
<div class="container-fluid p-4">
<!-- Header Controls -->
<div class="flex justify-between items-center mb-4">
<h1 class="text-3xl font-bold">My Calendar</h1>
<div class="flex gap-2">
<!-- View Mode -->
<select @change="changeViewMode" class="select select-sm">
<option value="dayGridMonth">Month</option>
<option value="timeGridWeek">Week</option>
<option value="timeGridDay">Day</option>
</select>
<!-- Filter -->
<button @click="showFilter = !showFilter" class="btn btn-sm">
Filter
</button>
<!-- Export -->
<button @click="exportCalendar" class="btn btn-sm">
Export
</button>
<!-- Print -->
<button @click="window.print()" class="btn btn-sm">
Print
</button>
</div>
</div>
<!-- Filter Panel -->
<div x-show="showFilter" class="mb-4 p-4 bg-base-200 rounded">
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('shift')"
:checked="filters.shift" />
<span>Shifts</span>
</label>
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('attendance')"
:checked="filters.attendance" />
<span>Attendance</span>
</label>
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('leave')"
:checked="filters.leave" />
<span>Leaves</span>
</label>
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('overtime')"
:checked="filters.overtime" />
<span>Overtime</span>
</label>
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('holiday')"
:checked="filters.holiday" />
<span>Holidays</span>
</label>
<label class="flex items-center gap-2">
<input type="checkbox"
@change="toggleFilter('event')"
:checked="filters.event" />
<span>Company Events</span>
</label>
</div>
<!-- Calendar Container -->
<div id="calendar"></div>
<!-- Legend -->
<div class="mt-4 p-4 bg-base-200 rounded">
<h3 class="font-bold mb-2">Legend</h3>
<div class="grid grid-cols-3 gap-4">
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-blue-500"></div>
<span>Shift</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-green-500"></div>
<span>Checked In</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-red-500"></div>
<span>Leave</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-orange-500"></div>
<span>Overtime</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-yellow-500"></div>
<span>Pending</span>
</div>
<div class="flex items-center gap-2">
<div class="w-4 h-4 bg-gray-500"></div>
<span>Holiday</span>
</div>
</div>
</div>
</div>
<!-- Event Details Modal -->
<div id="eventModal" class="modal">
<div class="modal-box">
<h3 id="eventTitle" class="font-bold text-lg"></h3>
<div id="eventDetails" class="py-4"></div>
<div class="modal-action">
<button class="btn" onclick="eventModal.close()">Close</button>
<button class="btn btn-primary" onclick="editEvent()">Edit</button>
</div>
</div>
</div>
@push('scripts')
<script>
const events = @json($events);
document.addEventListener('DOMContentLoaded', function() {
initializeCalendar(events);
});
</script>
@endpush
</x-employee-layout>
function initializeCalendar(events) {
const calendarEl = document.getElementById("calendar");
const calendar = new FullCalendar.Calendar(calendarEl, {
initialView: "dayGridMonth",
headerToolbar: {
left: "prev,next today",
center: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay",
},
events: events,
eventClick: handleEventClick,
datesSet: handleDatesSet,
eventClassNames: getEventClasses,
height: "auto",
});
calendar.render();
}
function handleEventClick(info) {
const event = info.event;
displayEventModal(event);
}
function getEventClasses(info) {
return ["event-" + info.event.extendedProps.type];
}
function displayEventModal(event) {
document.getElementById("eventTitle").textContent = event.title;
document.getElementById("eventDetails").innerHTML =
formatEventDetails(event);
document.getElementById("eventModal").showModal();
}
function formatEventDetails(event) {
const props = event.extendedProps;
switch (props.type) {
case "shift":
return `
<p><strong>Workplace:</strong> ${props.workplace}</p>
<p><strong>Workstation:</strong> ${props.workstation}</p>
<p><strong>Duration:</strong> ${props.duration}</p>
`;
case "attendance":
return `
<p><strong>Clock In:</strong> ${props.clockIn}</p>
<p><strong>Clock Out:</strong> ${props.clockOut}</p>
<p><strong>Duration:</strong> ${props.duration}</p>
<p><strong>Status:</strong> ${props.status}</p>
`;
// ... other types
}
}
// UserShift model
class UserShift extends Model
{
protected $dates = ['date'];
public function shift() {
return $this->belongsTo(Shift::class);
}
public function workplace() {
return $this->belongsTo(WorkPlace::class);
}
public function workstation() {
return $this->belongsTo(WorkStation::class);
}
}
// AttendanceRecord model
class AttendanceRecord extends Model
{
protected $dates = ['clock_in', 'clock_out'];
public function getDurationMinutesAttribute()
{
return $this->clock_in->diffInMinutes($this->clock_out);
}
}
// LeaveRequest model
class LeaveRequest extends Model
{
public function leave_type() {
return $this->belongsTo(LeaveType::class);
}
public function getDaysAttribute()
{
return $this->start_date->diffInDays($this->end_date);
}
}
Endpoint: GET /api/v1/calendar/events
Parameters:
startDate: 2025-12-01
endDate: 2025-12-31
filters: shift,attendance,leave,overtime
Response:
{
"events": [
{
"id": "shift-1",
"title": "Morning (08:00-17:00)",
"start": "2025-12-04",
"color": "/docs/1.0/employee/calendar#3B82F6",
"type": "shift"
}
]
}
public function exportICS()
{
$events = $this->formatCalendarEvents([...]);
$ics = new ICal('DTR Calendar');
foreach ($events as $event) {
$ics->addEvent([
'title' => $event['title'],
'description' => json_encode($event['extendedProps']),
'dtstart' => $event['start'],
'dtend' => $event['end'] ?? $event['start'],
'categories' => $event['type']
]);
}
return response($ics->get())
->header('Content-Type', 'text/calendar')
->header('Content-Disposition', 'attachment; filename="dtr-calendar.ics"');
}
Documentation Version: 1.0
Last Updated: December 4, 2025
Status: β
Complete