<?php
	// Assets::add( 'select2' );
	Assets::add( 'user-exams.min.js' );
	// Assets::add( 'amib-datepicker' );
	// Assets::add( 'momentjs' );
	// Assets::add( 'users.css' );
	AMIB::add_js_translation( trans( 'user-exam.js-msgs' ) );
?>
<?php $__env->startSection( 'head' ); ?>
	<script>
		var deleteUrl = "<?php echo route( 'delete-user-exam-ajax' ); ?>";
	</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection( 'content' ); ?>
	<h1>فهرست آزمون‌های &laquo;<?php echo e($user->full_name); ?>&raquo;</h1>

	<?php if( count( $exams ) ): ?>
		<table id="exams-table" class="default">
			<thead>
				<tr>
					<th><?php echo trans( 'main.row' ); ?></th>
					<th><?php echo trans( 'exam.name' ); ?></th>
					<th><?php echo trans( 'exam.course_id' ); ?></th>
					<th><?php echo trans( 'begin.allowed_timestamp' ); ?></th>
					<th><?php echo trans( 'exam.minutes' ); ?></th>
					<th><?php echo trans( 'begin.start_timestamp' ); ?></th>
					<th><?php echo trans( 'begin.finalized' ); ?></th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php $row = $exams->getFrom(); ?>
				<?php foreach( $exams as $exam ): ?>
					<tr data-exam-user-id="<?php echo $exam->pivot->id; ?>">
						<td><?php echo en2fa( $row++ ); ?></td>
						<td><?php echo e($exam->name); ?></td>
						<td><?php echo e($exam->pivot->type == 'exam' ? $exam->course_name : $exam->poll_name); ?></td>
						<td><?php echo unix_to_pdate_time( $exam->pivot->allowed_timestamp ); ?></td>
						<td><?php echo e(en2fa( $exam->pivot->type == 'exam' ? $exam->minutes : '--' )); ?></td>
						<td><?php echo unix_to_pdate_time( $exam->pivot->start_timestamp ); ?></td>
						<td>
							<?php if( $exam->pivot->finalized ): ?>
								<i class="fa fa-check"></i>
							<?php else: ?>
								<i class="fa fa-times"></i>
							<?php endif; ?>
						</td>
						<td>
							<?php if( $exam->pivot->finalized ): ?>
								<?php echo HTML::linkRoute( 'workbook', trans( 'user.workbook' ), array( $exam->pivot->id ), array( 'target' => '_BLANK', 'class' => 'button workbook' ) ); ?>

								<?php echo HTML::linkRoute( 'answer_sheet', trans( 'user.answer-sheet' ), array( $exam->pivot->id ), array( 'target' => '_BLANK', 'class' => 'button answer-sheet' ) ); ?>

							<?php endif; ?>
							
							<?php echo HTML::link( '#', trans( 'main.delete' ), array( 'class' => 'button delete' ) ); ?>

						</td>
					</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
		<div>
			<?php echo $exams->appends( $old_search_data )->links(); ?>

		</div>
	<?php else: ?>
		<div class="info-message"><?php echo trans( 'main.empty' ); ?></div>
	<?php endif; ?>
<?php $__env->stopSection(); ?>