<script>
    var getUrl = '<?php echo URL::route('getEmailData'); ?>';
    var getUrlAll = '<?php echo URL::route('getAllEmails'); ?>';
</script>

<!-- Dashboard overview start -->

<div id="dashboard-overview" class="fadeIn">
	<div class="row">
		<div class="col s6 m6 l3">
			<?php if($city['reportStats']['total']>0): ?>

			<a target="_self" href="<?php echo URL::route('CommunalServiceCityReports'); ?>">
				<?php endif; ?>

				<div class="widget-holder hoverable">
				<div class="widget-heading">
					<h2 class="widget-heading-thin"><?php echo Lang::get('communalService.total_report_number'); ?></h2>
				</div>
				<div class="widget-content">
					<div class="widget-stats">
						<h3 class="center-align"><?php echo $city['reportStats']['total']; ?></h3>
					</div>
				</div>
			</div>
				<?php if($city['reportStats']['total']>0): ?>

			</a>
			<?php endif; ?>

		</div>

		<div class="col s6 m6 l3">
			<?php if($city['reportStats']['byStatus']['status_new']>0): ?>
			<a target="_self" href="<?php echo URL::route('CommunalServiceCityReports', ['id' => 'null', 'date' => 'false', 'priority' => 'false', 'status' => 1]); ?>">
			<?php endif; ?>
				<div class="widget-holder hoverable">
				<div class="widget-heading">
					<h2 class="widget-heading-thin"><?php echo Lang::get('communalService.status_new'); ?></h2>
				</div>
				<div class="widget-content">
					<div class="widget-stats">
						<h3 class="center-align"><?php echo $city['reportStats']['byStatus']['status_new']; ?></h3>
					</div>
				</div>
			</div>
				<?php if($city['reportStats']['byStatus']['status_new']>0): ?>
			</a>
			<?php endif; ?>

		</div>

		<div class="col s6 m6 l3">
			<?php if($city['reportStats']['byStatus']['status_processing']>0): ?>

				<a target="_self" href="<?php echo URL::route('CommunalServiceCityReports', ['id' => 'null', 'date' => 'false', 'priority' => 'false', 'status' => 2]); ?>">
					<?php endif; ?>
			<div class="widget-holder hoverable">
				<div class="widget-heading">
					<h2 class="widget-heading-thin"><?php echo Lang::get('communalService.status_processing'); ?></h2>
				</div>
				<div class="widget-content">
					<div class="widget-stats">
						<h3 class="center-align"><?php echo $city['reportStats']['byStatus']['status_processing']; ?></h3>
					</div>
				</div>
			</div>
					<?php if($city['reportStats']['byStatus']['status_processing']>0): ?>

				</a>
			<?php endif; ?>
		</div>

		<div class="col s6 m6 l3">
			<?php if($city['reportStats']['byStatus']['status_resolved']>0): ?>

				<a target="_self" href="<?php echo URL::route('CommunalServiceCityReports', ['id' => 'null', 'date' => 'false', 'priority' => 'false', 'status' => 3]); ?>">
					<?php endif; ?>
			<div class="widget-holder hoverable">
				<div class="widget-heading">
					<h2 class="widget-heading-thin"><?php echo Lang::get('communalService.status_resolved'); ?></h2>
				</div>
				<div class="widget-content">
					<div class="widget-stats">
						<h3 class="center-align"><?php echo $city['reportStats']['byStatus']['status_resolved']; ?></h3>
					</div>
				</div>
			</div>
					<?php if($city['reportStats']['byStatus']['status_resolved']>0): ?>

				</a>
			<?php endif; ?>
		</div>

	</div>
	<?php if($city['communalService_status'] == 1 && $city['reportStats']['total'] > 0): ?>

	<div id="vueDash" class="row">



		<div class="col s12 m12 l6">
			<div class="widget-holder hoverable">
				<div class="widget-heading">
					<h2 class="widget-heading-thick"><?php echo ucfirst(Lang::get('core.latest_reports')); ?></h2>
				</div>
				<div class="widget-content">
					<div class="row">
						<div class="col s10">
							<div class="content-wrapper">
								<div class="carousel carousel-slider" data-indicators="true">
                                    <?php //echo "<pre>";print_r((array)$city);exit;?>
									<?php foreach($city['communalService_data'] as $report): ?>

										<div class="carousel-item white-text" href="<?php echo $report->id; ?>">
											<div class="row">
												<div class="col s12">
													<span><i class="material-icons">schedule</i><?php echo $report->report_date; ?></span>
												</div>
											</div>
											<div class="row">
												<div class="col s4">
													<?php if(strlen($report->image)>0): ?>
														<img src="<?php echo url('/'); ?>/uploads/communalService/thumbs/<?php echo $report->image; ?>" alt="">
													<?php endif; ?>
												</div>
												<div class="col s8">
													<?php if(strlen($report->report_description)>0): ?>
														<h5 class="vertical-align"><?php echo $report->report_description; ?></h5>
													<?php else: ?>
														<h5 class="vertical-align"><?php echo $report->type; ?> <?php echo $report->subtype; ?></h5>

													<?php endif; ?>
												</div>
											</div>
										</div>

									<?php endforeach; ?>

								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		<?php endif; ?>

		<div id="vueEmails">
			<div id="recent-emails" class="col s12 m12 l6">
				<div class="widget-holder hoverable">
					<div class="widget-heading">
						<h2 class="widget-heading-thick"><?php echo Lang::get('dashboard.email_dashboard_heading'); ?></h2>
					</div>
					<div class="widget-content">
						<div class="row">
							<div class="col s10">
								<div class="email-container content-wrapper">
									<?php foreach($emails as $email): ?>
									<div class="email-single">
										<span class="email-date"><?php echo date('d.m.Y', strtotime($email->date)); ?> - </span><a v-on:click="getEmail(<?php echo $email->email_id; ?>)" class="icon-btn icon-btn-edit email-truncate"><?php echo $email->subject; ?></a>
									</div>
									<?php endforeach; ?>
								</div>
								<a href="<?php echo URL::route('getAllEmails'); ?>" class="fetch-more btn-floating tooltipped btn-large waves-effect waves-light" data-position="left" data-delay="25" data-tooltip="<?php echo Lang::get('dashboard.all_emails_tooltip'); ?>">...</a>
							</div>
						</div>
					</div>
				</div>

			</div>
			<div id="show-email" class="modal modal-fixed-footer">
				<div class="modal-content">
					<h4>{{ subject }}</h4>
					<hr>
					<p class="email-modal-text" v-html="content"></p>
					<div v-if="image" class="email-modal-attachment">
						<h3><?php echo Lang::get('dashboard.email_modal_attachment'); ?>: </h3>
						<div class="attachment-container" v-for="imagePath in image">
							<img onclick="bigImage=this.src; showImage()" v-if="imagePath" :src="imagePath" alt="email-image" class="enlargale email-modal-image">
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<a href="#!" class="modal-action modal-close btn waves-effect waves-light"><?php echo Lang::get('dashboard.email_modal_close'); ?></a>
				</div>
			</div>

			<div id="show-image-modal" class="modal modal-fixed-footer">
				<div class="modal-content">
					<img id="big-image" src="">
				</div>
			</div>
		</div>
	</div>


</div>


<!-- Dashboard overview end -->


