@extends('layouts.pro-logged-in')
@section('content')

    <h3 class="d-flex my-3 px-3">
        <div>My Teams: List</div>
        <div class="ml-auto">
            <a class='btn btn-primary btn-sm ml-2' up-modal=".form-contents" up-width="800" up-history="false" href='/my_teams/add_new'><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New</a>
        </div>
    </h3>

    <div class="table-responsive p-0 bg-white border">
        <table class="table table-hover text-nowrap">
            <thead>
            <tr>
<th>Team Number</th>
<th>HCP</th>
<th>Ally Pro</th>
<th>Clients</th>
            </tr>
            </thead>
            <tbody>
            @foreach($records as $record)
                <tr>
<td><a href="/my_teams/view/<?= $record->uid ?>"><?= $record->team_number ?></a></td>
<td><?= value_from_rs($result_pros, 'name_display', [['id', '=', $record->hcp_pro_id], ], 'all'); ?></td>
<td><?= value_from_rs($result_pros, 'name_display', [['id', '=', $record->ally_pro_id], ], 'all'); ?></td>
<td><?php $_r = \Illuminate\Support\Facades\DB::select("select COUNT(*) as result FROM client WHERE team_id = " . ($record->id ? $record->id : -1) . "");
echo ($_r && count($_r)) ? $_r[0]->result : '-'; ?></td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>

@endsection
