<?php $this->load->view('admin/includes/head'); ?>

<?php $this->load->view('admin/includes/sidebar'); ?>

<?php $this->load->view('admin/includes/topbar'); ?>



<!-- Main content-->
<div class="container px-2 ">
	<div class="row">
		<div class="col-sm-3"></div>
		<div class="col-sm-6">
			<div class="">
				<?php
				// var_dump($userDetails);
				?>
				<div class="container d-flex justify-content-center align-items-center">
					<div class="card profile-card shadow  mt-4">
						<div class="card-body text-center">
							<img src="<?= base_url('admin_assets/img/membership.png') ?>" alt="User Profile" height="100" class="rounded-circle profile-img mb-3">
							<h3 class="card-title mb-0"><?= $userDetails->membershipName ?></h3>
							<p class="text-muted"><?= $userDetails->membershipType ?></p>
							<!-- <p class="card-text">Passionate web developer with 5 years of experience in creating responsive and
								user-friendly websites.</p>

							<div class="d-flex justify-content-center mb-3">
								<a href="#" class="btn btn-outline-primary me-2"><i class="bi bi-twitter"></i></a>
								<a href="#" class="btn btn-outline-primary me-2"><i class="bi bi-linkedin"></i></a>
								<a href="#" class="btn btn-outline-primary"><i class="bi bi-github"></i></a>
							</div> -->
							<hr>

							<ul class="list-group list-group-flush mb-3 text-start">
								<li class="list-group-item bg-transparent">
									<div class="row">
										<div class="col-sm-6">
											<b>Membership Status </b>
										</div>
										<div class="col-sm-6">
											<?= $userDetails->membershipStatus == 'ACTIVE' ? '<span class="badge badge-success">' . $userDetails->membershipStatus . '</span>' : '<span class="badge badge-danger">' . $userDetails->membershipStatus . '</span>' ?>
										</div>
									</div>
								</li>
								<li class="list-group-item bg-transparent">
									<div class="row">
										<div class="col-sm-6">
											<b>Membership Start Date </b>
										</div>
										<div class="col-sm-6">
											<?= $userDetails->membershipStartDate ?>
										</div>
									</div>
								</li>
								<?php
								if (isset($userDetails->memberShipExpiryDate) && !empty($userDetails->memberShipExpiryDate)) {
								?>
									<li class="list-group-item bg-transparent">
										<div class="row">
											<div class="col-sm-6">
												<b>Membership Expiry Date </b>
											</div>
											<div class="col-sm-6">
												<?= $userDetails->memberShipExpiryDate ?>
											</div>
										</div>
									</li>
								<?php
								}
								?>
							</ul>

							<!-- <div class="d-flex justify-content-between text-center mt-4">
								<div>
									<h5 class="mb-0">1.5k</h5>
									<small class="text-muted">Followers</small>
								</div>
								<div>
									<h5 class="mb-0">120</h5>
									<small class="text-muted">Projects</small>
								</div>
								<div>
									<h5 class="mb-0">4.8</h5>
									<small class="text-muted">Rating</small>
								</div>
							</div> -->
							<?php
							if ((isset($userDetails->memberShipExpiryDate) && !empty($userDetails->memberShipExpiryDate))) {
								$today = date("m/d/Y");

								// लक्षित तारीख (12/13/2025) सेट करें
								$targetDate = date("m/d/Y", strtotime($userDetails->memberShipExpiryDate));
// echo $today;
// echo $targetDate;
								// तारीखों की तुलना करें
								if ($today > $targetDate) {
							?>
									<hr>
									<button class="btn btn-success w-100 mt-4" onclick="window.location.href='<?= base_url('membership-form') ?>'">RENEW NOW</button>
								<?php
								}
							} else if (isset($userDetails->membershipStatus) && $userDetails->membershipStatus != 'ACTIVE') {
								?>
								<hr>
								<button class="btn btn-success w-100 mt-4" onclick="window.location.href='<?= base_url('membership-form') ?>'">RENEW NOW</button>

							<?php
							}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="col-sm-3"></div>
	</div>
	<!-- End Main content-->

	<?php $this->load->view('admin/includes/footer'); ?>

	</body>

	</html>