 
<?php $__env->startSection('content'); ?>
	<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Projects</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">
                            New Project v1.1 <?php echo isset($project) ? "<span style='display: inline; float: right; color: red;'>Please make sure autofilled data below is correct.</span>" : ''; ?>

                        </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/projects/add')); ?>" onsubmit="noDouble();">
										<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
										<div class="form-group">
											<label class="control-label col-sm-12 col-md-12 morePadding morePadding2" id="company_name-custom-label">Company Name</label>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('company_name')">
												<input type="text" class="form-control" id="company_name" name="company_name" value="<?php echo e(old('company_name') ? old('company_name') : (isset($project) ? $project->company_name : '')); ?>" title="Company Name">
													
											</div>
											<div class="col-sm-12 col-md-8 morePadding morePadding2">
												&nbsp;
											</div>
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('title')">
												<input type="text" class="form-control" id="title" name="title" value="<?php echo e(old('title')); ?>" title="Project Title">
												<span id="title-label" class="label-text">Project Title</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('order_type')">
												<select class="form-control" id="order_type" name="order_type"  title="Order Type">
													<option id="order_type_option"></option>
													<option value="new"
													<?php if(old('order_type') == 'new'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>New</option>
													<option value="upgrade"
													<?php if(old('order_type') == 'upgrade'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Upgrade</option>
													<option value="renewal"
													<?php if(old('order_type') == 'renewal'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Renewal</option>
													<option value="upgrade-and-renewal"
													<?php if(old('order_type') == 'upgrade-and-renewal'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Upgrade & Renewal</option>
													<option value="move"
													<?php if(old('order_type') == 'move'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Move</option>
													<option value="disconnect"
													<?php if(old('order_type') == 'disconnect'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Disconnect</option>
													<option value="add"
													<?php if(old('order_type') == 'add'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Add</option>
													<option value="change"
													<?php if(old('order_type') == 'change'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Change</option>
													<option value="misc"
													<?php if(old('order_type') == 'misc'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Misc.</option>
													<option value="nni"
													<?php if(old('order_type') == 'nni'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Type 2 (NNI)</option>
													
												</select>
												<span id="order_type-label" 
												<?php if(old('order_type')): ?>
												class="xlabel-text hasValue"
												<?php else: ?>
												class="label-text"
												<?php endif; ?>
												>Order Type</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('customer_type')">
												<select class="form-control" id="customer_type" name="customer_type"  title="Customer Type">
													<option id="customer_type_option"></option>
													<option value="business"
													<?php if(old('customer_type') == 'business' || (isset($project) && $project->customer_type == 'business')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Business</option>
													<option value="education"
													<?php if(old('customer_type') == 'education' || (isset($project) && $project->customer_type == 'education')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Education</option>
													<option value="healthcare"
													<?php if(old('customer_type') == 'healthcare' || (isset($project) && $project->customer_type == 'healthcare')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Healthcare</option>
													<option value="government"
													<?php if(old('customer_type') == 'government' || (isset($project) && $project->customer_type == 'government')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Government</option>
													<option value="wholesale"
													<?php if(old('customer_type') == 'wholesale' || (isset($project) && $project->customer_type == 'wholesale')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Wholesale</option>
													<option value="residential"
													<?php if(old('customer_type') == 'residential' || (isset($project) && $project->customer_type == 'residential')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Residential</option>
													<option value="internal"
													<?php if(old('customer_type') == 'internal' || (isset($project) && $project->customer_type == 'internal')): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Internal</option>
												</select>
												<span id="customer_type-label" 
												<?php if(old('customer_type') || (isset($project) && $project->customer_type != '')): ?>
												class="xlabel-text hasValue"
												<?php else: ?>
												class="label-text"
												<?php endif; ?>
												>Customer Type</span>	
											</div>	
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('sales_exec')">
												<input type="text" class="form-control" id="sales_exec" name="sales_exec" value="<?php echo e(old('sales_exec')); ?>" title="Sales Executive">
												<span id="sales_exec-label" class="label-text">Sales Executive</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('contract_term')">
												<input type="number" min="0" step="1" class="form-control" id="contract_term" name="contract_term" value="<?php echo e(old('contract_term')); ?>" title="Contract Term (Months)">
												<span id="contract_term-label" class="label-text">Contract Term</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" id="date_sold_container" onclick="inputFocus('date_sold')">
												<input type="text" class="form-control date" id="date_sold" name="date_sold" value="<?php echo e(old('date_sold')); ?>" title="Date Sold">
												<span id="date_sold-label" class="label-text">Date Sold</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" id="desired_due_date_container" onclick="inputFocus('desired_due_date')">
												<input type="text" class="form-control date" id="desired_due_date" name="desired_due_date" value="<?php echo e(old('desired_due_date')); ?>" title="Desired Due Date">
												<span id="desired_due_date-label" class="label-text">Desired Due Date</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" id="ready_to_bill_container" onclick="inputFocus('ready_to_bill')">
												<input type="text" class="form-control date" id="ready_to_bill" name="ready_to_bill" value="<?php echo e(old('ready_to_bill')); ?>" title="Ready To Bill Date">
												<span id="ready_to_bill-label" class="label-text">Ready To Bill Date</span>	
											</div>
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('client_primary_contact')">
												<input type="text" class="form-control" id="client_primary_contact" name="client_primary_contact" value="<?php echo e(old('client_primary_contact') ? old('client_primary_contact') : (isset($project) ? $project->client_primary_contact : '')); ?>" title="Client Primary Contact">
												<span id="client_primary_contact-label" class="label-text">Client Primary Contact</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('contact_phone_number')">
												<input type="text" class="form-control" id="contact_phone_number" name="contact_phone_number" value="<?php echo e(old('contact_phone_number') ? old('contact_phone_number') : (isset($project) ? $project->contact_phone_number : '')); ?>" title="Contact Phone Number">
												<span id="contact_phone_number-label" class="label-text">Contact Phone #</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('contact_primary_email')">
												<input type="email" class="form-control" id="contact_primary_email" name="contact_primary_email" value="<?php echo e(old('contact_primary_email') ? old('contact_primary_email') : (isset($project) ? $project->contact_primary_email : '')); ?>" title="Contact Primary Email">
												<span id="contact_primary_email-label" class="label-text">Contact Primary Email</span>	
											</div>
											     
    
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('technical_contact')">
												<input type="text" class="form-control" id="technical_contact" name="technical_contact" value="<?php echo e(old('technical_contact') ? old('technical_contact') : (isset($project) ? $project->technical_contact : '')); ?>" title="Technical Contact">
												<span id="technical_contact-label" class="label-text">Technical Contact</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('technical_phone_number')">
												<input type="text" class="form-control" id="technical_phone_number" name="technical_phone_number" value="<?php echo e(old('technical_phone_number') ? old('technical_phone_number') : (isset($project) ? $project->technical_phone_number : '')); ?>" title="Technical Phone Number">
												<span id="technical_phone_number-label" class="label-text">Technical Phone #</span>	
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('technical_email')">
												<input type="email" class="form-control" id="technical_email" name="technical_email" value="<?php echo e(old('technical_email') ? old('technical_email') : (isset($project) ? $project->technical_email : '')); ?>" title="Technical Email">
												<span id="technical_email-label" class="label-text">Technical Email</span>	
											</div>
											

										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('directory_phone')">
												<input type="text" class="form-control" id="directory_phone" name="directory_phone" value="<?php echo e(old('directory_phone') ? old('directory_phone') : (isset($project) ? $project->directory_phone : '')); ?>" title="Directory Phone Number">
												<span id="directory_phone-label" class="label-text">Directory Phone #</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('directory_address')">
												<input type="text" class="form-control" id="directory_address" name="directory_address" value="<?php echo e(old('directory_address') ? old('directory_address') : (isset($project) ? $project->directory_address : '')); ?>" title="Directory Address">
												<span id="directory_address-label" class="label-text">Directory Address</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('directory_city')">
												<input type="text" class="form-control" id="directory_city" name="directory_city" value="<?php echo e(old('directory_city') ? old('directory_city') : (isset($project) ? $project->directory_city : '')); ?>" title="Directory City">
												<span id="directory_city-label" class="label-text">City</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('directory_state')">
												<input type="text" class="form-control" id="directory_state" name="directory_state" value="<?php echo e(old('directory_state') ? old('directory_state') : (isset($project) ? $project->directory_state : '')); ?>" title="Directory State">
												<span id="directory_state-label" class="label-text">State</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('directory_zip')">
												<input type="text" class="form-control" id="directory_zip" name="directory_zip" value="<?php echo e(old('directory_zip') ? old('directory_zip') : (isset($project) ? $project->directory_zip : '')); ?>" title="Directory ZIP">
												<span id="directory_zip-label" class="label-text">ZIP</span>	
											</div>
										</div>
										<div class="form-group">
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('billing_attention')">
												<input type="text" class="form-control" id="billing_attention" name="billing_attention" value="<?php echo e(old('billing_attention') ? old('billing_attention') : (isset($project) ? $project->billing_attention : '')); ?>" title="Billing Attention">
												<span id="billing_attention-label" class="label-text">Billing Attention</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('billing_address')">
												<input type="text" class="form-control" id="billing_address" name="billing_address" value="<?php echo e(old('billing_address') ? old('billing_address') : (isset($project) ? $project->billing_address : '')); ?>" title="Billing Address">
												<span id="billing_address-label" class="label-text">Billing Address</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('billing_city')">
												<input type="text" class="form-control" id="billing_city" name="billing_city" value="<?php echo e(old('billing_city') ? old('billing_city') : (isset($project) ? $project->billing_city : '')); ?>" title="Billing City">
												<span id="billing_city-label" class="label-text">City</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('billing_state')">
												<input type="text" class="form-control" id="billing_state" name="billing_state" value="<?php echo e(old('billing_state') ? old('billing_state') : (isset($project) ? $project->billing_state : '')); ?>" title="Billing State">
												<span id="billing_state-label" class="label-text">State</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('billing_zip')">
												<input type="text" class="form-control" id="billing_zip" name="billing_zip" value="<?php echo e(old('billing_zip') ? old('billing_zip') : (isset($project) ? $project->billing_zip : '')); ?>" title="Billing ZIP">
												<span id="billing_zip-label" class="label-text">ZIP</span>	
											</div>
										</div>
										<div class="form-group">


											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('building_type')">
												<select class="form-control" id="building_type" name="building_type"  title="building Type">
													<option id="building_type_option"></option>
													<option value="Single Tenant"
													<?php if(old('building_type') == 'Single Tenant'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Single Tenant</option>
													<option value="Multi-Tenant"
													<?php if(old('building_type') == 'Multi-Tenant'): ?> 
														<?php echo e('selected'); ?> 
													<?php endif; ?>
													>Multi-Tenant</option>
													
												</select>
												<span id="building_type-label" 
												<?php if(old('building_type')): ?>
												class="xlabel-text hasValue"
												<?php else: ?>
												class="label-text"
												<?php endif; ?>
												>Building Type</span>	
											</div>

											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('service_address')">
												<input type="text" class="form-control" id="service_address" name="service_address" value="<?php echo e(old('service_address') ? old('service_address') : (isset($project) ? $project->service_address : '')); ?>" title="Service Street Address">
												<span id="service_address-label" class="label-text">Service Address</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('service_city')">
												<input type="text" class="form-control" id="service_city" name="service_city" value="<?php echo e(old('service_city') ? old('service_city') : (isset($project) ? $project->service_city : '')); ?>" title="Service City">
												<span id="service_city-label" class="label-text">City</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('service_state')">
												<input type="text" class="form-control" id="service_state" name="service_state" value="<?php echo e(old('service_state') ? old('service_state') : (isset($project) ? $project->service_state : '')); ?>" title="Service State">
												<span id="service_state-label" class="label-text">State</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('service_zip')">
												<input type="text" class="form-control" id="service_zip" name="service_zip" value="<?php echo e(old('service_zip') ? old('service_zip') : (isset($project) ? $project->service_zip : '')); ?>" title="Service ZIP">
												<span id="service_zip-label" class="label-text">ZIP</span>	
											</div>
										</div>
										<div class="form-group" id="checkbox_911_container">
											<div class="col-sm-12 col-md-12 XmorePadding morePadding2" onclick="" style="color: gray;">
												<input type="checkbox" class="Xform-control" id="is_911" name="service_as_911" value="1" title="911 Address" onchange="enter911()" <?php echo e(old('service_as_911') != 1 ? '' : 'checked'); ?>

												
												>
												911 Address Required
											</div>
										</div>
										
										<div class="form-group" id="address_911_container" style="display: none;"
										>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('county_code_911')">
												<input type="text" class="form-control" id="county_code_911" name="county_code_911" value="<?php echo e(old('county_code_911')); ?>" title="911 County Code">
												<span id="county_code_911-label" class="label-text">911 County Code</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('address_911')">
												<input type="text" class="form-control" id="address_911" name="address_911" value="<?php echo e(old('address_911')); ?>" title="911 Address">
												<span id="address_911-label" class="label-text">Address</span>	
											</div>
											<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('city_911')">
												<input type="text" class="form-control" id="city_911" name="city_911" value="<?php echo e(old('city_911')); ?>" title="911 City">
												<span id="city_911-label" class="label-text">City</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('state_911')">
												<input type="text" class="form-control" id="state_911" name="state_911" value="<?php echo e(old('state_911')); ?>" title="911 State">
												<span id="state_911-label" class="label-text">State</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('zip_911')">
												<input type="text" class="form-control" id="zip_911" name="zip_911" value="<?php echo e(old('zip_911')); ?>" title="911 ZIP">
												<span id="zip_911-label" class="label-text">ZIP</span>	
											</div>
										</div>
										<?php if(old('service_as_911')): ?>
										<script>$( document ).ready(function() { enter911(); });</script>
										<?php endif; ?>
										<div class="form-group" id="checkbox_construction_container">
											<div class="col-sm-12 col-md-12 XmorePadding morePadding2" onclick="" style="color: gray;">
												<input type="checkbox" class="Xform-control" id="construction_required" name="construction_required" value="1" title="Construction Required" onchange="showConstruction()" <?php echo e(old('construction_required') == 1 ? 'checked' : ''); ?>>
												Construction Required
											</div>
										</div>
										<?php if(old('construction_required')): ?>
										<script>$( document ).ready(function() { showConstruction(); });</script>
										<?php endif; ?>
										<div id="construction_container" style="display: none;">
											<div class="form-group" id="construction_group1">
												<div class="col-sm-2 col-md-1 morePadding morePadding2" >
													<div class="btn btn-primary" style="opacity: .5;"><i class="fa fa-minus"></i></div>
												</div>
												<div class="col-sm-12 col-md-9 morePadding morePadding2" id="construction_loc_container1" onclick="inputFocus('construction_location1')">
													<input type="text" class="form-control" id="construction_location1" name="construction_location[1]" value="<?php echo e(old('construction_location')[1]); ?>" title="Construction Location 1">
													<span id="construction_location1-label" class="label-text">Construction Location</span>	
												</div>
												<div class="col-sm-12 col-md-2 morePadding morePadding2" id="construction_est_container1" onclick="inputFocus('construction_build_estimate1')">
													<input type="number" step=".001" class="form-control" id="construction_build_estimate1" name="construction_build_estimate[1]" value="<?php echo e(old('construction_build_estimate')[1]); ?>" title="Construction Build Estimate 1" onchange="estimateTotal()">
													<span id="construction_build_estimate1-label" class="label-text">Build Estimate</span>	
												</div>
												<div class="col-sm-2 col-md-1 morePadding morePadding2" >
													
												</div>
												<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_contact1')">
													<input type="text" class="form-control" id="building_contact1" name="building_contact[1]" value="<?php echo e(old('building_contact')[1]); ?>" title="Building Contact 1">
													<span id="building_contact1-label" class="label-text">Building Contact</span>	
												</div>
												<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_phone_number1')">
													<input type="text" class="form-control" id="building_phone_number1" name="building_phone_number[1]" value="<?php echo e(old('building_phone_number')[1]); ?>" title="Building Phone Number 1">
													<span id="building_phone_number1-label" class="label-text">Phone #</span>	
												</div>
												<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_email1')">
													<input type="email" class="form-control" id="building_email1" name="building_email[1]" value="<?php echo e(old('building_email')[1]); ?>" title="Building Email 1">
													<span id="building_email1-label" class="label-text">Email</span>	
												</div>
												
											</div>
											<?php for($i = 2;$i<=30;$i++):?>
												<div class="form-group" id="construction_group<?php echo e($i); ?>"
												<?php if(!old('construction_location')[$i]): ?>
												style="display: none;"
												<?php endif; ?> 
												>
													<div class="col-sm-2 col-md-1 morePadding morePadding2" >
														<div class="btn btn-primary" onclick="removeConstruction(<?php echo e($i); ?>)"><i class="fa fa-minus"></i></div>
													</div>
													<div class="col-sm-12 col-md-9 morePadding morePadding2" id="construction_loc_container<?php echo e($i); ?>" onclick="inputFocus('construction_location<?php echo e($i); ?>')">
														<input type="text" class="form-control" id="construction_location<?php echo e($i); ?>" name="construction_location[<?php echo e($i); ?>]" value="<?php echo e(old('construction_location')[$i]); ?>" title="Construction Location <?php echo e($i); ?>">
														<span id="construction_location<?php echo e($i); ?>-label" class="label-text">Construction Location</span>	
													</div>
													<div class="col-sm-12 col-md-2 morePadding morePadding2" id="construction_est_container<?php echo e($i); ?>" onclick="inputFocus('construction_build_estimate<?php echo e($i); ?>')">
														<input type="number" step=".001" class="form-control" id="construction_build_estimate<?php echo e($i); ?>" name="construction_build_estimate[<?php echo e($i); ?>]" value="<?php echo e(old('construction_build_estimate')[$i]); ?>" title="Construction Build Estimate <?php echo e($i); ?>" onchange="estimateTotal()">
														<span id="construction_build_estimate<?php echo e($i); ?>-label" class="label-text">Build Estimate</span>	
													</div>
													<div class="col-sm-2 col-md-1 morePadding morePadding2" >
														
													</div>
													<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_contact<?php echo e($i); ?>')">
														<input type="text" class="form-control" id="building_contact<?php echo e($i); ?>" name="building_contact[<?php echo e($i); ?>]" value="<?php echo e(old('building_contact')[$i]); ?>" title="Building Contact <?php echo e($i); ?>">
														<span id="building_contact<?php echo e($i); ?>-label" class="label-text">Building Contact</span>	
													</div>
													<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_phone_number<?php echo e($i); ?>')">
														<input type="text" class="form-control" id="building_phone_number<?php echo e($i); ?>" name="building_phone_number[<?php echo e($i); ?>]" value="<?php echo e(old('building_phone_number')[$i]); ?>" title="Building Phone Number <?php echo e($i); ?>">
														<span id="building_phone_number<?php echo e($i); ?>-label" class="label-text">Phone #</span>	
													</div>
													<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('building_email<?php echo e($i); ?>')">
														<input type="email" class="form-control" id="building_email<?php echo e($i); ?>" name="building_email[<?php echo e($i); ?>]" value="<?php echo e(old('building_email')[$i]); ?>" title="Building Email <?php echo e($i); ?>">
														<span id="building_email<?php echo e($i); ?>-label" class="label-text">Email</span>	
													</div>

												</div>
												<?php endfor; ?>
											<div class="form-group">
												<div class="col-sm-12 col-md-10 morePadding morePadding2" >
													<div class="btn btn-primary" onclick="addConstruction()"><i class="fa fa-plus"></i></div>
												</div>
												<label class="xcontrol-label col-sm-6 col-md-1">Estimate Total</label>
												<i class="xcontrol-label col-sm-6 col-md-1" style="text-align: right;" id="estimate_total">$0.00</i>
											</div>
										</div>
										<div class="form-group" id="checkbox_nni_container">
											<div class="col-sm-12 col-md-12 XmorePadding morePadding2" onclick="" style="color: gray;">
												<input type="checkbox" class="Xform-control" id="is_nni" name="nni" value="1" title="NNI" onchange="showNNI()" <?php echo e(old('nni') == 1 ? 'checked' : ''); ?>>
												NNI
											</div>
										</div>
										
										<div id="nni_container" style="display: none;">
											<div class="form-group" id="nni_group1"
											>
												<div class="col-sm-2 col-md-1 morePadding morePadding2" >
													<div class="btn btn-primary" style="opacity: .5;"><i class="fa fa-minus"></i></div>
												</div>
												<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('nni_service_address1')">
													<input type="text" class="form-control" id="nni_service_address1" name="nni_service_address[1]" value="<?php echo e(old('nni_service_address')[1]); ?>" title="NNI Service Address 1">
													<span id="nni_service_address1-label" class="label-text">NNI Service Address</span>	
												</div>
												<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('nni_carrier1')">
													<input type="text" class="form-control" id="nni_carrier1" name="nni_carrier[1]" value="<?php echo e(old('nni_carrier')[1]); ?>" title="NNI Carrier">
													<span id="nni_carrier1-label" class="label-text">NNI Carrier</span>	
												</div>  
												<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('mrc_cogs1')">
													<input type="number" step=".001" class="form-control" id="mrc_cogs1" name="mrc_cogs[1]" value="<?php echo e(old('mrc_cogs')[1]); ?>" title="MRC COGS" onchange="calcMRCcogs()">
													<span id="mrc_cogs1-label" class="label-text">MRC COGS</span>	
												</div>
												<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('nrc_cogs1')" style="margin-bottom: 15px; ">
													<input type="number" step=".001" class="form-control" id="nrc_cogs1" name="nrc_cogs[1]" value="<?php echo e(old('nrc_cogs')[1]); ?>" title="NRC COGS" onchange="calcNRCcogs()">
													<span id="nrc_cogs1-label" class="label-text">NRC COGS</span>	
												</div>    
											</div>
										<?php for($i = 2;$i<=30;$i++):?>
											<div class="form-group" id="nni_group<?php echo e($i); ?>"
											<?php if(!old('nni_service_address')[$i]): ?>
											style="display: none;"
											<?php endif; ?> 
											>
												<div class="col-sm-2 col-md-1 morePadding morePadding2" >
													<div class="btn btn-primary" onclick="removeNNI(<?php echo e($i); ?>)"><i class="fa fa-minus"></i></div>
												</div>
												<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('nni_service_address<?php echo e($i); ?>')">
													<input type="text" class="form-control" id="nni_service_address<?php echo e($i); ?>" name="nni_service_address[<?php echo e($i); ?>]" value="<?php echo e(old('nni_service_address')[$i]); ?>" title="NNI Service Address <?php echo e($i); ?>">
													<span id="nni_service_address<?php echo e($i); ?>-label" class="label-text">NNI Service Address</span>	
												</div>
												<div class="col-sm-12 col-md-3 morePadding morePadding2" onclick="inputFocus('nni_carrier<?php echo e($i); ?>')">
													<input type="text" class="form-control" id="nni_carrier<?php echo e($i); ?>" name="nni_carrier[<?php echo e($i); ?>]" value="<?php echo e(old('nni_carrier')[$i]); ?>" title="NNI Carrier <?php echo e($i); ?>">
													<span id="nni_carrier<?php echo e($i); ?>-label" class="label-text">NNI Carrier</span>	
												</div>  
												<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('mrc_cogs<?php echo e($i); ?>')">
													<input type="number" step=".001" class="form-control" id="mrc_cogs<?php echo e($i); ?>" name="mrc_cogs[<?php echo e($i); ?>]" value="<?php echo e(old('mrc_cogs')[$i]); ?>" title="MRC COGS <?php echo e($i); ?>" onchange="calcMRCcogs()">
													<span id="mrc_cogs<?php echo e($i); ?>-label" class="label-text">MRC COGS</span>	
												</div>
												<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('nrc_cogs<?php echo e($i); ?>')" style="margin-bottom: 15px; ">
													<input type="number" step=".001" class="form-control" id="nrc_cogs<?php echo e($i); ?>" name="nrc_cogs[<?php echo e($i); ?>]" value="<?php echo e(old('nrc_cogs')[$i]); ?>" title="NRC COGS <?php echo e($i); ?>" onchange="calcNRCcogs()">
													<span id="nrc_cogs<?php echo e($i); ?>-label" class="label-text">NRC COGS</span>	
												</div> 
											
											</div>
											<?php endfor; ?>
											<div class="form-group">
												<div class="col-sm-12 col-md-8 morePadding morePadding2" >
													<div class="btn btn-primary" onclick="addNNI()"><i class="fa fa-plus"></i></div>
												</div>
												<label class="xcontrol-label col-sm-6 col-md-1">MRC Total</label>
												<i class="xcontrol-label col-sm-6 col-md-1" style="text-align: right;" id="mrc_total_cogs">$0.00</i>
												<label class="xcontrol-label col-sm-6 col-md-1">NRC Total</label>
												<i class="xcontrol-label col-sm-6 col-md-1" style="text-align: right;" id="nrc_total_cogs">$0.00</i>
											</div>
										</div>
										<hr>

										
										<div class="form-group" id="product_group1">
											<div class="col-sm-2 col-md-1 morePadding morePadding2" >
												<div class="btn btn-primary" style="opacity: .5;"><i class="fa fa-minus"></i></div>
											</div>
											<div class="col-sm-10 col-md-2 morePadding morePadding2" onclick="inputFocus('product1')">
												<input type="text" class="form-control" id="product1" name="product[1]" value="<?php echo e(old('product')[1]); ?>" title="Product 1">
												<span id="product1-label" class="label-text">Product</span>	
											</div>
											<div class="col-sm-12 col-md-1 morePadding morePadding2" onclick="inputFocus('usp1')">
												<input type="text" class="form-control" id="usp1" name="usp[1]" value="<?php echo e(old('usp')[1]); ?>"  title="USP 1">
												<span id="usp1-label" class="label-text">USP</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('quantity1')">
												<input type="number" class="form-control" id="quantity1" name="quantity[1]" value="<?php echo e(old('quantity')[1]); ?>" step="1" title="Quantity 1" onchange="setMRC(1)">
												<span id="quantity1-label" class="label-text">Quantity</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('unit_price1')">
												<input type="number" class="form-control" id="unit_price1" name="unit_price[1]" value="<?php echo e(old('unit_price')[1]); ?>" step=".001" title="Unit Price 1" onchange="setMRC(1)">
												<span id="unit_price1-label" class="label-text">Unit Price</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('product_mrc1')">
												<input type="number" class="form-control" id="product_mrc1" name="product_mrc[1]" value="<?php echo e(old('product_mrc')[1]); ?>" step=".001" title="MRC 1" onchange="calcMRC()">
												<span id="product_mrc1-label" class="label-text">MRC</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('product_nrc1')">
												<input type="number" class="form-control" id="product_nrc1" name="product_nrc[1]" value="<?php echo e(old('product_nrc')[1]); ?>" step=".001" title="NRC 1" onchange="calcNRC()">
												<span id="product_nrc1-label" class="label-text">NRC</span>	
											</div>
										</div>
									<?php for($i = 2;$i<=30;$i++):?>
										<div class="form-group" id="product_group<?php echo e($i); ?>"
										<?php if(!old('product')[$i]): ?>
										style="display: none;"
										<?php endif; ?> 
										>
											<div class="col-sm-2 col-md-1 morePadding morePadding2" >
												<div class="btn btn-primary" onclick="removeProduct2(<?php echo e($i); ?>)"><i class="fa fa-minus"></i></div>
											</div>
											<div class="col-sm-10 col-md-2 morePadding morePadding2" onclick="inputFocus('product<?php echo e($i); ?>')">
												<input type="text" class="form-control" id="product<?php echo e($i); ?>" name="product[<?php echo e($i); ?>]" value="<?php echo e(old('product')[$i]); ?>" title="Product <?php echo e($i); ?>">
												<span id="product<?php echo e($i); ?>-label" class="label-text">Product</span>	
											</div>
											<div class="col-sm-12 col-md-1 morePadding morePadding2" onclick="inputFocus('usp<?php echo e($i); ?>')">
												<input type="text" class="form-control" id="usp<?php echo e($i); ?>" name="usp[<?php echo e($i); ?>]" value="<?php echo e(old('usp')[$i]); ?>" title="USP <?php echo e($i); ?>">
												<span id="usp<?php echo e($i); ?>-label" class="label-text">USP</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('quantity<?php echo e($i); ?>')">
												<input type="number" class="form-control" id="quantity<?php echo e($i); ?>" name="quantity[<?php echo e($i); ?>]" value="<?php echo e(old('quantity')[$i]); ?>" step="1" title="Quantity <?php echo e($i); ?>" onchange="setMRC(<?php echo e($i); ?>)">
												<span id="quantity<?php echo e($i); ?>-label" class="label-text">Quantity</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('unit_price<?php echo e($i); ?>')">
												<input type="number" class="form-control" id="unit_price<?php echo e($i); ?>" name="unit_price[<?php echo e($i); ?>]" value="<?php echo e(old('unit_price')[$i]); ?>" step=".001" title="Unit Price <?php echo e($i); ?>" onchange="setMRC(<?php echo e($i); ?>)">
												<span id="unit_price<?php echo e($i); ?>-label" class="label-text">Unit Price</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('product_mrc<?php echo e($i); ?>')">
												<input type="number" class="form-control" id="product_mrc<?php echo e($i); ?>" name="product_mrc[<?php echo e($i); ?>]" value="<?php echo e(old('product_mrc')[$i]); ?>" step=".001" title="MRC <?php echo e($i); ?>" onchange="calcMRC()">
												<span id="product_mrc<?php echo e($i); ?>-label" class="label-text">MRC</span>	
											</div>
											<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus('product_nrc<?php echo e($i); ?>')">
												<input type="number" class="form-control" id="product_nrc<?php echo e($i); ?>" name="product_nrc[<?php echo e($i); ?>]" value="<?php echo e(old('product_nrc')[$i]); ?>" step=".001" title="NRC <?php echo e($i); ?>" onchange="calcNRC()">
												<span id="product_nrc<?php echo e($i); ?>-label" class="label-text">NRC</span>	
											</div>
										</div>
									<?php endfor; ?>
										
										<div class="form-group" id="plus_container">
											<div class="col-sm-12 col-md-8 morePadding morePadding2" >
												<div class="btn btn-primary" onclick="addProduct2()"><i class="fa fa-plus"></i></div>
											</div>
											<label class="xcontrol-label col-sm-6 col-md-1">MRC Total</label>
											<i class="xcontrol-label col-sm-6 col-md-1" style="text-align: right;" id="mrc_total">$0.00</i>
											<label class="xcontrol-label col-sm-6 col-md-1">NRC Total</label>
											<i class="xcontrol-label col-sm-6 col-md-1" style="text-align: right;" id="nrc_total">$0.00</i>
										</div>
										
										<div class="form-group">
											<label class="label-control col-sm-12 col-md-12">Required Teams <i style="font-weight: 200;">*Entry and billing are always required</i></label>
											<input type="hidden" name="team[1]" value="1">
											<?php foreach($teams as $team): ?>
												<?php if($team->id != 1 && $team->id != 12): ?>
												<div class="col-sm-12 col-md-4">
													<input type="checkbox" class="xform-control" name="team[<?php echo e($team->id); ?>]" value="1">&nbsp;<?php echo e($team->name); ?>

												</div>
												<?php endif; ?>
											<?php endforeach; ?>
											 
										</div> 
										  
										<div class="form-group">
											<div class="col-sm-12 col-md-8 morePadding morePadding2" onclick="inputFocus('notes')">
												<textarea class="form-control" id="notes" name="notes" title="Notes" placeholder="Notes"><?php echo e(old('notes')); ?></textarea>
												<!-- <span id="notes-label" class="label-text">Notes</span>  -->
											</div>
											<div class="col-sm-12 col-md-4 morePadding morePadding2" onclick="inputFocus('attachment')">
												<input type="file" class="form-control" id="attachment" name="attachment" value="<?php echo e(old('attachment')); ?>"  title="Attachment" style="border: none;">
												<span id="attachment-label" class="xlabel-text hasValue">Attachment</span>	
											</div>
											    
											
										</div>
										
										<div class="form-group">
											<div class="col-md-8 col-md-offset-0 morePadding">
												<button type="submit" class="btn btn-primary cta">
													Save
												</button>
												<i class="fa fa-spinner fa-spin fa-3x fa-fw cta-loading" style="display: none;"></i>
											</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')); ?>" />
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/css/selectize.bootstrap3.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;
			}
		}
		#company_name-custom-label {
			text-align: left;
			color: #317aba;
			padding-left: 20px;
			font-weight: normal;

		}
		.label-dropdown {
			display: inline;
			font-weight: normal;
			
		}
		.caption-dropdown {
			color: gray;
			font-weight: normal;
			padding: 0;
			display: inline;
		}
		.highlight {
			display: inline;
			margin: 0;
			padding: 0;
		}
		#company_name-selectized {
			width: 100% !important;
		}
		
	</style>
	<script>
	
	</script>
<?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 src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/js/standalone/selectize.min.js"></script>
	<script>
    $('#date_sold_container .date').datepicker({
        'format': 'yyyy-m-d',
        'autoclose': true
    });
    $('#desired_due_date_container .date').datepicker({
        'format': 'yyyy-m-d',
        'autoclose': true
    });
    $('#ready_to_bill_container .date').datepicker({
        'format': 'yyyy-m-d',
        'autoclose': true
    });
	</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();
	}

	function enter911()
	{
		var checkbox = document.getElementById('checkbox_911_container');
		var address = document.getElementById('address_911_container');

		if(address.style.display == 'none')
		{
			address.style.display = '';
		}
		else
		{
			address.style.display = 'none';
			document.getElementById('address_911').value = '';
			document.getElementById('county_code_911').value = '';
			document.getElementById('city_911').value = '';
			document.getElementById('state_911').value = '';
			document.getElementById('zip_911').value = '';
		}
	}
	function showConstruction()
	{
		var checkbox = document.getElementById('checkbox_construction_container');
		var address = document.getElementById('construction_container');

		if(address.style.display == 'none')
		{
			address.style.display = '';
		}
		else
		{
			address.style.display = 'none';

			for(i = 30; i>=1; i--)
			{
				document.getElementById('construction_location'+i).value = '';
				document.getElementById('construction_build_estimate'+i).value = '';
				document.getElementById('building_contact'+i).value = '';
				document.getElementById('building_phone_number'+i).value = '';
				document.getElementById('building_email'+i).value = '';

			}
		}
	}
	function showNNI()
	{
		var checkbox = document.getElementById('checkbox_nni_container');
		var address = document.getElementById('nni_container');

		if(address.style.display == 'none')
		{
			address.style.display = '';
		}
		else
		{
			address.style.display = 'none';

			for(i = 30; i>=1; i--)
			{
				document.getElementById('nni_service_address'+i).value = '';
				document.getElementById('nni_carrier'+i).value = '';
				document.getElementById('mrc_cogs'+i).value = '';
				document.getElementById('nrc_cogs'+i).value = '';
			}
		}
	}
	function addProduct2()
	{
		var next = 31;
		for(i = 30; i>=1; i--)
		{
			if(document.getElementById('product_group'+i).style.display != "none")
			{
				if(i != 30)
				{
					next = i + 1;
					document.getElementById('product_group'+next).style.display = '';
					return;
				}
				else
				{
					alert('Error: 2750724');
					return;
				}
				
			}
			
		}

		
	}
	function addProduct()
	{
		var product_group = document.getElementById('product_group');
		var plus_container = document.getElementById('plus_container');
		var theForm = document.getElementById('theForm');

		var string = 
			'<div class="form-group" id="product_group2">'+
				'<div class="col-sm-2 col-md-1 morePadding morePadding2" >'+
					'<div class="btn btn-primary" onclick="removeProduct(\'product_group2\')"><i class="fa fa-minus"></i></div>'+
				'</div>'+
				'<div class="col-sm-10 col-md-3 morePadding morePadding2" onclick="inputFocus(\'product2\')">'+
					'<input type="text" class="form-control" id="product2" name="product[2]" value="" title="Product 2">'+
					'<span id="product2-label" class="label-text">Product</span>'+
				'</div>'+
				'<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus(\'quantity2\')">'+
					'<input type="text" class="form-control" id="quantity2" name="quantity[2]" value="" title="Quantity 2">'+
					'<span id="quantity2-label" class="label-text">Quantity</span>'+
				'</div>'+
				'<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus(\'unit_price2\')">'+
					'<input type="text" class="form-control" id="unit_price2" name="unit_price[2]" value="" title="Unit Price 2">'+
					'<span id="unit_price2-label" class="label-text">Unit Price</span>'+
				'</div>'+
				'<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus(\'product_mrc2\')">'+
					'<input type="text" class="form-control" id="product_mrc2" name="product_mrc[2]" value="" title="MRC 2">'+
					'<span id="product_mrc2-label" class="label-text">MRC</span>'+
				'</div>'+
				'<div class="col-sm-12 col-md-2 morePadding morePadding2" onclick="inputFocus(\'product_nrc2\')">'+
					'<input type="text" class="form-control" id="product_nrc2" name="product_nrc[2]" value="" title="NRC 2">'+
					'<span id="product_nrc2-label" class="label-text">NRC</span>'+
				'</div>'+
			'</div>';

		//alert(string);

		var div = document.createElement('div');
		div.innerHTML = string;
		
		

		
		theForm.insertBefore(div.firstChild, plus_container);
		
	}

	function removeProduct2(num)
	{
		document.getElementById('product_group'+num).style.display = 'none';
		document.getElementById('product'+num).value = '';
		document.getElementById('quantity'+num).value = '';
		document.getElementById('unit_price'+num).value = '';
		document.getElementById('product_mrc'+num).value = '';
		document.getElementById('product_nrc'+num).value = '';

		document.getElementById('product'+num+'-label').className = 'label-text';
		document.getElementById('quantity'+num+'-label').className = 'label-text';
		document.getElementById('unit_price'+num+'-label').className = 'label-text';
		document.getElementById('product_mrc'+num+'-label').className = 'label-text';
		document.getElementById('product_nrc'+num+'-label').className = 'label-text';

		calcMRC();
		calcNRC();
	}
	
	function removeProduct(id)
	{
		document.getElementById(id).remove();
	}

	function addConstruction()
	{
		var next = 31;
		for(i = 30; i>=1; i--)
		{
			if(document.getElementById('construction_group'+i).style.display != "none")
			{
				if(i != 30)
				{
					next = i + 1;
					document.getElementById('construction_group'+next).style.display = '';
					return;
				}
				else
				{
					alert('Error: 2667158');
					return;
				}
				
			}
			
		}
		
	}

	function removeConstruction(num)
	{
		document.getElementById('construction_group'+num).style.display = 'none';
		document.getElementById('construction_location'+num).value = '';
		document.getElementById('construction_build_estimate'+num).value = '';
		document.getElementById('building_contact'+num).value = '';
		document.getElementById('building_phone_number'+num).value = '';
		document.getElementById('building_email'+num).value = '';

		document.getElementById('construction_location'+num+'-label').className = 'label-text';
		document.getElementById('construction_build_estimate'+num+'-label').className = 'label-text';
		document.getElementById('building_contact'+num+'-label').className = 'label-text';
		document.getElementById('building_phone_number'+num+'-label').className = 'label-text';
		document.getElementById('building_email'+num+'-label').className = 'label-text';

		estimateTotal();
	}

	function estimateTotal()
	{
		var total = 0;
		for(i = 1; i<=30; i++)
		{
			if(document.getElementById('construction_build_estimate'+i).value != "")
			{
				total += parseFloat(document.getElementById('construction_build_estimate'+i).value);
			}
		}
		document.getElementById('estimate_total').innerHTML = '$' + total.toFixed(3);
	}

	function addNNI()
	{
		var next = 31;
		for(i = 30; i>=1; i--)
		{
			if(document.getElementById('nni_group'+i).style.display != "none")
			{
				if(i != 30)
				{
					next = i + 1;
					document.getElementById('nni_group'+next).style.display = '';
					return;
				}
				else
				{
					alert('Error: 9573009');
					return;
				}
				
			}
			
		}
		
	}

	function removeNNI(num)
	{
		document.getElementById('nni_group'+num).style.display = 'none';
		document.getElementById('nni_service_address'+num).value = '';
		document.getElementById('nni_carrier'+num).value = '';
		document.getElementById('mrc_cogs'+num).value = '';
		document.getElementById('nrc_cogs'+num).value = '';

		document.getElementById('nni_service_address'+num+'-label').className = 'label-text';
		document.getElementById('nni_carrier'+num+'-label').className = 'label-text';
		document.getElementById('mrc_cogs'+num+'-label').className = 'label-text';
		document.getElementById('nrc_cogs'+num+'-label').className = 'label-text';

		calcMRCcogs();
		calcNRCcogs();
	}

	function calcMRCcogs()
	{
		var total = 0;
		for(i = 1; i<=30; i++)
		{
			if(document.getElementById('mrc_cogs'+i).value != "")
			{
				total += parseFloat(document.getElementById('mrc_cogs'+i).value);
			}
		}
		document.getElementById('mrc_total_cogs').innerHTML = '$' + total.toFixed(3);
	}

	function calcNRCcogs()
	{
		var total = 0;
		for(i = 1; i<=30; i++)
		{
			if(document.getElementById('nrc_cogs'+i).value != "")
			{
				total += parseFloat(document.getElementById('nrc_cogs'+i).value);
			}
		}
		document.getElementById('nrc_total_cogs').innerHTML = '$' + total.toFixed(3);
	}
	

	function calcMRC()
	{
		var total = 0;
		for(i = 1; i<=30; i++)
		{
			if(document.getElementById('product_mrc'+i).value != "")
			{
				total += parseFloat(document.getElementById('product_mrc'+i).value);
			}
		}
		document.getElementById('mrc_total').innerHTML = '$' + total.toFixed(3);
	}
	
	function calcNRC()
	{
		var total = 0;
		for(i = 1; i<=30; i++)
		{
			if(document.getElementById('product_nrc'+i).value != "")
			{
				total += parseFloat(document.getElementById('product_nrc'+i).value);
			}
		}
		document.getElementById('nrc_total').innerHTML = '$' + total.toFixed(3);
	}

	function setMRC(num)
	{
		
		var quantity = document.getElementById('quantity'+num).value;
		var unit_price = document.getElementById('unit_price'+num).value;

		if(quantity == '') quantity = 0;
		if(unit_price == '') unit_price = 0;

		var total = parseFloat(quantity) * parseFloat(unit_price);

		var mrc = document.getElementById('product_mrc'+num);
		var mrc_label = document.getElementById('product_mrc'+num+'-label');
	
		mrc.value = total.toFixed(3);
		mrc_label.className = 'hasValue';
		

		calcMRC();
	}

	<?php if(old('nni')): ?>
		showNNI();
	<?php endif; ?>

	calcMRC();
	calcNRC();
	estimateTotal();
	calcNRCcogs();
	calcMRCcogs();
<?php if(!isset($project) && !old('company_name')): ?>
	$('#company_name').selectize({
	    create: true,
	    sortField: 'text',
	    maxItems: 1,
	    valueField: 'company_name',
	    labelField: 'company_name',
	    searchField: ['company_name', 'city'],
	    options: [
	      	<?php foreach(\App\Project::all()->sortBy('company_name') as $project): ?>
	      		<?php if($project->company_name && $project->service_city): ?>
	    		{company_name: '<?php echo e($project->company_name); ?>', city: '<?php echo e($project->service_city); ?>', id: '<?php echo e($project->id); ?>' },
	    		<?php endif; ?>
	    	<?php endforeach; ?>
	    	],
    	render: {
            item: function(item, escape) {
				document.getElementById('company_name').setAttribute('dbID', item.id);
                
                return '<div>' +
                    (item.company_name ? '' + item.company_name + '' : '') +
                  
                '</div>';
            },
            option: function(item, escape) {
                var label = item.company_name;
                var caption = item.city ? item.city : null;
                return '<div>' +
                    '<span class="label-dropdown">' + label + '</span>' +
                    (caption ? '<span class="caption-dropdown">' + caption + '</span>' : '') +
                '</div>';
            }
        },
        onItemAdd: function(value, item) { 
            if(document.getElementById('company_name').getAttribute('dbID') != 'undefined')
            {
				window.location = "<?php echo e(url('uadmin/projects/add')); ?>/"+document.getElementById('company_name').getAttribute('dbID');
            } 

        }
	});
<?php endif; ?>	
	//alert(document.cookie.indexOf('XSRF-TOKEN'));

		function noDouble()
	{
		$('.cta').hide();
		$('.cta-loading').show();

		return true;
	}
</script>
	
	
<?php $__env->stopSection(); ?>	

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