<div class="container page-content clearfix communities-joined-list-page">
    
    <style type="text/css">
		.redirect-on-cmnt-page{
			cursor:pointer;	
		}
	</style>
    
    <div class="left-column">
                
		<?php		
			$fclasspr='set-favourite-cm-pr';
			$myFavouriteSelectedPr='';
		?>
            
        <div class="box">
        	<div class="box-title" style="background-color: #f5f5f5 !important; color:#000; font-size:14px; ">
            	@if($communityUrl) 
                	<a href="{{$communityUrl}}"><i class="fa fa-home favorite-cm-home-joined"></i></a>  
                @endif 
                
                <img src="{{Theme::asset()->img('theme/images/mychubs.png')}}"/>
                        
                <span style="float:right">Set <i class="fa fa-heart set-faourite-icon" aria-hidden="true"></i></span>
            </div>
            
            <?php /*?>@if(!$myOwnedCommunity)
                <a href="{{URL::route('community-createown')}}" class="create-cm-link">Start a Community <span class="create-cm-link-plus">+</span></a>                        
            @endif  <?php */?>
            
           {{-- @if(!\Auth::user()->present()->isMyCommunityCreated())
                @if(!$myOwnedCommunity || ($myOwnedCommunity and !$myOwnedCommunity->present()->hasCardAdded()))
                    <div align="center"><a href="{{URL::route('community-createown')}}" class="create-cm-link" style="font-size:19px; color:#0074D9 !important;">Create an Organization <br></a>    <i class="fa fa-info-circle global-networking-helpnote1" aria-hidden="true"></i>
                    
                     <div class="global-networking-text-note1">
                        <b>When you create an organization, you can activate:</b><br />
                        ✦ Web Portal + iOS and Android Apps<br />
                        ✦ Team Communication & Collaboration Tools<br />
                        ✦ Community Building Platform with marketplace - PLUG & PLAY<br />
                        ✦ Storefront & Personal Branding for Community Participants - PLUG & PLAY
                     </div> 
                    </div>                    
                    <hr class="community-create-line" />
                @endif   
            @endif --}}
            
            <?php
				$canShowIdhubs=\Auth::user()->present()->canShowIdhubs();
			?>
              
            @if($canShowIdhubs)           
                <div class="box-title global-networking-menu">
                    <div class="row">
                         <?php 
                            $newMessageCount=app('App\\Repositories\\MessageRepository')->countNew();
                            $mainSiteUrl=\Config::get('app.url').'/cmownpage?lgkey='.\Auth::user()->login_key."&lgurl=".\Config::get('app.url');
                            
                            $originalUrl=URL::route('user-home');
                            if(!isMobile()){
                                $originalUrl=$mainSiteUrl;
                            }
                        ?>
                    
                        <div class="col-xs-12 global-networking-menu-cols">
                            <a data-original="{{$originalUrl}}" data-new="{{$mainSiteUrl}}" data-ajaxify="true" class="global-networking-logo-link redirect-on-cmnt-page">
                                
                                    <!--<i class="fa fa-globe"></i> -->
                                    <img src="{{Theme::asset()->img('theme/images/idhubs.png')}}" class="idhubs-network"/>
                            </a>
                           
                            @if(count($communitiesJoined)==0 and $primaryCommunity and !$myOwnedCommunity)
                                <?php
                                    if(\Auth::user()->primary_community_favourite==0)
                                    { 
                                        $fclasspr="unset-favourite-cm-pr"; 
                                        $myFavouriteSelectedPr="checked='checked'";
                                    }
                                ?>
                                 <input type="radio" class="{{$fclasspr}} cmactionpr" data-id="0" id="cm0" data-url="{{URL::route('user-home')}}" name="set-favourite-community-primary"  {{$myFavouriteSelectedPr}} />
                            @endif
                            
                            @if($newMessageCount)
                                 <span class="communities-msg-cnt-show"> <i class="icon ion-ios7-chatboxes-outline"></i>{{$newMessageCount}}</span>
                            @endif
                             
                            <i class="fa fa-info-circle global-networking-helpnote" aria-hidden="true"></i>
    
                            <a data-original="{{$originalUrl}}" data-new="{{$mainSiteUrl}}" data-ajaxify="true" class="global-networking-text-link redirect-on-cmnt-page"> 
                                    <span class="global-networking-big">idhubs global</span> 
                                    
                                    @if(\Auth::user()->community_signup==0 and \Auth::user()->primary_community==0)
                                        <i class="fa fa-star" style="font-size:14px; float:none; color:#ecab10;  margin-left:5px;" aria-hidden="true"></i>
                                    @endif
                                    
                                    <span class="idhubs-domain-name">idhubs.com</span>
                                    
                                   
                                   <!-- <span class="global-networking-small">- stay connected with trusted peers -</span>--> 
                            </a>
                        </div>  
                     </div>
                     
                     <div class="global-networking-text-note">
                       idhubs is the first web3 interactive platform. You will be able to connect with others who are digitally identified, as-well as like-minded people from your community and around the world.  <br /><br />

Using idhubs you can also <span style="color:#87683D;">Build Your Organizational Digital Ecosystem</span>. Connect and interact with others to support business objectives and organizational operations.
                     </div>     
                </div>
            @endif
            
            <?php
				$urlDomain="";
				$mainUrl=parse_url(Config::get('app.url'));
				if(isset($mainUrl['host'])){
					$urlDomain=$mainUrl['host'];
				}
			?>
            <div class="box-content joined-cm-list"> 
            
            	 @if($primaryCommunity and !$primaryCommunity->present()->isMember())
                     @if(!$myOwnedCommunity || ($myOwnedCommunity and $myOwnedCommunity->id!=$primaryCommunity->id))   
                         <?php
						 
								$myFavouriteSelectedPr="";
								if(count($communitiesJoined)>0 || $myOwnedCommunity){
									$nameclass='set-favourite-community';
									$nameclickclass='cmaction';
									$fclasspr="set-favourite-cm";
									
									if(\Auth::user()->favourite_community==$primaryCommunity->id)
									{ 
										$fclasspr="unset-favourite-cm";
										$myFavouriteSelectedPr="checked='checked'";
									}
								}else{
									$nameclass='set-favourite-community-primary';
									$nameclickclass='cmactionpr';
									if(\Auth::user()->primary_community_favourite==$primaryCommunity->id || \Auth::user()->primary_community_favourite=="")
									{ 
										$fclasspr="unset-favourite-cm-pr"; 
										$myFavouriteSelectedPr="checked='checked'";
									}
								}
								
								$domainUrl=$primaryCommunity->present()->getCommunityDomainUrl();
								$getUrlHostname=getUrlHostnameScheme($domainUrl);
								$domainUrlNew=$getUrlHostname.'/cmownpage?lgkey='.\Auth::user()->login_key."&lgurl=".$domainUrl;
								
								$originalUrl=$primaryCommunity->present()->url();
								if(!isMobile()){
									$originalUrl=$domainUrlNew;
								}
                            ?>
                            <div class=" user media media">
                                  <div class="media-object pull-left joined-communities-img joined-communities-list-view-img">
                                       <a data-original="{{$originalUrl}}" data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page"><img src="{{$primaryCommunity->present()->getLogoAvatar()}}"/></a>
                                  </div>
                                  <div class="media-body joined-community-media-body">
                                    <a data-original="{{$originalUrl}}" data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page">
                                      <span class="media-heading">{{$primaryCommunity->title}}</span>  
                                      
                                      @if(\Auth::user()->community_signup==$primaryCommunity->id || \Auth::user()->primary_community==$primaryCommunity->id)
                                			<i class="fa fa-star" style="font-size:14px; float:none; color:#ecab10; margin-left:5px;" aria-hidden="true"></i>
                                	  @endif
                                    </a>
                                      
                                     <?php 
											$newMessageCount=app('App\\Repositories\\MessageRepository')->countNew($primaryCommunity->id);
									 ?>
									
                                     @if($newMessageCount)
                                             <span class="communities-msg-cnt-show"> <i class="icon ion-ios7-chatboxes-outline"></i>{{$newMessageCount}}</span>
                                     @endif
                        
                                      <?php /*?>@if(count($communitiesJoined)==0) <?php */?>
                                        <input type="radio" class="{{$fclasspr}} {{$nameclickclass}}" data-id="{{$primaryCommunity->id}}" id="cm{{$primaryCommunity->id}}" data-url="{{$primaryCommunity->present()->url()}}" name="{{$nameclass}}" {{$myFavouriteSelectedPr}}/>
                                     <?php /*?> @endif<?php */?>
                                      <span class="community-subdomain-name">{{$domainUrl}}</span>
                                  </div>
                            </div>
                    @endif
                 @endif
                 
            	 @if($myOwnedCommunity)
                        <?php 
							$community=$myOwnedCommunity;
							$fclass="set-favourite-cm";
							$myFavouriteSelected='';
							if(\Auth::user()->favourite_community==$community->id)
							{ 
								$fclass="unset-favourite-cm"; 
								$myFavouriteSelected="checked='checked'";
							}
							
							$domainUrl=$community->present()->getCommunityDomainUrl();
							$getUrlHostname=getUrlHostnameScheme($domainUrl);
							$domainUrlNew=$getUrlHostname.'/cmownpage?lgkey='.\Auth::user()->login_key."&lgurl=".$domainUrl;
							
							$originalUrl=$community->present()->url();
							if(!isMobile()){
								$originalUrl=$domainUrlNew;
							}
                        ?>    
                          
                        <div class=" user media media">
                              <div class="media-object pull-left joined-communities-img joined-communities-list-view-img">
                                   <a data-original="{{$originalUrl}}" data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page"><img src="{{$community->present()->getLogoAvatar()}}"/></a>
                              </div>
                              <div class="media-body joined-community-media-body">
                                  <a data-original="{{$originalUrl}}" data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page"><span class="media-heading">{{$community->title}}</span> <span class="brand-colored-texts">(admin)</span> @if(\Auth::user()->community_signup==$myOwnedCommunity->id || \Auth::user()->primary_community==$myOwnedCommunity->id)
                                			<i class="fa fa-star" style="font-size:14px; float:none; color:#ecab10; margin-left:5px;" aria-hidden="true"></i>
                                	  @endif</a>
                                  
								  @if($community->user_id==\Auth::user()->id and $community->present()->hasExpiredCommunity())								  
										@if($community->present()->hasPlanExpired())
											<a href="{{$community->present()->hasPlanExpired()}}" class="community-expired-renew-update-link">Overdue Invoice (currently inactive) - Pay Now</a> 
										@else
											<a href="{{URL::route('community-payment-outside',['slug'=>$community->id])}}" class="community-expired-renew-update-link">Renew/Update Your Account</a> 
										@endif
								  @endif
								  
                                  <?php 
										$newMessageCount=app('App\\Repositories\\MessageRepository')->countNew($community->id);
								  ?>
								
								  @if($newMessageCount)
										 <span class="communities-msg-cnt-show"> <i class="icon ion-ios7-chatboxes-outline"></i>{{$newMessageCount}}</span>
								  @endif 
                                   
                                  <input type="radio" class="{{$fclass}} cmaction" data-id="{{$community->id}}" id="cm{{$community->id}}" data-url="{{$community->present()->url()}}" name="set-favourite-community" {{$myFavouriteSelected}}/>
                                 
                                  <span class="community-subdomain-name">{{$domainUrl}}</span>
                              </div>
                        </div>
                 @endif
                   
                 @if(count($communitiesJoined)>0)
                    @foreach($communitiesJoined as $cm)
                        <?php $community=$cm->community;?>
                        @if($community and $community->external_community==1 and $community->eventmeeting==0 and $community->user_id!=\Auth::user()->id and $community->status==1)
							@if($community->present()->hasCardAdded())
								<?php 
                                    $fclass="set-favourite-cm";
                                    $myFavouriteSelected='';
                                    if(\Auth::user()->favourite_community==$community->id)
                                    { 
                                        $fclass="unset-favourite-cm"; 
                                        $myFavouriteSelected="checked='checked'";
                                    }
                                    
                                    $domainUrl=$community->present()->getCommunityDomainUrl();
                                    $getUrlHostname=getUrlHostnameScheme($domainUrl);
                                    $domainUrlNew=$getUrlHostname.'/cmownpage?lgkey='.\Auth::user()->login_key."&lgurl=".$domainUrl;
                                    $originalUrl=$community->present()->url();
                                    if(!isMobile()){
                                        $originalUrl=$domainUrlNew;
                                    }
                              ?>      
                                    <div class=" user media media">
                                          <div class="media-object pull-left joined-communities-img joined-communities-list-view-img">
                                               <a data-original="{{$originalUrl}}"  data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page"><img src="{{$community->present()->getLogoAvatar()}}"/></a>
                                          </div>
                                          <div class="media-body joined-community-media-body">
                                              <a data-original="{{$originalUrl}}" data-new="{{$domainUrlNew}}" data-ajaxify="true" class="redirect-on-cmnt-page"><span class="media-heading">{{$community->title}}</span> @if($community->user_id==\Auth::user()->id)<span class="brand-colored-texts">(admin)</span>@endif @if(\Auth::user()->community_signup==$community->id || \Auth::user()->primary_community==$community->id)
                                                <i class="fa fa-star" style="font-size:14px; float:none; color:#ecab10; margin-left:5px;" aria-hidden="true"></i>
                                          @endif</a>
                                              
											  @if($community->user_id==\Auth::user()->id and $community->present()->hasExpiredCommunity()) 
													@if($community->present()->hasPlanExpired())
														<a href="{{$community->present()->hasPlanExpired()}}" class="community-expired-renew-update-link">Overdue Invoice (currently inactive) - Pay Now</a> 
													@else
														<a href="{{URL::route('community-payment-outside',['slug'=>$community->id])}}" class="community-expired-renew-update-link">Renew/Update Your Account</a> 
													@endif
											  @endif
											  
                                              <?php 
                                                    $newMessageCount=app('App\\Repositories\\MessageRepository')->countNew($community->id);
                                              ?>
                                            
                                              @if($newMessageCount)
                                                     <span class="communities-msg-cnt-show"> <i class="icon ion-ios7-chatboxes-outline"></i>{{$newMessageCount}}</span>
                                              @endif
                                       
                                              <input type="radio" class="{{$fclass}} cmaction" data-id="{{$community->id}}" id="cm{{$community->id}}" data-url="{{$community->present()->url()}}" name="set-favourite-community" {{$myFavouriteSelected}}/>
                                             
                                              <span class="community-subdomain-name">{{$domainUrl}}</span>
                                          </div>
                                    </div>
                              @endif      
                        @endif
                    @endforeach
               @endif         
            </div>
        </div>

	</div>
    
    <div class="right-column">
        {!! Theme::section('user.side-info') !!}
        {!! Theme::widget()->get('notifications') !!}
    </div>
</div>
