@extends ('layouts.template')
@section('content')
    <div class="p-3 mcp-theme-1">
        <div class="card">
            <div class="card-header px-2 py-2 d-flex align-items-center">
                <strong class="">
                    <i class="fas fa-user"></i>
                    Client Pro Changes
                </strong>
            </div>
            <div class="card-body p-0">
                <div class="p-3">
                    @include('app.practice-management.client-pro-changes-filters')
                </div>
                <table class="table table-striped table-sm table-bordered mb-3">
                    @if($rows && count($rows))
                        <thead class="bg-light">
                        <tr>
                            <th class="border-0 text-secondary width-200px">Created</th>
                            <th class="border-0 text-secondary width-150px">Patient</th>
                            <th class="border-0 text-secondary width-150px">Association</th>
                            <th class="border-0 text-secondary width-200px">Old Pro</th>
                            <th class="border-0 text-secondary width-200px">New Pro</th>
                            <th class="border-0 text-secondary width-200px">Change Memo</th>
                            <th></th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($rows as $change)
                            <tr>
                                <td>{{friendly_date_time($change->created_at)}}</td>
                                <td><a href="{{route('patients.view.dashboard', $change->client)}}">{{$change->client->displayName()}}</a></td>
                                <td>{{$change->responsibility_type}}</td>
                                <td>{{$change->previousPro ? $change->previousPro->displayName() : '-'}}</td>
                                <td>{{$change->newPro ? $change->newPro->displayName() : '-'}}</td>
                                <td>{{$change->custom_memo}}</td>
                                <td></td>
                            </tr>
                        @endforeach
                        </tbody>
                    @else
                        <tbody>
                        <tr>
                            <td class="text-secondary p-3">No client pro changes!</td>
                        </tr>
                        </tbody>
                    @endif
                </table>
                <div class="px-3">
                    {!! $rows->links() !!}
                </div>
            </div>
        </div>
    </div>
@endsection
