tasks)) { $in_progress = '#fca000'; $todo = '#7d7d7d'; $error = '#fc0000'; $backlog = '#bababa'; $done = '#40de02'; $cancelled = 'black'; $state = [ "c73c2044-ea14-42cb-b08d-cecf3d1fdfb5" => "$in_progress",// in progress "a9ce312f-cfca-491e-8e3d-1975aa6ebc10" => "$todo",//to do "dea1fb57-a281-4fe7-8f3e-ee5567637e35" => "$error",// error "770fbe42-99f6-41db-9b9e-773d9cced1a5" => "$backlog",//backlog "b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0" => "$done",//done "d61d14a3-72f7-4f44-894b-efe8b2a75be1" => "$cancelled",//canceled ]; $state_order = [ "c73c2044-ea14-42cb-b08d-cecf3d1fdfb5", "a9ce312f-cfca-491e-8e3d-1975aa6ebc10", "dea1fb57-a281-4fe7-8f3e-ee5567637e35", "770fbe42-99f6-41db-9b9e-773d9cced1a5", "b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0", "d61d14a3-72f7-4f44-894b-efe8b2a75be1", ]; $user->tasks = $user->tasks->sortBy(function ($task) use ($state_order) { return array_search($task->state, $state_order); }); } // $duration for break timer is passed from AttendanceController ?> @extends('app') @section('content')
{{-- --}} @if (!isset($_COOKIE['token-0']))
@csrf

سامانه گذارش کار

{{ $s->response }}

@php $user_identity = $_COOKIE['user_identity'] ?? ''; @endphp

در حال بررسی موقعیت...

{{--

{{Carbon::now()}}

--}}
{{-- @if(session('open_task_modal'))--}} {{-- --}} {{-- @endif--}} @else
@endif
@if(isset($_COOKIE['user_identity'])) {{-- قسمت پردازش داده‌ها: گروه‌بندی لیست حضور و غیاب بر اساس نام ماه شمسی --}} @php // بررسی وجود داده $attendances = $user->attendances ?? collect(); // گروه‌بندی داده‌ها بر اساس نام ماه شمسی $groupedData = $attendances ->filter(fn ($item) => !empty($item->entered_at)) ->groupBy(function ($item) { $month = \App\Support\JalaliHelper::format($item->entered_at, '%B', ''); return $month !== '' ? $month : 'نامعتبر'; }); @endphp
@if($groupedData->isEmpty())

اطلاعاتی موجود نمیباشد

@else {{-- دکمه‌های تب (نام ماه‌ها) --}}
@foreach($groupedData->keys() as $month) @endforeach
@foreach($groupedData as $month => $records)
@if($_COOKIE['user_identity'] == 1370) @endif @php $monthLateMinutes = 0; $monthDailyFine = 0; $monthKey = null; $firstEntered = $records->first()?->entered_at; if ($firstEntered && \App\Support\JalaliHelper::fromDateTime($firstEntered)) { $monthKey = \Carbon\Carbon::parse($firstEntered); [$mStart, $mEnd] = app(\App\Services\LatePenaltyService::class)->jalaliMonthBounds($monthKey); $monthWeeklyFine = (int) \App\Models\LatePeriodFine::query() ->where('user_identity', $user->user_name) ->where('period_type', 'weekly') ->whereBetween('period_start', [$mStart->toDateString(), $mEnd->toDateString()]) ->sum('fine_amount'); } else { $monthWeeklyFine = 0; } @endphp @foreach($records as $item) @php $monthLateMinutes += (int) ($item->late_minutes ?? 0); $monthDailyFine += (int) ($item->daily_fine_amount ?? 0); @endphp {{-- شرط نمایش نام --}} @if($_COOKIE['user_identity'] == 1370) @endif {{-- تاریخ --}} {{-- زمان ورود --}} {{-- زمان خروج --}} {{-- مدت زمان --}} {{-- تأخیر --}} @endforeach @php $monthTotalFine = $monthDailyFine + $monthWeeklyFine; @endphp
نامتاریخ ورود خروج مدت تأخیر
{{$item->user_identity}} {{ \App\Support\JalaliHelper::format($item->entered_at, 'm/d') }} {{ \App\Support\JalaliHelper::format($item->entered_at, '%A', '') }} {{ $item->entered_at ? \Carbon\Carbon::parse($item->entered_at)->format('H:i') : '-' }} {{ $item->exited_at ? \Carbon\Carbon::parse($item->exited_at)->format('H:i') : '-' }} {{ $item->entered_at && $item->exited_at && $item->duration ? \Illuminate\Support\Str::of($item->duration)->beforeLast(':')->toString() : '-' }} @if(($item->late_minutes ?? 0) > 0) {{ $item->late_minutes }}د @if(($item->daily_fine_amount ?? 0) > 0) {{ number_format($item->daily_fine_amount) }}ت @endif @else - @endif
تعداد رکورد: {{ count($records) }}
تأخیر ماه: {{ $monthLateMinutes }} دقیقه
جریمه روزانه: {{ number_format($monthDailyFine) }} تومان
جریمه هفتگی: {{ number_format($monthWeeklyFine) }} تومان
جمع جریمه ماه: {{ number_format($monthTotalFine) }} تومان
@endforeach @endif
@endif
{{-- START TASK MODAL --}} @endsection @section('script') @endsection