<?php $__env->startSection('meta'); ?>
<meta name="Description" content="<?php echo $seo->meta_description; ?>">
<meta name="Keywords" content="<?php echo $seo->meta_keys; ?>">
<meta property="og:title" content="<?php echo e($gs->title); ?>" />
<meta property="og:description" content="<?php echo $seo->meta_description; ?>" />
<meta property="og:image" content="<?php echo e(asset('assets/images/logo/'.$gs->og_baner)); ?>" />
<?php $__env->stopSection(); ?>
<?php $__env->startSection('contents'); ?>

<!-- main div -->
<div class="mainDiv">
  <!-- header categories -->
  <div class="bg2 marginT-15 marginB10 visible-xs">
    <div class="">
      <div class=" padding0">
        <div class="positionRelative" style="border-bottom: 3px solid #9b090d">
          <div class="mobileHeaderCategoryDiv">
            <a class="sidebarCatTitle colorBlack hoverBlue paddingLR15 textDecorationNone active" aria-label="হোম"
              href="<?php echo e(route('frontend.index')); ?>"><strong>হোম</strong></a>
            <?php $__currentLoopData = $categories->take(7); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <a class="sidebarCatTitle colorBlack hoverBlue paddingLR15 textDecorationNone" aria-label="<?php echo e($category->title); ?>"
                href="<?php echo e(route('frontend.category', $category->slug)); ?>"><strong><?php echo e($category->title); ?></strong></a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- header categories end -->

  <!-- desktop version -->
  <?php echo $__env->make('frontend.partials.home-desktop', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

  <!-- mobile version -->
  <?php echo $__env->make('frontend.partials.home-mobile', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

</div>
<!-- main div end -->

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

<?php $__env->startSection('scripts'); ?>
<script type="text/javascript">
  // Poll vote handler
  $(document).on('click', '.vote-btn', function(e) {
    e.preventDefault();
    var pollId = $(this).data('id');
    var answerId = $('input[name="poll_answer_id_' + pollId + '"]:checked').val();
    var messageBox = $(this).closest('.poll-box').find('.poll-message');
    var resultBox = $(this).closest('.poll-box').find('.poll-result');
    var button = $(this);
    messageBox.html('');
    if (!answerId) {
      messageBox.html('Please select an option');
      return;
    }
    $.ajax({
      url: "<?php echo e(route('front.poll.vote')); ?>",
      method: "POST",
      data: {
        _token: "<?php echo e(csrf_token()); ?>",
        poll_question_id: pollId,
        poll_answer_id: answerId
      },
      success: function(res) {
        if (res.status === 'success') {
          button.removeClass('bgBrand').addClass('bg5').text('Voted').prop('disabled', true);
          $.get("<?php echo e(url('poll-result')); ?>/" + pollId, function(data) {
            resultBox.html(data);
          });
        } else {
          messageBox.html(res.message);
        }
      },
      error: function(xhr) {
        messageBox.html('Error submitting vote');
      }
    });
  });

  // Poll view result
  $(document).on('click', '.view-result', function(e) {
    e.preventDefault();
    var pollId = $(this).data('id');
    var box = $(this).closest('.poll-box').find('.poll-result');
    $.get("<?php echo e(url('poll-result')); ?>/" + pollId, function(data) {
      box.html(data);
    });
  });

  // Location search
  $(document).on('change', '.selectDivision', function() {
    var divisionId = $(this).val();
    if (divisionId) {
      $.get("<?php echo e(url('get-districts')); ?>/" + divisionId, function(data) {
        $('.selectDistrict').html(data);
        $('.selectUpazila').html('<option value="">উপজেলা</option>');
      });
    } else {
      $('.selectDistrict').html('<option value="">জেলা</option>');
      $('.selectUpazila').html('<option value="">উপজেলা</option>');
    }
  });

  $(document).on('change', '.selectDistrict', function() {
    var districtId = $(this).val();
    if (districtId) {
      $.get("<?php echo e(url('get-upazilas')); ?>/" + districtId, function(data) {
        $('.selectUpazila').html(data);
      });
    } else {
      $('.selectUpazila').html('<option value="">উপজেলা</option>');
    }
  });

  $(document).on('click', '.clickSearchButton', function() {
    var divisionId = $('.selectDivision').val();
    var districtId = $('.selectDistrict').val();
    var upazilaId = $('.selectUpazila').val();
    if (!divisionId) {
      $('.searchMessageDiv').show();
      return;
    }
    $('.searchMessageDiv').hide();
    var url = "<?php echo e(url('location-news')); ?>?division_id=" + divisionId;
    if (districtId) url += "&district_id=" + districtId;
    if (upazilaId) url += "&upazila_id=" + upazilaId;
    window.location.href = url;
  });

  // Latest/Popular tab caret toggle
  $(document).on('click', '.latestNav a', function() {
    $('.latestCaret').show();
    $('.highestCaret').hide();
  });
  $(document).on('click', '.highestNav a', function() {
    $('.highestCaret').show();
    $('.latestCaret').hide();
  });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.front', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/istiakahmedsourav/Desktop/JAMUNABKP/project/resources/views/frontend/index.blade.php ENDPATH**/ ?>