ergebnisformular fast fertig
Build and push / Pulling repo on server (push) Successful in 3s Details

This commit is contained in:
Chris 2023-10-31 11:49:20 +00:00
parent d96dc2fae3
commit a19cc42d69
3 changed files with 34 additions and 18 deletions

View File

@ -8,7 +8,7 @@ class Result extends Model
'run' => ['type' => 'text', 'required'], //run ID
'user' => ['type' => 'text', 'required'], //user ID
'disqualified' => ['type' => 'bool'],
'disqualified' => ['type' => 'bool','default'=>0],
'refusals' => ['type' => 'int','default'=>0],
'errors' => ['type' => 'int','default'=>0],
'timefaults' => ['type' => 'int','default'=>0],
@ -21,6 +21,7 @@ class Result extends Model
'photos' => ['type' => 'array','default'=>[]],
'videos' => ['type' => 'array','default'=>[]],
'memo' => ['type' => 'text'],
'public' => ['type' => 'bool','default'=>1],
);

View File

@ -59,11 +59,21 @@ class Runs extends Page {
$t = new Tournament();
$tid = $run->data['tournament'];
$t->load($tid);
$res = new Result();
if($_REQUEST['result_id'])
{
if(!$res->exists($_REQUEST['result_id']))
return partial('error.html', ['errorMessage' => 'Dieses Ergebnis existiert nicht']);
$res->load($_REQUEST['result_id']);
if(!$res->data['run']==$rid)
return partial('error.html', ['errorMessage' => 'Dieses Ergebnis gehört nicht zu diesem Lauf']);
}
else
$res->id = gen_ulid();
if(!$t->amIAdmin() && !$t->isMyEvent($tid))
return partial('error.html', ['errorMessage' => 'Du bist in diesem Turnier nicht angemeldet']);
else
{
$run->data['results'] = [];
$run->data['results']['time'] = $_REQUEST['time'];
$run->data['results']['penalty'] = $_REQUEST['penalty'];
$run->data['results']['disq'] = $_REQUEST['disq'];

View File

@ -7,7 +7,7 @@
</li>
<li class="breadcrumb-item">
<a href="/runs/overview/<?= $run_id; ?>" hx-push-url="/runs/overview/<?= $run_id; ?>" hx-get="/runs/overview/<?= $run_id; ?>" hx-target="#main">
<?= escape($run['name']); ?>
<?= escape($result['name']); ?>
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
@ -19,37 +19,38 @@
<?= $result_id?'Bearbeiten':'Eintragen'; ?>
</h2>
<form>
<input type="hidden" name="result_id" value="<?= $result_id; ?>">
<input type="hidden" name="run_id" value="<?= $run_id; ?>">
<div>
<label for="eliminated" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Disqualifiziert</label>
<input type="number" value="<?= $result['eliminated']; ?>" id="eliminated" name="eliminated" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
<div class="form-check form-switch">
<label class="form-check-label" for="disqualified">Disqualifiziert</label>
<input class="form-check-input" type="checkbox" id="disqualified" name="disqualified" value="1" <?= $result['disqualified']=='1'?'checked':''; ?>>
</div>
<div>
<label for="refusals" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Verweigeresultgen</label>
<label for="refusals">Verweigeresultgen</label>
<input type="number" value="<?= $result['refusals']; ?>" id="refusals" name="refusals" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="faults" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Fehler</label>
<label for="faults">Fehler</label>
<input type="number" value="<?= $result['faults']; ?>" id="faults" name="faults" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="time_faults" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Zeitfehler</label>
<label for="time_faults">Zeitfehler</label>
<input type="number" value="<?= $result['time_faults']; ?>" id="time_faults" name="time_faults" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="time" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Zeit</label>
<label for="time">Zeit</label>
<input type="number" value="<?= $result['time']; ?>" id="time" name="time" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="penalties" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Gesamtfehler</label>
<label for="penalties">Gesamtfehler</label>
<input type="number" value="<?= $result['penalties']; ?>" id="penalties" name="penalties" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="time_speed" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">m/Sek</label>
<label for="time_speed">m/Sek</label>
<input type="number" value="<?= $result['time_speed']; ?>" id="time_speed" name="time_speed" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="bewertung" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Bewertung</label>
<label for="bewertung">Bewertung</label>
<select id="bewertung" name="bewertung" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
<option value="V" <?=$result['bewertung']=='V' ?'selected':''; ?>>V</option>
<option value="SG" <?=$result['bewertung']=='SG' ?'selected':''; ?>>SG</option>
@ -58,24 +59,28 @@
</select>
</div>
<div>
<label for="points" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Punkte</label>
<label for="points">Punkte</label>
<input type="number" value="<?= $result['points']; ?>" id="points" name="points" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="rank" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Platz</label>
<label for="rank">Platz</label>
<input type="number" value="<?= $result['rank']; ?>" id="rank" name="rank" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Flowbite">
</div>
<div>
<label for="uploads" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Uploads</label>
<label for="uploads">Uploads</label>
<input type="file" accept="image/png, image/jpeg, image/gif" id="uploads" name="uploads">
</div>
<div>
<label for="video-url" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Video Url</label>
<label for="video-url">Video Url</label>
<input type="text" value="<?= $result['video-url']; ?>" class="form-control" id="video-url" aria-describedby="basic-addon3">
</div>
<div>
<label for="memo" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Memo</label>
<label for="memo">Memo</label>
<textarea value="<?= $result['memo']; ?>" id="memo" name="memo" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Deine Gedankengänge"></textarea>
</div>
<div class="form-check form-switch">
<label class="form-check-label" for="public">Daten im Lauf veröffentlichen</label>
<input class="form-check-input" type="checkbox" id="public" name="public" value="1" <?= $result['public']!='0'?'checked':''; ?>>
</div>
<button type="submit" name="submit" value="true" class="btn btn-primary">Speichern</button>
</form>