

	<div <?= $patient->has_care_plan_flag && !$patient->is_flag_cleared ? 'class="alert alert-danger p-1 rounded-0" style="min-width: 380px;"' : 'class="ml-2"' ?>>
	<?php #dump($patient); ?>
	@if($pro->pro_type === 'ADMIN')
		@if($patient->has_care_plan_flag && !$patient->is_flag_cleared)
			<div class="d-flex flex-column">
				<div class="d-flex align-items-center flex-wrap">
					<span class="mr-2"><b>Flagged At:</b> {{ friendly_date_time($patient->flagged_at) }}</span>
					<small class="text-sm">By: <i class="fas fa-user"></i> {{ $patient->carePlanFlaggedBy->displayName() }}</small>
				</div>
				
				<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque text-primary"></i></b> {{ $patient->memo }}</small>
			</div>

			@if($patient->is_flag_acknowledged && $patient->flag_acknowledged_at > $patient->flagged_at)
				<!-- This is resolved -->
				<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
					<div class="d-flex flex-column">
						<div class="d-flex align-items-center flex-wrap">
							<span class="mr-2"><b>Ack. At:</b> {{ friendly_date_time($patient->flag_acknowledged_at) }}</span>
							<small class="text-sm">By: <i class="fas fa-user"></i> {{ $patient->carePlanFlagAcknowledgedBy->displayName() }}</small>
						</div>
						
						<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque"></i></b> {{ $patient->flag_acknowledgement_memo }}</small>
					</div>
				</div>
			@endif
				<!-- Flagged by admin, pending ack. by pro -->
				<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
					<div class="d-flex">
						@if($patient->is_flag_acknowledged)
							<div moe>
								<a start show class="text-success"><i class="fas fa-flag  on-hover-opaque"></i> Clear Flag</a>
								<form url="/api/client/clearFlag" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control"></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-success mr-1">Clear Flag</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
						@else
							<div moe>
								<a start show class="text-success"><i class="fas fa-flag  on-hover-opaque"></i> Unflag Care Plan</a>
								<form url="/api/client/undoCarePlanFlag" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control"></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-success mr-1">Unflag Care Plan</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
						@endif
						<span class="mx-1 text-muted">|</span>
						@if($patient->is_flag_acknowledged)
							<div moe>
								<a start show class="text-danger"><i class="fas fa-flag  on-hover-opaque"></i> Flag Care Plan Again</a>
								<form url="/api/client/flagCarePlan" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control" required></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-danger mr-1">Flag Care Plan</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
						@else
							<div moe>
								<a start show class="text-primary">Update Memo</a>
								<form url="/api/client/updateFlagMemo" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control"><?= $patient->memo ?></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-primary mr-1">Update</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
						@endif
						<span class="ml-1 text-muted">|</span>
						@include('app.patient.note.partials.care-plan-flags-history')
					</div>
				</div>
			
		@else
			<!-- Not flagged, show flag popup -->
			<div class="d-flex align-items-center">
				<div moe>
					<a start show class="text-danger"><i class="fas fa-flag  on-hover-opaque"></i> Flag Care Plan</a>
					<form url="/api/client/flagCarePlan" class="mcp-theme-1">
						<input type="hidden" name="uid" value="{{$patient->uid}}">
						<div class="form-group">
							<label>Memo:</label>
							<textarea name="memo" rows="2" class="form-control" required></textarea>
						</div>
						<div>
							<button submit class="btn btn-sm btn-danger mr-1">Flag Care Plan</button>
							<button cancel class="btn btn-sm btn-default border">Cancel</button>
						</div>
					</form>
				</div>
				@include('app.patient.note.partials.care-plan-flags-history')
			</div>
			
		@endif

	@else
	<!-- HCP -->
		@if($patient->has_care_plan_flag && !$patient->is_flag_cleared)
			<div class="d-flex flex-column">
				<div class="d-flex align-items-center flex-wrap">
					<span class="mr-2"><b>Flagged At:</b> {{ friendly_date_time($patient->flagged_at) }}</span>
					<small class="text-sm">By: <i class="fas fa-user"></i> {{ $patient->carePlanFlaggedBy->displayName() }}</small>
				</div>			
				<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque text-primary"></i></b> {{ $patient->memo }}</small>
			</div>

			@if($patient->is_flag_acknowledged && $patient->flag_acknowledged_at > $patient->flagged_at)
				<!-- hcp has ack. -->
				<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
					<div class="d-flex flex-column">
						<div class="d-flex align-items-center flex-wrap">
							<span class="mr-2"><b>Ack. At:</b> {{ friendly_date_time($patient->flag_acknowledged_at) }}</span>
							<small class="text-sm">By: <i class="fas fa-user"></i> {{ $patient->carePlanFlagAcknowledgedBy->displayName() }}</small>
						</div>
						
						<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque"></i></b> {{ $patient->flag_acknowledgement_memo }}</small>
						
						<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
							<div moe>
								<a start show class="text-danger"><i class="fas fa-undo fa-fw  on-hover-opaque"></i> Undo Ack.</a>
								<form url="/api/client/undoAcknowledgeCarePlanFlag" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control"></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-danger mr-1">Undo Ack.</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
							<span class="mx-1 text-muted">|</span>
							<div moe>
								<a start show class="text-primary">Update Memo</a>
								<form url="/api/client/updateAcknowledgementMemo" class="mcp-theme-1">
									<input type="hidden" name="uid" value="{{$patient->uid}}">
									<div class="form-group">
										<label>Memo:</label>
										<textarea name="memo" rows="2" class="form-control"><?= $patient->flag_acknowledgement_memo ?></textarea>
									</div>
									<div>
										<button submit class="btn btn-sm btn-primary mr-1">Update</button>
										<button cancel class="btn btn-sm btn-default border">Cancel</button>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			
			@else
				<!-- Needs hcp ack. -->
				<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
				<div moe>
					<a start show class="text-primary"><i class="fa fa-check text-sm on-hover-opaque"></i> Ack.</a>
					<form url="/api/client/acknowledgeCarePlanFlag" class="mcp-theme-1">
						<input type="hidden" name="uid" value="{{$patient->uid}}">
						<div class="form-group">
							<label>Memo:</label>
							<textarea name="memo" rows="2" class="form-control" required></textarea>
						</div>
						<div>
							<button submit class="btn btn-sm btn-primary mr-1">Ack. Flag</button>
							<button cancel class="btn btn-sm btn-default border">Cancel</button>
						</div>
					</form>
				</div>
				</div>

			@endif
		@endif
	@endif
	</div>
