<div class="social-media-left-pannel">

    <div id="preview-card" class="box box-preview-card fixsideinfotop1">    
        <div class="cover">
            <a href="{{$loggedInUser->present()->url()}}" data-ajaxify="true">
                <img  src="{{(!empty($loggedInUser->cover)) ? $loggedInUser->present()->coverImage() : Theme::asset()->img('theme/images/profile-cover.jpg')}}"/>
            </a>
        </div>
        <div  class="media">
            <div class="media-object pull-left">
                <a href="{{$loggedInUser->present()->url()}}" data-ajaxify="true">
                    <img src="{{$loggedInUser->present()->getAvatar(150)}}"/>
                </a>
            </div>
            <div class="media-body">
                <h4 class="media-heading">{{$loggedInUser->fullname}}</h4>
                <span>@ {{$loggedInUser->username}}</span>
            </div>
        </div>
    </div>
    
    <div style="clear:both"></div>
    
    @if(!isset($hide_weahter))  
        <div class="social-media-left-pannel-db">
             <div class="cb-dashboard">    
                 
                 {!! Theme::section('community.page.weather') !!}
                     
                 <div class="cb-dashboard-box" style="border: 2px solid #cfcfcf;
  border-radius: 14px; box-shadow:none; background:#fff; margin-bottom: 5px; @if(!isset($hide_weahter)) margin-top:5px; @endif">
                     <div class="recent-activity-heading">Posting Activity 
                        <span style="float:right; font-size: 14px;">
                            <i style="margin-right:7px;" class="fa fa-thumbs-o-up" aria-hidden="true"></i>
                            <i style="margin-right:6px;" class="fa fa-comment-o" aria-hidden="true"></i> 
                            <i class="fa fa-share" aria-hidden="true"></i>
                        </span>
                     </div>                            
                     
                     <div class="posting-activity-inner-box">
                        <?php
                            $timeline_posts=\Auth::user()->present()->getTimelinePosts();
							
							//{!! strip_tags(html_entity_decode(preg_replace('/#(\w+)/', '', Str::limit($post->post_header_texts, 100)))) !!}
                        ?>
                        @if(count($timeline_posts)>0)
                        	<ul style="padding-left: 15px;">
                                @foreach($timeline_posts as $post)
                                	<li>                                        	
                                        <div class="posting-activity-row-box">   
                                            <a href="{{$post->present()->url()}}" style="text-decoration:none">
                                                @if($post->post_header_texts)                                            	
                                                      {!! strip_tags(html_entity_decode(preg_replace('/#/', '', Str::limit($post->post_header_texts, 100)))) !!}
                                                      dsf
                                                @elseif($post->text)
                                                    {!! strip_tags(html_entity_decode(preg_replace('/#/', '', Str::limit($post->text, 100)))) !!}
                                                @else
                                                    {{$post->content_type}}
                                                @endif
                                            </a>    
                                        </div> 
                                    </li>                                             
                                @endforeach
                             </ul>   
                        @else
                            No posts found!
                        @endif
                     </div>
                  </div>  
                  
                  <?php
					$revenue=app('App\\Repositories\\BusinessProductsOrdersRepository')->getMyTotalRevenue(\Auth::user()->id); 
				  ?>
			  
                  <?php
                    $topSellingProducts = app('App\\Repositories\\BusinessProductsOrdersRepository')->getMyTopSellingProducts(\Auth::user()->id, 5);
                  ?>
				 
				  <div class="cb-dashboard-box-col">
					 <div class="cb-dashboard-box" style="border: 2px solid #cfcfcf;
  border-radius: 14px; box-shadow:none; background:#fff; margin-bottom: 5px; @if(!isset($hide_weahter)) margin-top:5px; @endif">
                     	<div class="" style="font-size:16px; font-weight:bold;"> 
							Total Revenues : ${{number_format($revenue, 2, '.', ',')}}    
                        </div>                                  

                            @if(!empty($topSellingProducts))
                                <div style="margin-top:6px; margin-bottom:6px; font-size:14px; font-weight:bold;">Inventory Status</div>
                                <div style="font-size:13px; line-height: 1.35;">
                                    @foreach($topSellingProducts as $row)
                                        <div style="display:flex; align-items:baseline; justify-content:space-between; gap:6px; padding: 2px 0;">
                                            <span style="flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
                                                {{ $row['product_name'] }}
                                            </span>
                                            <span style="white-space:nowrap;">
                                                - {{ (int) ($row['stock_available'] ?? 0) }}/{{ (int) ($row['stock_total'] ?? 0) }}
                                            </span>
                                        </div>
                                    @endforeach
                                </div>
                            @endif
					 </div>
				  </div> 
             </div>
        </div>
    @endif
    
    <?php
        if(isset($bookingRideUrl)){
            $bookingRideUrl=$bookingRideUrl;
        }else{
            $bookingRideUrl="";
        }	
    ?>
    
    {!! Theme::section('user.action-buttons',['bookingRideUrl'=>$bookingRideUrl]) !!}
    {!! Theme::extend('user-side-preview-card') !!}
</div>