<?php
$tt_page_info = array(
  'Page_Info' =>   array(
    'Title' =>'ভিডিও',
    'Description' =>'' ,
    'Keyword' => '',
  ),
  'Social_og' => array(
    'Image' => '',
    'Type' => 'website',
    'URL' => 'video/',
  ),
);

require_once('./header.php'); // Include Footer
?>
<section class="py-4">
  <div class="container">
    <div class="row g-3 mt-3">
      <div class="col-12">
        <?php
          echo getBlockTitle('', 'ভিডিও  ',$site_domain.'video/');
        ?>
      </div>
      <div class="col-lg-6">
        <?php
        $tt_recent_video = showAllttdata("mahamudfutureit_video", " ORDER BY  ID  DESC LIMIT 1");
        if (!empty($tt_recent_video)) {
          foreach ($tt_recent_video as $the_rvideo) {
            ?>
            <div class="mahamudfutureit_vwraper">
              <div class="video-container">
                <?php echo getVideoEmbed($the_rvideo['VideoContent']) ?>
              </div>
              <h1 class="py-2 news-title  mt-1 "><a href="<?php echo $site_domain ?>video/<?php echo $the_rvideo['ID'] ?>/"><?php echo $the_rvideo['VideoTitle'] ?></a></h1>
            </div>
            <?php
          }
        }else {
          ?>
          <div class="text-center p-2 bg-light rounded-t">
            কোন ভিডিও নেই !
          </div>
          <?php
        }
        ?>
      </div>
      <div class="col-lg-6">
        <div class="row g-3">
          <?php
          $tt_recent_video = showAllttdata("mahamudfutureit_video", " ORDER BY  ID  DESC LIMIT 4 OFFSET 1");
          if (!empty($tt_recent_video)) {
            foreach ($tt_recent_video as $the_rvideo) {
              ?>
              <div class="col-6">
                <div class="mahamudfutureit_vwraper rounded-2 overflow-hidden">
                  <a href="<?php echo $site_domain ?>video/<?php echo $the_rvideo['ID'] ?>/" class="position-relative">
                    <i class="bi bi-play-circle"></i>
                    <img class="w-100" src="<?php echo $the_rvideo['FeaturedImage'] ?>" alt="<?php echo $the_rvideo['VideoTitle'] ?>">
                  </a>
                  <h3><a   href="<?php echo $site_domain ?>video/<?php echo $the_rvideo['ID'] ?>/"><?php echo $the_rvideo['VideoTitle'] ?></a></h3>
                </div>
              </div>
              <?php
            }
          }else {
            ?>
            <div class="text-center p-2 bg-light rounded-t">
              কোন ভিডিও নেই !
            </div>
            <?php
          }
          ?>
        </div>
      </div>
    </div>
    <div class="row   g-3  " id="news-container">
      <?php
      $tt_recent_video = showAllttdata("mahamudfutureit_video", " ORDER BY  ID  DESC LIMIT 4 OFFSET 5");
      if (!empty($tt_recent_video)) {
        foreach ($tt_recent_video as $the_rvideo) {
          ?>
          <div class="col-lg-3 col-6">
            <div class="mahamudfutureit_vwraper rounded-2 overflow-hidden">
              <a href="<?php echo $site_domain ?>video/<?php echo $the_rvideo['ID'] ?>/" class="position-relative">
                <i class="bi bi-play-circle"></i>
                <img class="w-100" src="<?php echo $the_rvideo['FeaturedImage'] ?>" alt="<?php echo $the_rvideo['VideoTitle'] ?>">
              </a>
              <h3><a   href="<?php echo $site_domain ?>video/<?php echo $the_rvideo['ID'] ?>/"><?php echo $the_rvideo['VideoTitle'] ?></a></h3>
            </div>
          </div>
          <?php
        }
      }else {
        ?>
        <div class="text-center p-2 bg-light rounded-t">
          কোন ভিডিও নেই !
        </div>
        <?php
      }
      ?>
    </div>
    <div class="row mb-2">
         <div id="loader" class="col-md-12 text-center py-3" style="display: none;"><img src="<?php echo $site_domain ?>assets/image/loading-post.gif" style=" height:40px;"></div>
         <div class="col-12 text-center py-3">
             <button class="btn btn-more-details tt-white tt-text" id="load-more-button"> আরো পড়ুন  </button>
         </div>
    </div>
  </div>
</section>
<script>
let page=3;
var data_type="ttvg";
data_id="";
let isLoading=!1;
function loadMoreNews() {
    if (isLoading) {
        return;
    }
    isLoading = true;
    $('#loader').show();

    $.ajax({
        url: '<?php echo $site_domain ?>ajax_master/load-post/',
        type: 'POST',
        data: {
            page: page ,
            data_id : data_id,
            data_type :data_type,

            },
        success: function(data) {
            const newsContainer = $('#news-container');
            newsContainer.append(data);

            page++;
            isLoading = false;
            $('#loader').hide();
            lazyLoadImages();
        },
        error: function(error) {
            isLoading = false;
            $('#loader').hide();
        }
    });
}
$('#load-more-button').click(function() {
    loadMoreNews();
});

</script>
<?php
require_once('./footer.php'); // Include Footer
?>
