edit delay and penalty calculations

This commit is contained in:
2026-07-22 17:38:35 +03:30
parent e1f86e6ffe
commit e9f397d759
4 changed files with 57 additions and 12 deletions
+13 -10
View File
@@ -146,10 +146,13 @@ if (!empty($user->tasks)) {
// بررسی وجود داده
$attendances = $user->attendances ?? collect();
// گروه‌بندی داده‌ها بر اساس نام ماه (مثلا: مهر، آبان)
$groupedData = $attendances->groupBy(function($item) {
return \Morilog\Jalali\Jalalian::fromCarbon(\Carbon\Carbon::parse($item->entered_at))->format('%B');
});
// گروه‌بندی داده‌ها بر اساس نام ماه شمسی
$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
<div class="container inline-flex flex-col items-center justify-center">
@@ -188,10 +191,10 @@ if (!empty($user->tasks)) {
@php
$monthLateMinutes = 0;
$monthDailyFine = 0;
$monthKey = $records->first()?->entered_at
? \Carbon\Carbon::parse($records->first()->entered_at)
: null;
if ($monthKey) {
$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)
@@ -220,9 +223,9 @@ if (!empty($user->tasks)) {
{{-- تاریخ --}}
<td style="border-right: 1px solid #ddd; padding: 4px; background-color: {{"#e6e6e6" }};">
{{ $item->entered_at ? \Morilog\Jalali\Jalalian::fromCarbon(\Carbon\Carbon::parse($item->entered_at))->format('m/d') : '-' }}
{{ \App\Support\JalaliHelper::format($item->entered_at, 'm/d') }}
<span class="text-xs text-gray-500 block">
{{ $item->entered_at ? \Morilog\Jalali\Jalalian::fromCarbon(\Carbon\Carbon::parse($item->entered_at))->format('%A') : '' }}
{{ \App\Support\JalaliHelper::format($item->entered_at, '%A', '') }}
</span>
</td>