<?php
	// Assets::add( 'select2' );
	// Assets::add( 'courses.min.js' );
	// Assets::add( 'courses.css' );
	// AMIB::add_js_translation( trans( 'course.js-msgs' ) );
?>
<?php $__env->startSection( 'head' ); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection( 'content' ); ?>
	<table class="default">
		<thead>
			<tr>
				<th>رتبه</th>
				<th>تراز</th>
				<th>تراز عمومی</th>
				<th>رتبه عمومی</th>
				<th>تراز تخصصی</th>
				<th>رتبه تخصصی </th>
				<th>نام و نام خانوادگی</th>

				<?php foreach( $exam->Lessons as $lesson ): ?>
					<th style="writing-mode: sideways-lr;"><?php echo $lesson->name; ?></th>
					<th style="writing-mode: sideways-lr;">&#9660; تراز &#9660;</th>
					<th style="writing-mode: sideways-lr;">&#9660; رتبه &#9660;</th>
				<?php endforeach; ?>

				<th style="writing-mode: sideways-lr;">سازمان</th>
				<th>کد ملی</th>
				<th>گروه‌ها</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach( $results as $row ): ?>
				<?php $raw_results = @json_decode( $row->pivot->raw_results ); ?>
				<?php if( is_null( $raw_results ) || false == property_exists( $raw_results, 'total_rank' ) ) continue; ?>

				<tr>
					<td><?php echo $raw_results->total_rank; ?></td>
					<td><?php echo $raw_results->total_taraz; ?></td>
					<td><?php echo $raw_results->general_taraz; ?></td>
					<td><?php echo $raw_results->general_rank; ?></td>
					<td><?php echo $raw_results->expertize_taraz; ?></td>
					<td><?php echo $raw_results->expertize_rank; ?></td>

					<td><?php echo e($row->full_name); ?></td>
					<?php foreach( $exam->Lessons as $lesson ): ?>
						<td>&lrm;<?php echo round( $raw_results->lessons->{$lesson->id}->mark, 2 ); ?></td>
						<td>&lrm;<?php echo round( $raw_results->lessons->{$lesson->id}->taraz, 2 ); ?></td>
						<td><?php echo $raw_results->{"lessons_{$lesson->id}_rank"}; ?></td>
					<?php endforeach; ?>
					<td><?php echo $row->Company ? $row->Company->name : '--'; ?></td>
					<td><?php echo e($row->national_code); ?></td>
					<td><?php echo implode( ',', array_replace(
							array_fill( 1, $biggest_group, 0 ),
							array_fill_keys( $row->Groups->lists( 'group_code' ), 1 )
					) ); ?>

					</td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
<?php $__env->stopSection(); ?>