@extends('layouts.default')

@section('title')
	@parent
	Проверка звонков
@stop

@section('breadcrumbs')
	{{ Breadcrumbs::render('checkcallsadmin') }}
@stop

@section('css')
  <link rel="stylesheet" href="{{asset('css/360player.css')}}">
@stop

@section('content')
	<div class="panel panel-default">
		<div class="panel-heading">
			<h4>{{ $workProject->name }}</h4>
		</div>
		<div class="panel-body">
			<table class="table">
					<thead>
						<tr>
							<th>Менеджер / Время</th>
							<th>Звонок</th>
							<th>В разговоре пропущено</th>
						</tr>
					</thead>
					<tbody>
						@foreach(Checkcall::whereStatus(Checkcall::STATUS_FAIL)->orderBy('created_at', 'DESC')->take(25)->get() as $checkcall)
							<tr>
								<td>
									{{ $checkcall->user->first_name }} {{ $checkcall->user->last_name }}<br/><span class="date-to-humanize" data-date="{{ $checkcall->mlsitcall->call_date }}">{{ $checkcall->mlsitcall->call_date }}</span>
								</td>
								<td>
									@if(!$checkcall->mlsitcall->call_state)
									<?php
										$checkcall->mlsitcall->checkStatus();
									?>
									@endif
									({{ $checkcall->mlsitcall->getStatusName() }})
									<div class="ui360">
										<a href="{{ action('PartnerController@getCallFile', array($checkcall->mlsitcall->id)) }}"></a>
									</div>
									<a target="_blank" href="{{ action('PartnerController@downloadCallFile', array($checkcall->mlsitcall->id, $checkcall->mlsitcall->filename)) }}">скачать</a>
								</td>
								<td>
									@foreach ($checkcall->checkquestionsLess() as $checkquestion)
										{{ $checkquestion->name }}<br/>
									@endforeach
								</td>
							</tr>
						@endforeach
					</tbody>
				</table>
		</div>
	</div>
@stop
