diff --git a/app/Http/Controllers/TaskController.php b/app/Http/Controllers/TaskController.php index e3054fe8..cb7b0480 100755 --- a/app/Http/Controllers/TaskController.php +++ b/app/Http/Controllers/TaskController.php @@ -153,17 +153,17 @@ class TaskController extends Controller ? "وضعیت: " . ($stateFa[$s1] ?? ($before['state'] ?? '-')) . " ← " . ($stateFa[$s2] ?? ($after['state'] ?? '-')) : "وضعیت: " . ($stateFa[$s2] ?? ($after['state'] ?? '-')); - $d1 = $before['start_date'] ?? null; - $d2 = $after['start_date'] ?? null; + $d1 = \App\Support\JalaliHelper::format($before['start_date'] ?? null, 'Y/m/d', '-'); + $d2 = \App\Support\JalaliHelper::format($after['start_date'] ?? null, 'Y/m/d', '-'); $lines[] = ($d1 !== $d2) - ? "شروع: " . ($d1 ?: '-') . " ← " . ($d2 ?: '-') - : "شروع: " . ($d2 ?: '-'); + ? "شروع: {$d1} ← {$d2}" + : "شروع: {$d2}"; - $t1 = $before['target_date'] ?? null; - $t2 = $after['target_date'] ?? null; + $t1 = \App\Support\JalaliHelper::format($before['target_date'] ?? null, 'Y/m/d', '-'); + $t2 = \App\Support\JalaliHelper::format($after['target_date'] ?? null, 'Y/m/d', '-'); $lines[] = ($t1 !== $t2) - ? "ددلاین: " . ($t1 ?: '-') . " ← " . ($t2 ?: '-') - : "ددلاین: " . ($t2 ?: '-'); + ? "ددلاین: {$t1} ← {$t2}" + : "ددلاین: {$t2}"; $desc1 = trim((string)($before['description'] ?? '')); $desc2 = trim((string)($after['description'] ?? '')); @@ -693,13 +693,8 @@ class TaskController extends Controller } $user = User::where('user_name', $_COOKIE['user_identity'])->first(); - $startDate = $this->normalizeTaskDate($request->input('start_date')); - if (!$startDate) { - return back()->withInput()->with('message', [ - 'color' => 'red', - 'text' => 'تاریخ شروع الزامی است. لطفاً از تقویم انتخاب کنید.', - ]); - } + $startDate = $this->normalizeTaskDate($request->input('start_date')) + ?: now()->format('Y-m-d'); $data = [ 'title' => $request->input('title'), @@ -718,11 +713,12 @@ class TaskController extends Controller $message = "تسک جدیدی با عنوان {$data['title']} برای شما ایجاد شد."; $deadline = \App\Support\JalaliHelper::format($data['target_date'] ?? null, 'Y/m/d', ''); $deadline = $deadline !== '' ? $deadline : null; + $startDateJalali = \App\Support\JalaliHelper::format($data['start_date'] ?? null, 'Y/m/d', ''); $app = App::find($data['app']); $message_admin = "ایجاد تسک: «{$data['title']}»"; $message_admin .= !empty($app) ? "\nاپ {$app->name_fa}" : null; $message_admin .= !empty($deadline) ? "\nددلاین {$deadline}" : null; - $message_admin .= !empty($data['start_date']) ? "\nتاریخ شروع {$data['start_date']}" : null; + $message_admin .= $startDateJalali !== '' ? "\nتاریخ شروع {$startDateJalali}" : null; $message_admin .= !empty($request->input('state_fa')) ? "\nوضعیت: {$request->input('state_fa')}" : null; $message_admin .= !empty($data['description']) ? "\nبا توضیحات:\n" . $data['description'] : null; $message_admin .= !empty($data['assignees']) ? "\nتوسط " . $user->name . " ساخته شد و به" : null; diff --git a/app/Services/LatePenaltyService.php b/app/Services/LatePenaltyService.php index d246b62f..03449eab 100644 --- a/app/Services/LatePenaltyService.php +++ b/app/Services/LatePenaltyService.php @@ -28,8 +28,9 @@ class LatePenaltyService ]; } - $entered = Carbon::parse($enteredAt); - $threshold = $entered->copy()->setTimeFromTimeString(self::WORK_START); + // فقط تا دقیقه؛ ثانیه نادیده گرفته میشود + $entered = Carbon::parse($enteredAt)->startOfMinute(); + $threshold = $entered->copy()->setTimeFromTimeString(self::WORK_START)->startOfMinute(); if ($entered->lte($threshold)) { return [ @@ -40,7 +41,7 @@ class LatePenaltyService ]; } - $lateMinutes = (int) ceil($threshold->diffInSeconds($entered) / 60); + $lateMinutes = (int) $threshold->diffInMinutes($entered); // تأخیر داخل بازه ارفاق روزانه (۸:۳۰ تا ۸:۴۵) — مبنای جریمه هفتگی $graceLateMinutes = min($lateMinutes, self::DAILY_GRACE_MINUTES); $dailyFineMinutes = max(0, $lateMinutes - self::DAILY_GRACE_MINUTES); diff --git a/resources/views/tasks/create.blade.php b/resources/views/tasks/create.blade.php index 3fbc5a37..a1490833 100755 --- a/resources/views/tasks/create.blade.php +++ b/resources/views/tasks/create.blade.php @@ -52,10 +52,19 @@ if (isset($task)) {