|
|
|
@ -79,8 +79,14 @@ class Activity extends Model
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
static::deleted(function($data) { |
|
|
|
|
if(Activity::where("parent_id", $data->parent_id)->count() == 0) |
|
|
|
|
Activity::find($data->parent_id)->update(["type_activity"=>"task"]); |
|
|
|
|
if (isset($data->parent_id)) { |
|
|
|
|
if(Activity::where("parent_id", $data->parent_id)->count() == 0) { |
|
|
|
|
$activity = Activity::find($data->parent_id); |
|
|
|
|
if ($activity) { |
|
|
|
|
$activity->update(["type_activity"=>"task"]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$data->updateBobot(true); |
|
|
|
|
$data->updateCostPlanning(); |
|
|
|
@ -100,7 +106,7 @@ class Activity extends Model
|
|
|
|
|
->whereNull('parent_id') |
|
|
|
|
->first(); |
|
|
|
|
|
|
|
|
|
if($root->rencana_biaya > 0){ |
|
|
|
|
if(isset($root) && $root->rencana_biaya > 0){ |
|
|
|
|
$activities = Activity::where("proyek_id", $this->proyek_id)->where("version_gantt_id", $this->version_gantt_id)->get(); |
|
|
|
|
foreach ($activities as $activity) { |
|
|
|
|
if($isDelete && $activity->id == $this->id) |
|
|
|
|