<!DOCTYPE html>
<html lang="en-US">
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<?php
			$message=app('App\\Repositories\\MessageRepository')->get($message_id);
		
			$community='';			
			$message_inside='';
			$chatName='';
			
			$msgTitle='';
			if($message->community_id){
				$community = app('App\\Repositories\\CommunityRepository')->getById($message->community_id);
				
				if($message->communityGroupId){
					$community_group = app('App\\Repositories\\CommunityCategoryRepository')->get($message->communityGroupId,$message->community_id);
					if($community_group){
						$chatName="<strong>"."# ".$community_group->title."</strong> group chat";
					}	
				}elseif($message->group_id){
					$personal_group = app('App\\Repositories\\MessageGroupsRepository')->getById($message->group_id);
					if($personal_group){
						$chatName="<strong>".$personal_group->title."</strong> inside group chat of ".$community->title;
					}	
				}else{
					$chatName="<strong>".$community->title."</strong> inside personal chat";
				}		
			}else{
				
				if($message->group_id){
					$personal_group = app('App\\Repositories\\MessageGroupsRepository')->getById($message->group_id);
					
					if($personal_group){
						$chatName="<strong>".$personal_group->title."</strong> social media group chat";
					}	
				}else{
					$chatName="social media personal chat";	
				}
				
				if($visiting_community_id){
					$community = app('App\\Repositories\\CommunityRepository')->getById($visiting_community_id);
				}		

				if($community){
					$chatName=$chatName." of <strong>".$community->title."</strong>";
				}else{
					$chatName=$chatName." of <strong>idhubs</strong>";
				}		
			}		
		?>	
    	<div>
            <h3>Hello {!!$to_user_name!!},</h3><br/>			            			
			<p><a href="{!!$from_user_profileUrl!!}">{!!$from_user_name!!}</a> has sent you a new message on {!!$chatName!!}.</p>           	            
			<br/>

			@if($community)
				<p><a href="{!!$community->present()->url('login')!!}">Click here</a> to login and see.</p>     

				 @if($community->email_signature)
					{!!$community->email_signature!!}
				 @else
					<p>
						Sincerely,<br/><br/>
						
						<strong>{!!$community->title!!}</strong><br/>
						{!!$community->address!!}<br>{!!ucfirst($community->city)!!},{!!$community->zip!!}<br>{!!ucfirst($community->state)!!},{!!ucfirst($community->country)!!}<br/>
						Tel: {!!$community->contact!!}<br/>
						Email: {!!$community->email!!}<br/>
						
						<br>
								   
						<hr>
					   
						<?php 
							$imgPath=$community->present()->getLogo(); 
							$url=$community->present()->url();
						?>
						
						<a href="{!!$url!!}"><img src="{!!ltrim($imgPath)!!}" style="width:200px; height:auto; "/></a>
						<br>
						<br>
						{!!$community->description!!}<br/>
					</p>
				 @endif 	
			@else
				<p><a href="{!!URL::to('/')!!}/usersignup">Click here</a>  to login and see.</p>  

				 <p><b>Best Wishes,</b><br/>
					idhubs Support<br/>			
					<a href="https://idhubs.com">www.idhubs.com</a><br/>				
					Contact: <a href="https://blog.idhubs.com/c/75/survey/support">https://blog.idhubs.com/c/75/survey/support</a><br/>			
				 </p>
			@endif
				
		</div>
	</body>
</html>