<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
    <thead>
    <tr>
        <th>
            <label><input type="checkbox" id="checkAll"> 本页</label>
            <label><input type="checkbox" id="checkTotal"> 全部</label>
        </th>
        <th class="sorting" data-sort="id"> ID</th>
        <th class="sorting"> 联系方式</th>
        <th class="sorting" data-sort="ower_id"> 线索拥有者</th>
        <th class="sorting">企业名称</th>
        <th class="sorting">企业网址</th>
        <th class="sorting">注册资本</th>
        <th class="sorting"> 最新跟进</th>
        <th class="sorting" data-sort="created_at"> 领取时间</th>
        <th width="22%">相关操作</th>
    </tr>
    </thead>
    <tbody>
    @if(isset($list))
        @foreach($list as $key => $item)
            <tr>

                <td>
                    <label><input class="contacts" name='contact_id[]' type="checkbox"
                                  value="{{ $item->id }}" data-id="{{ $item->id }}"></label>
                </td>
                <td>{{ $item->id }}</td>
                <td>{{ $item->contact?$item->contact->phone:'暂无联系人信息' }}</td>
                <td>{{ $item->ower->real_name }}</td>
                <td>
                    <a href="{{ U('Company/Info/view',['id'=> $item->company->id]) }}"> {{ $item->company->company_name }} </a>
                </td>
                <td><a href="http://{{ $item->company->website }}"
                       target="_blank">{{ $item->company->website }}</a></td>
                <td>{{ $item->company->reg_capital }}</td>
                <td>{{ $item->latestProgress() }}</td>
                <td>{{ $item->created_at }}</td>
                <td>
                    @if(role('User/Threads/update'))
                        <button onclick="layer.open({type: 2,area: ['25%', '60%'],content: '{{ U('User/Threads/update',['id'=>$item->id])}}'});"
                                class="btn btn-sm btn-primary ">跟进
                        </button>

                    @endif

                    @if(role('User/Threads/destroy'))
                        <a class="btn btn-sm btn-danger"
                           href="{{ U('User/Threads/destroy',['id'=>$item->id])}}"
                           onclick="return confirm('你确定放弃该线索？');">放弃</a>
                    @endif

                    @if(role('User/Threads/view'))

                    @endif
                </td>
            </tr>
        @endforeach
    @endif

    </tbody>
</table>

<div class="row">
    <div class="col-sm-6">
        <div class="dataTables_info" id="DataTables_Table_0_info"
             role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}
            条，共{{ $list->lastPage() }}页，总{{ $list->total() }}条。
        </div>
    </div>
    <div class="col-sm-6">
        <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
            {!! $list->setPath('')->appends(Request::all())->render() !!}
        </div>
    </div>
</div>