<?php

use App\Models\Point;

/** @var \App\Models\Client $patient */

$points = Point::getPointsOfCategory($patient, 'ALLERGY');
$tracker = Point::getGlobalSingletonOfCategory($patient, 'NO_KNOWN_TRACKER');
?>

<?php if($tracker && @($tracker->data->no_known_drug_allergies)): ?>
	<div class="text-secondary mb-2"><span>No known drug allergies</span></div>
<?php endif; ?>
<?php if($tracker && @($tracker->data->no_known_allergies_of_any_type)): ?>
	<div class="text-secondary mb-2"><span>No known allergies of any type</span></div>
<?php endif; ?>
<?php if(!$tracker || !@($tracker->data->no_known_allergies_of_any_type)): ?>
	<?php if (!count($points)): ?>
		<div class="text-secondary">-</div>
	<?php else: ?>
		<div class="d-flex align-items-baseline flex-wrap">
			<?php $j = 0; foreach ($points as $point): $j++; ?>
				<span class="mr-2 text-nowrap">• <?= !!@($point->data->name) ? @($point->data->name) : '-' ?></span>
			<?php endforeach; ?>
		</div>
	<?php endif; ?>
<?php endif; ?>
