<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Notifications</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; ?>
						<?php 
						//print_r($records);
						$record = new stdClass; 
						$record->id = $records['member_id']; 
						$record->email = $records['email'];
						$record->first_name = array_key_exists('first_name', $records['fields']) ? $records['fields']['first_name'] : '';
						$record->last_name = array_key_exists('last_name', $records['fields']) ? $records['fields']['last_name'] : '';
						$record->company_name = array_key_exists('company_name', $records['fields']) ? $records['fields']['company_name'] : (array_key_exists('company', $records['fields']) ? $records['fields']['company'] : '');
						$record->address = array_key_exists('address', $records['fields']) ? $records['fields']['address'] : '';
						$record->city = array_key_exists('city', $records['fields']) ? $records['fields']['city'] : '';
						$record->state = array_key_exists('state', $records['fields']) ? $records['fields']['state'] : '';
						$record->postal_code = array_key_exists('postal_code', $records['fields']) ? $records['fields']['postal_code'] : '';
						$record->phone = array_key_exists('phone', $records['fields']) ? $records['fields']['phone'] : '';
						$record->account = array_key_exists('account-', $records['fields']) ? $records['fields']['account-'] : '';
						$record->connection_type = array_key_exists('connection-type', $records['fields']) ? $records['fields']['connection-type'] : '';
						$record->account_exec = array_key_exists('account-exec', $records['fields']) ? $records['fields']['account-exec'] : '';
						$record->region = array_key_exists('region', $records['fields']) ? $records['fields']['region'] : '';
						$record->start_date = array_key_exists('start-date', $records['fields']) ? $records['fields']['start-date'] : '';
						
						$technical = false;
						$business = false;
						foreach($groups as $group)
						{
							if($group['member_group_id'] == '4970139')
							{
								$business = true;
							}
							if($group['member_group_id'] == '2003838')
							{
								$technical = true;
							}
						}

						?>
						<div class="panel-heading">
							Edit Record
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
				                    <form class="form-horizontal" role="form" method="POST" action="<?php echo e(url('admin/emma/edit')); ?>">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<input type="hidden" name="emmaID" value="<?php echo e($record->id); ?>">
										<?php if($technical): ?>
											<input type="hidden" name="type" value="technical">
										<?php else: ?>
											<input type="hidden" name="type" value="business">
										<?php endif; ?>

										<div class="form-group">
											<label class="col-md-2 control-label">Email</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="email" value="<?php echo e(old('email') ? old('email') : $record->email); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">First Name</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="first_name" value="<?php echo e(old('first_name') ? old('first_name') : $record->first_name); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Last Name</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="last_name" value="<?php echo e(old('last_name') ? old('last_name') : $record->last_name); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Company Name</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="company_name" value="<?php echo e(old('company_name') ? old('company_name') : $record->company_name); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Address</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="address" value="<?php echo e(old('address') ? old('address') : $record->address); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">City</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="city" value="<?php echo e(old('city') ? old('city') : $record->city); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">State</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="state" value="<?php echo e(old('state') ? old('state') : $record->state); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Zip Code</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="postal_code" value="<?php echo e(old('postal_code') ? old('postal_code') : $record->postal_code); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Phone</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="phone" value="<?php echo e(old('phone') ? old('phone') : $record->phone); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Account #</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="account" value="<?php echo e(old('account') ? old('account') : $record->account); ?>">	
											</div>
										</div>

												<input type="hidden" class="form-control" name="connection_type" value="Business">	

										<div class="form-group">
											<label class="col-md-2 control-label">Account Exec</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="account_exec" value="<?php echo e(old('account_exec') ? old('account_exec') : $record->account_exec); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Region</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="region" value="<?php echo e(old('region') ? old('region') : $record->region); ?>">	
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 control-label">Start Date</label>
											<div class="col-md-8">
												<input type="text" class="form-control" name="start_date" value="<?php echo e(old('start_date') ? old('start_date') : $record->start_date); ?>">	
											</div>
										</div>
										
										
										<div class="form-group">
											<div class="col-md-6 col-md-offset-0">
												<button type="submit" class="btn btn-primary">
													<i class="fa fa-cloud-upload fa-fw"></i> Save 
												</button>
											</div>
										</div>
									</form>
									                            <form class="form-horizontal" role="form" method="POST" action="<?php echo e(url('admin/emma/remove')); ?>" onsubmit="return confirm('Are you sure you want to permanently remove this record?')">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<input type="hidden" name="emmaID" value="<?php echo e($record->id); ?>">
										<div class="form-group">
											
											<div class="col-md-6 col-md-offset-0">
												<button type="submit" class="btn btn-primary" style="">
                                            			<i class="fa fa-trash-o fa-fw"></i> Remove 
                                            	</button>
											</div>
										</div>
							</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>


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

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

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