@extends('layouts.print')

@section('content')
    <?php
    $b = DB::table('nso007_branch')->find(1);
    ?>
    <div class="content-wrapper">
        <div class="box">
            <div class="container-fluid">
                <div class="page">
                    <div class="row">
                        <div class="col-sm-12 col-xs-12 col-lg-12 col-md-12">
                            <div class="text-center">
                                <h3>{{$b->company_name}}</h3>
                                <p><b>Address:</b> {{$b->address}}<br>
                                    <b>Tel:</b> {{$b->phone}}</p>
                                <div class="blank25"></div>
                                <h3 align="center">Task Report</h3>
                                <div class="blank25"></div>
                            </div>
                        </div>
                        <div class="col-sm-12 col-xs-12 col-lg-12 col-md-12">

                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>{{ __('administrator.date') }}</th>
                                    <th>{{ __('administrator.agent') }}</th>
                                    <th>{{ __('administrator.lead') }}</th>
                                    <th>{{ __('administrator.time') }}</th>
                                    <th>{{ __('administrator.subject') }}</th>
                                    <th>{{ __('administrator.task_type') }}</th>
                                    <th>{{ __('administrator.contact') }}</th>
                                    <th>{{ __('administrator.status') }}</th>
                                    <th>{{ __('administrator.close_deal') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $key => $row)
                                    <tr>
                                        <td>{{$key+1}}</td>
                                        <td>{{date('Y-m-d', strtotime($row->date))}}</td>
                                        <td>{{$row->agent_name}}</td>
                                        <td><?php $lead = DB::table('nso007_crm_leads')->select('family_name', 'name', 'contact')->where('id', $row->lead_id)->first(); echo $lead->family_name . ' ' . $lead->name; ?></td>
                                        <td>{{$row->hour.':'.$row->minutes.' '.$row->shift}}</td>
                                        <td>{{$row->subject}}</td>
                                        <td>{{str_replace('_',' ',$row->task_type)}}</td>
                                        <td>{{$lead->contact}}</td>
                                        <td>{!! ($row->convert_status==1?('<span class="label label-success">'. __('administrator.success').'</span>'):($row->convert_status==2?('<span class="label label-danger">'. __('administrator.fail').'</span>'):('<span class="label label-warning">'. __('administrator.pending')).'</span>')) !!}</td>
                                        <td>{!! $row->complete_status==1?'<span class="label label-primary">'.__('administrator.complete').'</span>':'<span class="label label-warning">'.__('administrator.pending').'</span>'; !!}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
@endsection


