@extends('adminlte::page') @section('title', __('calendar.tab-title')) @section('content_header') @stop @section('content') @php use Carbon\Carbon; $now = Carbon::create($year, $month); $daysInMonth = $now->daysInMonth; $dayLabels = ['Ned', 'Pon', 'Uto', 'Sri', 'Čet', 'Pet', 'Sub']; $prevMonth = $now->copy()->subMonth(); $nextMonth = $now->copy()->addMonth(); @endphp
@for ($i = 1; $i <= $daysInMonth; $i++) @endfor @foreach ($servers as $index => $serviser) @php $serviserOrders = $orders->where('user_id', $serviser->id)->sortBy('planned_starting_date')->values(); $rows = []; foreach ($serviserOrders as $event) { $eventStart = Carbon::parse($event->planned_starting_date); $eventEnd = Carbon::parse($event->execution_date); $placed = false; foreach ($rows as &$row) { $conflict = false; foreach ($row as $existingEvent) { $existingStart = Carbon::parse($existingEvent->planned_starting_date); $existingEnd = Carbon::parse($existingEvent->execution_date); if ($eventStart->lte($existingEnd) && $eventEnd->gte($existingStart)) { $conflict = true; break; } } if (! $conflict) { $row[] = $event; $placed = true; break; } } if (! $placed) { $rows[] = [$event]; } } $rowClass = $index % 2 === 0 ? 'bg-even' : 'bg-odd'; // klase za stilizaciju @endphp {{-- Prvi red sa imenom --}} @include('calendar.partials.event_row', [ 'events' => $rows[0] ?? [], 'daysInMonth' => $daysInMonth, 'month' => $month, 'year' => $year ]) {{-- Ostali slojevi (redovi) --}} @for ($i = 1; $i < count($rows); $i++) @include('calendar.partials.event_row', [ 'events' => $rows[$i], 'daysInMonth' => $daysInMonth, 'month' => $month, 'year' => $year ]) @endfor @endforeach
Serviser {{ $i }}
{{ $dayLabels[Carbon::create($year, $month, $i)->dayOfWeek] }}
{{ $serviser->name }}
@stop @section('footer') @include('calendar.modals.details') @append @push('css') @include('adminlte::libs.css.select2') @endpush @push('js') @endpush