
<?php $__env->startSection('content'); ?>
<div class="row"><div class="columns small-12">&nbsp;</div></div>

<?php if(Session::get('userRole') !== 'Patient'): ?>
<?php echo $__env->make('messages.new_message', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php endif; ?>
<?php if(count($chats)): ?>
	<div class="row">
		<div class="columns small-6 large-4">
			<ul class="chats" <?php echo Session::get('userRole') == 'Patient' ? 'style="display: none;"' : ''; ?>>
				<?php foreach($chats as $chat): ?>
				<li id="chat_<?php echo $chat->id; ?>" class="chat" onclick="
					showChat(
						'<?php echo URL::to('messages/' . $chat->id); ?>',
						'<?php echo $chat->name; ?>',
						'<?php echo URL::to('messages/'); ?>',
						'<?php echo csrf_token(); ?>',
						'<?php echo $chat->id; ?>',
						'<?php echo Session::get('userRole'); ?>'
					);
				">
					<?php echo Session::get('userRole') == 'Patient' ? 'Chat' : $chat->name; ?>
				</li>
				<?php endforeach; ?>
			</ul>
		</div>
		<div class="columns small-6 large-8">
			<div class="chat-panel">
				<div class="chats-title"></div>
				<div class="chats-content"></div>
				<div class="new-message"></div>
			</div>
		</div>
	</div>
<script>
	$(document).ready(function() {
		$('#chat_<?php echo $active; ?>').click();
	});
</script>
<?php else: ?>
	<p class="lead text-center">There are no messages yet.</p>
<?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>