doggo upload
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
2023-10-26 13:46:55 +02:00
parent 61d7ae9adf
commit 12c11b65ba
5 changed files with 132 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<div>
<h1>Hund hinzufügen/bearbeiten</h1>
<h1>Hund <?= $dogid?'Bearbeiten':'Hinzufügen'; ?></h1>
<form hx-post="/dogs/edit" hx-target="#response">
<form id="dogeditform" hx-post="/dogs/edit" hx-encoding='multipart/form-data' hx-target="#response">
<input type="hidden" name="dog_id" value="<?= $dogid; ?>">
<div>
<label for="name" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Name</label>
@ -32,7 +32,18 @@
<option value="L" <?= $dogdata['agility_size']=='L'?'selected':''; ?>>L</option>
</select>
</div>
<div>
<label for="photo" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Photo</label>
<input type="file" id="photo" name="photo" class="" placeholder="Max" required>
</div>
<button type="submit" name="submit" value="true" class="btn btn-primary">Submit</button>
</form>
<progress id='progress' value='0' max='100'></progress>
<div id="response"></div>
</div>
</div>
<script>
htmx.on('#dogeditform', 'htmx:xhr:progress', function(evt) {
htmx.find('#progress').setAttribute('value', evt.detail.loaded/evt.detail.total * 100)
});
</script>