<div class="users_section homeSection">
	<div class="container">
		
		<!-- Hero Search Header -->
		<div class="row mb-5 justify-content-center">
			<div class="col-md-10 col-lg-8 text-center">
				<h2 class="font-weight-bold mb-3 hero-search-title"><?= !empty(lang('restaurants')) ? lang('restaurants') : "Restaurants"; ?></h2>
				<p class="text-muted lead mb-4">Discover <span class="font-weight-bold count-highlight"><?= $this->common_m->count_total_user(); ?></span> amazing places near you.</p>
				
				<form action="<?= base_url('home/users'); ?>" method="get" class="bg-white shadow-sm rounded-pill p-2 d-flex align-items-center flex-wrap flex-md-nowrap border hero-search-form">
					<div class="flex-grow-1 px-3 w-100 w-md-auto mb-2 mb-md-0">
						<input type="text" class="form-control border-0 shadow-none bg-transparent px-0 search-input" name="username" placeholder="<?= lang('search_with_username'); ?>" value="<?= isset($_GET['username']) ? $_GET['username'] : ""; ?>">
					</div>
					
					<div class="px-2 border-left d-none d-md-block hidden">
						<select name="country" class="form-control border-0 shadow-none bg-transparent text-muted">
							<option value=""><?= lang('location'); ?></option>
							<option <?= isset($_GET['country']) && $_GET['country'] == 'all' ? "selected" : ""; ?> value=""><?= lang('all'); ?></option>
							<?php foreach ($countries as $key => $con) : ?>
								<option <?= isset($_GET['country']) && $_GET['country'] == $con['code'] ? "selected" : ""; ?> value="<?= $con['code']; ?>"> <?= $con['name']; ?> </option>
							<?php endforeach ?>
						</select>
					</div>

					<div class="d-flex w-100 w-md-auto justify-content-end px-2 px-md-0">
						<button type="button" class="btn btn-light rounded-circle mx-1 location-btn" id="getLocation" title="<?= lang('near_me'); ?>">
							<i class="icofont-google-map"></i>
						</button>

						<button type="submit" class="btn btn-primary rounded-pill px-4 ml-1 d-flex align-items-center justify-content-center search-submit-btn">
							<i class="icofont-search-user mr-2"></i> <span class="d-none d-sm-inline"><?= lang('search'); ?></span>
						</button>
					</div>
				</form>
			</div>
		</div>

		<!-- Restaurant Grid -->
		<div class="restaurantList" id="shopList">
			<div class="row">
				<?php foreach ($users as $key => $row) : ?>
					<?php include VIEWPATH . "frontend/inc/shop_thumb.php"; ?>
				<?php endforeach; ?>
			</div>
		</div>
		
		<!-- Pagination -->
		<div class="row mt-5">
			<div class="col-12 d-flex justify-content-center">
				<div class="php-pagination">
					<?= $this->pagination->create_links(); ?>
				</div>
			</div>
		</div>
	</div>
</div>



<!-- Modal -->
<div class="modal fade" id="qrModal" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-body">
				<div class="qrImage">
					<img src="" alt="qrcode" class="Qrcode">
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-secondary" data-dismiss="modal"><?= lang('ok'); ?></button>
			</div>
		</div>
	</div>
</div>


<script>
	function openQrcode(qr) {
		$('.Qrcode').attr('src', qr);
		$('#qrModal').modal('show');
	}
</script>