|
|
|
@ -36,6 +36,11 @@ class Activity extends Model
|
|
|
|
|
|
|
|
|
|
public function getStartDateAttribute($value) |
|
|
|
|
{ |
|
|
|
|
if ($value instanceof \DateTime) { |
|
|
|
|
return Carbon::instance($value) |
|
|
|
|
->timezone(env('APP_TIMEZONE')) |
|
|
|
|
->toDateTimeString(); |
|
|
|
|
} |
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value)) |
|
|
|
|
->timezone(env('APP_TIMEZONE')) |
|
|
|
|
->toDateTimeString(); |
|
|
|
@ -43,6 +48,11 @@ class Activity extends Model
|
|
|
|
|
|
|
|
|
|
public function getEndDateAttribute($value) |
|
|
|
|
{ |
|
|
|
|
if ($value instanceof \DateTime) { |
|
|
|
|
return Carbon::instance($value) |
|
|
|
|
->timezone(env('APP_TIMEZONE')) |
|
|
|
|
->toDateTimeString(); |
|
|
|
|
} |
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value)) |
|
|
|
|
->timezone(env('APP_TIMEZONE')) |
|
|
|
|
->toDateTimeString(); |
|
|
|
@ -188,6 +198,8 @@ class Activity extends Model
|
|
|
|
|
return 0; |
|
|
|
|
if(!$dataPlan = AssignMaterial::where('activity_id', $this->id)->get()) |
|
|
|
|
return 0; |
|
|
|
|
if($dataPlan->isEmpty()) |
|
|
|
|
return 0; |
|
|
|
|
if($dataPlan[0]->status_activity == 'done') |
|
|
|
|
return 100; |
|
|
|
|
return $this->persentase_progress; |
|
|
|
|