
<?php $__env->startSection('title'); ?> Post Details <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('frontend_content'); ?>

<div class="container h-100 mt-2">
    <div class=" bg-white py-2">

        <div class="faq p-2 text-active">
            <h4 class="mb-2"><?php echo $singlePostData->post_title; ?></h4>
            <p class="text-red-50"><?php echo e($singlePostData->departmentData->department_name); ?>><?php echo e($singlePostData->subjectData->subject_name); ?>><?php echo e($singlePostData->chapterData->chapter_name); ?></p>
            <p class="mb-2 text-secondary">
                <?php
                    $totalPostVisitCount = App\Models\UserPostClick::totalVisitCount($singlePostData->id);
                    $totalPostFavCount = App\Models\Favouritelist::getFavouriteListCount($singlePostData->id);
                    $getSinelFavouritePostData = App\Models\Favouritelist::getSinelFavouritePostData($singlePostData->id, Auth::user()->id);
                ?>
                <?php if($totalPostVisitCount != null): ?>
                <small>Read: <?php echo e($totalPostVisitCount); ?></small>
                <?php else: ?>
                <small>Read: 0</small>
                <?php endif; ?>
            </p>

            <span class="text-dark mb-3"><?php echo $singlePostData->post_description; ?></span>

            <div class="d-flex align-items-center justify-content-between text-dark mt-4" id="updatePostFavCount">
                <?php if($totalPostFavCount != null): ?>
                <p>Important: <?php echo e($totalPostFavCount); ?></p>
                <?php else: ?>
                <p>Important: 0</p>
                <?php endif; ?>
                <p class="d-flex align-items-center justify-content-center gap-2">
                    <?php if(isset($getSinelFavouritePostData) && $getSinelFavouritePostData != null): ?>
                    <a href="#" class="p-0 m-0" onclick="setFavPost(<?php echo e($singlePostData->id); ?>)">
                        <span class="material-symbols-outlined custom-fav-post-active">
                            thumb_up
                        </span>
                    </a>
                    <?php else: ?>
                    <a href="#" class="p-0 m-0" onclick="setFavPost(<?php echo e($singlePostData->id); ?>)">
                        <span class="material-symbols-outlined">
                            thumb_up
                        </span>
                    </a>
                    <?php endif; ?>
                </p>
            </div>
        </div>

    </div>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
    //To set favourite post...
    function setFavPost(postId){
        var url = "<?php echo e(route('webuser.add-remove-favourite-post')); ?>";
        if (postId != '') {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            $.ajax({
                type: 'post',
                url: url,
                data: {
                    post_id: postId,
                },
                success: function (data) {
                    if(data.error){
                        toastr.error(data.error);
                    }else{
                        $("#updatePostFavCount").html(data);
                    }
                }

            });
        }
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('frontend.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\update\test-paper-final\resources\views/frontend/postDetails.blade.php ENDPATH**/ ?>