<?php $__env->startSection('content'); ?>
	<div class="row"> 
    	<div class="col-lg-12">
    		<h1 class="page-header">Timecard</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">
             	 <?php echo e(strtoupper(date('d-M-Y', strtotime($timecard->date)))); ?> through <?php echo e(strtoupper(date('d-M-Y', strtotime('+6 days', strtotime($timecard->date))))); ?>

             	  &nbsp;|&nbsp; <?php echo e(Auth::user()->name); ?> &nbsp;|&nbsp; #<?php echo e($employee->number); ?>

             	  <i id="status_wheel" class="fa fa-spinner fa-pulse" style="float: right;"></i>
              </div>
                        <!-- /.panel-heading -->
              <div class="panel-body">
                <div class="row hidden-sm hidden-xs col_head">
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Account</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Company</span>
								</div>
								<div class="col-md-2 excel">
									<span class="col-md-12 excel">Description</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Sun (<?php echo e(date('j', strtotime($timecard->date))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Mon (<?php echo e(date('j', strtotime('+1 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Tue (<?php echo e(date('j', strtotime('+2 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Wed (<?php echo e(date('j', strtotime('+3 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Thur (<?php echo e(date('j', strtotime('+4 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Fri (<?php echo e(date('j', strtotime('+5 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Sat (<?php echo e(date('j', strtotime('+6 days', strtotime($timecard->date)))); ?>)</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-md-12 excel">Total</span>
								</div>
								
							</div> <!-- /pannel-body -->
						<?php $i = 0;?>
                        <?php foreach($accounts as $account): ?>
                        	<?php $access = !$account->global ?  \App\Access::where('employee','=',$employee->id)->where('type','=','account')->where('account','=',$account->id)->first() : false; ?>
							<div
							id="<?php echo e($access ? 'access' . $access->id : 'global'.$account->id); ?>"
							<?php if($access && $access->default): ?>
							class="row" 
							<?php else: ?>
							class="row rhidden"
							<?php endif; ?>
							<?php if(++$i%2 != 0): ?>
							style="background-color: #ecf2f5; border-top: 1px dotted #aaa;"
							<?php else: ?> if 
							style="border-top: 1px dotted #888;"
							<?php endif; ?>
							>
								<div class="col-md-1 excel sb">
									<!-- <button class="btn btn-primary btn-xs"><i class="fa fa-minus"></i></button> -->
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Account:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style"><?php echo e($account->number); ?></span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Company:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style"><?php echo e($account->company); ?></span>
								</div>
								<div class="col-md-2 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Description:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style"><?php echo e($account->description); ?>

									<?php if(!$account->global): ?>	
										<input class="default-checkbox" title="Default Account" name="default[<?php echo e($access->id); ?>]" type="checkbox" value="1" access="<?php echo e($access->id); ?>" onchange="updateDefault(this)" <?php echo e($access && $access->default ? 'checked' : ''); ?>>
									<?php endif; ?>	
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Sunday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_1" name="entry_<?php echo e($account->id); ?>[1]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="1" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Monday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_2" name="entry_<?php echo e($account->id); ?>[2]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="2" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Tuesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_3" name="entry_<?php echo e($account->id); ?>[3]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="3" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Wednesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_4" name="entry_<?php echo e($account->id); ?>[4]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="4" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Thursday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_5" name="entry_<?php echo e($account->id); ?>[5]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="5" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Friday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_6" name="entry_<?php echo e($account->id); ?>[6]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="6" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Saturday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="entry_<?php echo e($account->id); ?>_7" name="entry_<?php echo e($account->id); ?>[7]" type="number" step=".25" value="0.00" account="<?php echo e($account->id); ?>" day="7" accounttype="account"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Total:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										<strong id="<?php echo e($account->global ? 'total_global'.$account->id : 'total_access'.$access->id); ?>"  class="account_totals">0.00</strong>
									</span>
								</div>
							</div>
						<?php endforeach; ?>
						<?php foreach($allocations as $allocation): ?>
							<?php $access = \App\Access::where('employee','=',$employee->id)->where('type','=','allocation')->where('account','=',$allocation->id)->first(); ?>
							<div
							id="<?php echo e('access' . $access->id); ?>"
							<?php if($access->default): ?>
							class="row" 
							<?php else: ?>
							class="row rhidden"
							<?php endif; ?>
							<?php if(++$i%2 != 0): ?>
							style="background-color: #ecf2f5; border-top: 1px dotted #aaa;"
							<?php else: ?> if 
							style="border-top: 1px dotted #888;"
							<?php endif; ?>
							>
								<div class="col-md-1 excel sb">
									<!-- <button class="btn btn-primary btn-xs"><i class="fa fa-minus"></i></button> -->
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Account:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">-</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Company:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">-</span>
								</div>
								<div class="col-md-2 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Description:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style"><?php echo e($allocation->description); ?>

										<input class="default-checkbox" title="Default Allocation" name="default[<?php echo e($access->id); ?>]" type="checkbox" value="1" access="<?php echo e($access->id); ?>" onchange="updateDefault(this)" <?php echo e($access->default ? 'checked' : ''); ?>>
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Sunday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_1" name="allo_entry_<?php echo e($allocation->id); ?>[1]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="1" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Monday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_2" name="allo_entry_<?php echo e($allocation->id); ?>[2]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="2" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Tuesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_3" name="allo_entry_<?php echo e($allocation->id); ?>[3]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="3" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Wednesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_4" name="allo_entry_<?php echo e($allocation->id); ?>[4]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="4" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Thursday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_5" name="allo_entry_<?php echo e($allocation->id); ?>[5]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="5" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Friday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_6" name="allo_entry_<?php echo e($allocation->id); ?>[6]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="6" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Saturday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="allo_entry_<?php echo e($allocation->id); ?>_7" name="allo_entry_<?php echo e($allocation->id); ?>[7]" type="number" step=".25" value="0.00" account="<?php echo e($allocation->id); ?>" day="7" accounttype="allocation"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Total:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										<strong id="total_access<?php echo e($access->id); ?>" class="account_totals">0.00</strong>
									</span>
								</div>
							</div>
						<?php endforeach; ?>
						<?php for($k=1;$k<=18;$k++): ?>
                        	<div
							id="wo<?php echo e($k); ?>"

							class="row rhidden" 

							<?php if(++$i%2 != 0): ?>
							style="background-color: #ecf2f5; border-top: 1px dotted #aaa;"
							<?php else: ?> if 
							style="border-top: 1px dotted #888;"
							<?php endif; ?>
							>
								<i style="display: none;" id="wo_id<?php echo e($k); ?>"></i>
								<i style="display: none;" id="awo_id<?php echo e($k); ?>"></i>
								<div class="col-md-1 excel sb">
									<!-- <button class="btn btn-primary btn-xs"><i class="fa fa-minus"></i></button> -->
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Work Order:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style" id="wo_number<?php echo e($k); ?>"></span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Company:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">-</span>
								</div>
								<div class="col-md-2 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg col_label">Description:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style" id="wo_description<?php echo e($k); ?>" title=""></span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Sunday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_1" name="wo_entry_<?php echo e($k); ?>[1]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="1" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Monday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_2" name="wo_entry_<?php echo e($k); ?>[2]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="2" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Tuesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_3" name="wo_entry_<?php echo e($k); ?>[3]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="3" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Wednesday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_4" name="wo_entry_<?php echo e($k); ?>[4]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="4" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Thursday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_5" name="wo_entry_<?php echo e($k); ?>[5]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="5" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Friday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_6" name="wo_entry_<?php echo e($k); ?>[6]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="6" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg weekend">Saturday:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel weekend">
										<input class="time_input" id="wo_entry_<?php echo e($k); ?>_7" name="wo_entry_<?php echo e($k); ?>[7]" type="number" step=".25" value="0.00" account="<?php echo e($k); ?>" day="7" accounttype="work_order"  onblur="PREupdateEntry(this)">
									</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Total:&nbsp;</span>
									<span class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										<strong id="total_wo<?php echo e($k); ?>"  class="account_totals">0.00</strong>
									</span>
								</div>
							</div>
							<?php endfor; ?>
							<div class="row" style="border-top: 1px solid black; ">
								<div class="col-md-4 excel hb">
									Total
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Sunday:&nbsp;</span>
									<span id="day_d1" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Monday:&nbsp;</span>
									<span id="day_d2" class="col-xs-6 col-sm-6 col-md-12 exce account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Tuesday:&nbsp;</span>
									<span id="day_d3" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Wednesday:&nbsp;</span>
									<span id="day_d4" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Thursday:&nbsp;</span>
									<span id="day_d5" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel sb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Friday:&nbsp;</span>
									<span id="day_d6" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel hb">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Saturday:&nbsp;</span>
									<span id="day_d7" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										0.00
									</span>
								</div>
								<div class="col-md-1 excel">
									<span class="col-xs-6 col-sm-6 hidden-md hidden-lg">Total:&nbsp;</span>
									<span id="day_all" class="col-xs-6 col-sm-6 col-md-12 excel account_style">
										<strong>0.00</strong>
									</span>
								</div>
							</div>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="row">
             	<div class="col-md-12">
             		<textarea id="notes" name="notes" class="notes" rows="4" oninput="updateNotes(this);" onblur="updateNotes(this);" placeholder="Notes"><?php echo e($timecard->notes); ?></textarea>
             	</div>
             </div>
			 <div class="row">
                <div class="col-md-6">
                    <div class="panel panel-default">

		              <div class="panel-heading">
		             	Accounts
		              </div>
		                        <!-- /.panel-heading -->
		              <div class="panel-body">
		              	<div class="dataTable_wrapper">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-accounts">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Company</th>
                                            <th>Description</th>
                                            <th>Keywords</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php $count = 0;  ?>
                                    <?php foreach(\App\Access::where('employee','=',$employee->id)->get() as $access): ?>
                                    <?php $count++; ?>
                                    <?php if(!$access->default): ?>
                                    <?php if($count % 2 == 1): ?>
                                        <tr class="odd" id="a_row<?php echo e($access->id); ?>" onclick="addAccount2(<?php echo e($access->id); ?>); removeRowAccount(this);" style="cursor: cell;">
                                    <?php else: ?>
                                    	<tr class="even" id="a_row<?php echo e($access->id); ?>" onclick="addAccount2(<?php echo e($access->id); ?>); removeRowAccount(this);"  style="cursor: cell;">
                                    <?php endif; ?>
                                    	
                                    	<?php if($access->type == 'allocation'): ?>
											<?php $allocation = \App\Allocation::find($access->account); ?>
                                    		<td>&nbsp;</td>
                                    		<td>&nbsp;</td>
                                    		<td><?php echo e($allocation->description); ?></td>
                                    		<td>&nbsp;</td>
                                    	<?php else: ?>
											<?php $account = \App\Account::find($access->account); ?>
											<td><?php echo e($account->number); ?></td>
                                    		<td><?php echo e($account->company); ?></td>
                                    		<td><?php echo e($account->description); ?></td>
                                    		<td>&nbsp;</td>
										<?php endif; ?>	
									<?php endif; ?>		
                                    	</tr>
                                    <?php endforeach; ?>
                                    <?php foreach(\App\Account::where('global','=',1)->get() as $account): ?>
                                    <?php $count++; ?>
                                   
                                    <?php if($count % 2 == 1): ?>
                                        <tr class="odd" id="ag_row<?php echo e($account->id); ?>" onclick="addAccount3(<?php echo e($account->id); ?>); removeRowAccount(this);" style="cursor: cell;">
                                    <?php else: ?>
                                    	<tr class="even" id="ag_row<?php echo e($account->id); ?>" onclick="addAccount3(<?php echo e($account->id); ?>); removeRowAccount(this);"  style="cursor: cell;">
                                    <?php endif; ?>
                                    	

											
											<td><?php echo e($account->number); ?></td>
                                    		<td><?php echo e($account->company); ?></td>
                                    		<td><?php echo e($account->description); ?></td>
                                    		<td>&nbsp;</td>

										
                                    	</tr>
                                    <?php endforeach; ?>
                                    </tbody>
                                </table>
                        </div>
		              </div>
		            </div>
		         </div>

                <div class="col-md-6">
                    <div class="panel panel-default">

		              <div class="panel-heading">
		             	Work Orders
		              </div>
		                        <!-- /.panel-heading -->
		              <div class="panel-body">
		              			<table class="table table-striped table-bordered table-hover" id="dataTables-workorders">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Description</th>
                                            <th>Keywords</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php $count = 0;  ?>
                                    <?php foreach($work_orders as $wo): ?>
                                    <?php $count++; ?>
                                    <?php if($count % 2 == 1): ?>
                                        <tr class="odd" id="wo_row<?php echo e($wo->Id); ?>" onclick="addWO(<?php echo e($wo->Id); ?>);" style="cursor: cell;">
                                    <?php else: ?>
                                    	<tr class="even" id="wo_row<?php echo e($wo->Id); ?>" onclick="addWO(<?php echo e($wo->Id); ?>);" style="cursor: cell;">
                                    <?php endif; ?>
                                    		<td><?php echo e($wo->WONumber); ?></td>
                                    		<td><?php echo e($wo->Client_WO_Name); ?></td>
                                    		<td>&nbsp;</td>
                                    	</tr>
                                    <?php endforeach; ?>
                                    </tbody>
                                </table>
		              </div>
		            </div>
		         </div>
			</div>
			<hr>
			<div class="row">
				<div class="col-md-4">
					<form method="POST" action="<?php echo e(url('admin/timecard/previous')); ?>" style="display: inline;">
						<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
						<input type="hidden" name="timecardID" value="<?php echo e($timecard->id); ?>">
						<button type="submit" class="btn btn-primary"><i class="fa fa-arrow-left"></i></button>
					</form>
					<?php if($timecard->approve_self != ''): ?>
					<form method="POST" action="<?php echo e(url('admin/timecard/next')); ?>"  style="display: inline;">
						<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
						<input type="hidden" name="timecardID" value="<?php echo e($timecard->id); ?>">
						<button type="submit" class="btn btn-primary"><i class="fa fa-arrow-right"></i></button>
					</form>
					<?php endif; ?>
				</div>
				<div class="col-md-8">
					<a class="btn btn-primary" style="float: right;" href="<?php echo e(url('uadmin/timecard/review')); ?>">Verify</a>
				</div>
			</div>

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

<?php $__env->startSection('extras'); ?>
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.css"/>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css" />
    <style>
	    @import  url('https://fonts.googleapis.com/css?family=Ubuntu');
		.time_input {
			width: 100%;
			background-color: transparent;
			outline: none;
			border: none;
			padding-left: 10px;
			opacity: 0.2;
		}

		input:focus {
			background-color: #333;
/* 			border: 1px solid gray; */
			color: white;
		}
		.col_label {
/*
			border-right: none;
			border-left: none;
			border-top: none;
			border-bottom: 1px solid #b3b3b3;
*/
			background-color: #555;
			color: white;
			text-align: right;
			font-family: 'Ubuntu', sans-serif;
			text-transform:uppercase;
			font-size: .75em;
			padding: 0.2em 0 0.2em 0;
			letter-spacing: 1px;
			}
		.col_head {
			background-color: #555;
			color: white;
			text-align: center;
			font-family: 'Ubuntu', sans-serif;
			text-transform:uppercase;
			font-size: .75em;
			padding: 0.25em 0 0.25em 0;
			letter-spacing: 1px;
		}
		.col_head .excel {
			border-right: 1px solid #b3b3b3;
			border-left: none;
		}
		.col_head .excel:last-child {
			border-right: none;
		}
		.excel {
			margin: 0;
			padding: 0;
			padding-left: 0px;
			font-family: 'Ubuntu', sans-serif;
		}
		.weekend {
			background-color: rgba(0, 0, 0, 0.25);
			color: #555;
			height: 20px;
		}
		.account_style {
			padding-left: 10px;
		}
		.default-checkbox {
			float: right;
			display: none;
		}
		.excel:hover .default-checkbox {
			display: block;
		}
		.rhidden {
			display: none;
		}
		.wo_select {
			
			width: 100% !important;
		}
		.wo_select button {
			width: 100%;
			background-color: transparent;
			outline: none;
			border: none;
			padding: 0;
		}
		.dropdown-menu .open {
			max-width: 100px !important;
			min-width: 100px !important;
		}
		a:hover{
    		text-decoration: none;
    	}
    	.odd .subBack {
    		background-color: #f0fcff;
    	}
    	.even .subBack {
    		background-color: #ecf7fa;
    	}
    	.floatLeft
    	{
    		float: left;
    	}
    	.notes {
    		opacity: 1;
    		background-color: #f6f6f6;
    		border-radius: 4px;
    		padding-top: 5px;
    		padding-right: 5px;
    		padding-bottom: 5px;
    		margin-bottom: 15px;
    		border: 1px solid #e1e1e1;
    		width: 100%;
			outline: none;
			padding-left: 10px;
    	}
    	@media  print {
  @page  {
    size: 427mm 330mm;
    margin: 14mm;
  }
  .container {
    width: 1170px;
  }
}
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('bottom'); ?>
   <script type="text/javascript" src="https://cdn.datatables.net/t/bs/pdfmake-0.1.18,dt-1.10.11,b-1.1.2,b-flash-1.1.2,b-html5-1.1.2,b-print-1.1.2/datatables.min.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
   <script>
	
   		var status_wheel = document.getElementById('status_wheel');
   		var account_options = <?php echo e($accounts->count()); ?>;
   		var accounts_table, workorders_table;
   		var visible_wo = 0;
   		var ccc = 0;
   		function statusWheel(state)
   		{
			if(state)
			{
				status_wheel.style.display = "block";
			}
			else
			{
				status_wheel.style.display = "none";
			}
   		}
   		function addAccount()
   		{
   	   		statusWheel(true);
			var accounts = document.getElementById('accounts');
			if(accounts.value > 0)
			{
				var option = document.getElementById('option'+accounts.value);
				var row = document.getElementById('access'+accounts.value);
				row.style.display = 'block';
				option.style.display = 'none';
				accounts.selectedIndex = 0;
				account_options--;
				if(account_options < 1)
				{
					accounts.style.display = 'none';
				}
				
			}
			statusWheel(false);
   		}
   		function addAccount2(access)
   		{
   	   		statusWheel(true);
			
			if(access > 0)
			{
				
				var row = document.getElementById('access'+access);
				row.style.display = 'block';
				
				account_options--;
				
				
			}
			statusWheel(false);
   		}
   		function addAccount3(account)
   		{
   	   		statusWheel(true);
			
			if(account > 0)
			{
				
				var row = document.getElementById('global'+account);
				row.style.display = 'block';
				
				account_options--;
				
				
			}
			statusWheel(false);
   		}
		function addWO(wo)
		{
			statusWheel(true);
			if(document.getElementById('awo_id'+wo) == null)
			{
				visible_wo++;
				if(visible_wo > 18)
				{
					alert('Cannot add additional work orders.');
					statusWheel(false);
					return;
					
				}
				var wo_num = document.getElementById('wo_number'+visible_wo);
				var wo_desc = document.getElementById('wo_description'+visible_wo);
				var wo_id = document.getElementById('wo_id'+visible_wo);
				var awo_id = document.getElementById('awo_id'+visible_wo);

				wo_num.innerHTML = wos[wo].number;
				
				var description = wos[wo].description;
				if(description.length > 18)
				{
					wo_desc.innerHTML = description.substring(0,17)+'...';
				}
				else
				{
					wo_desc.innerHTML = description;
				}
				wo_desc.title = description;

				wo_id.innerHTML = wo;
				awo_id.id = 'awo_id'+wo;
				awo_id.innerHTML = visible_wo;
				
				var row = document.getElementById('wo'+visible_wo);
				row.style.display = 'block';

				removeRowWO(document.getElementById('wo_row'+wo));
			}
			

			statusWheel(false);
		}
   		function updateDefault(box)
   		{
   	   		statusWheel(true);
			$.post("/uadmin/ajaxTimecardDefault.php",
			{
				access: box.getAttribute('access'),
				value: box.checked ? 1 : 0

			},
			function(data,status)
			{
				console.log(data);
				console.log(status);
				statusWheel(false);
			}
			);
   		}
   		function PREupdateEntry(entry)
   		{
   			entry.value = Number(entry.value);

			if(entry.value < 0)
			{
				entry.value = 0.00;
			}
   			if(entry.value > 24)
   			{
				entry.value = 24.00;
   			}
   			
   			entry.value = (Math.round(entry.value * 4)/4).toFixed(2);
   			
   			updateEntry(entry);

   		}
   		function updateEntry(entry)
   		{
   	   		
   	   		statusWheel(true);
			var account;
			if(entry.getAttribute('accounttype') == 'work_order')
			{
				var k = entry.getAttribute('account');
				var wo_id = document.getElementById('wo_id'+k).innerHTML;
				account = wo_id;

			}
			else
			{
				account = entry.getAttribute('account');
			}
   	   		if(entry.value > 0)
   	   		{
				entry.style.opacity = '1';
   	   		}
   	   		else
   	   		{
				entry.style.opacity = '0.3';
   	   		}
   	   		
			$.post("/uadmin/ajaxTimecardEntry.php",
			{
				timecard: <?php echo e($timecard->id); ?>,
				value: entry.value,
				account: account,
				type: entry.getAttribute('accounttype'),
				day: entry.getAttribute('day')
			},
			function(data,status)
			{
				getTotals();
				statusWheel(false);
				
					
			}
			);
   		}

   		function updateNotes(notes)
   		{
   			statusWheel(true);
   			$.post("/uadmin/ajaxTimecardNotes.php",
   					{
   						timecard: <?php echo e($timecard->id); ?>,
   						notes: notes.value
   					},
   					function(data,status)
   					{
   						statusWheel(false);
   					}
   					);
   		}
   		
   		function getEntries()
   		{
   	   		statusWheel(true);
   			$.get("/uadmin/ajaxEntries.php",
   			{
				timecard: <?php echo e($timecard->id); ?>

   			},
   		   	function(data, status)
   		   	{
   		        //console.log("Data: " + data.entries[0].value + "\nStatus: " + status);
   		        for(j=0;j<data.access.length;j++)
   		       	{
   	   		       	var access2 = data.access[j];
					var row = document.getElementById('access'+access2);
					row.style.display = 'block';
					var table_row = document.getElementById('a_row'+access2);
					if(table_row != null)
					{
						removeRowAccount(table_row);
						
					}
					
   		       	}
   		     	for(k=0;k<data.global.length;k++)
		       	{
	   		       	var account3 = data.global[k];
					var row = document.getElementById('global'+account3);
					row.style.display = 'block';
					var table_row = document.getElementById('ag_row'+account3);
					if(table_row != null)
					{
						removeRowAccount(table_row);
						
					}
					
		       	}
   		     	if(account_options < 1)
				{
   		     	var accounts = document.getElementById('accounts');
					accounts.style.display = 'none';
				}
   		        for(i=0;i<data.entries.length;i++)
   		       	{
   	   		       	var entry = data.entries[i];
   	   		       	if(entry.type == 'account')
   	   		       	{
   	   		      		var input = document.getElementById('entry_'+entry.account+'_'+entry.day);
   	   		       	}
   	   		       	else if(entry.type == 'work_order')
   	   		       	{
   	   	   		       	addWO(entry.account);
   	   	   		        var k_num = document.getElementById('awo_id'+entry.account).innerHTML;
   	   		      		var input = document.getElementById('wo_entry_'+k_num+'_'+entry.day);
   	   		       	}
   	   		       	else
   	   		       	{
   	   		      		var input = document.getElementById('allo_entry_'+entry.account+'_'+entry.day);
   	   		       	}
					
					input.value = entry.value;
					if(input.value > 0)
					{
						input.style.opacity = '1';
					}
   		       	}
   		       	getTotals();
   		       	statusWheel(false);
   		    }
   		    );
   		}
   		function getTotals()
   		{
   			statusWheel(true);
   			$.get("/uadmin/ajaxTimecardTotals.php",
   			{
				timecard: <?php echo e($timecard->id); ?>

   			},
   		   	function(data, status)
   		   	{
   				//console.log(data);
   		   		var total_hours = 0.00;
   		   		for(i=1;i<=7;i++)
   		   		{
   		   			var Ptotal = document.getElementById('day_d'+i);
					Ptotal.innerHTML = Number(0.00).toFixed(2);
   		   		}
   		        for(var day in data.days)
   		       	{
   	   		       	
					var total = document.getElementById('day_'+day);
					total.innerHTML = Number(data.days[day]).toFixed(2);
					total_hours += +data.days[day];
   		       	}
   		       	var sheet_total = document.getElementById('day_all');
   		       	sheet_total.innerHTML = Number(total_hours).toFixed(2);

   		       	

				var account_totals = document.getElementsByClassName('account_totals');
   		       	for(var one in account_totals)
   		       	{
   	   		       	var ind = account_totals[one];
					ind.innerHTML = Number(0.00).toFixed(2);
					
   		       	}
   		     	for(var key in data.accounts)
		       	{
   		     		var k_num = document.getElementById('awo_id'+key);
   		     		if(k_num == null)
   		     		{
   		     			var total = document.getElementById('total_'+key);
   		     			total.innerHTML = Number(data.accounts[key]).toFixed(2);
   		     		}
   		     		else
   		     		{
   	   		     		
   		     			var total = document.getElementById('total_wo'+k_num.innerHTML);
   		     			
   		     			total.innerHTML = Number(data.accounts[key]).toFixed(2);
   		     		}
					
					
					
		       	}
   		       	statusWheel(false);
   		    }
   		    );
   		}


   		function removeRowAccount(element)
		{
   			console.log(element);
   			var table = $('#dataTables-accounts').DataTable();
			table.row(element).remove().draw();
		}

   		function removeRowWO(element)
		{
   			var table = $('#dataTables-workorders').DataTable();
			table.row(element).remove().draw();
		}
   		
   	    $(document).ready(function() {
   	     accounts_table = $('#dataTables-accounts').dataTable( {
   	 					"pageLength": 10,
   	 					"order": [ 0, 'asc' ],
   	 					"stateSave" : false,
   	 					"scrollX" : window.innerWidth < 800 ? true : false,
   	 					"columnDefs": [
   	 					               {
   	 					                   "targets": [ 3 ],
   	 					                   "visible": false,
   	 					                   "searchable": true
   	 					               },
   	 					           ],
   	 					"pagingType": 'simple',
   	 					"language": {
   	 			            "lengthMenu": "Show _MENU_",
   	 			            "zeroRecords": "No available accounts",
   	 			            "info": "Showing _START_ to _END_ of _TOTAL_ accounts",
   	 			            "infoEmpty": "No available accounts",
   	 			            "infoFiltered": "(filtered from _MAX_ accounts)",
   	 			        	"paginate": {
		   	 			        "first":      "First",
		   	 			        "last":       "Last",
		   	 			        "next":       "<i class='fa fa-arrow-right'></i>",
		   	 			        "previous":   "<i class='fa fa-arrow-left'></i>"
		   	 			    	}
   	 			        }
   	 					
   	         } ); 
   	  	workorders_table = $('#dataTables-workorders').dataTable( {
						"pageLength": 10,
						"order": [ 0, 'asc' ],
						"stateSave" : false,
						"scrollX" : window.innerWidth < 800 ? true : false,
						"columnDefs": [
						               {
						                   "targets": [ 2 ],
						                   "visible": false,
						                   "searchable": true
						               },
						           ],
						"pagingType": 'simple',
   	 					"language": {
   	 			            "lengthMenu": "Show _MENU_",
   	 			            "zeroRecords": "No available work orders",
   	 			            "info": "Showing _START_ to _END_ of _TOTAL_ work orders",
   	 			            "infoEmpty": "No available work orders",
   	 			            "infoFiltered": "(filtered from _MAX_ work orders)",
   	 			        	"paginate": {
		   	 			        "first":      "First",
		   	 			        "last":       "Last",
		   	 			        "next":       "<i class='fa fa-arrow-right'></i>",
		   	 			        "previous":   "<i class='fa fa-arrow-left'></i>"
		   	 			    	}
   	 			        }
						
		  		} );   

   			
   	     });
   	 if ( typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && $.fn.dataTableExt.fnVersionCheck('1.9.2')/*older versions should work too*/ )
     {
         $.fn.dataTableExt.oApi.clearSearch = function ( oSettings )
         {
      
             var table = this;
              
             //any browser, must include your own file
             //var clearSearch = $('<img src="/images/delete.png" style="vertical-align:text-bottom;cursor:pointer;" alt="Delete" title="Delete"/>');
              
             //no image file needed, css embedding must be supported by browser
             var clearSearch = $('<i class="fa fa-times-circle-o fa-fw" style="vertical-align:text-bottom;cursor:pointer;color: gray;"></i>');
             $(clearSearch).click( function ()
                     {
                           table.fnFilter('');
                     });
             $(oSettings.nTableWrapper).find('div.dataTables_filter').append(clearSearch);
             $(oSettings.nTableWrapper).find('div.dataTables_filter label').css('margin-right', '-16px');//16px the image width
             $(oSettings.nTableWrapper).find('div.dataTables_filter input').css('padding-right', '16px');
         }
      
         //auto-execute, no code needs to be added
         $.fn.dataTable.models.oSettings['aoInitComplete'].push( {
             "fn": $.fn.dataTableExt.oApi.clearSearch,
             "sName": 'whatever'
         } );
     }

			var wos = [];
			<?php foreach($work_orders as $wo): ?>
				wos[<?php echo e($wo->Id); ?>] = {
					"number": "<?php echo e($wo->WONumber); ?>",
					"description": "<?php echo e($wo->Client_WO_Name); ?>",
					"company": "<?php echo e($wo->Client_Company); ?>"
				};
			<?php endforeach; ?>

			$(document).ready(function() {
			    $(".time_input").focus(function() {
			    	 statusWheel(true);
				     $(this).select(); 
				     //this.setSelectionRange(0, this.value.length);
				     statusWheel(false);
				     } );
			    $(".time_input").mouseup(function(e){
			        e.preventDefault();
			    });
			});

			function nextDown()
			{
				var current = document.activeElement;
				var time_fields = document.querySelectorAll('input[day="'+current.getAttribute('day')+'"]');
				var next = false;
				for ( var i = 0; i < time_fields.length; i++ ) 
				{
					if(next && time_fields[i].offsetParent !== null)
					{
						time_fields[i].focus();
						next = false;
					}
					if(current.id == time_fields[i].id)
					{
						next = true;
					}
				}
			}

			var keys = [];
			
			document.onkeydown = function(evt){    
			   var key = evt.keyCode;
			   keys[key] = true;
			    if(keys[13]){
			    	
					
					nextDown();
					
					keys[13] = false;

			    } 
			}
			document.onkeyup = function(evt){    
			   var key = evt.keyCode;
			   keys[key] = false;
			}
   		
   		window.onload = getEntries();
    </script> 

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





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