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

133 lines
8.9 KiB
HTML
Raw Normal View History

2023-08-16 08:04:48 +02:00
<section class="container mx-auto px-4">
<section class="flex space-x-4">
<h1 class="text-white font-semibold text-5xl">
{{"Parking spaces"}}
</h1>
<div class="">
&nbsp;
</div>
<div>
</div>
2023-09-05 16:09:26 +02:00
{% if let Some(session) = session %}
2023-08-16 08:04:48 +02:00
<div>
2023-08-16 16:53:27 +02:00
<a
href="/parking-spaces/form"
x-get="/parking-spaces/form"
x-target="main"
class="text-emerald-500 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150 border-2 rounded-full"
>
2023-08-16 08:04:48 +02:00
<i class="fas fa-plus"></i>
2023-08-16 16:53:27 +02:00
</a>
2023-08-16 08:04:48 +02:00
</div>
2023-09-05 16:09:26 +02:00
{% endif %}
2023-08-16 08:04:48 +02:00
</section>
2023-09-04 15:02:53 +02:00
2023-09-12 18:03:42 +02:00
{% if !parking_spaces.is_empty() %}
<section
id="own-parking-spaces"
class="w-full p-4 bg-white border border-white-200 rounded-lg shadow sm:p-8 dark:bg-white-800 dark:border-white-700 mt-6"
>
<div class="flex items-center justify-between mb-4">
<h5 class="text-xl font-bold leading-none text-gray-900 dark:text-black">Owned parking spaces</h5>
</div>
<div class="flow-root">
<ul role="list" class="divide-y divide-white-200 dark:divide-white-700">
{% for parking_space in parking_spaces -%}
<li class="py-3 sm:py-4">
<oswilno-parking-space
id="parking-space-{{ parking_space.id }}"
>
{% if let Some(account) = account_by_id.get(parking_space.account_id) -%}
2023-09-12 18:03:42 +02:00
{% if let Some(location_id) = parking_space.location_id -%}
{% if let Some(location) = location_by_id.get(location_id) -%}
{% if let Some(spot) = parking_space.spot -%}
<div class="lg:grid grid-cols-4 grid-flow-col">
{% include "./single_parking_space.html" %}
{% include "./parking_space_state.html" %}
2023-09-12 18:03:42 +02:00
<div class="flex justify-end">
{% if parking_space.state == ParkingSpaceState::Verified %}
<a
class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center"
id="create-rent-{{parking_space.id}}"
hx-get="/parking-spaces/{{parking_space.id}}/parking-space-rents/form"
hx-headers='{"Accept":"text/html-partial"}'
>
2023-09-27 18:17:27 +02:00
<svg height="48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 171.439 171.439" xml:space="preserve" fill="#000000A">
<path style="fill:#000002;" d="M21.803,171.439c-0.463,0-0.922-0.129-1.322-0.378c-0.563-0.351-0.963-0.91-1.113-1.557L1.182,91.241 c-0.313-1.345,0.524-2.688,1.869-3.001l6.729-1.563l76.692-64.254l-4.435-4.012c-1.514,0.934-3.295,1.472-5.2,1.472 c-5.482,0-9.941-4.46-9.941-9.941S71.355,0,76.837,0s9.941,4.46,9.941,9.941c0,1.766-0.463,3.426-1.273,4.864l4.837,4.375 l1.117-0.936c0.902-0.757,2.21-0.781,3.141-0.058l48.281,37.561l6.189-1.438c1.347-0.309,2.688,0.525,3.001,1.87l18.187,78.263 c0.313,1.345-0.524,2.688-1.869,3.001L22.369,171.375C22.182,171.418,21.992,171.439,21.803,171.439z M6.618,92.545l17.054,73.394 l141.149-32.8l-17.055-73.393l-4.879,1.134c-0.022,0.006-0.045,0.011-0.068,0.016L11.556,91.397 c-0.041,0.011-0.082,0.021-0.124,0.029L6.618,92.545z M90.216,25.809L20.553,84.174L136.61,57.205L96.188,25.759 c-0.038,0.539-0.25,1.07-0.64,1.502c-0.925,1.024-2.506,1.104-3.531,0.178L90.216,25.809z M76.837,5 c-2.725,0-4.941,2.217-4.941,4.941s2.217,4.941,4.941,4.941c1.361,0,2.596-0.554,3.491-1.447c0.026-0.027,0.052-0.055,0.079-0.081 c0.849-0.888,1.372-2.091,1.372-3.413C81.778,7.217,79.562,5,76.837,5z M40.256,140.785c-1.135,0-2.162-0.778-2.432-1.931 l-6.447-27.504c-0.315-1.344,0.519-2.689,1.864-3.004c0.829-0.194,1.659,0.048,2.247,0.579c1.199-1.163,2.694-1.983,4.362-2.374 c2.429-0.569,4.937-0.16,7.058,1.156c2.121,1.315,3.603,3.378,4.173,5.809c1.176,5.016-1.949,10.055-6.965,11.23 c-0.386,0.091-0.773,0.156-1.158,0.196l12.745,7.904c1.173,0.729,1.534,2.27,0.807,3.442c-0.728,1.174-2.268,1.533-3.442,0.808 l-12.309-7.635l1.934,8.251c0.315,1.344-0.52,2.689-1.864,3.004C40.637,140.763,40.445,140.785,40.256,140.785z M41.992,111.303 c-0.333,0-0.668,0.039-1,0.116c-1.13,0.266-2.089,0.954-2.701,1.94c-0.612,0.986-0.803,2.151-0.538,3.281 c0.546,2.331,2.888,3.778,5.222,3.239c2.332-0.548,3.785-2.89,3.238-5.223c-0.265-1.13-0.954-2.089-1.94-2.7 C43.577,111.525,42.792,111.303,41.992,111.303z M67.849,133.016c-1.135,0-2.162-0.778-2.432-1.931l-2.969-12.666 c-0.003-0.011-0.005-0.021-0.008-0.033c-0.002-0.011-0.005-0.021-0.007-0.033l-3.14-13.396c0-0.002-0.001-0.005-0.002-0.008 c-0.315-1.344,0.52-2.689,1.864-3.004L76,98.466c1.343-0.315,2.689,0.52,3.004,1.863s-0.52,2.689-1.864,3.004l-12.411,2.909 l2.009,8.568l7.462-1.749c1.344-0.316,2.69,0.52,3.005,1.863c0.315,1.344-0.519,2.689-1.863,3.004l-7.463,1.75l1.835,7.831 l12.412-2.908c1.343-0.315,2.689,0.52,3.004,1.863s-0.52,2.689-1.864,3.004l-14.838,3.479c-0.002,0-0.005,0.001-0.007,0.001 C68.23,132.993,68.038,133.016,67.849,133.016z M93.49,127.005c-1.135,0-2.162-0.778-2.432-1.931l-6.126-26.136 c-0.219-0.933,0.116-1.865,0.791-2.455c0.929-1.001,2.494-1.075,3.51-0.155l18.833,17.021l-4.407-18.801 c-0.315-1.344,0.519-2.689,1.863-3.004c1.346-0.315,2.69,0.52,3.005,1.863l6.126,26.136c0.218,0.93-0.115,1.861-0.786,2.45 c-0.927,1.009-2.495,1.083-3.515,0.161L91.52,105.135l4.406,18.799c0.315,1.344-0.519,2.689-1.864,3.004 C93.871,126.982,93.679,127.005,93.49,127.005z M131.954,117.989c-1.135,0-2.162-0.778-2.432-1.931l-5.556-23.702l-6.93,1.624 c-1.344,0.313-2.69-0.52-3.004-1.863c-0.315-1.344,0.519-2.689,1.864-3.004l18.727-4.39c1.344-0.316,2.689,0.52,3.004,1.863 c0.315,1.344-0.519,2.689-1.864,3.004l-6.929,1.625l5.556,23.702c0.315,1.344-0.519,2.689-1.863,3.004 C132.335,117.967,132.143,117.989,131.954,117.989z">
</path>
</svg>
</a>
{% endif %}
2023-09-13 18:05:17 +02:00
<a
href="/parking-spaces/edit/{{parking_space.id}}"
hx-target="main"
hx-get="/parking-spaces/edit/{{parking_space.id}}"
hx-headers='{"Accept":"text/html-partial"}'
2023-09-27 18:17:27 +02:00
class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center"
2023-09-13 18:05:17 +02:00
>
2023-09-27 18:17:27 +02:00
<svg height="48" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="fill-white">
<path d="M20,16v4a2,2,0,0,1-2,2H4a2,2,0,0,1-2-2V6A2,2,0,0,1,4,4H8" class="stroke-blue-800" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
</path>
<polygon fill="none" points="12.5 15.8 22 6.2 17.8 2 8.3 11.5 8 16 12.5 15.8" class="stroke-blue-800" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
</polygon>
</svg>
2023-09-13 18:05:17 +02:00
</a>
2023-09-14 14:25:29 +02:00
<a
href="/parking-spaces/delete/{{parking_space.id}}"
hx-target="main"
hx-delete="/parking-spaces/edit/{{parking_space.id}}"
hx-headers='{"Accept":"text/html-partial"}'
2023-09-27 18:17:27 +02:00
class="text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center"
2023-09-14 14:25:29 +02:00
>
2023-09-27 18:17:27 +02:00
<svg viewBox="0 0 24 24" height="48" class="stroke-red-800 fill-white" xmlns="http://www.w3.org/2000/svg">
<path d="M10 12V17" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M14 12V17" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M4 7H20" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M6 10V18C6 19.6569 7.34315 21 9 21H15C16.6569 21 18 19.6569 18 18V10" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M9 5C9 3.89543 9.89543 3 11 3H13C14.1046 3 15 3.89543 15 5V7H9V5Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</path>
</svg>
2023-09-14 14:25:29 +02:00
</a>
2023-09-13 18:05:17 +02:00
</div>
2023-09-12 18:03:42 +02:00
</div>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</oswilno-parking-space>
</li>
{% endfor %}
</ul>
</div>
2023-09-04 15:02:53 +02:00
</section>
2023-09-12 18:03:42 +02:00
{% endif %}
2023-09-04 15:02:53 +02:00
2023-08-16 08:04:48 +02:00
<oswilno-parking-space-rents>
{% for parking_space_rent in parking_space_rents -%}
{% if let Some(parking_space) = parking_space_by_id.get(parking_space_rent.parking_space_id) %}
2023-09-14 14:25:29 +02:00
{% if parking_space.state == ParkingSpaceState::Verified || Some(parking_space.account_id.clone()) == account_id %}
2023-08-16 08:04:48 +02:00
{% if let Some(account) = account_by_id.get(parking_space.account_id) %}
<oswilno-parking-space-rent id="parking-space-rent-{{ parking_space_rent.id }}">
<oswilno-parking-space id="parking-space-{{ parking_space.id }}">
<oswilno-account id="account-{{ account.id }}">
<div>{{ account.login }}</div>
</oswilno-account>
</oswilno-parking-space>
<oswilno-price id="parking-space-rent-{{ parking_space_rent.id }}-price" multiplier="100" currency="PLN" price="{{ parking_space_rent.price }}">
{{ parking_space_rent.price }}
</oswilno-price>
</oswilno-parking-space-rent>
{% endif %}
{% endif %}
2023-09-14 14:25:29 +02:00
{% endif %}
2023-08-16 08:04:48 +02:00
{% endfor -%}
</oswilno-parking-space-rents>
</section>