<?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);
		}
		
	}
	
	if(old('groups') != "" && count(old('groups') > 0))
	{
		$oldGroups = array();
		foreach(old('groups') as $key => $value)
		{
			$oldGroups[$value] = $group_object->getName($value);
		}
	}
	elseif (count($groups) > 0)
	{
		$oldGroups = array();
		foreach($groups as $key => $value)
		{
			$oldGroups[$value->group] = $group_object->getName($value->group);
		}
	
	}
	
	if(old('rall') != "" && count(old('rall') > 0))
	{
		$oldrall = array();
		foreach(old('rall') as $key => $value)
		{
			$oldrall[$value] = $addon_object->getName($value);
		}
	}
	elseif (count($rall) > 0)
	{
		$oldrall = array();
		foreach($rall as $key => $value)
		{
			$oldrall[$value->addon] = $addon_object->getName($value->addon);
		}
	
	}
	
	if(old('rone') != "" && count(old('rone') > 0))
	{
		$oldrone = array();
		foreach(old('rone') as $key => $value)
		{
			$oldrone[$value] = $addon_object->getName($value);
		}
	}
	elseif (count($rone) > 0)
	{
		$oldrone = array();
		foreach($rone as $key => $value)
		{
			$oldrone[$value->addon] = $addon_object->getName($value->addon);
		}
	
	}
	
	if(old('suggested') != "" && count(old('suggested') > 0))
	{
		$oldsuggested = array();
		foreach(old('suggested') as $key => $value)
		{
			$oldsuggested[$value] = $addon_object->getName($value);
		}
	}
	elseif (count($suggested) > 0)
	{
		$oldsuggested = array();
		foreach($suggested as $key => $value)
		{
			$oldsuggested[$value->addon] = $addon_object->getName($value->addon);
		}
	
	}
	
	
	?>



	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Services</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 Service
                        </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/services/edit')); ?>">
										<input type="hidden" id="tokenID" name="_token" value="<?php echo e(csrf_token()); ?>">
										<input type="hidden" id="serviceID" name="id" value="<?php echo e($service->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(old('name') ? old('name') : $service->name); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">Listed As</label>
											<div class="col-md-7">
												<input type="text" class="form-control" name="listing" value="<?php echo e(old('listing') ? old('listing') : $service->listing); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 col-md-3 col-lg-3 control-label switch-title">Service Type</label>
											<div class="col-sm-9 col-md-9 col-lg-2 switch-field">
												<input type="checkbox" class="form-control" id="switch_left" name="res" value="res" <?php echo e($service->type == 'res' || $service->type == 'both' ? 'checked' : ''); ?>>
												
												<label class="" for="switch_left" style="text-align: center;" title="Residential"><i class="fa fa-home"></i></label>
	
												<input type="checkbox" class="form-control" id="switch_right" name="bus" value="bus" <?php echo e($service->type == 'bus' || $service->type == 'both' ? 'checked' : ''); ?>>
													
												<label class="" for="switch_right" style="text-align: center;" title="Business"><i class="fa fa-building"></i></label>
											</div>

											<label class="col-sm-3 col-md-3 col-lg-2 control-label switch-title">Billing Type</label>
											<div class="col-sm-9 col-md-9 col-lg-2 switch-field">
												<input type="radio" class="form-control" id="switch_left2" name="billing_type" value="monthly" <?php echo e($service->billing_type == 'monthly' ? 'checked' : ''); ?>>
												
												<label class="" for="switch_left2" style="text-align: center;" title="Monthly"><i class="fa fa-retweet"></i></label>
	
												<input type="radio" class="form-control" id="switch_right2" name="billing_type" value="once" <?php echo e($service->billing_type == 'once' ? 'checked' : ''); ?>>
													
												<label class="" for="switch_right2" style="text-align: center;" title="One Time"><i class="fa fa-clock-o"></i></label>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">Price</label>
											<div class="col-md-3">
												<input type="text" class="form-control" name="price" value="<?php echo e(old('price') ? old('price') : $service->price); ?>">	
											</div>
											<label class="col-md-1 control-label">Priority</label>
											<div class="col-md-3">
												<input type="number" class="form-control" name="priority" value="<?php echo e(old('priority') ? old('priority') : $service->priority); ?>" min="0" step="1">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">Bundle Multiplier</label>
											<div class="col-md-3">
												<input type="number" min="0" step=".5" class="form-control" name="multiplier" value="<?php echo e(old('multiplier') ? old('multiplier') : $service->multiplier); ?>">	
											</div>
											<label class="col-md-1 control-label">Quantity</label>
											<div class="col-md-3">
												<input type="checkbox" class="xform-control" name="qty_control" value="1"
												<?php if($service->qty_control): ?>
												checked
												<?php endif; ?>
												>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-3 control-label">Description</label>
											<div class="col-md-7">
												<textarea rows="2" name="description" class="form-control"><?php echo e(old('description') ? old('description') : $service->description); ?></textarea>
											</div>
										</div>
										<div class="form-group">
								          <label class="col-md-3 control-label">Requires All</label>
								          <div class="col-md-7 component-mt-select"
								               data-mt-max-tags="100"
								               data-mt-request-url="/uadmin/ajaxAddons.php"
								               data-mt-tag-input-name="rall"
								               data-mt-default-values='<?php echo e(isset($oldrall) ? json_encode($oldrall) : "{}"); ?>'>
								            <input type="text" class="form-control" id="addons_input" data-mt-filter-control/>
								          </div>
								        </div>
								        <div class="form-group">
								          <label class="col-md-3 control-label">Requires One</label>
								          <div class="col-md-7 component-mt-select"
								               data-mt-max-tags="100"
								               data-mt-request-url="/uadmin/ajaxAddons.php"
								               data-mt-tag-input-name="rone"
								               data-mt-default-values='<?php echo e(isset($oldrone) ? json_encode($oldrone) : "{}"); ?>'>
								            <input type="text" class="form-control" id="addons_input" data-mt-filter-control/>
								          </div>
								        </div>
								        <div class="form-group">
								          <label class="col-md-3 control-label">Suggested</label>
								          <div class="col-md-7 component-mt-select"
								               data-mt-max-tags="100"
								               data-mt-request-url="/uadmin/ajaxAddons.php"
								               data-mt-tag-input-name="suggested"
								               data-mt-default-values='<?php echo e(isset($oldsuggested) ? json_encode($oldsuggested) : "{}"); ?>'>
								            <input type="text" class="form-control" id="addons_input" data-mt-filter-control/>
								          </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">
								          <label class="col-md-3 control-label">Groups</label>
								          <div class="col-md-7 component-mt-select"
								               data-mt-max-tags="100"
								               data-mt-request-url="/uadmin/ajaxGroups.php"
								               data-mt-tag-input-name="groups"
								               data-mt-default-values='<?php echo e(isset($oldGroups) ? json_encode($oldGroups) : "{}"); ?>'>
								            <input type="text" class="form-control" 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(); ?>