<?php /* CityHub - Communal Service - Report details */ ?>

<?php //goDie($tracking); ?>

<div class="row">
	<div class="col s12">
		<div class="widget-holder hoverable fadeIn">
			<div class="widget-heading">
				<h2 class="widget-heading-thick"><?php echo isset($title) ? $title : null; ?></h2>
				<a href="<?php echo route('ReportCreatePdf', array($report->id)); ?>" target="_blank" class="btn-floating waves-effect waves-light btn-primary new-blog-post generateButton" title="<?php echo Lang::get('communalService.generate_pdf'); ?>"> <i class="material-icons">picture_as_pdf</i></a>
			</div>
			<div class="widget-content">
				<div class="row">
					<div class="col s6">
						<div id="map-canvas" style="margin-top:20px;height: 500px; width: 100%; display: block;margin-bottom:100px;">
						</div>
					</div>
					<div class="col s6">
						<div class="inputs-wrapper">
							<p><?php echo Lang::get('communalService.details_city'); ?>: <strong><?php echo $city->city_name; ?></strong></p>

							<?php if($company != null): ?>
							<p><?php echo Lang::get('communalService.details_delegated_to'); ?>: <strong><?php echo $company->name; ?></strong></p>
							<hr>
							<?php endif; ?>
							<p><?php echo Lang::get('communalService.details_type'); ?>: <strong><?php echo $report->type; ?></strong></p>
							<p><?php echo Lang::get('communalService.details_subtype'); ?>: <strong><?php echo $report->subtype; ?></strong></p>
							<p><?php echo Lang::get('communalService.details_status'); ?>: <strong><?php echo Lang::get('communalService.' . $report->status); ?></strong></p>
							<p><?php echo Lang::get('communalService.details_priority'); ?>: <strong><?php echo Lang::get('communalService.' . $report->priority); ?></strong></p>
							<p><?php echo Lang::get('communalService.details_description'); ?>: <strong><?php echo e($report->description); ?></strong></p>
							<br>
							<p><?php echo Lang::get('communalService.details_admin_note'); ?>:</p>
							<p>
								<strong><?php echo $report->admin_note; ?></strong>
							</p>
							<?php if(Entrust::hasRole('manager')): ?>
							<p><?php echo Lang::get('communalService.details_admin_note_for_managers'); ?>:</p>
							<p>
								<?php echo $report->admin_note_for_managers; ?>

							</p>
							<?php endif; ?>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col s6 text-center">
						<img src="<?php echo url('/') . '/uploads/communalService/' . $report->image; ?>" alt="<?php echo e($report->description); ?>" class="img-max">
					</div>
					<div class=" col s6">
						<h3><?php echo Lang::get('communalService.report_tracking'); ?></h3>

						<?php if(!empty($tracking)): ?>
						<div class="table-wrapper">

							<table class="table-cityhub datatable-tracking bordered responsive-table">
								<thead>
								<tr>
									<th class="text-center"><?php echo Lang::get('touristInformation.header_id'); ?></th>
									<th><?php echo Lang::get('usersList.header_name'); ?></th>
									<th><?php echo Lang::get('communalService.header_action'); ?></th>
									<th class="col m2"><?php echo Lang::get('communalService.header_date_time'); ?></th>
								</tr>
								</thead>
								<tbody>
								<?php foreach($tracking as $track): ?>
								<tr>
									<td class="text-center"><?php echo $track->id; ?></td>
									<td><?php echo $track->first_name.' '.$track->last_name; ?></td>
									<td>
									<?php echo $track->action; ?>

										<?php if($track->action == 'delegated'): ?>
										<button type="button" class="btn btn-xs btn-warning" data-toggle="popover" data-placement="top" data-content="<?php echo $track->company_name; ?>"><span class="icon-swap-horiz"></span></button>
										<?php endif; ?>
										<?php if($track->action == 'edited'): ?>
                                        <?php
                                        $data = '<b>'.Lang::get('communalService.status').':</b> '.$track->status_change;
                                        $data .= "<br />";
                                        $data .= '<b>'.Lang::get('communalService.priority').':</b> '.$track->priority_change;
                                        ?>
										<button type="button" class="btn btn-xs btn-success" data-toggle="popover" data-placement="top" data-content="<?php echo $data; ?>">?</button>
										<?php endif; ?>
									</td>
									<td><?php echo $track->date; ?></td>
								</tr>
								<?php endforeach; ?>
								</tbody>
							</table>
						</div>
						<?php else: ?>
							<h5 class="text-center"><?php echo Lang::get('communalService.tracking_not_available'); ?></h5>
						<?php endif; ?>

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



<script>
var city_name = '<?php echo e($city->city_name); ?>';
var city_latitude = '<?php echo $city->city_center_latitude; ?>';
var city_longitude = '<?php echo $city->city_center_longitude; ?>';
var city_radius = '<?php echo $city->city_radius_from_center; ?>';
var coordinates = '<?php echo $city->coordinates; ?>';
var report_status = '<?php echo $report->status_id; ?>';
var report_latitude = '<?php echo $report->latitude; ?>';
var report_longitude = '<?php echo $report->longitude; ?>';

$(document).ready(function() {
	$.fn.dataTable.moment( 'D.M.Y, H:mm' );


} );
</script>
