@if (session()->has('message'))
{{ session('message') }}
@endif

{{ __('views.tasks.summary.title') }}

@if($this->canShowActions())
@endif
@if($this->canShowActions()) @endif @foreach($tasks as $task) @php($taskArray = $task->toArray()) @if($this->canShowActions()) @endif @endforeach
{{ __('views.tasks.summary.task') }} {{ __('views.tasks.summary.casa') }} {{ __('views.tasks.summary.company') }} {{ __('views.tasks.summary.adviser') }} {{ __('views.tasks.summary.date') }} {{ __('views.tasks.summary.total') }} {{ __('views.tasks.summary.remaining') }} {{ __('views.tasks.summary.progress') }} {{ __('views.tasks.summary.action') }}
@if($taskArray['company_schedule_id']) {{ __('views.tasks.summary.created_by_schedule') }} @else {{ $taskArray['tarea'] }} @endif
@if(isset($taskArray['casa_name']) && $taskArray['casa_name']) {{ $taskArray['casa_name'] }} @else --- @endif @if(isset($taskArray['company_name']) && $taskArray['company_name']) {{ $taskArray['company_name'] }} @endif @if(isset($taskArray['asesor_nombre']) && $taskArray['asesor_nombre'])
{{ $taskArray['asesor_nombre'] }}
@if($taskArray['company_schedule_id']) @endif
@elseif(!isset($taskArray['asesor_nombre']) && isset($taskArray['company_name'])) {{ __('views.tasks.summary.general_task') }} @endif
@if(isset($taskArray['fecha_company']) && $taskArray['fecha_company']) {{ toDate($taskArray['fecha_company']) }} @endif {{ $taskArray['total_count'] }} {{ $taskArray['zero_result_count'] }} @php($percent = 100 - round($taskArray['zero_result_count'] / $taskArray['total_count'], 3) * 100)
{{$percent}}%
@if($percent != 100)
@endif @if($this->canShowActions())
@endif @if($this->canShowActionsWithAsesor())
@endif
{{ __('views.tasks.summary.change_adviser_title') }}
@if(isset($taskArray['id_asesor']) && $taskArray['id_asesor'])
@endif
{{ __('views.tasks.summary.management_metrics') }}
@if(!empty($taskDetails) && $taskDetails['totalSum'] > 0)
{{ __('views.tasks.summary.technical') }}

{{ array_sum(array_column($taskDetails['technical'] ?? [], 'total_count')) }}

{{ __('views.tasks.summary.processed') }}

{{ array_sum(array_column($taskDetails['processed'] ?? [], 'total_count')) }}

@if(!empty($taskDetails['technical']))
{{ __('views.tasks.summary.technical_detail') }}
@foreach($taskDetails['technical'] as $detail)
{{$this->getResultDescriptionById($detail['idresultado'])}}
{{$detail['total_count']}} ({{number_format($detail['total_count'] / $taskDetails['totalSum'] * 100, 1)}}%)
@endforeach
@endif @if(!empty($taskDetails['processed']))
{{ __('views.tasks.summary.processed_detail') }}
@foreach($taskDetails['processed'] as $detail)
{{$this->getResultDescriptionById($detail['idresultado'])}}
{{$detail['total_count']}} ({{number_format($detail['total_count'] / $taskDetails['totalSum'] * 100, 1)}}%)
@endforeach
@endif
@else

{{ __('views.tasks.summary.no_data') }}

@endif
{{ __('views.tasks.summary.adviser_in_management') }} {{ count($userDetails) }} {{ __('views.tasks.summary.records') }}
@if(count($userDetails))
@foreach($userDetails as $client) @endforeach
{{ __('views.tasks.summary.document') }} {{ __('views.tasks.summary.adviser') }}
{{ $client['documento'] }}
{{ $client['userLogin'] }}
@else
{{ __('views.tasks.summary.no_agents') }}

{{ __('views.tasks.summary.no_agents_description') }}

@endif
@if ($tasks->hasPages()) {{ $tasks->links() }} @endif