93 lines
6.1 KiB
PHP
93 lines
6.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => "Form"])
|
|
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
|
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div class="account-pages">
|
|
<div class="container">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card border-primary border mb-3" id="compatition_dashboard_{{$competition->id}}">
|
|
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
|
<div class="card-body">
|
|
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
|
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
|
<div class="table-responsive">
|
|
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Rank</th>
|
|
<th colspan="2">Team Name</th>
|
|
<th>Avg Runs</th>
|
|
<th>TM Count</th>
|
|
<th>Total Runs</th>
|
|
@foreach($competition->metrics as $metric)
|
|
<th>{{$metric->name}}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@php
|
|
$rank = 0;
|
|
$lastscore = 0;
|
|
$metrics = $competition->metrics;
|
|
$participants = [];
|
|
foreach($competition->participants as $participant){
|
|
$participant->runrate = 0;
|
|
$score = is_object($participant->score) ? 0 : $participant->score;
|
|
if($score > 0) {
|
|
$score = $score / $participant->users_count;
|
|
$participant->runrate = $score;
|
|
}
|
|
$participants[] = $participant;
|
|
}
|
|
usort($participants,function($first,$second){
|
|
return $first->runrate < $second->runrate;
|
|
});
|
|
@endphp
|
|
|
|
@foreach($participants as $participant)
|
|
@if($participant->type == 'Team')
|
|
@php
|
|
if($lastscore == 0 && $participant->runrate > 0) {
|
|
$rank++;
|
|
$lastscore = $participant->runrate;
|
|
}
|
|
if($lastscore > 0 && $participant->runrate < $lastscore) {
|
|
$rank++;
|
|
$lastscore = $participant->runrate;
|
|
}
|
|
@endphp
|
|
<tr>
|
|
<td><h2>{{$rank}}</h2></td>
|
|
<td style="width: 36px;">
|
|
<img src="{{$participant->team->image}}" alt="contact-img" title="contact-img" class="avatar-md" />
|
|
</td>
|
|
<td><h5 class="m-0 fw-normal">{{$participant->team->name}}</h5></td>
|
|
<td>{{ number_format((float)$participant->runrate, 2, '.', '') }}</td>
|
|
<td>{{ $participant->users_count }}</td>
|
|
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
|
@foreach($metrics as $metric)
|
|
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |