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

135 lines
5.6 KiB
HTML

<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>
{% if let Some(session) = session %}
<div>
<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"
>
<i class="fas fa-plus"></i>
</a>
</div>
{% endif %}
</section>
{% 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(location_id) = parking_space.location_id -%}
{% if let Some(location) = location_by_id.get(location_id) -%}
{% if let Some(spot) = parking_space.spot -%}
{% if let Some(account) = account_by_id.get(parking_space.account_id) -%}
<div class="flex items-center justify-between space-x-4">
<div class="flex-shrink-0">
<span class="text-sm font-medium text-white-900 truncate dark:text-black">
{{location.name}}
</span>
<span class="text-sm font-medium text-white-900 truncate dark:text-black">
{{location.number}}
</span>
<span class="text-sm font-medium text-white-900 truncate dark:text-black">
Etap {{location.stage}}
</span>
</div>
<div class="inline-flex items-center text-base font-semibold text-gray-900 dark:text-black">
{{spot}}
</div>
{% match parking_space.state %}
{% when ParkingSpaceState::Pending %}
<div class="inline-flex items-center px-2 py-1 mr-2 text-sm font-medium text-yellow-800 bg-yellow-100 rounded dark:bg-yellow-900 dark:text-yellow-300">
<div class="inline-flex items-center p-1 text-sm text-yellow-400 bg-transparent rounded-sm hover:bg-yellow-200 hover:text-yellow-900 dark:hover:bg-yellow-800 dark:hover:text-yellow-300">
Pending
</div>
</div>
{% when ParkingSpaceState::Verified %}
<div class="inline-flex items-center px-2 py-1 mr-2 text-sm font-medium text-blue-800 bg-blue-100 rounded dark:bg-blue-900 dark:text-blue-300">
<div class="inline-flex items-center p-1 text-sm text-blue-400 bg-transparent rounded-sm hover:bg-blue-200 hover:text-blue-900 dark:hover:bg-blue-800 dark:hover:text-blue-300">
Accepted
</div>
</div>
{% when ParkingSpaceState::Banned %}
<div class="inline-flex items-center px-2 py-1 mr-2 text-sm font-medium text-red-800 bg-red-100 rounded dark:bg-red-900 dark:text-red-300">
<div class="inline-flex items-center p-1 text-sm text-red-400 bg-transparent rounded-sm hover:bg-red-200 hover:text-red-900 dark:hover:bg-red-800 dark:hover:text-red-300">
Rejected
</div>
</div>
{% endmatch %}
<div>
<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"}'
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Edit
</a>
<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"}'
class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800"
>
Delete
</a>
</div>
</div>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</oswilno-parking-space>
</li>
{% endfor %}
</ul>
</div>
</section>
{% endif %}
<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) %}
{% if parking_space.state == ParkingSpaceState::Verified || Some(parking_space.account_id.clone()) == account_id %}
{% 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 %}
{% endif %}
{% endfor -%}
</oswilno-parking-space-rents>
</section>