@extends(request()->input('popupmode') ? 'layouts.empty' : 'layouts.template')
<?php
/** @var \App\Models\Client $patient */
?>
<?php
$trimLayout = true;
$routeName = request()->route()->getName();
$leanLeftNav = ($routeName === 'patients.view.notes.view.dashboard' && @$note && !!$note->visitTemplate) || ($routeName === 'patients.view.sleep-study');
$isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1);
?>
<style media="screen">
	.pt-name {
		font-size: 1.5rem !important;
	}
</style>
@section('content')
<div class="container-fluid h-100 popup-content-container">
	<div class="main-row h-100 {{ !request()->input('popupmode') ? '' : 'px-0' }} {{$leanLeftNav ? 'autohide-leftnav' : ''}}">
		@if(!request()->input('popupmode'))
		<nav id="sidebarMenu" class="d-block bg-light sidebar collapse px-0">
			<div class="sidebar-sticky pt-3">
				<ul class="nav flex-column mcp-theme-1">
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.dashboard') === 0 ? 'active' : '' }}" href="{{ route('patients.view.dashboard', ['patient' => $patient]) }}">Dashboard</a>
					</li>
					@if($performer->pro->pro_type == 'ADMIN' && $isOldClient)
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.migrate-canvas') === 0 ? 'active' : '' }}" href="{{ route('patients.view.migrate-canvas', ['patient' => $patient]) }}">Canvas Migrate</a>
					</li>
					{{--
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.canvas') === 0 ? 'active' : '' }}" href="{{ route('patients.view.canvas', ['patient' => $patient]) }}">Canvas</a>
					</li>
					--}}
					@endif
					<li class="nav-item">
						@if($pro->pro_type === 'ADMIN' && $patient->mcp)
							<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}" href="{{ route('patients.view.calendar', ['patient' => $patient]) }}?opUid={{$patient->mcp->uid}}">Calendar</a>
						@else
							<a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}" href="{{ route('patients.view.calendar', ['patient' => $patient]) }}">Calendar</a>
						@endif
					</li>

					@if($pro->pro_type === 'ADMIN')
						<li class="nav-item">
							<a class="nav-link {{ strpos($routeName, 'patients.view.invoicing-') === 0 ? 'active' : '' }}" href="{{ route('patients.view.invoicing-companies', ['patient' => $patient]) }}" title="Deprecated">Invoicing</a>
						</li>
					@endif

					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.appointments') === 0 ? 'active' : '' }}" href="{{ route('patients.view.appointments', ['patient' => $patient, 'forPro' => 'all', 'status' => 'all']) }}">Appointments</a>
					</li>
					{{--
						<li class="nav-item">
							<a class="nav-link {{ strpos($routeName, 'patients.view.programs') === 0 ? 'active' : '' }}"
					href="{{ route('patients.view.programs', ['patient' => $patient]) }}">Programs</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.flowsheets') === 0 ? 'active' : '' }}" href="{{ route('patients.view.flowsheets', ['patient' => $patient]) }}">Flowsheets</a>
					</li>
					--}}
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.vitals-settings') === 0 ? 'active' : '' }}" href="{{ route('patients.view.vitals-settings', ['patient' => $patient]) }}">Vitals Settings</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.vitals-graph') === 0 ? 'active' : '' }}" href="{{ route('patients.view.vitals-graph', ['patient' => $patient]) }}">Vitals Graph</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.sleep-study') === 0 ? 'active' : '' }}" href="{{ route('patients.view.sleep-study', ['patient' => $patient]) }}">Sleep Study</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.care-months') === 0 ? 'active' : '' }}" href="{{ route('patients.view.care-months', ['patient' => $patient]) }}">Care Months</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.measurements') === 0 ? 'active' : '' }}" href="{{ route('patients.view.measurements', ['patient' => $patient]) }}">Measurements</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.notes') === 0 ? 'active' : '' }}" href="{{ route('patients.view.notes', ['patient' => $patient]) }}">Notes</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.generic-bills') === 0 ? 'active' : '' }}" href="{{ route('patients.view.generic-bills', ['patient' => $patient]) }}">Admin. Bills</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.handouts') === 0 ? 'active' : '' }}" href="{{ route('patients.view.handouts', ['patient' => $patient]) }}">Handouts</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.rm-setup') === 0 ? 'active' : '' }}" href="{{ route('patients.view.rm-setup', ['patient' => $patient]) }}">Remote Monitoring</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.rtm') === 0 ? 'active' : '' }}" href="{{ route('patients.view.rtm', $patient) }}">RTM</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.patient-prescriptions') === 0 ? 'active' : '' }}" href="{{ route('patients.view.patient-prescriptions', ['patient' => $patient]) }}">ERx &amp; Orders</a>
						<?php /*
							<ul class="m-0 p-0 nav-child-list">
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === '' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => '']) }}">All</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'erx' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'erx']) }}">Drug</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'lab' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'lab']) }}">Lab</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'imaging' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'imaging']) }}">Imaging</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'referral' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'referral']) }}">Referral</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'supply' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'supply']) }}">Supply</a>
								</li>
								<li class="nav-item">
									<a class="nav-link {{ strpos($routeName, 'patients.view.patient-erx') === 0 && @$type === 'other' ? 'active' : '' }}"
									   href="{{ route('patients.view.patient-erx', ['patient' => $patient, 'type' => 'other']) }}">Other</a>
								</li>
							</ul>
							*/ ?>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === '' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => '']) }}">Tickets</a>
					</li>
					@if($isOldClient && 0)
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient]) }}" title="Deprecated">ERx / Orders
							<span class="text-secondary text-sm pl-2">(dep)</span>
						</a>
						<ul class="m-0 p-0 nav-child-list">
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === '' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => '']) }}">All</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'erx' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'erx']) }}">ERx</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'lab' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'lab']) }}">Lab</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'imaging' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'imaging']) }}">Imaging</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 && @$type === 'other' ? 'active' : '' }}" href="{{ route('patients.view.patient-tickets', ['patient' => $patient, 'type' => 'other']) }}">Other</a>
							</li>
						</ul>
					</li>
					@endif
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.supply-orders') === 0 ? 'active' : '' }}" href="{{ route('patients.view.supply-orders', ['patient' => $patient]) }}">Supply Orders</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.shipments') === 0 ? 'active' : '' }}" href="{{ route('patients.view.shipments', ['patient' => $patient]) }}">Shipments</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.incoming-reports') === 0 ? 'active' : '' }}" href="{{ route('patients.view.incoming-reports', ['patient' => $patient]) }}">Incoming Reports</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.allergies') === 0 ? 'active' : '' }}" href="{{ route('patients.view.allergies', ['patient' => $patient]) }}">Allergies</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.medications') === 0 ? 'active' : '' }}" href="{{ route('patients.view.medications', ['patient' => $patient]) }}">Medications</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.dx-and-focus-areas') === 0 ? 'active' : '' }}" href="{{ route('patients.view.dx-and-focus-areas', ['patient' => $patient]) }}">Dx and
							Focus Areas</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.care-team') === 0 ? 'active' : '' }}" href="{{ route('patients.view.care-team', ['patient' => $patient]) }}">Care Team</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.history') === 0 ? 'active' : '' }}" href="{{ route('patients.view.history', ['patient' => $patient]) }}">History</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.memos') === 0 ? 'active' : '' }}" href="{{ route('patients.view.memos', ['patient' => $patient]) }}">Memos</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ $routeName === 'patients.view.sms' ? 'active' : '' }}" href="{{ route('patients.view.sms', ['patient' => $patient]) }}">SMS</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.sms-numbers') === 0 ? 'active' : '' }}" href="{{ route('patients.view.sms-numbers', ['patient' => $patient]) }}">SMS Numbers</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ $routeName === 'patients.view.outgoing-sms-log' ? 'active' : '' }}" href="{{ route('patients.view.outgoing-sms-log', ['patient' => $patient]) }}">Outgoing SMS Log</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.documents') === 0 ? 'active' : '' }}" href="{{ route('patients.view.documents', ['patient' => $patient]) }}">Documents</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.settings') === 0 ? 'active' : '' }}" href="{{ route('patients.view.settings', ['patient' => $patient]) }}">Settings</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.sms-reminders') === 0 ? 'active' : '' }}" href="{{ route('patients.view.sms-reminders', ['patient' => $patient]) }}">SMS Reminders</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.measurement-confirmation-numbers') === 0 ? 'active' : '' }}" href="{{ route('patients.view.measurement-confirmation-numbers', ['patient' => $patient]) }}">Meas. Conf. Numbers</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.pros') === 0 ? 'active' : '' }}" href="{{ route('patients.view.pros', ['patient' => $patient]) }}">Pros</a>
					</li>
					@if($performer->pro->pro_type == 'ADMIN')
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.pro-changes') === 0 ? 'active' : '' }}" href="{{ route('patients.view.pro-changes', ['patient' => $patient]) }}">Client Pro Changes</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.client-pro-access') === 0 ? 'active' : '' }}" href="{{ route('patients.view.client-pro-access', ['patient' => $patient]) }}">Client Pro Access</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.client-documents') === 0 ? 'active' : '' }}" href="{{ route('patients.view.client-documents', ['patient' => $patient]) }}">Client Documents</a>
					</li>
					@endif
					<li class="nav-item">
						<a class="nav-link" href="/patients/view/{{ $patient->uid }}/intake">Intake</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.primary-coverage') === 0 ? 'active' : '' }}" href="{{ route('patients.view.primary-coverage', $patient) }}">Primary Coverage</a>
					</li>
					@if($performer->pro->pro_type == 'ADMIN' || $performer->pro->id == $patient->default_na_pro_id)
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.insurance-coverage') === 0 ? 'active' : '' }}" href="{{ route('patients.view.insurance-coverage-history', $patient) }}">Insurance Coverage History</a>
					</li>
						@if($performer->pro->pro_type == 'ADMIN')
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.mcp-requests') === 0 ? 'active' : '' }}" href="{{ route('patients.view.mcp-requests', $patient) }}">MCP Requests</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.eligible-refreshes') === 0 ? 'active' : '' }}" href="{{ route('patients.view.eligible-refreshes', $patient) }}">Eligible Refreshes</a>
							</li>
							<li class="nav-item">
								<a class="nav-link {{ strpos($routeName, 'patients.view.claims-resolver') === 0 ? 'active' : '' }}" href="{{ route('patients.view.claims-resolver', $patient) }}">Claims Resolver</a>
							</li>
						@endif
					@endif
					<li class="nav-item">
						<a class="nav-link {{ strpos($routeName, 'patients.view.accounts') === 0 ? 'active' : '' }}" href="{{ route('patients.view.accounts', $patient) }}">Linked Accounts</a>
					</li>
                    @if($performer->pro->pro_type == 'ADMIN')
                    <li class="nav-item">
                        <a class="nav-link {{ strpos($routeName, 'patients.view.companies') === 0 ? 'active' : '' }}" href="{{ route('patients.view.companies', $patient) }}">Linked Companies</a>
                    </li>
                    @endif
					<li class="nav-item">
						<a class="nav-link {{ $routeName === 'patients.view.review-requests' ? 'active' : '' }}" href="{{ route('patients.view.review-requests', ['patient' => $patient]) }}">Review Requests</a>
					</li>
					<li class="nav-item">
						<a class="nav-link {{ $routeName === 'patients.view.messages' ? 'active' : '' }}" href="{{ route('patients.view.messages', ['patient' => $patient]) }}">Messages</a>
					</li>
				</ul>
				<div class="mt-3 mcp-theme-1">
					@yield('left-nav-content')
				</div>
			</div>
		</nav>
		@endif
		<main role="main" class="w-100 {{$trimLayout || $leanLeftNav ? 'p-0' : ''}}">
			@include('app.patient.partials.cpt-alert')
			@if($pro->is_enrolled_as_mcp && !$patient->mcp)
			<div class="d-flex align-items-center alert alert-info bg-white mcp-theme-1 p-3 hide-inside-ticket-popup m-1">
				<div class="font-size-16 mr-3">
					<i class="fa fa-exclamation-triangle text-warning-mellow"></i>
					This patient currently does not have an MCP assigned.
				</div>
				<div class="d-flex align-items-center">
					<button class="btn btn-info" onclick="$('.in-conv-confirmed').removeClass('d-none').addClass('d-inline-flex')">I am currently seeing or talking to this patient</button>
					<div class="in-conv-confirmed d-none align-items-center">
						<i class="fa fa-chevron-right mx-3 text-secondary"></i>
						<div moe class=" hide-inside-popup">
							<a href="" start show class="btn btn-primary font-weight-bold text-white">
								Assign myself as the MCP for this patient
							</a>
							<form url="/api/client/putMcp" class="mcp-theme-1">
								<input type="hidden" name="uid" value="{{$patient->uid}}">
								<input type="hidden" name="mcpProUid" value="{{$pro->uid}}">
								<p>Are you sure?</p>
								<div>
									<button submit class="btn btn-sm btn-primary mr-2">
										Submit
									</button>
									<button cancel class="btn btn-sm btn-default border">
										Cancel
									</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			@endif
			@if($patient->has_mcp_done_onboarding_visit !== 'YES' && $patient->is_mcp_onboarding_active === 'NO')
			<div class="alert alert-warning mt-3 mcp-theme-1 p-3 hide-inside-ticket-popup">
				<div class="font-weight-bold text-dark font-size-16">MCP onboarding is not active for this patient.</div>
				<div class="text-secondary p-2 border mt-2 bg-light">
					<div class="font-weight-bold">{{$patient->why_is_mcp_onboarding_not_active_category}}</div>
					<div>{{$patient->why_is_mcp_onboarding_not_active_memo}}</div>
				</div>
			</div>
			@endif
			<div class="card {{$trimLayout || $leanLeftNav ? 'card m-0 border-0 rounded-0' : 'my-3'}}" id="patient-header">
				<div id="patient-header-content">
					<div class="@if($patient->client_engagement_status_category == 'DUMMY') alert-warning @endif hide-inside-ticket-popup">
						@include('layouts.patient-header')
					</div>
				</div>
				<?php $iCM = $patient->isAwaitingRMCommunicationFromMCP(); ?>
				@if($iCM !== FALSE)
					<div class="d-block mb-2 mx-2 p-2 alert alert-warning mcp-theme-1 border border-warning text-dark rounded-0 ">
						<span class="font-size-13">
							<i class="fa fa-exclamation-triangle mr-1"></i>
							This patient has not had RPM-related interactive communication this month. Please document interactive time
							@if(request()->route()->getName() === 'patients.view.care-months.view.dashboard' && @$careMonth && @$careMonth->id === $iCM->id)
								here.
							@else
								<a href="{{route('patients.view.care-months.view.dashboard', ['patient' => $patient, 'careMonth' => $iCM])}}"
								   class="font-weight-bold d-inline">here</a>.
							@endif
						</span>
					</div>
				@endif
				@if($pro->pro_type === 'ADMIN')
				<div class="screen-only p-2 d-flex align-items-start justify-content-between mcp-theme-1 bg-aliceblue hide-inside-popup border-top">
					<div class="d-flex align-items-center">
						<b class="">Tags ({{count($patient->clientTags)}}):</b>
					@foreach($patient->clientTags as $tag)
					<div class="d-inline-flex align-items-center ml-2 py-1 px-2 rounded bg-aliceblue text-info">
						<span class="text-sm">{{$tag->tag}}</span>
						<div moe relative class="ml-2">
							<a href="" start show><i class="fa fa-times text-secondary on-hover-opaque"></i></a>
							<form url="/api/clientTag/cancel" class="mcp-theme-1 min-width-200px">
								<input type="hidden" name="uid" value="{{$tag->uid}}">
								<p class="text-nowrap text-dark">Cancel this tag?</p>
								<div>
									<button submit class="btn btn-sm btn-primary mr-2">Submit</button>
									<button cancel class="btn btn-sm btn-default border">Cancel</button>
								</div>
							</form>
						</div>
					</div>
					@endforeach
					<div moe relative class="ml-2">
						<a href="" start show class="text-sm">+ Add</a>
						<form url="/api/clientTag/create" class="mcp-theme-1">
							<input type="hidden" name="clientUid" value="{{$patient->uid}}">
							<div class="mb-2">
								<label class="text-secondary text-sm">Tag</label>
								<input type="text" class="form-control form-control-sm" name="tag" placeholder="Tag" required>
							</div>
							<div>
								<button submit class="btn btn-sm btn-primary mr-2">Submit</button>
								<button cancel class="btn btn-sm btn-default border">Cancel</button>
							</div>
						</form>
					</div>
					<div class="ml-3">
						<div class="d-flex align-items-center">
							<b class="mr-2">Partners ({{ count($patient->companyClients)  }}):</b>
							<div class="d-flex align-items-center mr-2">
								@foreach($patient->companyClients as $companyClient)
									<span class="mr-2">
										{{$companyClient->company->name}}
										<div moe class="d-inline-block">
											<a start show><i class="fa fa-times text-secondary on-hover-opaque"></i></a>
											<form url="/api/companyClient/deactivate" class="mcp-theme-1">
												<input type="hidden" name="uid" value="{{$companyClient->uid}}">
												<div class="form-group">
													<p>Are you sure?</p>
												</div>
												<div>
													<button submit class="btn btn-sm btn-primary mr-1">Submit
													</button>
													<button cancel class="btn btn-sm btn-default border">
														Cancel
													</button>
												</div>
											</form>
										</div>
									</span>
								@endforeach
							</div>
						</div>
					</div>
					</div>

					<div class="d-flex">
						<span class="mr-2"><b>Best Time to Call:</b> {{ $patient->best_time_to_call ?? '-' }}</span>
						@include('app.patient.partials.update-best-time-to-call')
					</div>

				</div>
				@endif
				<div class="card-body {{$routeName === 'patients.view.notes.view.dashboard' ? 'p-0' : ''}} border-top">
					{{--<h1 class="h3">@yield('section-title')</h1>--}}
					<div class="mcp-theme-1">
						@yield('inner-content')
					</div>
				</div>
			</div>
		</main>
	</div>
</div>
<script>
	(function() {
		function init() {
			$('.note-method-select').change(function() {
				let form = $(this).closest('form');
				if (this.value === 'IN_CLINIC') {
					form.find('.if-in-clinic').show();
				} else {
					form.find('.if-in-clinic').hide();
				}
			});

			$('.note-method-select').each(function() {
				let form = $(this).closest('form');
				if (this.value === 'IN_CLINIC') {
					form.find('.if-in-clinic').show();
				} else {
					form.find('.if-in-clinic').hide();
				}
			});
		}
		addMCInitializer('patient-add-note-popup', init, '#patient-header')
	}).call(window);
</script>
<script>
	(function() {
		function init() {
			let sbMenu = $('#sidebarMenu');
			sbMenu
					.off('scroll')
					.on('scroll', function() {
						localStorage.sidebarMenuScrollTop = $(this).scrollTop();
					});
			if(localStorage.sidebarMenuScrollTop) {
				sbMenu.scrollTop(+localStorage.sidebarMenuScrollTop);
				let sbMenuPos = sbMenu.offset(),
						activeItem = sbMenu.find('.nav-item>.nav-link.active').first(),
						activeItemPos = activeItem.offset();
				if(activeItem.length) {
					if(activeItemPos.top < sbMenuPos.top || (activeItemPos.top + activeItem.outerHeight(true)) > (sbMenuPos.top + sbMenu.outerHeight(true))) {
						activeItem[0].scrollIntoView({behavior : "auto", block: "nearest"});
					}
				}
			}
		}
		addMCInitializer('sidebarMenu', init, '#sidebarMenu')
	}).call(window);
</script>
@endsection
