<?php $__env->startSection('meta'); ?>
<title><?php echo e($division->name ?? 'অবস্থানভিত্তিক খবর'); ?></title>
<meta property="og:title" content="<?php echo e($division->name ?? 'অবস্থানভিত্তিক খবর'); ?>" />
<meta property="og:image" content="<?php echo e(asset('assets/images/'.$gs->og_baner)); ?>" />
<?php $__env->stopSection(); ?>
<?php $__env->startSection('contents'); ?>

<!-- main div -->
<div class="mainDiv">
<!-- desktop version start -->
<div class="bgWHite">
	<div class="container">
		<div class="row">

			<!-- category header -->
			<div class="col-sm-12 col-md-12 marginB20 marginT20 hidden-xs">
				<span class="desktopCategoryTitle"><a class="color1" aria-label="সারাদেশ" href="<?php echo e(url('/location-news')); ?>"><strong>সারাদেশ</strong></a> <i class="fa fa-caret-right marginR5 title1_8"></i></span>
				<?php if($division): ?>
					<h1 class="desktopCategoryTitle"><a aria-label="<?php echo e($division->name); ?>" href="<?php echo e(url('/location-news?division_id='.$division->id)); ?>"><strong><?php echo e($division->name); ?></strong></a></h1>
				<?php endif; ?>
				<?php if($district): ?>
					<span class="desktopCategoryTitle"><i class="fa fa-caret-right marginR5 title1_8"></i> <a aria-label="<?php echo e($district->name); ?>" href="<?php echo e(url('/location-news?division_id='.($division->id ?? '').'&district_id='.$district->id)); ?>"><strong><?php echo e($district->name); ?></strong></a></span>
				<?php endif; ?>
				<?php if($upazila): ?>
					<span class="desktopCategoryTitle"><i class="fa fa-caret-right marginR5 title1_8"></i> <strong><?php echo e($upazila->name); ?></strong></span>
				<?php endif; ?>
				<?php if(!$division && isset($allDivisions) && $allDivisions->count() > 0): ?>
				<div class="desktopSubCategoryDiv borderC1B1 paddingB5 marginB10">
					<ul>
						<?php $__currentLoopData = $allDivisions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $div): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<li><span class="categoryPageSubLeftCart"></span> <h2><a aria-label="<?php echo e($div->name); ?>" href="<?php echo e(url('/location-news?division_id='.$div->id)); ?>"><?php echo e($div->name); ?></a></h2></li>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
					</ul>
				</div>
				<?php endif; ?>
				<?php if($division && $districts->count() > 0): ?>
				<div class="desktopSubCategoryDiv borderC1B1 paddingB5 marginB10">
					<ul>
						<?php $__currentLoopData = $districts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<li><span class="categoryPageSubLeftCart"></span> <h2><a aria-label="<?php echo e($dist->name); ?>" href="<?php echo e(url('/location-news?division_id='.$division->id.'&district_id='.$dist->id)); ?>"><?php echo e($dist->name); ?></a></h2></li>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
					</ul>
				</div>
				<?php endif; ?>
			</div>

			<!-- mobile header -->
			<div class="col-sm-12 col-md-12 paddingLR20 marginB15 visible-xs marginT5">
				<span class="sectionTitle displayInline border0"><a class="color1" aria-label="সারাদেশ" href="<?php echo e(url('/country-news')); ?>"><strong>সারাদেশ</strong></a> <i class="fa fa-caret-right marginR5 title1_8"></i></span>
				<?php if($division): ?>
					<h1 class="sectionTitle displayInline border0 margin0 marginB0"><a aria-label="<?php echo e($division->name); ?>" href="<?php echo e(url('/location-news?division_id='.$division->id)); ?>"><strong><?php echo e($division->name); ?></strong></a></h1>
				<?php endif; ?>
				<?php if($district): ?>
					<span class="sectionTitle displayInline border0 margin0 marginB0"><i class="fa fa-caret-right marginR5 title1_8"></i> <strong><?php echo e($district->name); ?></strong></span>
				<?php endif; ?>
				<?php if($upazila): ?>
					<span class="sectionTitle displayInline border0 margin0 marginB0"><i class="fa fa-caret-right marginR5 title1_8"></i> <strong><?php echo e($upazila->name); ?></strong></span>
				<?php endif; ?>
				<?php if(!$division && isset($allDivisions) && $allDivisions->count() > 0): ?>
				<div class="desktopSubCategoryDiv borderC1B1 paddingB5 marginB10 marginT5">
					<ul>
						<?php $__currentLoopData = $allDivisions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $div): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<li><span class="categoryPageSubLeftCart"></span> <h2><a aria-label="<?php echo e($div->name); ?>" href="<?php echo e(url('/location-news?division_id='.$div->id)); ?>"><?php echo e($div->name); ?></a></h2></li>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
					</ul>
				</div>
				<?php endif; ?>
				<?php if($division && $districts->count() > 0): ?>
				<div class="desktopSubCategoryDiv borderC1B1 paddingB5 marginB10 marginT5">
					<ul>
						<?php $__currentLoopData = $districts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<li><span class="categoryPageSubLeftCart"></span> <h2><a aria-label="<?php echo e($dist->name); ?>" href="<?php echo e(url('/location-news?division_id='.$division->id.'&district_id='.$dist->id)); ?>"><?php echo e($dist->name); ?></a></h2></li>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
					</ul>
				</div>
				<?php endif; ?>
			</div>


			<div class="col-sm-9 col-md-9">
				<div class="row">
					<div class="col-sm-12 col-md-12">
						<div class="row desktopFlexRow marginLR-15 loadMoreCategoryNews borderR3rdItemNone">
							<?php if($posts->count() > 0): ?>
								<?php $__currentLoopData = $posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
									<div class="col-md-4 col-xs-12 marginB20 xs-marginB15 paddingLR15 borderC1R1 desktopSectionLead">
										<div class="thumbnail h100P borderC1B1 borderRadius0">
											<div class="positionRelative">
												<p class="marginT15 marginB13 positionAbsolute bottom0 marginL10"><span class="categoryNameClass borderC1-1 bg9 colorWhite"><i class="fa fa-regular fa-tag"></i> <?php echo e($post->category->title ?? 'সারাদেশ'); ?></span></p>
												<img src="<?php echo e(asset('assets/images/post/'.$post->image_big)); ?>" class="img-responsive borderRadius0" alt="<?php echo e(strlen($post->title)>100 ? mb_substr($post->title,0,100,'utf-8').'...' : $post->title); ?>">
											</div>
											<div class="caption paddingLR0">
												<h1 class="title11 colorBlack marginT10"><?php echo e(strlen($post->title)>100 ? mb_substr($post->title,0,100,'utf-8').'...' : $post->title); ?></h1>
												<p class="desktopTime"><i class="fa fa-clock title1_4 color2 verticalAlignMiddle marginT2"></i> <?php echo e($post->createdAt()); ?></p>
											</div>
										</div>
										<a href="<?php echo e(route('frontend.postBySubcategory.details',[$post->category->slug ?? 'news',$post->slug])); ?>" class="linkOverlay"></a>
									</div>
								<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
							<?php else: ?>
								<div class="col-md-12 text-center marginT30 marginB30">
									<p class="title11 color2">কোনো খবর পাওয়া যায়নি।</p>
								</div>
							<?php endif; ?>
						</div>
					</div>
				</div>

				<!-- load more -->
				<div class="row marginT30 marginB30">
					<div class="col-md-12 col-xs-12">
						<div class="text-center">
							<?php if($posts->hasMorePages()): ?>
							<span data-page="2" class="loadMoreButton clickLoadMore">আরও পড়ুন <i class="fa fa-spinner loadingIcon" style="display: none;"></i></span>
							<?php endif; ?>
						</div>
					</div>
				</div>

			</div>

			<!-- sidebar -->
			<div class="col-sm-3 col-md-3 hidden-xs">
				<!-- location search -->
				<div class="row">
					<div class="col-sm-12 col-md-12 marginB20">
						<div class="borderRadius10 overflowHidden borderC1-1 shadow3">
							<div class="desktopLocationDiv paddingLR20 paddingB10">
								<div class="col-sm-12 col-md-12 paddingLR5">
									<h2 class="title10 text-center borderC1B1 padding8 marginT0 marginB20"><strong>আপনার এলাকার খবর</strong></h2>
								</div>
								<div class="col-sm-12 col-md-12 searchMessageDiv marginB0 paddingLR5" style="display: none;">
									<div class="alert alert-warning alert-dismissible fade in marginB15 text-center title12" role="alert">
										<button type="button" class="close bgUnset colorBlack" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
										<strong>প্রিয় পাঠক!</strong> বিভাগ, জেলা ও উপজেলা সঠিকভাবে পছন্দ করে অনুসন্ধান করুন। ধন্যবাদ।
									</div>
								</div>

								<div class="col-sm-12 col-md-12 marginB20 paddingLR5">
									<select class="form-control selectDivision" name="division">
										<option value="">বিভাগ</option>
										<?php $__currentLoopData = \App\Models\Division::whereIn('id', [3,4,5,6,7,8,9,10])->orderBy('name')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $div): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
											<option value="<?php echo e($div->id); ?>" <?php echo e((request('division_id') == $div->id) ? 'selected' : ''); ?>><?php echo e($div->name); ?></option>
										<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									</select>
								</div>
								<div class="col-sm-12 col-md-12 marginB20 paddingLR5">
									<select class="form-control selectDistrict" name="district">
										<option value="">জেলা</option>
									</select>
								</div>
								<div class="col-sm-12 col-md-12 marginB20 paddingLR5">
									<select class="form-control selectUpazila" name="upazila">
										<option value="">উপজেলা</option>
									</select>
								</div>
								<div class="col-sm-12 col-md-12 marginB20 paddingLR5">
									<button type="button" class="btn btn-block clickSearchButton bgRed"><i class="fa fa-search title1_6"></i> খুঁজুন</button>
								</div>
							</div>
						</div>
					</div>
				</div>

				<!-- latest popular news -->
				<div class="row">
					<div class="col-sm-12 col-md-12 marginB20">
						<?php echo $__env->make('partial.front.sidebar-latest-popular', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
					</div>
				</div>
			</div>

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

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

<?php $__env->startSection('scripts'); ?>

<script>
$(document).ready(function(){
	// Division -> District AJAX
	$(".selectDivision").on("change", function(){
		$('.selectDistrict').html('<option value="">জেলা</option>');
		$('.selectUpazila').html('<option value="">উপজেলা</option>');
		var divisionId = $(this).val();
		if(divisionId) {
			$.get('/get-districts-by-division/' + divisionId, function(data){
				$('.selectDistrict').html(data);
			});
		}
	});

	// District -> Upazila AJAX
	$(".selectDistrict").on("change", function(){
		$('.selectUpazila').html('<option value="">উপজেলা</option>');
		var districtId = $(this).val();
		if(districtId) {
			$.get('/get-upazilas-by-district/' + districtId, function(data){
				$('.selectUpazila').html(data);
			});
		}
	});

	// Search button
	$('.clickSearchButton').click(function(){
		var divisionId = $('.selectDivision').val();
		var districtId = $('.selectDistrict').val();
		var upazilaId = $('.selectUpazila').val();
		var params = [];
		if(divisionId) params.push('division_id=' + divisionId);
		if(districtId) params.push('district_id=' + districtId);
		if(upazilaId) params.push('upazila_id=' + upazilaId);
		if(params.length > 0) {
			window.location.href = '/location-news?' + params.join('&');
		} else {
			$('.searchMessageDiv').show();
		}
	});

	// Load more
	$('.clickLoadMore').click(function(){
		var btn = $(this);
		var page = btn.data('page');
		btn.find('.loadingIcon').show();
		var url = new URL(window.location.href);
		url.searchParams.set('page', page);
		$.get(url.toString(), function(response){
			var newItems = $(response).find('.loadMoreCategoryNews').children();
			if(newItems.length > 0) {
				$('.loadMoreCategoryNews').append(newItems);
				btn.data('page', parseInt(page) + 1);
			}
			var hasMore = $(response).find('.clickLoadMore').length > 0;
			if(!hasMore) {
				btn.hide();
			}
			btn.find('.loadingIcon').hide();
		});
	});

	// Tab toggle
	$('.latestNav').click(function(){
		$('.latestCaret').show();
		$('.highestCaret').hide();
	});
	$('.highestNav').click(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/location_news.blade.php ENDPATH**/ ?>