oswilno/crates/oswilno-parking-space/templates/parking-space-rents/form.html

64 lines
2.8 KiB
HTML

<section id="main-view" class="lg:min-h-ffh xl:min-h-ffhl flex items-top justify-center">
<section>
<div class="max-w-md w-full p-6 bg-white text-lg">
{% include "../parking-spaces/rent_space_info.html" %}
</div>
<div class="max-w-md w-full p-6 bg-white rounded-lg shadow-lg">
<form
{% if let Some(id) = form.id %}
hx-put='/parking-space-rents/update/{{id}}'
{% else %}
hx-post='/parking-space-rents/create'
{% endif %}
hx-headers="{'Accept':'text/html-partial'}"
>
{% if let Some(id) = form.id %}
<input type="hidden" value="{{id}}" name="id" />
{% endif %}
<input type="hidden" value="{{parking_space.id}}" name="parking_space_id" />
<div class="mb-4">
<label
for="price"
class="block mb-2 text-sm text-gray-600"
>
{{ "Price"|t(lang,t) }}
</label>
<div class="flex w-full">
<input
id="price-major"
name="price-major"
class="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.price %} value="{{ v / 100 }}" {% endif %}
/>
<span class="m-1 text-lg font-medium">.</span>
<input
id="price-minor
name="price-minor"
class="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.price %} value="{{ v % 100 }}" {% endif %}
/>
<span class="m-1">PLN</span>
</div>
</div>
<div class="mb-6">
<input
type="submit"
{% if let Some(id) = form.id %}
value="{{"Update parking space rent"|t(lang,t)}}"
{% else %}
value="{{"Register parking space rent"|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>
</div>
</section>
</section>