<?php $__env->startSection('content'); ?>
		<div class="row">
    	<div class="col-lg-12">
    		<h1 class="page-header">Appointments</h1>
    	</div>
    </div>
    <div class="row">
    	<?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="col-md-12">
	        <div class="panel panel-default">
		        <div class="panel-heading">
	            	Technicians
	            </div>
	            <div class="panel-body">
	            	<div class="dataTable_wrapper">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-technicians">
                            <thead>
                                <tr>
                               		<th>Technician</th>
                               		<th>Today's Scheduled Hours</th>
                                    <th>Today's Appointment Count</th>
                                    <th>Today's FlexTask Count</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php $count = 0; ?>
                            <?php foreach(\App\Appointment_tech::selectPrep() as $tech): ?>
                            <?php $count++; ?>
                            <?php if($count % 2 == 1): ?>
                                <tr class="odd">
                            <?php else: ?>
                            	<tr class="even">
                            <?php endif; ?>
                                    <td>
                                    	<a 
                                    		href="<?php echo e(url('uadmin/appointments/technician/'.$tech->user()->id)); ?>" 
                                    		title="View Appointments and FlexTasks"
                                    		target="_blank"
                                    	>
                                       		<?php echo e($tech->user()->name); ?>

                                       	</a>
                                    </td>
                                    <td>
                                        <?php echo e($tech->scheduled_hours); ?>

                                    </td>
                                    <td>
                                        <?php echo e($tech->appointment_count); ?>

                                    </td>
                                    <td>
                                        <?php echo e($tech->flextask_count); ?>

                                    </td>
                                    <td style="text-align: center;">
                                        <a 
                                        	href="<?php echo e(url('uadmin/appointments/technician/'.$tech->user()->id)); ?>" 
                                        	title="View Appointments and FlexTasks"
                                        	target="_blank"
                                    	>
                                        	<i class="fa fa-calendar"></i>
                                        </a>
                                        &nbsp; &nbsp;
                                        <a href="mailto:<?php echo e($tech->user()->email); ?>?cc=<?php echo e($tech->dispatcher_email); ?>" title="Email Technician"><i class="fa fa-envelope"></i></a>
                                    </td>
                                </tr>
                          	<?php endforeach; ?>
                            </tbody>
                    	</table>
                    </div>
	            </div>
		    </div>
		    <i>*This page will auto-refresh every 10 minutes while open.</i>
		    <br><br>
	    </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"/>

    <style>
    	a:hover{
    		text-decoration: none;
    	}
    	.odd .subBack {
    		background-color: #f0fcff;
    	}
    	.even .subBack {
    		background-color: #ecf7fa;
    	}
    	.floatLeft
    	{
    		float: left;
    	}
    </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>
	    $(document).ready(function() {
		    var table1 = $('#dataTables-technicians').dataTable({
				"pageLength": 100,
				"order": [0,'asc'],
				"stateSave" : true,
				"scrollX" : window.innerWidth < 800 ? true : false
	        }); 
	    });

	    if(typeof $.fn.dataTable == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" && $.fn.dataTableExt.fnVersionCheck('1.9.2'))
	    {
	        $.fn.dataTableExt.oApi.clearSearch = function ( oSettings )
	        {
	            var table = this;
	            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');
	            $(oSettings.nTableWrapper).find('div.dataTables_filter input').css('padding-right', '16px');
	        }
	        $.fn.dataTable.models.oSettings['aoInitComplete'].push( {
	            "fn": $.fn.dataTableExt.oApi.clearSearch,
	            "sName": 'whatever'
	        });
	    }

	    var inactivityTimeoutSelectTech = setTimeout(function()
		{
			self.location = '<?php echo e(url()); ?>' + window.location.pathname;
		},1000*60*10);
    </script> 
<?php $__env->stopSection(); ?>
<?php echo $__env->make('residential.templates.uadmin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>