<?php $__env->startSection('content'); ?>
<?php 
	if(old('cities') != "" && count(old('cities') > 0))
	{
		$oldCities = array();
		foreach(old('cities') as $key => $value)
		{
			$oldCities[$value] = $city_object->getName($value);
		}
	}
	elseif (count($cities) > 0)
	{
		$oldCities = array();
		foreach($cities as $key => $value)
		{
			$oldCities[$value->city] = $city_object->getName($value->city);
		}
	
	}
?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Channels</h1>
    	</div>
    </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                    
                    	<?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-heading">
                            Edit Headend
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
				                <!--     <form id="theForm" class="form-horizontal" role="form" method="POST" action="<?php echo e(url('admin/headends/add')); ?>"> -->
				                	<form class="form-horizontal" method="POST" action="<?php echo e(url('admin/headends/edit')); ?>">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<input type="hidden" name="headendID" value="<?php echo e($headend->id); ?>">
										
										<div class="form-group">
											<label class="col-md-3 control-label">Name</label>
											<div class="col-md-7">
												<input type="text" class="form-control" name="name" value="<?php echo e($headend->name); ?>" disabled>	
											</div>
										</div>
										<div class="form-group">
									        <label class="col-md-3 control-label">Cities</label>
									        <div class="col-md-7 component-mt-select"
									        	data-mt-max-tags="100"
									             data-mt-request-url="/uadmin/ajaxCities.php"
									              data-mt-tag-input-name="cities"
									              data-mt-default-values='<?php echo e(isset($oldCities) ? json_encode($oldCities) : "{}"); ?>'>
									          <input type="text" class="form-control" id="to-message" data-mt-filter-control/>
								        	</div>
								        </div>
										<div class="form-group">
											<div class="col-md-8 col-md-offset-3">
												<button type="submit" class="btn btn-primary">
													Save
												</button>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	<meta name="csrf-token" value="<?php echo e(csrf_token()); ?>">
	<script type="text/javascript" src="<?php echo e(url('mt-select/js/jquery.js')); ?>"></script>
	<script>
		$(function () {
		    $.ajaxSetup({
		        headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }
		    });
		});
	</script>
	<script type="text/javascript" src="<?php echo e(url('mt-select/js/jquery-mt-select.js')); ?>"></script>
  	<link rel="stylesheet" href="<?php echo e(url('mt-select/css/style.css')); ?>">
  	
  	<style>
  		.switch-field {
		  font-family: "Lucida Grande", Tahoma, Verdana, sans-serif;
		  padding: 40px;
		    overflow: hidden;
		}
		
		.switch-title {
		  margin-bottom: 6px;
		}
		
		.switch-field input {
		  display: none;
		}
		
		.switch-field label {
		  float: left;
		}
		
		.switch-field label {
		  display: inline-block;
		  width: 60px;
		  background-color: #e4e4e4;
		  color: rgba(0, 0, 0, 0.6);
		  font-size: 14px;
		  font-weight: normal;
		  text-align: center;
		  text-shadow: none;
		  padding: 6px 14px;
		  border: 1px solid rgba(0, 0, 0, 0.2);
		  -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
		  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
		  -webkit-transition: all 0.2s ease-in-out;
		  -moz-transition:    all 0.2s ease-in-out;
		  -ms-transition:     all 0.2s ease-in-out;
		  -o-transition:      all 0.2s ease-in-out;
		  transition:         all 0.2s ease-in-out;
		}
		
		.switch-field label:hover {
		    cursor: pointer;
		}
		
		.switch-field input:checked + label {
		  background-color: #3198df;
		  -webkit-box-shadow: none;
		  box-shadow: none;
		}
		
		.switch-field label:first-of-type {
		  border-radius: 4px 0 0 4px;
		}
		
		.switch-field label:last-of-type {
		  border-radius: 0 4px 4px 0;
		}
  	</style>
<?php $__env->stopSection(); ?>
			

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