oswilno/crates/oswilno-parking-space/templates/parking-spaces/form-partial.html

78 lines
2.2 KiB
HTML

<section id="main-view" class="lg:min-h-ffh xl:min-h-ffhl flex items-top justify-center">
<section class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
<h2 class="text-xl text-gray-900 mb-2">{{ "Register parking space"|t(lang,t) }}</h2>
{% for error in errors.global() %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
{% endfor %}
<form
{% if let Some(id) = form.id %}
hx-post="/parking-spaces/update"
{% else %}
hx-post="/parking-spaces/create"
{% endif %}
hx-target="main"
>
{% if let Some(id) = form.id %}
<input type="hidden" name="id" value="{{id}}" />
{% endif %}
<div class="mb-4">
<label
for="location_id"
class="block mb-2 text-sm text-gray-600"
>
{{ "Location"|t(lang,t) }}
</label>
<select
id="location_id"
name="location_id"
value="{{ form.location_id|skip_if(0) }}"
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
>
{% for loc in locations %}
<option
value="{{loc.id}}"
{% if form.location_id == loc.id %} selected {% endif %}
>
{{ loc.name }}
{{ loc.number }}
Etap {{ loc.stage }}
</option>
{% endfor %}
</select>
{% for error in errors.field("login") %}
<oswilno-error>{{error|t(lang,t)}}</oswilno-error>
{% endfor %}
</div>
<div class="mb-4">
<label
for="spot"
class="block mb-2 text-sm text-gray-600"
>
{{ "Spot"|t(lang,t) }}
</label>
<input
id="spot"
name="spot"
class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500"
type="number"
required
{% if let Some(v) = form.spot %}
value="{{v}}"
{% endif %}
/>
</div>
<div class="mb-6">
<input
type="submit"
{% if let Some(id) = form.id %}
value="{{"Update parking space"|t(lang,t)}}"
{% else %}
value="{{"Register parking space"|t(lang,t)}}"
{% endif %}
class="w-64 bg-cyan-600 text-white py-2 rounded-lg mx-auto block focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 mb-2"
/>
</div>
</form>
</section>
</section>