<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header"><?php echo e($property_ticket->name); ?> (Completed)</h1>

    		<form id="theForm" class="form-horizontal" style="margin-bottom: 0px;" role="form" method="POST" enctype="multipart/form-data" action="<?php echo e(url('admin/properties/ticket/reinstate')); ?>">
				<div style="display: inline; float:right;">
					<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
					<input type="hidden" name="ticketID" value="<?php echo e($property_ticket->id); ?>">
					<button type="submit" class="btn btn-link" style="color:red; float:right;">
						Reinstate Ticket
					</button>
				</div>
			</form>
    	</div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <?php if(session('status')): ?>
			<div class="alert alert-success">
				<?php echo e(session('status')); ?>

			</div>
			<?php endif; ?>
			<?php if(count($errors) > 0): ?>
				<div class="alert alert-danger">
					<strong>Whoops!</strong> There were some problems with your input.<br><br>
					<ul>
						<?php foreach($errors->all() as $error): ?>
							<li><?php echo e($error); ?></li>
						<?php endforeach; ?>
					</ul>
				</div>
			<?php endif; ?>

			<?php if($property_ticket->assigned_user): ?>
			<div class="col-lg-2 section">
				<label>Assigned To</label>
				<p><?php echo e(App\User::find($property_ticket->assigned_user)['name']); ?></p>	
			</div>
			<?php endif; ?>
			<?php if($property_ticket->due_date): ?>
			<div class="col-lg-2 section">
				<label>Due Date</label>
				<p><?php echo e(date_create($property_ticket->due_date)->format('Y-m-d')); ?></p>	
			</div>
			<?php endif; ?>
			<?php if($property_ticket->priority): ?>
			<div class="col-lg-2 section">
				<label>Priority</label>
				<p><?php echo e(ucfirst($property_ticket->priority)); ?></p>	
			</div>
			<?php endif; ?>
			<div class="col-lg-2 section">
				<label>Property</label>
				<p><a target="_blank" href="<?php echo e(url('uadmin/properties/view/'.$property_ticket->property)); ?>"><?php echo e(App\Property::find($property_ticket->property)['name']); ?></a></p>
			</div>
			<div class="col-lg-12 section">
				<label>Instructions</label>
				<p><?php echo e($property_ticket->description); ?></p>	
			</div>
			<div class="col-lg-12">
				<label>Notes</label>
				<?php if($property_ticket->notes): ?>
				<p><?php echo e($property_ticket->notes); ?></p>
				<?php else: ?>
				<p>--</p>
				<?php endif; ?>
			</div>
			<div class="col-sm-12 section">
				<label>Images</label>
				<br/>
				<?php if(count($attachments)>0): ?>
				<div class="gallery">
				<?php foreach($attachments as $attachment): ?>
					<div class="gallery-image hover-shadow">
						<img class="img-button" src='<?php echo e(asset('uadmin/properties/tickets/images/'.$attachment->id)); ?>' data-toggle="modal" data-id="<?php echo e($attachment->id); ?>" data-target="#viewModal">
					</div>
				<?php endforeach; ?>
				</div>
				<?php else: ?>
				--
				<?php endif; ?>
			</div>
		</div>
	</div>

	<!-- View Image Modal -->
	<div id="viewModal" class="modal fade" role="dialog">
		<div class="modal-dialog">

			<!-- Modal content-->
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">&times;</button>
					<h4 class="modal-title">Image</h4>
				</div>
				<div class="modal-body img-fill">
					<img id="imageId" src=''>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				</div>
			</div>

		</div>
	</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	<style>
		.section{
			margin-bottom: 20px;
		}

.modal{
	padding-top: 100px;
}

.gallery img {
	height: 100%;
	width: auto;
	cursor: pointer;
}

.gallery{
    padding-bottom: 10px;
    overflow-y: hidden;
    overflow-x: auto;
    white-space: nowrap;
}

.gallery-image{
	display: inline-block;
	width:140px;
	height:140px;
	margin: 5px;
	overflow:hidden;
	text-align: center;
	image-orientation: from-image;
}

.hover-shadow:hover {
	box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
	transition: 0.3s;
}

.img-fill{
	display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#imageId{
	flex-shrink: 0;
    height: 100%;
    max-height: 500px;
    width: auto;
	image-orientation: from-image;
}
	</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom'); ?>
<script>
	$(document).on("click", ".img-button", function () {
    	var myImageId = $(this).data('id');
    	document.getElementById("imageId").src = window.location.origin+'/uadmin/properties/tickets/images/'+myImageId;
    	console.log(document.getElementById("imageId").src);
	});
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('residential.templates.uadmin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>