<?php

	if( is_bool($type) || is_numeric($type) ) $type = !empty($type) ? "success" : "danger";
	else if( !is_string($type) ) $type = 'info';
	
	switch($type) {
		case 'success':
			$icon = 'fas fa-check-circle';
			break;
		case 'danger':
			$icon = 'fas fa-exclamation-triangle';
			break;
		case 'warning':
			$icon = 'fas fa-exclamation-circle';
			break;
		default:
			$icon = 'fas fa-info-circle';
	}

?>
<div class="alert alert-<?php echo $type; ?> <?php if( $dismissible ) echo 'alert-dismissible'; ?> fade show my-3" role="alert">

	<div class='d-flex'>
		<div class='mr-2'>
			<i class='<?php echo $icon; ?>'></i>
		</div>
		<div class='<?php if( $dismissible ) echo 'pr-3'; ?>'>
			<?php echo $message; ?>
		</div>
	</div>
	
	<?php if( $dismissible ): ?>
		<button type="button" class="close" data-dismiss="alert" aria-label="Close">
			<span aria-hidden="true" style="font-size: 16px;">&times;</span>
		</button>
	<?php endif; ?>
	
</div>