@php
    $blog_view              = HelpDesk::getPostMeta(optional($blog)->id,'blog_view') ?? 0;
    $total_post_views       = $blog_start_view + $blog_view;

	$blog_options 	        = ThemeOption::GetBlogOptionById(optional($blog)->id);
    $post_pagination        = $blog_options['post_pagination'] ?? false;
    $post_type_quote_author = $blog_options['post_type_quote_author'] ?? null;
    $post_type_quote_text   = $blog_options['post_type_quote_text'] ?? null;

	if( !$show_sidebar || empty($sidebar) || $layout == 'sidebar_full')
	{
		$is_sidebar = false;
		$classes = 'w-full';
	}
    else{
		$is_sidebar = true;
		$classes = 'lg:w-8/12 mb-30';
        if($layout == 'sidebar_left')
        {
            $classes .= ' lg:order-2';
        }
	}
	$container = ($is_sidebar) ? 'container' : 'container-sm';
@endphp

<section class="noice-overlay z-3 pb-50 {{ !$show_banner ? 'xl:pt-200 sm:pt-150 pt-120' : 'lg:pt-100 pt-50' }}">

    <div class="{{ $container }}">
        <div class="row">
            <!--Content Side-->
			<div class="{{ $classes }}">

                <!-- Password protected block -->
                @include('elements.password_protected_block')
                <!-- End Password protected block -->

                @if ($status == 'unlock_'.$blog->id)
                
                <div>
                     @php
                        if($blog->visibility != 'Pu'){
                            $blog_visibility = $blog->visibility == 'Pr' ? __('Private: ') : __('Protected: ');
                        }else {
                            $blog_visibility = '';
                        }
                    @endphp

                    <div class="{{ !$is_sidebar ? 'text-center' : '' }}">
                        @if (!$show_banner)
                        <h1 class="xl:text-6xl/80 md:text-5xl text-4xl font-semibold md:mb-30 mb-10">{{ $blog_visibility }}{{ $blog->title }}</h1>
                        @endif
                        <ul class="text-base dark:text-white text-textlight inline-flex flex-wrap space-y-8 space-x-20 uppercase mt-auto">
                            @if(!empty($date_on))
                            <li class="inline-block relative">{{ $blog->publish_on }}</li>
                            @endif
                            <li class="inline-block relative ps-15 before:content-['/'] before:absolute before:h-full before:top-0 before:left-0">
                                {{ __('By') }}
                                <a href="{!! DzHelper::author($blog->user_id) !!}">
                                {{ optional($blog->user)->name }}
                                </a>
                            </li>
                            @if(!empty($comment_count_on))
                                <li class="inline-block relative">
                                    <i class="las la-comment-alt"></i>
                                    @if ($comment_count_on){{ $total_comments }} {{ __('Comments') }}@endif
                                </li>
                            @endif
                            @if(!empty($blog_view_on))
                            <li class="inline-block relative">
                                <a href="javascript:void(0);">
                                    <svg class="inline mr-2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>
                                    <span> {{  $total_post_views }} </span>
                                </a>
                            </li>
                            @endif
                            @if(!empty($category_on) && !empty($blog->blog_categories))
                                <li class="inline-block relative">
                                    <i class="las la-tag text-xl"></i>
                                    {{ $blog->blog_categories->pluck('title')->join(', ') }}
                                </li>
                            @endif
                        </ul>
                    </div>
                    
                    <div class="dz-media mt-30">
                        <div class="relative quote-box {{ $featured_image && $featured_img_on && !empty(@$blog->feature_img->value) ? 'show-image' : ''}}">
                            @if ($featured_image && $featured_img_on && !empty(@$blog->feature_img->value))
                            <figure class="aligncenter my-0">
                                <img class="" src="{{ DzHelper::getStorageImage('storage/blog-images/'.@$blog->feature_img->value) }}" alt="{{ __('Blog Image') }}">
                            </figure>
                            @endif
                            <div class="quote-text text-center sm:py-100 py-20 sm:px-50 px-15 {{ $featured_image && $featured_img_on && !empty(@$blog->feature_img->value) ? 'absolute top-1/2 sm:left-30 left-10 bg-secondary/60 backdrop-blur-md sm:right-30 right-10 -translate-y-1/2' : 'bg-secondary' }}">
                                <blockquote class="wp-block-quote before:content-['\f10d'] before:font-['Font_Awesome_5_Free'] before:font-bold sm:before:text-8xl before:text-4xl before:absolute before:text-white sm:before:top-20 before:top-10 sm:before:left-50 before:left-20">
                                    @if (!empty($post_type_quote_author))
                                    <cite class="quote-word text-white">
                                        {{$post_type_quote_author}}
                                    </cite>
                                    @endif
                                    @if (!empty($post_type_quote_text))
                                    <p class="sm:text-3xl text-md text-white mt-10">{{$post_type_quote_text}}</p>
                                    @endif
                                </blockquote>
                            </div>
                        </div>
                    </div>

                    <div class="blog-content mt-30">
                        <p>
                        {!! $blog->content !!}
                        </p>
                    </div>
                    @if(optional($blog->video)->value)
                        <div class="mb-30">
                            <iframe width="420" height="345" src="{{ $blog->video->value }}"></iframe>
                        </div>
                    @endif
        
                    @if (($tag_on) || ($post_sharing_on && $show_social_icon && $social_shaing_on_post))
                    <div class="mb-30 flex flex-wrap justify-between items-center before:content-[''] before:absolute before:top-0 before:left-0 before:h-1 before:w-full dark:before:bg-white/10 before:bg-black/10 relative">
                        @if ($tag_on)
                        <ul class="dark:text-white text-textlight ">
                            <li class="inline-block sm:px-13 px-8 py-24 first:ps-0">{{ __('Tags:') }}</li>
                            @forelse($blog->blog_tags as $blog_tag)
                            <li class="inline-block sm:px-13 px-8 py-24 first:ps-0"><a href="{!! DzHelper::laraBlogTagLink($blog_tag->id); !!}"><span>{{ $blog_tag->title }}</span></a></li>
                            @empty
                            {{ __('No record found.') }}
                            @endforelse
                        </ul>
                        @endif
                        @if($post_sharing_on && $show_social_icon && $social_shaing_on_post)
                            <ul class="flex gap-20">
                                {!! get_social_icons('','dark:text-white text-dark text-base/40 hover:text-primary') !!}
                            </ul>
                        @endif
                    </div>
                    @endif

                    <!-- Author block element -->
                    @include('elements.author_block_element')
                    <!-- End Author block element -->

                    <!-- Blog Pagination element -->
                    @include('elements.blog_pagination_element')
                    <!-- End Blog Pagination element -->

                    <!-- Related element -->
                    @include('elements.related_blog_element')
                    <!-- End Related element -->

                    <!-- Comment list block -->
                    @include('elements.comments_block')
                    <!-- End comment list block -->

                </div>

                @endif

            </div>
            <!-- End Content Side-->
            
            <!-- sidebar area -->
            @if ($show_sidebar && $is_sidebar)
            <div class="lg:w-4/12">
                <aside class="side-bar my-sticky space-top-0 sticky-top dz-sidebar {{ ($layout == 'sidebar_left')  ? 'xl:pr-30' : ($layout == 'sidebar_right' ? 'xl:pl-30' : '')}}">
                    @include('elements.sidebar')
                </aside>
            </div>
            @endif
            <!-- End sidebar area -->

        </div>
    </div>
</section>
