Edit task creation start time

This commit is contained in:
2026-07-25 11:34:23 +03:30
parent 49c9a45e82
commit 2c811c0d8c
3 changed files with 39 additions and 24 deletions
+12 -16
View File
@@ -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;