|
|
@ -401,7 +401,21 @@ class ActivityController extends Controller |
|
|
|
foreach ($data['activities'] as $i => $activity_row) { |
|
|
|
foreach ($data['activities'] as $i => $activity_row) { |
|
|
|
$startDate = \DateTime::createFromFormat('Y-m-d H:i:s.uP', $projectStart->mulai_proyek); |
|
|
|
$startDate = \DateTime::createFromFormat('Y-m-d H:i:s.uP', $projectStart->mulai_proyek); |
|
|
|
$endDate = clone $startDate; |
|
|
|
$endDate = clone $startDate; |
|
|
|
$endDate->modify('+'.$activity_row['duration'].' days'); |
|
|
|
$endDate->modify('-1 day'); |
|
|
|
|
|
|
|
$daysRemaining = $activity_row['duration']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Loop until the remaining days become zero |
|
|
|
|
|
|
|
while ($daysRemaining > 0) { |
|
|
|
|
|
|
|
$endDate->modify('+1 day'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if the current day is a day off (Sunday or Saturday) |
|
|
|
|
|
|
|
$currentDayOfWeek = (int)$endDate->format('w'); |
|
|
|
|
|
|
|
if (strpos($dayOffs, (string)$currentDayOfWeek) !== false) { |
|
|
|
|
|
|
|
continue; // Skip the day off and continue to the next day |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$daysRemaining--; // Decrease the remaining days by one |
|
|
|
|
|
|
|
} |
|
|
|
$endDate->setTime(23, 59, 59); |
|
|
|
$endDate->setTime(23, 59, 59); |
|
|
|
$input['name'] = $activity_row['name']; |
|
|
|
$input['name'] = $activity_row['name']; |
|
|
|
$input['proyek_id'] = $projectId; |
|
|
|
$input['proyek_id'] = $projectId; |
|
|
@ -744,6 +758,7 @@ class ActivityController extends Controller |
|
|
|
$data = $request->all(); |
|
|
|
$data = $request->all(); |
|
|
|
foreach ($data as $value) { |
|
|
|
foreach ($data as $value) { |
|
|
|
$activity = Activity::find($value['id']); |
|
|
|
$activity = Activity::find($value['id']); |
|
|
|
|
|
|
|
$activity->duration = $value['duration']; |
|
|
|
$activity->start_date = $value['start_date']; |
|
|
|
$activity->start_date = $value['start_date']; |
|
|
|
$activity->end_date = $value['end_date']; |
|
|
|
$activity->end_date = $value['end_date']; |
|
|
|
$activity->save(); |
|
|
|
$activity->save(); |
|
|
|