This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/web/pages/dogs/dog.html.php
piapassecker 503afa3cee
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
Layout change
2023-11-20 19:49:06 +01:00

271 lines
12 KiB
PHP

<!-- FILEPATH: /home/chris/git/dogstats/web/pages/dogs/dog.html -->
<div class="container">
<div class="">
<div class="row">
<div id="dog-data" class="col-sm-6 offset-sm-3 position-relative rounded-2 shadow mb-3 mb-md-5">
<img src="<?= $dogdata['photo']?:'https://pictshare.net/1ch3e5.png' ?>/120x160/forcesize" width="120" height="160" class="rounded-5 rounded-top-0 dog-image shadow" alt="<?= escape($dogdata['name']); ?>'s profile Picture">
<h5 class="mb-3">
<?= escape($dogdata['name']); ?>
</h5>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td>Alter:</td>
<td><?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?></td>
</tr>
<?php if($dogdata['breed']): ?>
<tr>
<td>Rasse:</td>
<td><?= escape($dogdata['breed']); ?></td>
</tr>
<?php endif; ?>
<?php if($dogdata['kennel_name']): ?>
<tr>
<td>Zuchtname:</td>
<td><?= escape($dogdata['kennel_name']); ?></td>
</tr>
<?php endif; ?>
<?php if($dogdata['size']): ?>
<tr>
<td>Größe:</td>
<td><?= escape($dogdata['size']); ?> cm</td>
</tr>
<?php endif; ?>
<?php if($dogdata['agility_size']): ?>
<tr>
<td>Agility Größe:</td>
<td><?= escape($dogdata['agility_size']); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php if($ismydog===true): ?>
<div class="d-flex justify-content-end">
<button type="button" class="btn btn-secondary" hx-get="/dogs/edit/<?= $dogid; ?>" hx-target="#main">
<i class="fas fa-edit"></i>
</button>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="container" id="sitemain">
<!-- table of all runs of this dog-->
<h4>Alle Ergebnisse</h4>
<div class="accordion" id="accordion-dog-runs">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
2023
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordion-dog-runs">
<div class="accordion-body">
Runs 2023
<table class="table">
<thead>
<tr>
<th>Turnier</th>
<th>Lauf</th>
<th>Platz</th>
<th>Dis</th>
<th>VW</th>
<th>F</th>
<th>ZF</th>
<th>Zeit</th>
<th>GF</th>
<th>m/Sek</th>
<th>Bew.</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Turnier</th>
<th>Lauf</th>
<th>Platz</th>
<th>Dis</th>
<th>VW</th>
<th>F</th>
<th>ZF</th>
<th>Zeit</th>
<th>GF</th>
<th>m/Sek</th>
<th>Bew.</th>
</tr>
</thead>
<tbody>
<?php if(count($results) > 0): ?>
<?php foreach($results as $result) : ?>
<?php
$t = new Tournament();
$run = new Run();
$tname = $t->getField('name',$result['tournament']);
$tdate = $t->getField('date',$result['tournament']);
$rname = $run->getField('name',$result['run']);
$sdata['dates'][] = $tdate;
$sdata['speed'][] = $result['speed'];
$sdata['errors'][] = $result['errors'];
$sdata['refusals'][] = $result['refusals'];
$sdata['time'][] = $result['runtime'];
$sdata['points'][] = $result['points'];
$sdata['ranking'][] = $result['ranking'];
//'Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Punkte','Platz'
?>
<tr>
<td><a href="/tournaments/event/<?= $result['tournament']; ?>">
<?= $tname; ?>
</a></td>
<td><a href="/runs/overview/<?= $result['run']; ?>">
<?= $rname; ?>
</a></td>
<td>
<?= escape($result['ranking']); ?>
</td>
<td>
<?= $result['disqualified']?'Ja':'Nein'; ?>
</td>
<td>
<?= escape($result['refusals']); ?>
</td>
<td>
<?= escape($result['errors']); ?>
</td>
<td>
<?= escape($result['timefaults']); ?>
</td>
<td>
<?= escape($result['runtime']); ?>
</td>
<td>
<?= escape($result['penalties']); ?>
</td>
<td>
<?= escape($result['speed']); ?>
</td>
<td>
<?= escape($result['ranking']); ?>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="12">
<div class="alert alert-info" role="alert">
<i class="fas fa-info-circle"></i> <?= escape($dogdata['name']); ?> hat noch keine Ergebnisse
</div>
</td>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php if(count($results) > 0): ?>
<div class="col">
<div id="graph" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
<script type="text/javascript">
// Initialize the echarts instance based on the prepared dom
var myChart = echarts.init(document.getElementById('graph'));
// Specify the configuration items and data for the chart
var option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit','Punkte','Platz']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: <?= json_encode($sdata['dates']); ?>
},
yAxis: {
type: 'value'
},
series: [
{
name: 'Geschwindigkeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['speed']); ?>
},
{
name: 'Fehler',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['errors']); ?>
},
{
name: 'Verweigerungen',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['refusals']); ?>
},
{
name: 'Zeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['time']); ?>
},
{
name: 'Punkte',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['points']); ?>
},
{
name: 'Platz',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['ranking']); ?>
}
]
};
// Display the chart using the configuration items and data just specified.
myChart.setOption(option);
</script>
</div>
<?php endif; ?>
</div>
</div>