@php($teams=$data['teams']) @if(!$teams->isEmpty()) @foreach($teams as $team) @php($total_task = DB::table('tasks')->where('task_owner', $team->admin_uuid)->where('task_related_to', 'Opportunity')->where('task_linked_with_uuid', $data['opportunity'])->count()) @php($completed_task_stage_uuid = DB::table('task_stage')->where('is_completed', 1)->first()) @php($progress_task_stage_uuid = DB::table('task_stage')->where('is_completed','!=', 1)->first()) @php($completed_task = DB::table('tasks')->where('task_owner', $team->admin_uuid)->where('task_related_to', 'Opportunity')->where('task_linked_with_uuid', $data['opportunity'])->where('task_stage', !empty($completed_task_stage_uuid->record_uuid)?$completed_task_stage_uuid->record_uuid:'')->count()) @php($progress_task = DB::table('tasks')->where('task_owner', $team->admin_uuid)->where('task_related_to', 'Opportunity')->where('task_linked_with_uuid', $data['opportunity'])->where('task_stage', !empty($progress_task_stage_uuid->record_uuid->record_uuid)?$progress_task_stage_uuid->record_uuid->record_uuid:'')) @php($progress_task_count = $progress_task->count()) @php($progress_task_sum = $progress_task->sum('estimated_time_to_complete')) @php($last_task_estimate = $progress_task->orderBy('id', 'desc')->first())