<div id="editor" class="">
    @php(\App\Performance\PerfMarks::start('view:post/editor/main'))
	<?php
		$pstact=Request::get('pstact');
	?>
    
   <input type="hidden" id="selected_pstact" value="{{$pstact}}" />
    	
    <form enctype="multipart/form-data" id="post-form" class="form-horizontal" action="" method="post">
        {{ csrf_field() }}
        <input type="hidden" value="{{(isset($type)) ? $type : 'user-timeline'}}" name="val[type]" id="post_draft_type"/>
        <input type="hidden" value="{{(isset($typeId)) ? $typeId : ''}}" name="val[type_id]" id="post_draft_type_id"/>
        <input type="hidden" value="{{(isset($to)) ? $to : 0}}" name="val[to_user]" id="to_user"/>
        <input type="hidden" value="{{(isset($community_id)) ? $community_id : ''}}" name="val[community_id]" id="post_draft_community_id"/>
        <input type="hidden" value="{{(isset($page_id)) ? $page_id : ''}}" name="val[page_id]" id="post_draft_page_id"/>
        <input type="hidden" value="text" id="content_type" name="val[content_type]"/>
        
		<input type="hidden" value="{{(isset($post_created_from_type)) ? $post_created_from_type : ''}}" name="val[post_created_from_type]" id="post_created_from_type"/>

        <input type="hidden" value="{{(isset($posted_in_community)) ? $posted_in_community : ''}}" name="val[posted_in_community]" id="post_posted_in_community"/>
		
		<input type="hidden" id="link_html_contents" name="val[link_html_contents]"/>
        
        @if(isset($to))
            <input type="hidden" value="{{$to}}" name="val[to_userid]"/>
        @endif
        
        <?php
            \App\Performance\PerfMarks::start('post/editor:setup');
			$post_posting_type="user-timeline";
			$post_posting_typeId=0;
			$post_posting_community_id=0;
			$post_posting_page_id=0;
			$post_posting_posted_in_community=0;
			
            // If the parent view already passed a community object, reuse it.
            $passedCommunity = (isset($community) && $community) ? $community : null;

            // Cache Theme asset helper; repeated Theme::asset() calls are expensive.
            $themeAsset = Theme::asset();

            // Reuse the authenticated user/presenter instead of repeatedly calling Auth::user()->present().
            $user = isset($loggedInUser) && $loggedInUser ? $loggedInUser : \Auth::user();
            $userPresenter = $user ? $user->present() : null;

            // Cache request segments/config values used repeatedly in the template.
            $seg1 = \Request::segment(1);
            $seg3 = \Request::segment(3);
            $seg4 = \Request::segment(4);
            $isHomeOrProfile = ($seg1 == 'home' || $seg3 == 'home' || isset($userprofile));
            $postTextLimit = \Config::get('post-text-limit');
            $enablePostTextLimit = (bool) \Config::get('enable-post-text-limit');
            $sharingCommunityNameCached = null;
            if($isHomeOrProfile){
                $sharingCommunityNameCached = getSharingCommunityName();
            }
			
			if(isset($type)){
				$post_posting_type=$type;	
			}
			
			if(isset($typeId)){
				$post_posting_typeId=$typeId;	
			}
			
			if(isset($community_id)){
				$post_posting_community_id=$community_id;	
			}
			
			if(isset($page_id)){
				$post_posting_page_id=$page_id;	
			}
			
			if(isset($posted_in_community)){
				$post_posting_posted_in_community=$posted_in_community;	
			}
			
		
			$eventCommunityId="";
			$canAccessEvent=0;
			$canAskQuestion=0;
			
			$showFitness="";
			$showRssFeeds="";
			$rss_add_url='';
            $communityPresenter = null;
			
			if(isset($community_id)){
				$eventCommunityId=$community_id;
                if(!$passedCommunity || (int) $passedCommunity->id !== (int) $eventCommunityId){
					$community=($userPresenter) ? $userPresenter->getCommunityById($eventCommunityId) : null;
                }else{
                    $community=$passedCommunity;
                }
                $communityPresenter = ($community) ? $community->present() : null;

                // Cache categories once per request; the template references them multiple times.
                $communityCategories = ($community) ? $community->categories : [];
				
				if($community){
                    if(($communityPresenter && $communityPresenter->canDoEvents()==1 and $community->owner_event_access==1) || ($communityPresenter && $communityPresenter->canDoCrowdfunding()==1 and $community->owner_donation_access==1)){
						$canAccessEvent=1;
					}
					
                    if($communityPresenter && $communityPresenter->canShowFitness()==1){
						$showFitness="ok";
					}
					
                    if($communityPresenter && $communityPresenter->canCommunityRSSAccess()==1){
						$showRssFeeds="ok";
					}
				}
			}

            if (!isset($communityCategories)) {
                $communityCategories = (isset($community) && $community) ? $community->categories : [];
            }
			
			$askQuestionCmId=0;
			$can_share_recipe=1;
            $askQuestionCmPresenter = null;
			if(isset($community_id)){
				$askQuestionCmId=$community_id;	
				
				if($askQuestionCmId){
                    if(isset($community) && $community && (int) $community->id === (int) $askQuestionCmId){
                        $askQuestionCm=$community;
                    }else{
                        $askQuestionCm=($userPresenter) ? $userPresenter->getCommunityById($askQuestionCmId) : null;
                    }
					
					if($askQuestionCm){
                        if(isset($community) && $community && isset($communityPresenter) && $communityPresenter && (int) $askQuestionCm->id === (int) $community->id){
                            $askQuestionCmPresenter = $communityPresenter;
                        }else{
                            $askQuestionCmPresenter = $askQuestionCm->present();
                        }
                        if($askQuestionCmPresenter && $askQuestionCmPresenter->canUserAskQuestion('internal')==1){
							$canAskQuestion=1;
						}
					}
				}
			}elseif(isset($posted_in_community)){
				$askQuestionCmId=$posted_in_community;	
				
				if($askQuestionCmId){
                    if(isset($community) && $community && (int) $community->id === (int) $askQuestionCmId){
                        $askQuestionCm=$community;
                    }else{
                        $askQuestionCm=($userPresenter) ? $userPresenter->getCommunityById($askQuestionCmId) : null;
                    }
					
					if($askQuestionCm){
                        if(isset($community) && $community && isset($communityPresenter) && $communityPresenter && (int) $askQuestionCm->id === (int) $community->id){
                            $askQuestionCmPresenter = $communityPresenter;
                        }else{
                            $askQuestionCmPresenter = $askQuestionCm->present();
                        }
                        if($askQuestionCmPresenter && $askQuestionCmPresenter->canUserAskQuestion('external')==1){
							$canAskQuestion=1;
						}
						
						if($askQuestionCm->can_share_recipe==0){
							$can_share_recipe=0;
						}
					}
				}
			}
		
            $placeHolder='Type a post';
			$postBtnclass="";
			$handIconClass="handIconClass";
			$openTopicList="";
			if(isset($type) and $type=='community' and !isset($typeId)){
				$placeHolder='Type a post';
				$postBtnclass="hide-post-btn";
				$handIconClass="handIconClass";
				$openTopicList="openTopicList";
			}
			
			$hashTag="";
			if(isset($type) and isset($typeId) and $type=='community'){				
                $communityCategory=($userPresenter) ? $userPresenter->getCommunityCategoryById($typeId) : null;	
				if(!empty($communityCategory)){
					$placeHolder='Type a post';
					
					if($showFitness=="ok" and $communityCategory->fitness_access==1){
						$showFitness="yes";
					}
					
					if($showRssFeeds=="ok" and $communityCategory->rss_access==1){
						$showRssFeeds="yes";
                        $rss_add_url=($communityPresenter) ? $communityPresenter->url('category/'.$communityCategory->slug."/rssfeeds") : '';
					}
				}
			}
			
			if(isset($type) and isset($typeId) and $type=='resume'){
				//if(\Auth::user()->id==126 || \Auth::user()->id==24034){		
                    $resumeData=($userPresenter) ? $userPresenter->isResumeCreated() : null;	
					if($resumeData){
						$showRssFeeds="ok";
						$showRssFeeds="yes";
						$rss_add_url=$resumeData->present()->url('rssfeeds');					
					}
				//}	
			}
			
			$draftType=(isset($type)) ? $type : 'user-timeline';
			$draftTypeId=(isset($typeId)) ? $typeId : 0;
			$draftCommunityId=(isset($community_id)) ? $community_id : 0;
			$draftPageId=(isset($page_id)) ? $page_id : 0;
			
			$profileUsr=0;
			if(isset($to)){
				$profileUsr=$to;
			}
			
            $draftMessage=($userPresenter) ? $userPresenter->getPostDraft($draftType,$draftTypeId,$draftCommunityId,$draftPageId,$profileUsr) : null;

            $maxPostVideoUploadSize = ($userPresenter) ? $userPresenter->maxPostVideoUploadSize() : 0;
			
			$requestLimit="unlimited";
			if($draftType=="resume"){
				$canAskQuestion=1;	
				$requestLimit=$askIdeaRequestLimit;
			}
            \App\Performance\PerfMarks::stop('post/editor:setup');
        ?>
		
        <div class="editor-body">
        	 <div class="post_header_texts {{$postBtnclass}}" style="display:none">        
                <div class="row">
                    <div class="col-sm-10 col-xs-9 post_header_texts_col_1">
                        <input autocomplete="off" class="form-control save-post-in-draft" id="post_header_texts" value="@if($draftMessage){{$draftMessage->heading}}@endif" name="val[post_header_texts]" placeholder="Add a title (optional). Choose a color to highlight title."/> 
                    </div>
                    
                    <div class="col-sm-2 col-xs-3 post_header_texts_col_2">
                        <input type='text' class="containerCmColorPicker cmhdcolor"/>
                        <input class="cmHeaderColor existing_cmheader_color" type="hidden" name="val[post_header_texts_color]"/>
                    </div>
                </div>    
            </div>
        
            <div class="media post-textarea-container">
            
                <?php /*?><div class="media-object pull-left">
                    <!--<img src="{{(isset($avatar)) ? $avatar : $loggedInUser->present()->getAvatar(50)}}" width="50"
                         height="50"/>-->
                         <i class="fa fa-pencil-square-o" aria-hidden="true" style="font-size:30px; color:#e5b6bb"></i>

                </div><?php */?>
                <div class="media-body post-texts-main-body">
                
                    @if($isHomeOrProfile)
                        @if($sharingCommunityNameCached)
                            <div class="sharing-community-name">{{$sharingCommunityNameCached}}</div>
                        @endif
                    @endif
                
                
                    <textarea id="post-textarea" data-text-limit="{{$postTextLimit}}"
                              data-counter-target="#main-editor-text-counter" data-target="#hashtag-mention-suggestion"
                              class="post-add-editor-box post-textarea mention save-post-in-draft {{$handIconClass}} {{$openTopicList}} {{($enablePostTextLimit) ? 'post-text-limit' : null}}"
                              name="val[text]" placeholder="{{$placeHolder}}" title="{{$placeHolder}}">{{$hashTag}}@if($draftMessage){{$draftMessage->body}}@endif</textarea>        
                	
                    	
                        <div class="add-hashtag-box">
                             	<div class="add-hashtag-title">
                                	Add hashtag
                                </div>
                                
                                <div class="hashtag-existing-list">
                                	<div class="hashtag-outer" id="hashtag-content">
                                          <i class="fa fa-arrow-left hashtag-lefty hashtag-paddle" id="left-button" aria-hidden="true"></i>
                                          
                                          <div class="hashtag-inner">#digital</div>
                                          <div class="hashtag-inner">#future</div>
                                          <div class="hashtag-inner">#security</div>
                                          <div class="hashtag-inner">#blockchain</div>
                                          <div class="hashtag-inner">#socialmedia</div>
                                          <div class="hashtag-inner">#community</div>
                                          <div class="hashtag-inner">#society</div>
                                          <div class="hashtag-inner">#technology</div>
                                          <div class="hashtag-inner">#organization</div>
                                          <div class="hashtag-inner">#webdesigning</div>
                                          <div class="hashtag-inner">#language</div>
                                          <div class="hashtag-inner">#reference</div>
                                          <div class="hashtag-inner">#hardware</div>
                                          <div class="hashtag-inner">#projects</div>
                                      	  <div class="hashtag-inner">#business</div>
                                          <div class="hashtag-inner">#economy</div>
                                          <div class="hashtag-inner">#events</div>
                                          <i class="fa fa-arrow-right hashtag-righty hashtag-paddle" aria-hidden="true" id="right-button"></i>
                                           
                                     </div>
                                </div>
                        </div>
                
                </div>
            </div>

            <?php /*?><div class="add-file-container">
				 <input type="text" autocomplete="off" name="val[pdf_file_url]" placeholder="Share a pdf link" id="pdf_file_url"/>
                <div class="wrap">
                    <div class="title">{{trans('post.share-from-your-computer')}}</div>
                    <div class="content">
						<a class="btn btn-file btn-success" style="padding:0px 5px;margin:0px 5px;">
							<span class="fileupload-new">Add File</span>
							<input id="post-editor-file-upload" type="file" name="share_file"/>
						</a>
                        <span class="size-indicator">{{trans('post.file-max-size')}}: {{ formatBytes(10485760)}}</span>
                    	<div class="pdf-file-name-show"></div>
                    </div>
                </div>
            </div><?php */?>

            <div id="hashtag-mention-suggestion" class="hashtag-mention-suggestion">
                <div class="listing"></div>
            </div>
            <div id="post-type-content">
            
                <div class="images-container"></div>

                <input type="text" autocomplete="off" name="val[type_content]"
                       placeholder="{{trans('post.share-video-from')}}"/>
                <div class="post-media-suggestion">
                    <div class="search-indicator">


                    </div>
                    <div class="listing"></div>
                </div>
                <div id="post-editor-video-upload-container" class=" fileupload fileupload-exists" data-provides="fileupload">
                    <a class="btn btn-file black-color-button select-video-file-btn">
                        <span class="fileupload-new"><i class="icon ion-ios7-cloud-upload-outline"></i> {{trans('post.upload-videos')}}</span>
                        <span class="fileupload-exists"><i class="icon ion-ios7-cloud-upload-outline"></i> {{trans('post.upload-videos')}}</span>

                        <input accept="video/*" id="post-editor-video-upload" multiple  class="" type="file" name="video">
                    </a>                   
                    
                    <a class="btn btn-file red-color-button cancel-video-post">{{trans('post.cancel')}}</a>
                    
                    <!--<i class="fa fa-info-circle upload-video-guide-link" aria-hidden="true"></i>                    
                    <ul class="list-upload-video-guide-link">
                        <li data-url="{{$themeAsset->img('theme/images/video/youtube-link.png')}}">for youtube</li>
                        <li data-url="{{$themeAsset->img('theme/images/video/vimeo-link.png')}}">for vimeo</li>
                        <li data-url="{{$themeAsset->img('theme/images/video/dropbox-link.png')}}">for dropbox</li>
                    </ul>-->
                    
                    <span class="video-ready-to-upload" style="color:#f00;">Video is attached. To upload, click post.</span>
                    
                    {{--<a class="btn-file btn-success" data-toggle="modal" data-target="#videoLibraryModal" style="padding:0px 5px;margin:0px 5px;">--}}
                        {{--<span class="fileupload-exists"><i class="icon ion-ios7-cloud-upload-outline"></i> {{trans('post.use-library')}}</span>--}}
                    {{--</a>--}}
					
                    <span class="size-indicator">{!! trans('post.video-max-size') !!}: {!! formatBytes($maxPostVideoUploadSize) !!}</span>
                </div>
                <div id="post-editor-photos-upload-container" class=" fileupload fileupload-new" data-provides="fileupload">
                    <a id="post-editor-photos-selector" _title="{{trans('post.attach-photos')}}" class="btn btn-file black-color-button" style="padding:0px 5px">
                    <span class="fileupload-new">Upload Images</span>
                    <span class="fileupload-exists">Upload Images</span>

                    <input accept="image/*" id="post-image-input" multiple class="" type="file" name="image[]">
                    </a>
					<a class="btn-file black-color-button uploadFromGalleryBtn" onclick="openImageGalleryToPost()">
                        <span>{{trans('post.use-common-media')}}</span>
                    </a>
                    
					<a class="btn btn-file red-color-button cancel-mbl-post">{{trans('post.cancel')}}</a>
                    {{--<a class="btn-file btn-success" data-toggle="modal" data-target="#imageLibraryModal" style="padding:0px 5px;margin:0px 5px;">--}}
                        {{--<span class="fileupload-exists"><i class="icon ion-ios7-cloud-upload-outline"></i> {{trans('post.use-library')}}</span>--}}
                    {{--</a>--}}
                    
                    <span class="size-indicator">{!! trans('post.image-max-size') !!}: {!! formatBytes(10485760) !!}</span>
                     
                </div>
            </div>
            
             <div class="post-editor-survey-upload-container" style="padding:0px;">
             
                     @if($isHomeOrProfile)
                        @if($sharingCommunityNameCached)
                            <div class="sharing-community-name">{{$sharingCommunityNameCached}}</div>
                        @endif
                     @endif
             
                     <div class="wrap" style="border:none;">
                        <!--<div class="title">
						    {{trans('post.create-a-poll')}}
                        
                        	@if($eventCommunityId!="")                            	
                                 <span class="community-events-links">
                                    <a href="{{$communityPresenter ? $communityPresenter->url('surveys') : ''}}">{{trans('post.see-polls')}}</a>  
                                 </span> 
                            @else
                            	  <a class="page-repload-actn pull-right"></i> <span class="mobile-content-type-icon brand-colored-texts">Cancel Post</span></a>
                                        
                            @endif     
                        </div>-->
                        
                        <div class="content setDefaultPanel">
                        
                        	  <input type="hidden" name="val[post-survey]" id="post-survey"/>
                               	
                              <!--<div class="form-group">
                                    <label class="col-sm-3 control-label">{{trans('post.survey-title')}}</label>
                                    <div class="col-sm-9">
                                      	<input type="text" class="form-control survey_title" name="val[survey_title]" id="survey_title" placeholder="{{trans('post.survey-title')}}" autocomplete="off" maxlength="70"/>
                                    </div>
                              </div>-->
                              
                              <div class="form-group">
                                    <label class="col-sm-12 control-label">Select the type of question you want to use for your poll?</label>
                                    <div class="col-sm-12">
                                      	    <label class="radio-inline"><input type="radio" class="answer_type" id="answer_type1" name="val[answer_type]" value="direct" checked="checked">{{trans('post.poll-direct')}}</label>
                                            <label class="radio-inline"><input type="radio" class="answer_type" id="answer_type2" name="val[answer_type]" value="fact">{{trans('post.poll-fact')}}</label>
                                            <label class="radio-inline"><input type="radio" class="answer_type" id="answer_type3"  name="val[answer_type]" value="selective">{{trans('post.poll-selective')}}</label> 
                                    </div>
                              </div>
                              
                              <div class="form-group answet_type_data">
                                    <div class="col-sm-12 direct-survey-question">
										{{trans('post.poll-yes-no')}}		
                                    </div>
                                    
                                    <div class="col-sm-12 fact-survey-question">
										{{trans('post.poll-true-false')}}	
                                    </div>
                              </div>
                              
                              <div class="form-group marginbottom0px" style="margin-top: -10px;">
                                    <label class="col-sm-12 control-label">{{trans('post.poll-question')}}</label>
                                    <div class="col-sm-12">
                                      	<input type="text" class="form-control survey_quest" name="val[survey_quest]" id="survey_quest" placeholder="{{trans('post.type-a-question')}}" autocomplete="off"/>
                                    </div>
                              </div>
                              
                              <div class="form-group marginbottom0px">
                                   <div class="col-sm-6">
                                        <label class="control-label">Do you want to add an image associated with this question?(<span class="brand-colored-texts">{{trans('post.optional')}}</span>)</label>
                                          <div class="" style="margin-top:15px;">
                                                <div class="uploadSurveyfile" style="height: 130px;">
                                                       <input type="file" class="form-control" id="survey_question_file" name="survey_question_file">
                                                       <div class="dragUpload">
                                                            <div>
                                                                <i style="font-size:40px" class="fa fa-upload event-media-upload-btn" aria-hidden="true"></i>
                                                            </div>     
                                
                                                            <div class="drag-drop-texts" style="font-size:16px;">{{trans('post.poll-drag-and-drop-image')}}</div>
                                                            <img src="" id="survey_question_file_img" class="thumbMediaImgSurvey survey_question_file_img"/> 
                                                       </div>
                                                </div>
                                           </div>
                                     </div>
                                     
                                     <div class="col-sm-6">                                     		                  
                                         <label class="control-label">{{trans('post.poll-ends-on')}}</label>
                                                
                                         <div class='input-group date' id='datetimepicker1'>
                                            <input type='text' class="form-control surveyend" placeholder="{{trans('post.poll-end-date')}}" id="surveyend" name="val[surveyend]" autocomplete="off"/>
                                            <span class="input-group-addon">
                                                <span class="glyphicon glyphicon-calendar"></span>
                                            </span>
                                         </div>
                                             
                                          
                                         <div style="margin-top:30px;">
                                            <input type='text' class="colorPicker"/>
                                            <input type="hidden" name="val[surveyColor]" id="surveyColor" class="surveyColor" value="#ffebcd" />               
                                            <span style="margin-left:10px; color:#000; font-size:15px;">
                                            	Select a background color for your post
                                            </span>    
                                         </div> 
                                     </div>   
                              </div>
                              
                              <div class="form-group answet_type_data"> 
                                    <div class="col-sm-12 selective-survey-question">
                                    
                                    	    <div class="form-group">
                                            	<label class="col-sm-12 control-label brand-colored-texts">{{trans('post.poll-answer-option')}}</label>
                                                <div class="col-sm-12">
                                                   <select class="form-control" id="selective_survey_type" name="val[selective_type]">
                                                   		<option value="0">{{trans('post.poll-with-text')}}</option>
                                                        <option value="1">{{trans('post.poll-with-image')}}</option>
                                                   </select>
                                                </div>
                                            </div>
                                    
                                            <div class="form-group selective-simple-survey">
                                                <label class="col-sm-1 control-label">a.</label>
                                                <div class="col-sm-11">
                                                    <input type="text" class="form-control survey_quest_a" id="survey_quest_a" name="val[survey_quest_a]"/>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group selective-simple-survey">
                                                    <label class="col-sm-1 control-label">b.</label>
                                                    <div class="col-sm-11">
                                                        <input type="text" class="form-control survey_quest_b" id="survey_quest_b" name="val[survey_quest_b]"/>
                                                    </div>
                                           </div>
                                           
                                           <div class="form-group selective-simple-survey">
                                                <label class="col-sm-1 control-label">b.</label>
                                                <div class="col-sm-11">
                                                    <input type="text" class="form-control survey_quest_c" id="survey_quest_c" name="val[survey_quest_c]"/>
                                                </div>
                                           </div>
                                           
                                           <div class="form-group selective-simple-survey">
                                                <label class="col-sm-1 control-label">d.</label>
                                                <div class="col-sm-11">
                                                    <input type="text" class="form-control survey_quest_d" id="survey_quest_d" name="val[survey_quest_d]"/>
                                                </div>
                                                
                                              <!--<div class="form-group">
                                                    <label class="col-sm-1 control-label"></label>
                                                    <div class="col-sm-11" style="margin-left: 58px;">
                                                        {{trans('post.please-enter-minimum')}}
                                                    </div>
                                              </div>-->
                                          </div>	
                                          
                                          <div class="form-group selective-images-survey">
                                                <div class="col-sm-12">
                                                    <div class="uploadSurveyfile">
                                                           <input type="file" class="form-control" id="selective_survey_file_image1" name="selective_survey_file_image1" onchange="setSaveData('selective_survey_image1',this);">
                                                            <input type="hidden" name="val[selective_survey_image1]" id="selective_survey_image1" />
                                                            <div class="dragUpload survey-img-opt-box">
                                                                <div>
                                                                    <i class="fa fa-upload event-media-upload-btn" aria-hidden="true"></i>
                                                                </div>     
                                    
                                                                <div class="drag-drop-texts">{{trans('post.image-a-drag-and-drop')}} <br /> {{trans('post.survey-option-image-resolution')}} </div>
                                                                
                                                                <img src="" id="survey-thumb-img-1" class="thumbMediaImgSurvey survey-thumb-img-1"/> 
                                                            </div>
                                                            <i class="fa fa-trash-o remove-survey-photo remove-survey-photo-1" data-id="1"></i>
                                                    </div>
                                                    
                                                    <div class="uploadSurveyfile">
                                                           <input type="file" class="form-control" id="selective_survey_file_image2" name="selective_survey_file_image2" onchange="setSaveData('selective_survey_image2',this);">
                                                            <input type="hidden" name="val[selective_survey_image2]" id="selective_survey_image2" />
                                                            <div class="dragUpload survey-img-opt-box">
                                                                <div>
                                                                    <i class="fa fa-upload event-media-upload-btn" aria-hidden="true"></i>
                                                                </div>     
                                    
                                                                <div class="drag-drop-texts">{{trans('post.image-b-drag-and-drop')}} <br /> {{trans('post.survey-option-image-resolution')}}</div>
                                                                <img src="" id="survey-thumb-img-2" class="thumbMediaImgSurvey survey-thumb-img-2"/> 
                                                            </div>
                                                            <i class="fa fa-trash-o remove-survey-photo remove-survey-photo-2" data-id="2"></i>
                                                    </div>
                                                    
                                                    <div class="uploadSurveyfile">
                                                           <input type="file" class="form-control" id="selective_survey_file_image3" name="selective_survey_file_image3" onchange="setSaveData('selective_survey_image3',this);">
                                                            <input type="hidden" name="val[selective_survey_image3]" id="selective_survey_image3" />
                                                            <div class="dragUpload survey-img-opt-box">
                                                                <div>
                                                                    <i class="fa fa-upload event-media-upload-btn" aria-hidden="true"></i>
                                                                </div>     
                                    
                                                                <div class="drag-drop-texts">{{trans('post.image-c-drag-and-drop')}} <br /> {{trans('post.survey-option-image-resolution')}}</div>
                                                                <img src="" id="survey-thumb-img-3" class="thumbMediaImgSurvey survey-thumb-img-3"/> 
                                                            </div>
                                                            <i class="fa fa-trash-o remove-survey-photo remove-survey-photo-3" data-id="3"></i>
                                                    </div>
                                                    
                                                    <div class="uploadSurveyfile">
                                                           <input type="file" class="form-control" id="selective_survey_file_image4" name="selective_survey_file_image4" onchange="setSaveData('selective_survey_image4',this);">
                                                            <input type="hidden" name="val[selective_survey_image4]" id="selective_survey_image4" />
                                                            <div class="dragUpload survey-img-opt-box">
                                                                <div>
                                                                    <i class="fa fa-upload event-media-upload-btn" aria-hidden="true"></i>
                                                                </div>     
                                    
                                                                <div class="drag-drop-texts">{{trans('post.image-d-drag-and-drop')}} <br /> {{trans('post.survey-option-image-resolution')}}</div>
                                                                <img src="" id="survey-thumb-img-4" class="thumbMediaImgSurvey survey-thumb-img-4"/> 
                                                            </div>
                                                            <i class="fa fa-trash-o remove-survey-photo remove-survey-photo-4" data-id="4"></i>
                                                    </div>
                                          		</div>
                                          </div>
                                          
                                          <div class="form-group selective-images-survey">
                                                <div class="col-sm-12 brand-colored-texts">
                                          			{{trans('post.image-a-and-b-are-mondatory')}}
                                                </div>    
                                          </div>		
                                    </div>
                              </div>
                              
                              <div class="form-group marginbottom0px">
                                    <div class="col-sm-12">
                                        <textarea class="form-control" class="poll_desc" placeholder="Write a description for this poll question (optional)" id="poll_desc" name="val[poll_desc]"></textarea>
                                    </div>    
                              </div> 
                        </div>
                    </div>
            </div>
            
            @if($canAccessEvent==1)
                <div class="post-editor-event-upload-container">
                        {!! Theme::section('post.editor.event',['eventCommunityId'=>$eventCommunityId]) !!} 
                </div>
            @endif
            
           <?php /*?> <div class="post-editor-aichat-upload-container">
                 @if($isHomeOrProfile)
                        @if($sharingCommunityNameCached)
                            <div class="sharing-community-name">{{$sharingCommunityNameCached}}</div>
                        @endif
                 @endif
                     
                 {!! Theme::section('post.editor.aichat-add',['eventCommunityId'=>$eventCommunityId]) !!} 
            </div><?php */?>
            
            @if($showFitness=="yes")
            	<div class="post-editor-fitness-upload-container">
                        {!! Theme::section('post.editor.fitness',['fitnessCommunityId'=>$eventCommunityId]) !!} 
                </div>
            @endif
            
            <div class="post-with-friend people-tagging">
                <div class="tags">
                    <div class="indicator"><img src="{{$themeAsset->img('theme/images/loading.gif')}}"/></div>
                    <b>{{trans('post.post-with')}} : </b><input type="text" placeholder="{{trans('post.who-you-with')}}"/>
                </div>
                <div class="people-suggestion-container">

                    <div class="suggestion-list"></div>
                    <!--<div class="suggestion-info">Click <a href="">here</a> if the name is not listed</div>-->
                </div>
            </div>

            <div class="post-editor-link-container">
                <input type="hidden" value="" name="val[link_title]" class="link_title"/>
                <input type="hidden" value="" name="val[the_link]" class="the_link"/>
                <input type="hidden" name="val[link_description]" class="link_description"/>
                <input type="hidden" name="val[link_image]" class="link_image"/>
                <div class="link-preview-container">

                </div>
            </div>
        </div>
        
        @if($canAskQuestion==1)
            <div class="ask-question-box-outer">
               <textarea id="ai-question-add" name="val[ai_question]" placeholder="For help, type an idea or ask a question for a blog or an article. " data-value="500"></textarea>
                
                <span class="btn ai-question-get-answer-btn" title="go"  data-type="{{$draftType}}" data-value="{{$requestLimit}}"><!--<i class="fa fa-angle-double-right" aria-hidden="true"></i>--> <img class="question-ask-btn" src="{{$themeAsset->img('theme/images/ask.png')}}"/> </span>
            </div>
        @endif
        
        <div class="editor-footer {{$postBtnclass}}">
            <ul class="nav footer-post-type-btns">
            		
                <!--<li>
                    <a href="" class="add-people" title="{{trans('post.share-post-with')}}"><i class="ion-person-add icon"></i></a>
                </li>
                <li class="share_movie">
                    <a class="content-type-toggle" data-type="movie" title="{{trans('post.share-watched-movie')}}"
                       data-placeholder="{{trans('post.share-watched-movie')}}" href="">
                        <i class="icon ion-ios7-film"></i>

                    </a></li>-->
                <!--<li class="share_audio">
                    <a class="@if($openTopicList) {{$openTopicList}} @else content-type-toggle @endif" data-type="audio" title="{{trans('post.share-music-from')}}"
                       data-placeholder="{{trans('post.share-music-from')}}">
                        <i class="ion-ios7-musical-notes"></i>

                    </a></li>-->
               <!-- <li class="share_visited-place"><a class="content-type-toggle" data-type="location" title="{{trans('post.add-visited-place')}}"
                       data-placeholder="{{trans('post.add-visited-place')}}" href="">
                        <i class="icon ion-ios7-location-outline"></i>

                    </a></li>-->
                {{--<li>--}}
                    {{--<a class="content-type-toggle" data-type="link" title="{{trans('post.share-link')}}"--}}
                       {{--data-placeholder="{{trans('post.share-link')}}" href="">--}}
                        {{--<i class="icon ion-link"></i>--}}
                    {{--</a>--}}
                {{--</li>--}}
                @if(Config::get('enable-emoticon'))
                    <!--<li>
                        <a style="top: 5px;" class="emoticon-selector" href="javascript:void(0)">
                            <img style="display: block;width: 25px;margin: 3px auto"
                                 src="{{$themeAsset->img('theme/images/emoticon.png')}}"/>
                        </a>
                        <div class="" style="display: none">

                        </div>
                    </li>-->
                @endif
				
                <li class="mobile-post-icons cnt-tp-post-txt post-type-cnt-btn-text">
                	<a class="post-type-cnt-btn post-a-text-content @if($openTopicList) {{$openTopicList}} @else post-text-content-type @endif" data-type="text">
                		<i class="fa fa-pencil-square-o content-type-txt" aria-hidden="true"></i>
                        
                        <span class="mobile-content-type-icon blue-headings-post">{{trans('post.create-a-post')}}</span>
                    </a>   
                </li>
                
               <!-- <li class="post-type-cnt-btn-attachment" style="display:none">
                
                <a>-->
                     <!--<i class="fa fa-paperclip attachment" aria-hidden="true"></i> 
                     <i class="fa fa-arrow-right brand-colored-texts arrow" aria-hidden="true"></i>

                	 <span class="mobile-content-type-icon brand-colored-texts">{{trans('post.attach-media')}}</span>-->
                     
                     <!--{{trans('post.attach-media')}}
				</a>
</li>-->
                
				<li class="mobile-post-icons post-type-cnt-btn-image post-a-type-texts-link" style="display:none">
					<a class="post-type-cnt-btn post-img-content-type @if($openTopicList) {{$openTopicList}} @else content-type-toggle camera @endif" data-type="image" data-placeholder="{{trans('post.share-image-from')}}"> 
                       <!--<i class="fa fa-camera"></i>-->
                       <img class="select-content-type" src="{{$themeAsset->img('theme/images/image-files.png')}}"/> 
                       <span class="mobile-content-type-icon blue-headings-post post-a-type-texts-heading">{{trans('post.post-photo')}}</span>
                    </a>
				</li>
                
                <li class="mobile-post-icons post-type-cnt-btn-video post-a-type-texts-link" style="display:none">
					<a class="post-type-cnt-btn post-a-video @if($openTopicList) {{$openTopicList}} @else content-type-toggle video @endif" data-type="video" data-placeholder="{{trans('post.share-video-from')}}"> 
                    	<!--<i class="fa fa-play"></i> -->
                        <img class="select-content-type" src="{{$themeAsset->img('theme/images/video-files.png')}}"/> 
                        <span class="mobile-content-type-icon blue-headings-post post-a-type-texts-heading">{{trans('post.post-video')}}</span>
                    </a>
				</li>
                
                @if($canAskQuestion==1)
                  <li>
                    <span class="need-idea-ask-me">
                        <span class="need-idea-ask-me-link write-with-ai-button">
                            Write with AI
                            
                            <img class="post-write-with-ai-img" src="{{$themeAsset->img('theme/images/post/post-write-ai.png')}}"/>
                        </span> 
                        
                        @if($draftType=="resume" and $requestLimit!="unlimited")
                        	<i class="fa fa-exclamation-circle need-idea-resume-note-btn" aria-hidden="true"></i>
                        @endif 
                        
                        <img class="ask-question-loader" src="{{$themeAsset->img('theme/images/ask-question.gif')}}"/>
                        
                         @if($draftType=="resume" and $requestLimit!="unlimited")
                             <span class="need-idea-resume-note">
                                  You currently have a free plan that includes {{$askIdeaRequestLimit}} free requests.<br /> 
                                  For unlimited requests, purchase a suitable plan.<br />
                                  <a href="{{$ipUrl}}/askmeplan" style="color:#EE1414"><strong>Click here</strong></a> to subscribe now. 	
                             </span>
                         @endif 
                    </span>                                        
                  </li>  
                @endif
				
				@if(isset($post_created_from_type) and $post_created_from_type=='rss')
					<li>
						<span class="rewrite-blog-post-btn btn" title="Magical Compose" style="border:none;">
                            <img src="{{$themeAsset->img('theme/images/magic-write.png')}}" style="width:25px;"/>
							rewrite 	
						</span>
                    <li>    
				@endif
                
                <?php /*?><li class="mobile-post-icons">
					<a class="post-a-pdf @if($openTopicList) {{$openTopicList}} @else post-add-file-trigger @endif"> <i class="fa fa-file-pdf-o"></i> <!--<img src="{{Theme::asset()->img('theme/images/pdf-logo.png')}}"/> --><span class="mobile-content-type-icon">Pdf</span></a>
				</li><?php */?>
                
                <li class="mobile-post-icons post-type-cnt-btn-survey">
					<a class="post-type-cnt-btn post-a-survey @if($openTopicList) {{$openTopicList}} @else post-add-survey-trigger @endif" data-type="survey"> <i class="fa fa-list"></i>  <span class="mobile-content-type-icon blue-headings-post">{{trans('post.post-poll')}}</span></a>
				</li>			
                
                @if(isset($type) and $type=='community')
                    <?php $category=$seg4; ?>
                    <li class="mobile-post-icons post-type-cnt-document">
                        <a class="post-type-cnt-btn post-a-document @if($openTopicList) {{$openTopicList}} @endif" href="@if($openTopicList==""){{$communityPresenter ? $communityPresenter->url('category/'.$category.'/documents') : ''}} @endif" data-type="document"> <i class="fa fa-cloud-upload"></i> <span class="mobile-content-type-icon blue-headings-post">{{trans('post.post-documents')}}</span></a>
                    </li>
                   
                    @if($canAccessEvent==1)
                        <li class="mobile-post-icons post-type-cnt-btn-event">
                            <a class="post-type-cnt-btn post-a-event @if($openTopicList) {{$openTopicList}} @else post-add-event-trigger @endif" data-type="event"> <i class="fa fa-calendar"></i> <span class="mobile-content-type-icon blue-headings-post">{{trans('post.post-events')}}</span></a>
                        </li>
                    @endif 
                    
                    @if($showFitness=="yes") 
                        <li class="mobile-post-icons post-type-cnt-btn-fitness">
                            <a class="post-type-cnt-btn post-a-fitness @if($openTopicList) {{$openTopicList}} @else post-add-fitness-trigger @endif"data-type="fitness"> <i class="fa fa-male"></i> <span class="mobile-content-type-icon blue-headings-post">{{trans('post.post-fitness')}}</span></a>
                        </li>   
                    @endif    
				@endif					
				
                @if($isHomeOrProfile)				
					@if($can_share_recipe==1)				
						<li class="mobile-post-icons post-type-cnt-btn-recipe">
							<a href="{{\URL::to('foods')}}" class="post-type-cnt-btn"data-type="recipe"> <i class="fa fa-cutlery"></i> <span class="mobile-content-type-icon blue-headings-post">{{trans('post.post-share-recipe')}}</span></a>
						</li>
					@endif
                @endif
               
               @if($isHomeOrProfile || (isset($type) and $type=="resume"))     
                    <li class="mobile-post-icons product-sell-menu post-type-cnt-btn-product">
                        <a href="{{\URL::route('producttosell')}}?sellontype=@if(isset($type)){{$type}}@endif" class="post-type-cnt-btn" data-type="product"><img src="{{$themeAsset->img('theme/images/start-selling.png')}}" style="height:22px;"/>
                        <span class="mobile-content-type-icon blue-headings-post">{{trans('post.start-selling')}}</span>
                        </a>
					</li>
				@endif
                
                <!--<li class="mobile-post-icons blog-post-menu post-type-cnt-btn-blog">
                    <a href="{{\URL::route('article-post')}}?type={{$post_posting_type}}&typeId={{$post_posting_typeId}}&community_id={{$post_posting_community_id}}&page_id={{$post_posting_page_id}}&posted_in_community={{$post_posting_posted_in_community}}&blog_type=image&return_back={{\Request::url()}}" class="post-type-cnt-btn" data-type="blog"><i class="fa fa-pencil" aria-hidden="true"></i>
<span class="mobile-content-type-icon blue-headings-post">Write Article</span>
                    </a>
                </li>-->
                
                <!--<li class="mobile-post-icons post-type-cnt-btn-aichat">
                    <a class="post-type-cnt-btn post-a-aichat @if($openTopicList) {{$openTopicList}} @else post-add-aichat-trigger @endif" data-type="aichat"> <i class="fa fa-comments" aria-hidden="true"></i> <span class="mobile-content-type-icon blue-headings-post">AI Chat</span></a>
                </li>-->
                
                 <!--<li class="mobile-post-icons blog-post-menu post-type-cnt-btn-blog">
                    <a href="{{\URL::route('article-post')}}?type={{$post_posting_type}}&typeId={{$post_posting_typeId}}&community_id={{$post_posting_community_id}}&page_id={{$post_posting_page_id}}&posted_in_community={{$post_posting_posted_in_community}}&blog_type=video" class="post-type-cnt-btn" data-type="blog"><i class="fa fa-video-camera" aria-hidden="true"></i><span class="mobile-content-type-icon">Blog</span>
                    </a>
                </li>-->
                
                 <!--<li class="mobile-post-icons pull-right">
                    <a href="" class="open-global-htmlformating-post" data-type="post"><i class="fa fa-question-circle"></i> <span class="mobile-content-type-icon">{{trans('post.post-help')}}</span></a>
                </li>-->
                
                <?php
                    $canStartMeeting=($userPresenter && $user) ? $userPresenter->canStartMeeting($user->id) : 0;
				?>
                @if($canStartMeeting and $canStartMeeting!=2)
                    <li class="mobile-post-icons post-type-cnt-btn-video-live">
                         <a class="get-video-live-btn" data-type="video-live"> 
                              <i class="fa fa-video-camera" aria-hidden="true"></i>
                              <span class="mobile-content-type-icon">{{trans('post.live')}}</span>
                         </a>      
                    </li>
                @endif
                
				@if($seg1!='c')
                    <li class="pull-right page-repload-actn-menu" style="display:none; margin-right: 15px;">
                        <a class="page-repload-actn"></i> <span class="mobile-content-type-icon brand-colored-texts">Cancel Post</span></a>
                    </li>
                @endif  
                
                <li class="add-post-scheduling-action" style="float:right; display:none">
               		<div class="post-publish-type-editor">
                        <div class="post-publish-type"> 
                            
                            <ul class="postfooteracts">
                            	<li><label class="checkbox-inline show_link_image" style="margin-top: -10px;"><input type="checkbox" name="val[show_link_image]" value="1" checked="checked">{{trans('post.post-link')}} <i class="fa fa-eye" aria-hidden="true"></i></label></li>
                                
                                <li class="postfooteractstype"><input type="radio" id="post-publish-type-choose1" class="post-publish-type-choose" name="val[publish_type]" checked value="0"> <span class="postfooteractstitle">{{trans('post.post-now')}}</span></li>
                                
                                <li class="postfooteractstype"><input type="radio" id="post-publish-type-choose2" class="post-publish-type-choose" name="val[publish_type]" value="1"> <span class="postfooteractstitle">{{trans('post.post-schedule')}}</span></li>                  
                                
                                <li>
                                    <?php $isIpProfile=$seg1;?>
                                
                                    @if($isIpProfile=='ip')
                                        <label class="checkbox-inline"><input type="checkbox" name="val[show_on_social_media]" value="1" checked="checked"> <img class="interactive-post-icon" src="{{$themeAsset->img('theme/images/interactive-post.png')}}"/></label>
                                    @endif
                                </li>								
								
                            </ul>   
                        </div>
                        
                        <div class="post-schedule-dates">
                            <div class="row">
                                <div class="col-sm-6">
                                   <div class='input-group date' id='post_schedule_start_date'>
                                        <input type='text'  name="val[schedule_start_date]" id="schedule_start_date" placeholder="{{trans('post.post-schedule-starting')}}" class="form-control"/>
                                        <span class="input-group-addon">
                                            <span class="glyphicon glyphicon-calendar"></span>
                                        </span>
                                    </div>
                                </div>    
                                <div class="col-sm-6">
                                    
                                    <div class='input-group date' id='post_schedule_end_date'>
                                        <input type='text'  name="val[schedule_end_date]" id="schedule_end_date" placeholder="{{trans('post.post-schedule-ending')}}" class="form-control" />
                                        <span class="input-group-addon">
                                            <span class="glyphicon glyphicon-calendar"></span>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>

			 <div class="global-htmlformating-text-note-post">
                 {!! Theme::section('helps.html-formatting') !!} 
             </div>  
        </div>  
      
        
		<img style="position: relative; top: 12px; right: 10px; width: 25px; height: 25px; display: none; bottom: 0px; left: 92%;
  z-index: 99999;" class="post-editor-indicator post-editor-indicator-mobile" src="{{$themeAsset->img('theme/images/loading.gif')}}"/>  
         
        <div class="alert alert-danger" id="post-error"
             style="border-radius: 0;padding: 7px 10px;margin: 0;display:none">{{trans('post.error', ['size' => formatBytes(10485760)])}}</div>       

        <div class="editor-footer {{$postBtnclass}} add-post-editor-footer post-bottom-main-btn-footer" style="display:none">
                  
            @if(isset($post_created_from_type) and $post_created_from_type=='rss')
                <div class="rss-content-ready-note">
                    <span style="color:#FF0000">*</span> Content ready? Tap image icon, upload a matching image for 10&times; the impact!
                </div>
            @endif             
            
            <ul class="nav" style="display: ruby;">
				
                @if($showRssFeeds=="yes")
                    <li style="margin-right:15px">
                    	<a href="{{$rss_add_url}}" class="blog-ideas-link-btn">
                        	Blog Ideas 
                    		<img class="post-blog-ideas-img" src="{{$themeAsset->img('theme/images/post/post-blog-ideas.png')}}"/>
                    	</a>
                    </li>
                @endif
                
                @if($userPresenter && $userPresenter->canShareExperience())
					<li class="@if(isset($type) and ($type=="page" || $type=="resume")) share-exp-menu-no-act @else share-exp-menu-act @endif" style="display:none; margin-right:10px;">
						<a class="share-expperience-link-btn" href="{{\URL::route('experience-create')}}">							
							<span style="display:inline-block; font-size: 16px;" class="mobile-content-type-icon blue-headings-post">
                            	Share Experience
                            </span>
                            
                            <img class="share-expperience-img" src="{{$themeAsset->img('theme/images/post/post-share-experience.png')}}"/>
						</a>
					</li>
				@endif
                
				{!! Theme::extend('post-editor-bottom-nav') !!} 
                <li class="action-container dsktp footer-options" style="position:unset">
                    <img class="indicator" src="{{$themeAsset->img('theme/images/loading.gif')}}"/>
                    @if($enablePostTextLimit)
                        <span id="main-editor-text-counter"
                              class="post-text-counter">{{$postTextLimit}}</span>
                              
                         <span class="remaining-post-chars">remaining</span>
                    @endif
                    <div id="post-privacy-container" class="btn-group">

                        @if (!isset($to) and !isset($offPrivacy))
                            <button id="post-editor-privacy-selector" class="btn btn-default btn-sm dropdown-toggle"
                                    title="{{trans('post.who-see-this')}}" data-toggle="dropdown"><i
                                        class="icon ion-locked"></i>
                                <span>{{($userPresenter) ? $userPresenter->postPrivacyName() : ''}}</span> <i class="caret"></i>
                            </button>
                            <ul class="dropdown-menu pull-left">
                                <li><a data-value="1" data-text="{{trans('global.public')}}"
                                       href="">{{trans('global.public')}}</a></li>
                                <li><a data-value="2" data-text="{{trans('connection.friends')}}"
                                       href="">{{trans('connection.friends')}}</a></li>
                                <li><a data-value="3" data-text="{{trans('connection.followers')}}"
                                       href="">{{trans('connection.followers')}}</a></li>
                                <li><a data-value="4" data-text="{{trans('connection.friends-followers')}}"
                                       href="">{{trans('connection.friends-followers')}}</a></li>
                                <li><a data-value="5" data-text="{{trans('connection.only-me')}}"
                                       href="">{{trans('connection.only-me')}}</a></li>

                            </ul>

                        @endif
                        <input type="hidden"
                               value="{{(isset($privacy)) ? $privacy : (($userPresenter) ? $userPresenter->postPrivacyValue() : '')}}"
                               name="val[privacy]"/>
                    </div>
                    <button id="post-submit-button" class="btn btn-sm btn-success {{$postBtnclass}}"><!--<i
                                class="icon ion-compose"></i>-->{{trans('post.post')}}</button>

                </li>
				
            </ul>
        </div>
    </form>
    
    @if(isset($type) and isset($community_id) and $type=='community')
        <div class="community-topic-listings">
            <div class="cm-topic-lists-heading">{{trans('community.select-a-relevant-hash-topic')}}</div>
            <div class="cm-topic-lists">
            	<ul class="nav">
    	                <?php
        	                    $viewerUserId = (\Auth::check()) ? (int) \Auth::id() : 0;
        	                    $memberCategoryIdMap = [];
        	                    if ($viewerUserId > 0 && isset($community) && $community) {
        	                        // Batch-fetch category memberships for this user in this community.
        	                        $memberCategoryIds = app('App\\Repositories\\CommunityCategoryMembersRepository')
        	                            ->getCategoryIds((int) $community->id, $viewerUserId);
        	                        $memberCategoryIds = is_array($memberCategoryIds) ? $memberCategoryIds : (array) $memberCategoryIds;
        	                        foreach ($memberCategoryIds as $cid) {
        	                            $memberCategoryIdMap[(int) $cid] = true;
        	                        }
        	                    }

    	                    // Batch-load per-category "new posts" counts (external communities only).
    	                    // This avoids calling $communityPresenter->newPosts() inside the loop.
    	                    $newPostsByCategoryId = [];
    	                    if (isset($community) && $community && $communityPresenter && $community->external_community == 1 && \Auth::check()) {
    	                        $categoryIds = [];
                                foreach ($communityCategories as $c) {
    	                            if ($c && isset($c->id)) {
    	                                $categoryIds[] = (int) $c->id;
    	                            }
    	                        }
    	                        if (!empty($categoryIds)) {
    	                            $postSeenRepo = app('App\\Repositories\\PostSeenRepository');
    	                            $newPostsByCategoryId = $postSeenRepo->newPostsNotSeenBulk((int) $community->id, $categoryIds, (int) \Auth::id());
    	                        }
    	                    }
    	                ?>
                        @foreach($communityCategories as $category)
                            <?php
                                $canViewCategory = false;
                                if ($communityPresenter && $category) {
                                    // Fast-path non-meeting topics to avoid per-category DB work.
                                    if ((int) ($category->meeting_topic ?? 0) === 0) {
                                        $categoryStatus = (int) ($category->status ?? 0);
                                        $categoryGroupType = (int) ($category->group_type ?? 0);
                                        $categoryIdInt = (int) ($category->id ?? 0);
                                        $communityOwnerId = (int) ($community->user_id ?? 0);
                                        if ($viewerUserId > 0 && $viewerUserId === $communityOwnerId) {
                                            $canViewCategory = true;
                                        } elseif ($categoryGroupType === 1 && $categoryStatus === 1) {
                                            $canViewCategory = true;
                                        } elseif (!empty($memberCategoryIdMap[$categoryIdInt]) && $categoryStatus === 1) {
                                            $canViewCategory = true;
                                        }
                                    } else {
                                        // Meeting topics keep the full logic (event/appointment window checks).
                                        $canViewCategory = $communityPresenter->canViewCategory($category);
                                    }
                                }
                            ?>
                            @if($canViewCategory)
                                <?php $newPosts = ($community->external_community==1) ? (int)($newPostsByCategoryId[(int) $category->id] ?? 0) : 0; ?>
                            <li class="post-community-topic-choose category-{{$category->id}} @if($seg4 == $category->slug) selected-topic @endif">
                                <a data-ajaxify="true" href="{{$communityPresenter->url('category/'.$category->slug)}}">
                                    @if($community->external_community==1)
                                        # {{$category->title}} @if($newPosts>0)<span class="action-count-text"> {{$newPosts}}</span>@endif
                                    @else 
                                        <i class="icon ion-ios7-arrow-thin-right"></i> {{$category->title}}
                                    @endif
                                </a>
                            </li>
                        @endif    
                    @endforeach
                </ul>
            </div>
        </div>
    @endif

</div>
    @php(\App\Performance\PerfMarks::stop('view:post/editor/main'))

<!-- -->

<div class="list-upload-video-guide-box">
	<i class="fa fa-window-close-o close-list-upload-video-guide" aria-hidden="true"></i>

	<div class="list-upload-video-guide-img">
    	
    </div>
</div>
{!! Theme::section('user.image-library',['community_id'=>(isset($community_id)) ? $community_id : 0]) !!} 
