<?php

/**
 * @package com_spbooking
 * @author JoomShaper http://www.joomshaper.com
 * @copyright Copyright (c) 2010 - 2023 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */

// No Direct Access
defined('_JEXEC') or die('Resticted Aceess');

use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\LayoutHelper;

$top_review_limit = 5;

?>


<div id="spbooking" class="spbooking spbooking-view-package spbooking-view-details">
	<div class="spbooking-container">
		<!-- package details basic information -->
		<div class="spbooking-row spbooking-align-center">
			<div class="spbooking-col-12 spbooking-col-lg-9 spbooking-details-top-left">

				<?php if ($this->item->category_title)
				{
					?>
					<h4 class="spbooking-details-category">
						<?php echo $this->item->category_title; ?>
					</h4>
				<?php } ?>

				<p class="spbooking-title"><?php echo $this->item->title; ?></p>

				<div class="spbooking-title-bottom">
					<?php if ($this->item->location)
					{
						?>
						<div class="spbooking-details-location">
							<i class="fa fa-map-marker text-green"></i>&nbsp;<span class="text-mute"><?php echo $this->item->location; ?></span>
						</div>
					<?php } ?>

					<?php if (!empty($this->item->start_date) && $this->item->start_date != '0000-00-00')
					{
						?>
						<div class="spbooking-details-date-wrap">
							<span class="spbooking-details-start-date">
								<i class="fa fa-calendar text-green"></i>&nbsp;<span class="text-mute"><?php echo date('dS M', strtotime($this->item->start_date)); ?></span>
							</span>
							<?php if (!empty($this->item->end_date) && $this->item->end_date != '0000-00-00')
							{
								?>
								-
								<span class="spbooking-details-end-date text-mute">
									<?php echo date('dS M', strtotime($this->item->end_date)); ?>
								</span>
							<?php } ?>
						</div>
					<?php } ?>
				</div> <!-- /.spbooking-title-bottom -->

				<!-- Major Activities -->
				<div class="spbooking-major-activities">
					<?php if (!empty($this->item->major_activities))
					{
						?>
						<div class="spbooking-details-major-activities">
							<?php foreach ($this->item->major_activities as $major_activity)
							{
								?>
								<div class="spbooking-major-activities-item">
									<div class="spbooking-major-activities-media-type">
										<?php if (!empty($major_activity->icon_image))
										{
											if ($major_activity->icon_image == 'icon')
											{
												?>
												<i class="<?php echo $major_activity->icon ?> major-activities-icon"></i>
											<?php }
											elseif ($major_activity->icon_image == 'image')
											{
												?>
												<img src="<?php echo Uri::root() . $major_activity->image; ?>" alt="" class="major-activities-image">
											<?php }
										}   ?>
									</div>
									<div class="spbooking-major-activities-title">
										<span><?php echo $major_activity->key; ?></span>
									</div>
								</div>
							<?php } ?>
						</div>
					<?php } ?>
				</div>
				<!-- / Major Activities -->

			</div> <!-- /.spbooking-col-9 -->

			<div class="spbooking-col-12 spbooking-col-lg-3 spbooking-details-top-right">
				<!-- Adult Price -->
				<?php if (!empty($this->item->price) && $this->item->price != 0.00)
				{
					?>
					<div class="spbooking-price-box text-right">
						<?php if (!empty($this->item->sale_price) && $this->item->sale_price != 0.00)
						{
							?>
							<div class="original-price">
								<del class="text-mute">
									<?php echo SpbookingHelper::formatPrice($this->item->price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</del>
							</div>
							<div class="sale-price text-green">
								<span>
									<?php echo SpbookingHelper::formatPrice($this->item->sale_price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</span> / <?php echo Text::_('COM_SPBOOKING_ADULT'); ?>
							</div>
						<?php }
						else
						{
							?>
							<div class="sale-price text-green">
								<span>
									<?php echo SpbookingHelper::formatPrice($this->item->price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</span> / <?php echo Text::_('COM_SPBOOKING_ADULT'); ?>
							</div>
						<?php } ?>
					</div>
				<?php } ?>
				<!-- Child Price -->
				<?php if (!empty($this->item->child_price) && $this->item->child_price != 0.00)
				{
					?>
					<div class="spbooking-price-box text-right">
						<?php if (!empty($this->item->child_sale_price) && $this->item->child_sale_price != 0.00)
						{
							?>
							<div class="original-price">
								<del class="text-mute">
									<?php echo SpbookingHelper::formatPrice($this->item->child_price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</del>
							</div>
							<div class="sale-price text-green">
								<span>
									<?php echo SpbookingHelper::formatPrice($this->item->child_sale_price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</span> / <?php echo Text::_('COM_SPBOOKING_CHILD'); ?>
							</div>
						<?php }
						else
						{
							?>
							<div class="sale-price text-green">
								<span>
									<?php echo SpbookingHelper::formatPrice($this->item->child_price, $this->item->currency, $this->item->currency_type, $this->item->currency_position); ?>
								</span> / <?php echo Text::_('COM_SPBOOKING_CHILD'); ?>
							</div>
						<?php } ?>
					</div>
				<?php } ?>
				<div class="spbooking-top-right-bottom mt-10">
					<?php if (!empty($this->item->is_available))
					{
						?>
						<a href="<?php echo Uri::root() . ('index.php?option=com_spbooking&view=checkout&layout=package&checkout_for=package&package_id=' . $this->item->id); ?>" class="spbooking-btn spbooking-btn-primary spbooking-btn"><?php echo Text::_('COM_SPBOOKING_COMMON_BOOK_NOW'); ?></a>
					<?php }
					else
					{
						?>
						<button class="spbooking-btn spbooking-btn-primary"><?php echo Text::_('COM_SPBOOKING_COMMON_BOOK_NOW'); ?></button><br>
						<small class="text-danger"><?php echo Text::_('COM_SPBOOKING_PACKAGE_NOT_AVAILABLE'); ?></small>
					<?php } ?>
				</div> <!-- /.spbooking-top-right-bottom  -->
			</div> <!-- /.spbooking-col-3 -->
		</div>
	</div>


	<!-- package gallery -->
	<div class="spbooking-row spbooking-details-image mt-preset">
		<!-- rooms gallery -->
		<div class="spbooking-col-12">
			<?php echo LayoutHelper::render('gallery.gallery', array('gallery' => $this->item->gallery, 'title' => '', 'banner_image' => $this->item->image, 'modifier_class' => 'package-gallery')); ?>
		</div>
	</div> <!-- /.spbooking-details-gallery -->

	<div class="spbooking-container">
		<!-- package overview -->
		<div class="spbooking-row spbooking-details-overview mt-preset">

			<?php // Generate columns
			if (!empty($this->item->certificates) && $this->item->certificates && count((array) $this->item->certificates) == 1)
			{
				$left_col = 6;
				$right_col = 3;
				$review_col = 3;
			}
			else
			{
				$left_col = 9;
				$right_col = 3;
				$review_col = 12;
			}
			?>

			<!-- package description -->
			<div class="spbooking-col-md-12 spbooking-col-lg-<?php echo $left_col; ?>">
				<h4 class="overview is-uppercase"><?php echo Text::_('COM_SPBOOKING_PACKAGE_OVERVIEW_TITLE'); ?></h4>
				<?php
				if (!empty($this->item->description))
				{
					?>
					<div class="description"><?php echo $this->item->description; ?></div>
				<?php } ?>
			</div>

			<!-- overall rating  -->
			<?php if ($this->showRatings)
			{
				?>
			<div class="spbooking-col spbooking-col-md-6 spbooking-col-lg-<?php echo $right_col; ?>">
				<div class="overall-rating">
					<div class="spbooking-box">
						<label class="title"><?php echo Text::_('COM_SPBOOKING_PACKAGE_OVERALL_RATING'); ?></label>
						<h1 class="rating"><?php echo $this->item->reviews['average_rating']; ?><small>/5</small></h1>
						<?php
						foreach (range(1, 5) as $key => $rating)
						{
							?>
							<?php if ($rating <= $this->item->reviews['average_rating'])
							{
								?>
								<span class="fa fa-star is-filled"></span>
							<?php }
							elseif ($rating > $this->item->reviews['average_rating'] && $this->item->reviews['average_rating'] > $rating - 1)
							{
								?>
								<span class="fa fa-star-half-o is-filled"></span>
							<?php }
							else
							{
								?>
								<span class="fa fa-star-o"></span>
							<?php } ?>
						<?php } ?>
						<p class="total-reivews">
							<?php echo "(" . $this->item->reviews['total_reviews'] . " " . SpbookingHelper::pluralize($this->item->reviews['total_reviews'], 'COM_SPBOOKING_TOTAL_REVIEW_TEXT', 'COM_SPBOOKING_TOTAL_REVIEWS_TEXT') . ")"; ?>
						</p>
					</div>
				</div>
			</div>
			<?php } ?>           

			<?php if (!empty($this->item->certificates) && $this->item->certificates && count((array) $this->item->certificates) == 1)
			{
				?>
				<!-- oscars -->
				<div class="spbooking-col-md-6 spbooking-col-lg-<?php echo $review_col; ?> spbooking-item-certificates">
					<div class="package-award">
						<div class="spbooking-box">
							<?php foreach ($this->item->certificates as $certificate)
							{
								?>
								<img src="<?php echo $certificate->image; ?>" alt="<?php echo $certificate->name; ?>">
							<?php } ?>
						</div>
					</div>
				</div><!-- /.spbooking-col- -->
			<?php } ?>
		</div> <!-- /.spbooking-row -->

		<?php if (!empty($this->item->certificates) && $this->item->certificates && count((array) $this->item->certificates) > 1)
		{
			?>
			<!-- package overview -->
			<div class="spbooking-row spbooking-item-certificates">
				<?php foreach ($this->item->certificates as $certificate)
				{
					?>
					<div class="spbooking-col-sm-3 mt-20">
						<img src="<?php echo $certificate->image; ?>" alt="<?php echo $certificate->name; ?>">
					</div>
				<?php } ?>
			</div> <!-- /.spbooking-row -->
		<?php } ?>

		<!-- tour overview -->
		<div class="spbooking-row tour-overview">
			<div class="spbooking-col-12">
				<h4 class="tour-over-view-title is-uppercase"><?php echo Text::_('COM_SPBOOKING_PACKAGE_TOUR_OVERVIEW_TITLE'); ?></h4>
				<?php
				if (!empty($this->item->overview))
				{
					?>
					<div class="tour-overview-details">
						<div class="spbooking-col-12 spbooking-col-lg-9">
							<div class="spbooking-row">
								<?php foreach ($this->item->overview as $overview)
								{
									?>
									<div class="spbooking-col-md-4">
										<div class="package-overview-holder">
											<div class="icon-image-wrap">
												<?php if (!empty($overview->icon_image))
												{
													?>
													<?php if ($overview->icon_image == 'icon')
													{
														?>
														<span class="text-green <?php echo $overview->icon; ?> fa-2x"></span>
													<?php }
													else
													{
														?>
														<img src="<?php echo $overview->image; ?>" alt="">
													<?php } ?>
												<?php } ?>
											</div>
											<div class="text-wrap">
												<?php if (!empty($overview->key))
												{
													?>
													<h4 class=""><?php echo $overview->key; ?></h4>
												<?php } ?>
												<?php
												if (!empty($overview->value))
												{
													?>
													<p class="text-mute"><?php echo $overview->value; ?></p>
												<?php } ?>
											</div>
										</div>
									</div>
								<?php } ?>
							</div>
						</div>
					</div>
				<?php } ?>
			</div>
		</div>


		<!-- package include  -->
		<div class="spbooking-row spbooking-package-inc-exc mt-preset">
			<?php if (!empty($this->item->includes) && $this->item->includes)
			{
				?>
				<div class="spbooking-col-md-6 spbooking-package-includes-wrap">
					<h3><?php echo Text::_('COM_SPBOOKING_PACKAGE_INCLUDED'); ?></h3>
					<ul class="spbooking-package-includes mt-30">
						<?php foreach ($this->item->includes as $include)
						{
							?>
							<?php if (!empty($include->key))
							{
								?>
								<li class="is-uppercase">
									<?php if (!empty($include->icon_image))
									{
										?>
										<?php if ($include->icon_image == 'icon')
										{
											?>
											<span class="<?php echo !empty($include->icon) ? $include->icon : 'fa fa-check-square-o'; ?> text-green"></span>
										<?php }
										else
										{
											?>
											<?php
											if (!empty($include->image))
											{
												?>
												<img class="icon-image" src="<?php echo $include->image; ?>" alt="">
											<?php } ?>
										<?php } ?>
									<?php } ?>
									<?php echo " " . $include->key; ?>
								</li>
							<?php } ?>

						<?php } ?>
					</ul>
				</div>
			<?php } ?>

			<!-- package excludes -->
			<?php if (!empty($this->item->excludes) && $this->item->excludes)
			{
				?>
				<div class="spbooking-col-md-6 spbooking-package-excludes-wrap">
					<h3><?php echo Text::_('COM_SPBOOKING_PACKAGE_EXCLUDED'); ?></h3>
					<ul class="spbooking-package-excludes mt-30">
						<?php foreach ($this->item->excludes as $exclude)
						{
							?>
							<?php if (!empty($exclude->key))
							{
								?>
								<li class="is-uppercase">
									<?php if (!empty($exclude->icon_image))
									{
										?>
										<?php if ($exclude->icon_image == 'icon')
										{
											?>
											<span class="<?php echo !empty($exclude->icon) ? $exclude->icon : 'fa fa-times-circle-o'; ?> text-red"></span>
										<?php }
										else
										{
											?>
											<?php
											if (!empty($exclude->image))
											{
												?>
												<img class="icon-image" src="<?php echo $exclude->image; ?>" alt="">
											<?php } ?>
										<?php } ?>
									<?php } ?>
									<?php echo " " . $exclude->key; ?>
								</li>
							<?php } ?>
						<?php } ?>
					</ul>
				</div>
			<?php } ?>

		</div> <!-- /.spbooking-package-inc-exc -->


		<!-- Daywise Tour Activities -->
		<div class="spbooking-row tour-activities mt-preset">
			<div class="spbooking-col-12">
				<h4 class="itenary-title is-uppercase"><?php echo Text::_('COM_SPBOOKING_PACKAGE_ITENARY_TITLE'); ?></h4>
				<?php
				if (!empty($this->item->activities))
				{
					?>
					<!-- activity nav links -->
					<div class="itenary-tab">
						<ul class="nav nav-pills mt-20 itenary-nav">
							<?php $i = 0; ?>
							<?php
							foreach ($this->item->activities as $key => $activity)
							{
								?>
								<li class="nav-item">
									<a class="nav-link text-mute <?php echo $i == 0 ? 'active' : ''; ?>" data-trigger="<?php echo '#day-' . $key; ?>" href="javascript:"><?php echo Text::sprintf('COM_SPBOOKING_ACTIVITIES_DAY_N', $key); ?></a>
									<!-- Show Date -->
									<?php foreach ($activity as $day)
									{
										if (isset($day->date))
										{
											?>
											<div class="nav-link spbooking-activity-content-date">
												<?php echo $day->date; ?>
											</div>
											<?php break;
										}
									} ?>
								</li>
													<?php $i++;
							}

							$i = 0; ?>
						</ul>

						<!-- activity content -->
						<div class="itenary-panel">
											<?php foreach ($this->item->activities as $key => $days)
											{
												?>
								<div class="spbooking-activity-content <?php echo $i == 0 ? 'show' : ''; ?>" id="day-<?php echo $key; ?>">
									<div class="tracking-bar"><?php echo Text::sprintf('COM_SPBOOKING_ACTIVITIES_DAY_N', $key); ?></div>
									<ul>
												<?php foreach ($days as $index => $activity)
												{
													?>
											<li class="activity-container">
												<div class="left-box">
													<!-- left marker style would be here -->
												</div>
												<div class="activity-box">
													<div class="time-slot text-mute">
														<?php if (!empty($activity->time))
														{
															?>
															<?php if (!empty($activity->icon_image))
															{
																if ($activity->icon_image == 'icon')
																{
																	?>
																	<i class="<?php echo $activity->icon ?> activity-time-icon"></i>
																<?php }
																elseif ($activity->icon_image == 'image')
																{
																	?>
																	<img src="<?php echo Uri::root() . $activity->image; ?>" alt="" class="activity-time-image">
																<?php }
															}   ?>
															<span class=""><?php echo $activity->time; ?></span>
														<?php } ?>
													</div>
													<?php if (!empty($activity->desc))
													{
														?>
														<p class="activity-desc"><?php echo $activity->desc; ?></p>
													<?php } ?>
												</div>
											</li>
												<?php } ?>
									</ul>
								</div>
												<?php $i++;
											} ?>
				<?php } ?>
						</div>
					</div>
			</div>
		</div>

		<div class="spbooking-row">
			<?php if (!empty($this->item->custom))
			{
				?>
				<div class="spbooking-details-custom">
					<?php foreach ($this->item->custom as $custom)
					{
						?>
						<div class="spbooking-custom-item">
							<div class="spbooking-custom-title">
								<h4><?php echo $custom->key; ?></h4>
							</div>
							<div class="spbooking-custom-description">
								<p><?php echo $custom->value; ?></p>
							</div>
						</div>
					<?php } ?>
				</div>
			<?php } ?>               
		</div>
	</div>

	<!-- review slider carousel -->
	<?php if ($this->showRatings && $this->item->reviews['total_reviews'] > 0)
	{
		?>
	<div class="spbooking-row mt-preset">
		<div class="spbooking-col carousel-background" style="<?php echo $this->item->carousel_background; ?>">       
			<div class="spbooking-container">
				<!-- top review carousel -->
				<div class="top-reviews-carousel owl-carousel">
				<?php if (!empty($this->item->reviews['top_rating']))
				{
					?>
					<?php foreach ($this->item->reviews['top_rating'] as $key => $rating)
					{
						?>
						<?php if ($key < $top_review_limit)
						{
							?>
							<div class="content-container">
								<?php if (!empty($rating->review))
								{
									?>
									<blockquote class="blockquote">
										<p class="mb-0"><?php echo "\"" . $rating->review . "\""; ?></p>
										<?php
										if (!empty($rating->user_name))
										{
											?>
											<footer class="blockquote-footer"><?php echo $rating->user_name; ?></footer>
										<?php } ?>
									</blockquote>
								<?php } ?>

								<?php if (!empty($rating->inner_rating))
								{
									?>
									<?php foreach (range(1, 5) as $index)
									{
										?>
										<?php if ($index <= $rating->inner_rating)
										{
											?>
											<span class="fa fa-star is-filled"></span>
										<?php }
										elseif ($index > $rating->inner_rating && $rating->inner_rating > $index - 1)
										{
											?>
											<span class="fa fa-star-half-o is-filled"></span>
										<?php }
										else
										{
											?>
											<span class="fa fa-star-o"></span>
										<?php } ?>
									<?php } ?>
								<?php } ?>
							</div>
						<?php } ?>
					<?php } ?>
				<?php } ?>
				</div>
			</div>
			

			<!-- additional review -->
			<div class="additional-review">
				<?php if (!empty($this->item->additional_reviews))
				{
					?>
					<?php foreach ($this->item->additional_reviews as $ad_review)
					{
						?>
						<div class="review-wrapper">
							<?php if (!empty($ad_review->rating))
							{
								?>
								<h1><strong><?php echo $ad_review->rating; ?></strong><small>/5</small></h1>
							<?php } ?>
							<?php
							if (!empty($ad_review->rating))
							{
								?>
								<?php foreach (range(1, 5) as $index)
								{
									?>
									<?php if ($index <= $ad_review->rating)
									{
										?>
										<span class="fa fa-star is-filled"></span>
									<?php }
									elseif ($index > $ad_review->rating && $ad_review->rating > $index - 1)
									{
										?>
										<span class="fa fa-star-half-o is-filled"></span>
									<?php }
									else
									{
										?>
										<span class="fa fa-star-o"></span>
									<?php } ?>
								<?php } ?>
							<?php } ?>
							<?php
							if (!empty($ad_review->image))
							{
								?>
								<img src="<?php echo Uri::root() . $ad_review->image; ?>" alt="<?php echo $ad_review->provider; ?>">
							<?php }
							elseif (!empty($ad_review->provider))
							{
								?>
								<p><strong><?php echo $ad_review->provider; ?></strong></p>
							<?php } ?>
						</div>
					<?php } ?>

					<!-- award certifications -->
					<?php if (!empty($this->item->certificates))
					{
						?>
						<?php foreach ($this->item->certificates as $certificate)
						{
							?>
							<div class="review-wrapper">
								<?php if (!empty($certificate->image))
								{
									?>
									<img src="<?php echo Uri::root() . $certificate->image; ?>" alt="" width="100" height="100">
								<?php } ?>
							</div>
						<?php } ?>
					<?php } ?>

					<!-- customer review  -->
					<div class="review-wrapper">
						<h1 class="rating"><strong><?php echo $this->item->reviews['average_rating']; ?></strong><small>/5</small></h1>
						<?php
						foreach (range(1, 5) as $key => $rating)
						{
							?>
							<?php if ($rating <= $this->item->reviews['average_rating'])
							{
								?>
								<span class="fa fa-star is-filled"></span>
							<?php }
							elseif ($rating > $this->item->reviews['average_rating'] && $this->item->reviews['average_rating'] > $rating - 1)
							{
								?>
								<span class="fa fa-star-half-o is-filled"></span>
							<?php }
							else
							{
								?>
								<span class="fa fa-star-o"></span>
							<?php } ?>
						<?php } ?>
						<p><strong><?php echo Text::_('COM_SPBOOKING_CUSTOMER_REVIEW'); ?></strong></p>
					</div>
				<?php } ?>
			</div>
		</div>
	</div>
	<?php } ?>
	

	<div class="spbooking-container">
		<!-- user comments -->
		<div class="spbooking-row accomodation-user-comments">
			<div class="spbooking-col-12">
				<label class="user-comments-title is-uppercase"><?php echo Text::_('COM_SPBOOKING_PACKAGE_USER_COMMENTS') . " (" . $this->item->reviews['total_reviews'] . ")"; ?></label>
				<?php
				if (!empty($this->item->reviews['reviews']))
				{
					?>
					<ul class="user-comment-list list-group">
						<?php foreach ($this->item->reviews['reviews'] as $comment)
						{
							?>
							<li class="user-comment-item list-group-item">
								<div class="comment-header">
									<img class="img-round" src="<?php echo Uri::root() . 'components/com_spbooking/assets/images/default.png'; ?>" alt="">
									<p class='user-name'><?php echo $comment->user_name; ?></p>
									<small class="comment-date text-mute"><?php echo HTMLHelper::_('date', $comment->created, 'jS M, Y'); ?></small>
								</div>
								<?php if (!empty($comment->review))
								{
									?>
									<div class="comment-body mt-10">
										<p><?php echo $comment->review; ?></p>
									</div>
								<?php } ?>

								<?php if (!empty($comment->inner_rating) && $this->showRatings)
								{
									?>
									<?php foreach (range(1, 5) as $index)
									{
										?>
										<?php if ($index <= $comment->inner_rating)
										{
											?>
											<span class="fa fa-star is-filled"></span>
										<?php }
										elseif ($index > $comment->inner_rating && $comment->inner_rating > $index - 1)
										{
											?>
											<span class="fa fa-star-half-o is-filled"></span>
										<?php }
										else
										{
											?>
											<span class="fa fa-star-o"></span>
										<?php } ?>
									<?php } ?>
									<strong><?php echo $comment->inner_rating; ?></strong>
								<?php } ?>
							</li>
						<?php } ?>
					</ul>
				<?php } ?>
			</div>
		</div>

		<!-- give feedback form -->
		<!-- if review enabled -->
		<?php if (!empty($this->cParams->get('review', 1)))
		{
			$review_categories_feedback = SpbookingHelper::getReviewOptions(array('safty_security' => 'Safety and Security', 'maintenance' => 'Maintenance', 'cleanliness' => 'Cleanliness', 'service' => 'Service', 'hospitality' => 'Hospitality'));
			?>
			<!-- if guest review disabled -->
			<?php if ($this->cParams->get('guest_review', 0) == 0)
			{
				?>
				<!-- if user logged in -->
				<?php if (Factory::getUser()->id > 0)
				{
					?>
					<div class="spbooking-row user-feedback">
						<div class="spbooking-col-sm-12">
							<label class="give-feedback-title is-uppercase"><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_TITLE'); ?></label>
							<form action="#" class="feedback-form" id="feedback-form">
								<div class="feedback-first-formgroup">
									<div class="form-group overall-rating">
										<label for=""><?php echo Text::_('Overall Rating'); ?></label>

										<?php foreach (range(1, 5) as $index)
										{
											?>
											<?php if ($index <= $this->item->reviews['average_rating'])
											{
												?>
												<span class="fa fa-star is-filled"></span>
											<?php }
											elseif ($index > $this->item->reviews['average_rating'] && $this->item->reviews['average_rating'] > $index - 1)
											{
												?>
												<span class="fa fa-star-half-o is-filled"></span>
											<?php }
											else
											{
												?>
												<span class="fa fa-star-o"></span>
											<?php } ?>
										<?php } ?>
									</div>

									<div class="form-group">
										<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_RATING'); ?></label>
										<ul class="review-categories-list">
										<?php foreach ($review_categories_feedback as $k => $value)
										{
											?>
											<li class="review-list-item" >
												<span class="review-list-item-title" data-alias="<?php echo $k; ?>"><?php echo $value; ?> </span>
												<input type="hidden" name="review_categories[]" value="<?php echo $k; ?>">
											</li>
										<?php } ?> 
										</ul>
									</div>

									<div class="form-group">
										<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK'); ?></label>
										<textarea name="review" id="feedback" cols="10" rows="7" class="form-control"></textarea>
									</div>
								</div>

								<div class="feedback-second-formgroup">
									<div class="form-row form-group">
										<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_PERSONAL_INFO'); ?></label>
										<div class="group-row">
											<div class="row">
												<input type="hidden" name="user_name" value="<?php echo Factory::getUser()->name; ?>">
												<input type="hidden" name="user_email" value="<?php echo Factory::getUser()->email; ?>">
												<div class="col">
													<div class="reserve-box">
														<input type="hidden" name="package_id" value="<?php echo $this->item->id; ?>">
														<input type="hidden" name="review_for" value="package">
													</div>

													<div class="form-group submit-button-wrap">
														<button type="submit" class="spbooking-btn spbooking-btn-primary is-uppercase"><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_SUBMIT_FEEDBACK'); ?></button>
													</div>
												</div>
											</div>
										</div>
									</div>
							</form>
						</div>
					</div>
				<?php }
				else
				{
					?>
					<p class="login-message">
						<?php $link = base64_encode(Route::_('index.php?option=com_spbooking&view=package&id=' . $this->item->id . SpbookingHelper::getItemid('packages'))); ?>
						<?php $login_link = Route::_('index.php?option=com_users&view=login' . SpbookingHelper::getItemid('login') . '&return=' . $link); ?>
						<?php echo Text::sprintf('COM_SPBOOKING_LOGIN_FOR_FEEDBACK', $login_link); ?>
					</p>
				<?php } ?>
			<?php }
			else
			{
				?>
				<!-- if guest review allowed -->
				<div class="spbooking-row user-feedback">
					<div class="spbooking-col-sm-12">
						<label class="give-feedback-title is-uppercase"><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_TITLE'); ?></label>
						<form action="#" class="feedback-form" id="feedback-form">
							<div class="feedback-first-formgroup">
								<div class="form-group overall-rating">
									<label for=""><?php echo Text::_('Overall Rating'); ?></label>

									<?php foreach (range(1, 5) as $index)
									{
										?>
										<?php if ($index <= $this->item->reviews['average_rating'])
										{
											?>
											<span class="fa fa-star is-filled"></span>
										<?php }
										elseif ($index > $this->item->reviews['average_rating'] && $this->item->reviews['average_rating'] > $index - 1)
										{
											?>
											<span class="fa fa-star-half-o is-filled"></span>
										<?php }
										else
										{
											?>
											<span class="fa fa-star-o"></span>
										<?php } ?>
									<?php } ?>
								</div>

								<div class="form-group">
									<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_RATING'); ?></label>
									<ul class="review-categories-list">
										<?php foreach ($review_categories_feedback as $rcfk => $value)
										{
											?>
										<li class="review-list-item" >
											<span class="review-list-item-title" data-alias="<?php echo $rcfk; ?>"><?php echo $value; ?> </span>
											<input type="hidden" name="review_categories[]" value="<?php echo $rcfk; ?>">
										</li>
										<?php } ?> 
									</ul>
								</div>

								<div class="form-group">
									<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK'); ?></label>
									<textarea name="review" id="feedback" cols="10" rows="7" class="form-control"></textarea>
								</div>
							</div>

							<div class="feedback-second-formgroup">
								<div class="form-row form-group">
									<label for=""><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_FEEDBACK_PERSONAL_INFO'); ?></label>
									<div class="group-row">
										<div class="row">
											<?php if (Factory::getUser()->id > 0)
											{
												?>
												<input type="hidden" name="user_name" value="<?php echo Factory::getUser()->name; ?>">
												<input type="hidden" name="user_email" value="<?php echo Factory::getUser()->email; ?>">
											<?php }
											else
											{
												?>
												<div class="col-md-6">
													<input type="text" class="form-control" name="user_name" required="required" placeholder="<?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_NAME'); ?>">
												</div>
												<div class="col-md-6">
													<input type="email" class="form-control" name="user_email" required="required" placeholder="<?php echo Text::_('COM_SPBOOKING_ACCOMODATION_USER_EMAIL'); ?>">
												</div>
											<?php } ?>
											<div class="col">
												<div class="reserve-box">
													<input type="hidden" name="package_id" value="<?php echo $this->item->id; ?>">
													<input type="hidden" name="review_for" value="package">
												</div>

												<div class="form-group submit-button-wrap">
													<button type="submit" class="spbooking-btn spbooking-btn-primary is-uppercase"><?php echo Text::_('COM_SPBOOKING_ACCOMODATION_SUBMIT_FEEDBACK'); ?></button>
												</div>
											</div>
										</div>
									</div>
								</div>
						</form>
					</div>
				</div>
			<?php } ?>
		<?php } ?>
	</div>
</div>
