<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Maintenance Tickets</h1>
    	</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; ?>
			<div class="panel panel-default">
				<div class="panel-heading">
                    Edit Maintenance Ticket
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-12">
		                    <form id="theForm" class="form-horizontal" role="form" method="POST" enctype="multipart/form-data" action="<?php echo e(url('admin/properties/ticket/edit')); ?>">
								<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
								<input type="hidden" name="ticketID" value="<?php echo e($property_ticket->id); ?>">

								<?php if(isset($property_ticket->property_log)): ?>
								<input type="hidden" name="property_log" value="<?php echo e($property_ticket->property_log); ?>">
								<?php endif; ?>

								<?php if(isset($property_ticket->property_schedule)): ?>
								<input type="hidden" name="property_schedule" value="<?php echo e($property_ticket->property_schedule); ?>">
								<?php endif; ?>

								<div class="form-group">

									<div class="col-sm-12 col-md-12" style="margin-bottom: 10px;">

										<div class="col-sm-12 col-md-4 input-item" onclick="inputFocus('name')">
											<input type="text" step="1" class="form-control" id="name" name="name" value="<?php echo e($property_ticket->name); ?>" title="name">
											<span id="name-label" class="label-text">Ticket Name*</span>
										</div>
									</div>

									<div class="col-sm-12 col-md-12">
										<div class="col-sm-12 col-md-2 morePadding morePadding2" onchange="handleType();" onclick="inputFocus('priority')">
											<select class="form-control" id="priority" name="priority"  title="priority" value="<?php echo e($property_ticket->priority); ?>">
												<option value="Low" <?php echo e($property_ticket->priority == 'low' ? 'selected' : ''); ?>>Low</option>
												<option value="Medium" <?php echo e($property_ticket->priority == 'medium' ? 'selected' : ''); ?>>Medium</option>
												<option value="High" <?php echo e($property_ticket->priority == 'high' ? 'selected' : ''); ?>>High</option>
											</select>
											<span id="priority-label" class="xlabel-text hasValue">Priority</span>	
										</div>

										<div class="col-sm-12 col-md-2 morePadding morePadding2" onchange="handleType();" onclick="inputFocus('assigned_user')">
											<select class="form-control" id="assigned_user" name="assigned_user"  title="assigned_user" value="<?php echo e($property_ticket->assigned_user); ?>">
												<option value=" ">Select One</option>
												
												<?php foreach($users as $user): ?>
													
													<option value="<?php echo e($user->id); ?>" <?php echo e($property_ticket->assigned_user == $user->id ? 'selected' : ''); ?>><?php echo e($user->name); ?></option>
												
												<?php endforeach; ?>
											</select>
											<span id="assigned_user-label" class="xlabel-text hasValue">Assign Employee</span>	
										</div>
									</div>
								</div>

								<div class="form-group">
									<div class="col-sm-12 col-md-12" style="margin-bottom: 20px;">
										<label class="label-control col-sm-12 col-md-12" style="margin-bottom: -5px;">What needs to be done?</label>
										<div class="col-sm-12 col-md-12 morePadding morePadding2" onclick="inputFocus('description')">
											<textarea class="form-control" style="max-width: 100%; height:200px;" id="description" name="description" title="Description" placeholder="Description"><?php echo e($property_ticket->description); ?></textarea>
										</div>
									</div>

									<div class="col-sm-12 col-md-12">
										<div class="col-sm-12 col-md-3 input-item" id="due_date_container" onclick="inputFocus('due_date')">
											<input type="text" class="form-control date" id="due_date" name="due_date" value="<?php echo e($property_ticket->due_date ? date_create($property_ticket->due_date)->format('Y-m-d') : ''); ?>" title="Due Date" autocomplete="off">
											<span id="due_date-label" class="label-text">Due Date</span>	
										</div>
									</div>
								</div>

								<div class="form-group">
									<div class="col-sm-12 col-md-12 morePadding"  style="text-align: right;">
										<button type="submit" value="pass" class="btn btn-primary">
											Save
										</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	
	<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/jquery.timepicker.css')); ?>" />
	<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/bootstrap-datepicker3.min.css')); ?>" />

	<style>
		input:focus+.label-text, input:not([value=""])+.label-text, select+.label-text {
		    font-weight: normal;
		    padding: 0;
		    padding-left: 20px;
		    -webkit-transform: translateY(-2rem) scale(.7);
		    transform: translateY(-2rem) scale(.7);
		}
		input+.label-text, select+.label-text, .hasValue{
		    font-size: 1.5rem;
		    font-weight: 400;
		    position: absolute;
		    top: 0;
		    left: 0;
		    display: block;

		    padding-left: 20px;
		    padding-top: 5px;
		    padding-bottom: 5px;
		    opacity: .8;
		    transition: all .3s ease-out,opacity 150ms ease .3s;
		    -webkit-transform: translateY(0) scale(1);
		    transform: translateY(0) scale(1);
		    -webkit-transform-origin: left top;
		    transform-origin: left top;
		}
		span {
		    font-size: 1rem;
		    font-weight: 600;
		    display: block;
		    padding-top: .25rem;
		    padding-bottom: .25rem;
		    margin-left: 1rem;
		    color: #317aba;
		}
		.hasValue
		{
		    font-weight: normal;
		    padding: 0;
		    padding-left: 20px;
		    -webkit-transform: translateY(-2rem) scale(.7);
		    transform: translateY(-2rem) scale(.7);
		}
		

		@media (max-width: 959px)
		{
			.morePadding {
			    margin-top: 1.5em;
			}
		}

		@media (min-width: 960px)
		{
			.morePadding {
			    margin-top: 1em;
			}
		}
		
    	a:hover{
    		text-decoration: none;
    	}
    	.odd .subBack {
    		background-color: #f0fcff;
    	}
    	.even .subBack {
    		background-color: #ecf7fa;
    	}
    	.floatLeft
    	{
    		float: left;
    	}

    	.checkbox-item{
    		padding-top: 7px;
    	}

    	.no-bold{
    		font-weight: normal;
    	}

    	.input-item{
    		padding-bottom: 0px;
    	}

    	@media (max-width: 991px)
		{
			.input-item{
	    		margin-top: 20px;
	    	}
		}

    	@media (min-width: 992px)
		{
			.input-item{
	    		margin-top: 12px;
	    	}
		}
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom'); ?>

	<script src="<?php echo e(asset('js/jquery.datepair.min.js')); ?>"></script>
	<script src="<?php echo e(asset('js/bootstrap-datepicker.min.js')); ?>"></script>
	<script src="<?php echo e(asset('js/jquery.timepicker.min.js')); ?>"></script>

<script>
	
	$('.form-control').each(function() {
	   var elem = $(this);

	   // Save current value of element
	   elem.data('oldVal', elem.val());

	   // Look for changes in the value
	   elem.bind("propertychange change click keyup input paste", function(event){
	      // If value has changed...
	      if (elem.data('oldVal') != elem.val()) {
	       // Updated stored value
	       elem.data('oldVal', elem.val());
	       var elem2 = $('#'+elem.attr('id')+"-label");
	       elem2.addClass('hasValue');
	       elem2.removeClass('label-text');
	       if(elem.val() == "")
	       {
	    	   elem2.addClass('label-text');
		       elem2.removeClass('hasValue');
	       }
	     }
	   });
	 });

	function inputFocus(id)
	{
		document.getElementById(id).focus();
	}

	$('#due_date_container .date').datepicker({
        'format': 'yyyy-m-d',
        'autoclose': true
    });

</script>

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

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