Rapport-Laravel/resources/views/widgets/compatition_dashboard.php

60 lines
3.4 KiB
PHP

<div class="card">
<div class="card-body">
<h4 class="header-title mb-2">{{$title}}</h4>
<div class="row">
@foreach($scores as $score)
<div class="col-md-6">
<button class="btn btn-warning btn-xs rounded-pill mb-1 dlscreenshot" target="live_score_{{$score->id}}">Download PNG</button>
<div class="card border-primary border mb-3" id="live_score_{{$score->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($score->validity_start))}} - {{date("d M Y h:iA", strtotime($score->validity_end)-1 )}}</div>
<div class="card-body">
<h4 class="card-title text-primary">{{$score->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 colspan="2">Team Name</th>
<th>Rx</th>
<th>Rank</th>
</tr>
</thead>
<tbody>
@php
$rank = 0;
$lastscore = 0;
@endphp
@foreach($score->participants as $participant)
@if($participant->type == 'Team')
@php
$score = is_object($participant->score) ? 0 : $participant->score;
if($lastscore == 0 && $score > 0) {
$rank++;
$lastscore = $score;
}
if($lastscore > 0 && $score < $lastscore) {
$rank++;
$lastscore = $score;
}
@endphp
<tr>
<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>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
<td><h2>{{$rank}}</h2></td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>