get()) : collect(); $jalalian_object = Jalalian::now(); $first_day_of_month = $jalalian_object->subDays($jalalian_object->getDay() - 1); $carbon_gregorian = $first_day_of_month->toCarbon(); $thismonth = $carbon_gregorian->format('Y-m-d 00:00:00'); $ids = json_decode(request()->cookie('seen_angizeh_ids', '[]'), true) ?: []; $s = ai::where('key', 'angizeh') ->when($ids, fn($q) => $q->whereNotIn('id', $ids)) ->orderByDesc('id') ->first() ?? ai::where('key', 'angizeh')->orderByDesc('id')->first(); $ids = array_merge($ids, [$s->id]); Cookie::queue('seen_angizeh_ids', json_encode($ids), 14400); //total time $now = Jalalian::fromCarbon(Carbon::now()); $tsec = 0; //dd(->user_profile); if (isset($_COOKIE['token01'])) { $a = json_decode($_COOKIE['token01']); $user = User::where('user_name', $a->user_profile)->with('attendances')->first(); } else { $user = isset($_COOKIE['user_identity']) ? User::where('user_name', $_COOKIE['user_identity'])->with('attendances')->first() : null; } //dd($user); if (!empty($user->attendanes)) { foreach ($user->attendances as $att) { $date = $att->entered_at != null ? Jalalian::fromCarbon(Carbon::parse($att->entered_at)) : null; $att->date = $date != null ? $date->format('Y/m/d') : null; if ($att->duration != null && $date != null && $now->getMonth() == $date->getMonth()) { [$h, $m, $sec] = explode(':', $att->duration); $tsec += $h * 3600 + $m * 60 + $sec; } } } $hours = floor($tsec / 3600); $minutes = floor(($tsec % 3600) / 60); $totalTime = sprintf('%02d:%02d', $hours, $minutes); $formaction = (isset($_COOKIE['ad']) && $_COOKIE['ad'] == 1) ? 'admin/' : 'attendance/'; $now = Carbon::now()->format('Y-m-d'); $existed = $Attendance->whereNull('exited_at')->first(); $requested = $Attendance->whereNull('exited_at')->where('requested', 'true')->first(); $lastday = $Attendance->whereNull('exited_at')->where('entered_at', '<', $now)->first(); $forgot = $lastday ? Carbon::parse($lastday->entered_at)->format('Y-m-d') : ''; //dd($lastday); $hash = md5(strtolower(trim($user->email))); $gravatarUrl = "https://www.gravatar.com/avatar/$hash?s=200&d=identicon"; ?> @extends('app') @section('content')
| نام | @endif {{-- {{dd($user)}}--}}تاریخ | ورود | خروج | {{----}} {{-- استراحت--}} {{-- | --}}جمع |
|---|---|---|---|---|---|
| {{$item->user_identity}} | @endif{{ $item->entered_at ? Jalalian::fromCarbon(Carbon::parse($item->entered_at))->format('m/d') : '-' }} | {{ $item->entered_at ? Carbon::parse($item->entered_at)->format('H:i') : '-' }} | {{ $item->exited_at ? Carbon::parse($item->exited_at)->format('H:i') : '-' }} | {{----}} {{-- میزان استراحت--}} {{-- | --}}{{ $item->entered_at && $item->exited_at ? Carbon::parse($item->duration)->format('H:i') : '-' }} |