[TASK] basic styling logbook and stats
This commit is contained in:
		| @@ -297,7 +297,7 @@ function initSearch() { | |||||||
| } | } | ||||||
|  |  | ||||||
| function filterElements(input: string) { | function filterElements(input: string) { | ||||||
|   const elements = document.querySelectorAll('form[data-filterable="true"]'); |   const elements = document.querySelectorAll('div[data-filterable="true"]'); | ||||||
|   let resultWrapper = <HTMLElement>document.querySelector('#filter-result-js'), |   let resultWrapper = <HTMLElement>document.querySelector('#filter-result-js'), | ||||||
|       amountShownElements = 0; |       amountShownElements = 0; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,33 +39,35 @@ | |||||||
| 		<div class="bg-primary-100 p-3 rounded-b-md grid gap-4"> | 		<div class="bg-primary-100 p-3 rounded-b-md grid gap-4"> | ||||||
| 			<div id="filter-result-js" class="text-primary-950"></div> | 			<div id="filter-result-js" class="text-primary-950"></div> | ||||||
| 			{% for user in users %} | 			{% for user in users %} | ||||||
| 				<form action="/admin/user" data-filterable="true" data-filter="{{ user.name }}" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between"> |         <div data-filterable="true" data-filter="{{ user.name }}"> | ||||||
| 					<div class="w-full"> |           <form action="/admin/user" method="post" class="bg-white p-3 rounded-md flex items-end md:items-center justify-between w-full"> | ||||||
| 						<input type="hidden" name="id" value="{{ user.id }}"/> |             <div class="w-full"> | ||||||
| 						<div class="font-bold mb-1">{{ user.name }} |               <input type="hidden" name="id" value="{{ user.id }}"/> | ||||||
| 							{% if user.last_access %} |               <div class="font-bold mb-1">{{ user.name }} | ||||||
| 								(last access: |                 {% if user.last_access %} | ||||||
| 								{{ user.last_access | date }}) |                   (last access: | ||||||
| 							{% endif %} |                   {{ user.last_access | date }}) | ||||||
| 						</div> |                 {% endif %} | ||||||
| 						<div class="grid md:grid-cols-3"> |               </div> | ||||||
| 							{{ macros::checkbox(label='Scheckbuch', name='is_guest', id=loop.index , checked=user.is_guest) }} |               <div class="grid md:grid-cols-3"> | ||||||
| 							{{ macros::checkbox(label='Steuerberechtigter', name='is_cox', id=loop.index , checked=user.is_cox) }} |                 {{ macros::checkbox(label='Scheckbuch', name='is_guest', id=loop.index , checked=user.is_guest) }} | ||||||
| 							{{ macros::checkbox(label='Technical', name='is_tech', id=loop.index , checked=user.is_tech) }} |                 {{ macros::checkbox(label='Steuerberechtigter', name='is_cox', id=loop.index , checked=user.is_cox) }} | ||||||
| 							{{ macros::checkbox(label='Admin', name='is_admin', id=loop.index , checked=user.is_admin) }} |                 {{ macros::checkbox(label='Technical', name='is_tech', id=loop.index , checked=user.is_tech) }} | ||||||
| 						</div> |                 {{ macros::checkbox(label='Admin', name='is_admin', id=loop.index , checked=user.is_admin) }} | ||||||
| 						{% if user.pw %} |               </div> | ||||||
| 							<a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a> |               {% if user.pw %} | ||||||
| 						{% endif %} |                 <a class="inline-block mt-1 text-primary-600 hover:text-primary-900 underline" href="/admin/user/{{ user.id }}/reset-pw">Passwort zurücksetzen</a> | ||||||
| 					</div> |               {% endif %} | ||||||
| 					<div class="grid gap-3"> |             </div> | ||||||
| 						<a href="/admin/user/{{ user.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');"> |             <div class="grid gap-3"> | ||||||
| 							{% include "includes/delete-icon" %} |               <a href="/admin/user/{{ user.id }}/delete" class="inline-block btn btn-alert" onclick="return confirm('Wirklich löschen?');"> | ||||||
| 							Löschen |                 {% include "includes/delete-icon" %} | ||||||
| 						</a> |                 Löschen | ||||||
| 						<input value="Ändern" type="submit" class="w-28 btn btn-primary"/> |               </a> | ||||||
| 					</div> |               <input value="Ändern" type="submit" class="w-28 btn btn-primary"/> | ||||||
| 				</form> |             </div> | ||||||
|  |           </form> | ||||||
|  |         </div> | ||||||
| 			{% endfor %} | 			{% endfor %} | ||||||
| 		</div> | 		</div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -188,50 +188,43 @@ | |||||||
| 	</div> | 	</div> | ||||||
| {% endmacro show %} | {% endmacro show %} | ||||||
|  |  | ||||||
| {% macro show_old(log, state, allowed_to_close=false, only_ones) %} | {% macro show_old(log, state, allowed_to_close=false, only_ones, index) %} | ||||||
| 	Bootsname: |   <div class="border-t bg-white px-3 py-1" data-filterable="true" data-filter="{{ log.boat.name }} {{ log.shipmaster_user.name }} {% for rower in log.rowers %} {{ rower.name }} {% endfor %}"> | ||||||
| 	{{ log.boat.name }}<br/> |     <div> | ||||||
| 	Schiffsführer: |       <strong>{{ log.boat.name }}</strong> <small class="text-gray-600">({{ log.shipmaster_user.name }}{% if log.shipmaster_only_steering %} - handgesteuer {% endif %})</small> | ||||||
| 	{{ log.shipmaster_user.name }}<br/> |       <small class="block text-gray-600">{{ log.departure | date(format='%d.%m.%Y - %H:%M') }} {% if state == "completed" %}- {{ log.arrival | date(format='%d.%m.%Y - %H:%M') }}{% endif %}</small> | ||||||
| 	{% if log.shipmaster_only_steering %} |       {% set amount_rowers = log.rowers | length %} | ||||||
| 		Schiffsführer steuert nur |         {% set amount_guests = log.boat.amount_seats - amount_rowers -1 %} | ||||||
| 	{% endif %} |         {% if allowed_to_close and state == "on_water" %} | ||||||
| 	Weggefahren: |           {{ log::home(log=log, only_ones=only_ones) }} | ||||||
| 	{{ log.departure }}<br/> |         {% else %} | ||||||
| 	{% if state == "completed" %} |           <div> | ||||||
| 		Angekommen: |             {{ log.destination }} | ||||||
| 		{{ log.arrival}}<br/> |             {% if state == "completed" %} | ||||||
| 	{% endif %} |               <small class="text-gray-600">({{ log.distance_in_km }} km)</small> | ||||||
| 	{% set amount_rowers = log.rowers | length %} |             {% endif %} | ||||||
| 	{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %} |           </div> | ||||||
| 	{% if allowed_to_close and state == "on_water" %} |           {% if amount_guests > 0 or log.rowers | length > 0 %} | ||||||
| 		{{ log::home(log=log, only_ones=only_ones) }} |             Ruderer: | ||||||
| 	{% else %} |           {% endif %} | ||||||
| 		Ziel: |           {% if amount_guests > 0 %} | ||||||
| 		{{ log.destination }}<br/> |             {{ amount_guests }} | ||||||
| 		{% if state == "completed" %} |             Gäste (ohne Account) | ||||||
| 			Km: |           {% endif %} | ||||||
| 			{{ log.distance_in_km }}<br/> |           {% for rower in log.rowers %} | ||||||
| 		{% endif %} |             {{ rower.name }} | ||||||
| 		{% if log.comments %} |           {% endfor %} | ||||||
| 			Kommentare: |           {% if log.comments %} | ||||||
| 			{{ log.comments }}<br/> |             Kommentare: | ||||||
| 		{% endif %} |             {{ log.comments }}<br/> | ||||||
| 		{% if log.logtype %} |           {% endif %} | ||||||
| 			Logtype: |           {% if log.logtype %} | ||||||
| 			{{ log.logtype }}<br/> |             Logtype: | ||||||
| 		{% endif %} |             {{ log.logtype }}<br/> | ||||||
| 		{% if amount_guests > 0 or log.rowers | length > 0 %} |           {% endif %} | ||||||
| 			Ruderer: |         {% endif %} | ||||||
| 		{% endif %} |     </div> | ||||||
| 		{% if amount_guests > 0 %} |   </div> | ||||||
| 			{{ amount_guests }} |  | ||||||
| 			Gäste (ohne Account) |  | ||||||
| 		{% endif %} |  | ||||||
| 		{% for rower in log.rowers %} |  | ||||||
| 			{{ rower.name }} |  | ||||||
| 		{% endfor %} |  | ||||||
| 	{% endif %} |  | ||||||
| {% endmacro show_old %} | {% endmacro show_old %} | ||||||
|  |  | ||||||
| {% macro home(log, only_ones) %} | {% macro home(log, only_ones) %} | ||||||
|   | |||||||
| @@ -7,10 +7,18 @@ | |||||||
|  |  | ||||||
| 	<div class="max-w-screen-lg w-full"> | 	<div class="max-w-screen-lg w-full"> | ||||||
| 		<h1 class="h1">Logbuch</h1> | 		<h1 class="h1">Logbuch</h1> | ||||||
| 		{% for log in logs %} |  | ||||||
| 			{{ log::show_old(log=log, state="completed", only_ones=false) }} |     <div class="mt-3"> | ||||||
| 			<hr/> |       <div class="bg-gray-200 p-3 mt-4 rounded-t-md"> | ||||||
| 		{% endfor %} |         <label for="name" class="sr-only">Suche</label> | ||||||
|  |         <input type="search" name="name" id="filter-js" class="w-full relative block rounded-md border-0 py-1.5 px-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:z-10 focus:ring-2 focus:ring-inset focus:ring-primary-600 sm:text-sm sm:leading-6 mb-2 md:mb-0" placeholder="Suchen nach..."> | ||||||
|  |       </div> | ||||||
|  |  | ||||||
|  |       <div id="filter-result-js" class="bg-gray-200 text-primary-950 pb-3 px-3 text-right"></div> | ||||||
|  |       {% for log in logs %} | ||||||
|  |         {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} | ||||||
|  |       {% endfor %} | ||||||
|  |     </div> | ||||||
| 	</div> | 	</div> | ||||||
|  |  | ||||||
| {% endblock content%} | {% endblock content%} | ||||||
|   | |||||||
| @@ -6,11 +6,13 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| 	<div class="max-w-screen-lg w-full"> | 	<div class="max-w-screen-lg w-full"> | ||||||
| 		<h1 class="h1">Statstik</h1> | 		<h1 class="h1">Statistik</h1> | ||||||
| 		<ol> | 		<ol class="mt-3"> | ||||||
| 			{% for s in stat %} | 			{% for s in stat %} | ||||||
| 				<li>{{s.name}}: | 				<li class="{% if loop.index % 2 == 0 %} bg-gray-200 {% else %} bg-white {% endif %} flex justify-between px-3 py-1"> | ||||||
| 					{{s.rowed_km}}km</li> |           <span>{{s.name}}</span> | ||||||
|  | 					<span>{{s.rowed_km}}km</span> | ||||||
|  |         </li> | ||||||
| 			{% endfor %} | 			{% endfor %} | ||||||
| 		</ol> | 		</ol> | ||||||
| 	</div> | 	</div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Marie Birner
					Marie Birner