@extends ('layouts.patient')
@section('inner-content')
    <div class="">
        <div class="d-flex align-items-center pb-2">
            <h4 class="font-weight-bold m-0">Pro Changes</h4>
        </div>
        <table class="table table-striped table-sm table-bordered mb-3">
            @if($patient->clientProChanges && count($patient->clientProChanges))
                <thead class="bg-light">
                <tr>
                    <th class="border-0 text-secondary width-200px">Created</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 class="border-0 text-secondary">
                        @if($pro->pro_type === 'ADMIN')
                            Created By
                        @endif
                    </th>
                </tr>
                </thead>
                <tbody>
                @foreach($patient->clientProChanges as $change)
                    <tr>
                        <td>{{friendly_date_time($change->created_at)}}</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>
                            @if($pro->pro_type === 'ADMIN' && $change->creator)
                                {{$change->creator->displayName()}}
                            @endif
                        </td>
                    </tr>
                @endforeach
                </tbody>
            @else
                <tbody>
                    <tr>
                        <td class="text-secondary p-3">No client pro changes for this patient</td>
                    </tr>
                </tbody>
            @endif
        </table>
    </div>
@endsection
