
<?php $__env->startSection('content'); ?>

<?php if(count($errors)): ?>
<div class="row errors">
	<div class="columns small-12">
		<div data-alert class="alert-box alert">
			<p class="lead">Please fix the following errors:</p>
			<ul>
			<?php foreach($errors->all() as $error): ?>
			  <li><?php echo $error; ?></li>
			<?php endforeach; ?>
			</ul>
			<a href="#" class="close">&times;</a>
		</div>
	</div>
</div>
<?php endif; ?>

<?php if(Session::has('errorMsg')): ?>
<div class="row" class="errors">
	<div class="columns small-12">
		<div data-alert class="alert-box alert">
			<p class="lead"><?php echo Session::get('errorMsg'); ?></p>
			<a href="#" class="close">&times;</a>
		</div>
	</div>
</div>
<?php endif; ?>

<div class="row">
	<div class="columns small-12">
			
		<?php if(!count($audits)): ?>
		<form id="dpr_search">
		<input type="hidden" name="search" value="on">
			<label>Start date: </label>
			<input type="date" name="start_date">
			<label>End date: </label>
			<input type="date" name="end_date">
			<label>Filter: </label>
			<select name="filter" id="dpr_filter">
				<option value="providers">Providers</option>
				<option value="laboratories">Laboratories</option>
				<option value="employers">Employers</option>
			</select>
			<div id="dpr_providers">
				<label>Providers: </label>
				<select name="providers[]" multiple>
				<?php foreach($providers as $provider): ?>
					<option value="<?php echo $provider->full_name; ?>">
						<?php echo $provider->full_name; ?>
					</option>
				<?php endforeach; ?>
				</select>
			</div>
			<div id="dpr_laboratories">
				<label>Laboratories: </label>
				<select name="laboratories[]" multiple>
				<?php foreach($labs as $lab): ?>
					<option value="<?php echo $lab->labid1; ?>"><?php echo $lab->labid1; ?></option>
					<option value="<?php echo $lab->labid2; ?>"><?php echo $lab->labid2; ?></option>
				<?php endforeach; ?>
				</select>
			</div>
			<div id="dpr_employers">
				<label>Employers: </label>
				<select name="employers[]" multiple id="dpr_employers">
				<?php foreach($employers as $employer): ?>
					<option value="<?php echo $employer->pid; ?>"><?php echo $employer->name; ?> (pid: <?php echo $employer->pid; ?>)</option>
				<?php endforeach; ?>
				</select>
			</div>
			<div class="small-12">
				<button type="submit"> Search </button>
			</div>				
		</form>

		<?php else: ?>
		<dl class="tabs" data-tab>
			<dd class="tab-title active"><a href="#table">Table</a></dd>

			<?php if(((($audits->getCurrentPage() - 1) * $audits->getPerPage()) + 1 ) <= ($audits->getPerPage())): ?>
				<dd class="tab-title"><a href="#graph" id="audits_graph_trigger">Graph</a></dd>
			
			<?php endif; ?>
			
		</dl>
		<div class="tabs-content">
			<div class="content active" id="table">
				<?php echo $__env->make('audits.table', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
			</div>
			<div class="content" id="graph">
				<?php echo $__env->make('audits.graph', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
			</div>
		</div>
		<?php endif; ?>



		<?php if(count($audits)): ?>
		<div class="small-12">
		<form method="POST" id="dpr_download">
			<?php echo $__env->make('dpr.token', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
			<a href="#" onclick="sendCode('<?php echo URL::to('dpr/data/code'); ?>')" class="button">Download</a> 
			<a href="<?php echo e(URL::to('dpr/','data')); ?>" class="button">Return</a> 
		</form>
		</div>
		<?php endif; ?>

	</div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>