Compare commits

..

5 Commits

Author SHA1 Message Date
17f4291af0 Merge pull request 'marie-magic' (#501) from marie-magic into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m20s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 6m18s
Reviewed-on: #501
2024-05-16 22:46:42 +02:00
3097d99e00 remove unused imports
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m18s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-05-16 22:37:57 +02:00
0eac1a66f9 better layout
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled
2024-05-16 22:35:26 +02:00
f034f80794 Merge branch 'main' of ssh://git.hofer.link:2222/Ruderverein-Donau-Linz/rowt 2024-05-16 22:07:55 +02:00
57c9d532c8 push 2024-05-16 22:07:30 +02:00
4 changed files with 83 additions and 92 deletions

View File

@ -21,9 +21,10 @@ use sqlx::SqlitePool;
use tera::Context;
use crate::model::{
logbook::Logbook,
notification::Notification,
role::Role,
user::{User, UserWithDetails},
user::{User, UserWithDetails, SCHECKBUCH},
};
pub(crate) mod admin;
@ -52,8 +53,15 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
context.insert("flash", &msg.into_inner());
}
if user.has_role(db, "scheckbuch").await {
let last_trips = Logbook::completed_with_user(db, &user).await;
context.insert("last_trips", &last_trips);
}
context.insert("notifications", &Notification::for_user(db, &user).await);
context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await);
context.insert("costs_scheckbuch", &SCHECKBUCH);
Template::render("index", context.into_json())
}

View File

@ -10,10 +10,9 @@ use tera::Context;
use crate::model::{
log::Log,
logbook::Logbook,
tripdetails::TripDetails,
triptype::TripType,
user::{AllowedForPlannedTripsUser, User, UserWithDetails, SCHECKBUCH},
user::{AllowedForPlannedTripsUser, User, UserWithDetails},
usertrip::{UserTrip, UserTripDeleteError, UserTripError},
};
@ -32,11 +31,6 @@ async fn index(
context.insert("trip_types", &triptypes);
}
if user.has_role(db, "scheckbuch").await {
let last_trips = Logbook::completed_with_user(db, &user).await;
context.insert("last_trips", &last_trips);
}
let days = user.get_days(db).await;
if let Some(msg) = flash {
@ -46,7 +40,6 @@ async fn index(
context.insert("fee", &user.fee(db).await);
context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await);
context.insert("days", &days);
context.insert("costs_scheckbuch", &SCHECKBUCH);
Template::render("planned", context.into_json())
}

View File

@ -1,12 +1,9 @@
{% import "includes/macros" as macros %}
{% import "includes/forms/log" as log %}
{% extends "base" %}
{% block content %}
<div class="max-w-screen-lg w-full">
<h1 class="h1">
Ruder
<wbr />
assistent
</h1>
<h1 class="h1">Ruder&shy;assistent</h1>
<div class="grid gap-3 my-5">
<div class="m-auto">
<a href="/planned"
@ -15,6 +12,7 @@
<span class="text-xl px-3">Geplante Ausfahrten</span>
</a>
</div>
{% if notifications %}
<div id="notification"
class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
@ -64,6 +62,7 @@
</div>
</details>
</div>
{% endif %}
{% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
@ -98,14 +97,26 @@
</div>
{% endif %}
{% if "scheckbuch" in loggedin_user.roles %}
<div class="grid gap-3 mb-4">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
<h2 class="h2">Scheckbuch</h2>
<ul class="list-none ms-2 divide-y divide-gray-200 dark:divide-primary-600">
<li class="py-1">
<a href="/planned" class="block w-100 py-2 hover:text-primary-600">Geplante Ausfahrten</a>
</li>
</ul>
{% if "paid" not in loggedin_user.roles %}
<div class="p-3 dark:text-white bg-white dark:bg-primary-900">
Bitte nimm zur nächsten Ausfahrt die {{ costs_scheckbuch / 100 }}&nbsp;€ für das Scheckbuch mit. Falls du das bereits gemacht hast, gibt uns bitte kurz Bescheid, dass dies noch nicht eingetragen wurde.
</div>
{% endif %}
<div class="text-sm p-3 bg-gray-200 bg-opacity-80 dark:bg-primary-950 dark:text-white text-primary-950">
<h3>Du hast bisher an {{ last_trips | length }} deiner 5 Scheckbuch-Ausfahrten teilgenommen.</h3>
{% if last_trips %}
<ol class="mt-3">
{% for last_trip in last_trips %}
<li>{{ log::show_old(log=last_trip, state="completed", only_ones=false, index=loop.index) }}</li>
{% endfor %}
</ol>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% if "schnupper-betreuer" in loggedin_user.roles %}

View File

@ -3,27 +3,6 @@
{% extends "base" %}
{% block content %}
<div class="max-w-screen-xl w-full grid sm:grid-cols-2 lg:grid-cols-3 gap-4">
{% if "scheckbuch" in loggedin_user.roles %}
<div class="grid gap-3 sm:col-span-2 lg:col-span-3">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
role="alert">
<h2 class="h2">Scheckbuch</h2>
{% if "paid" not in loggedin_user.roles %}
<div class="bg-gray-300 text-center text-black">
Bitte nimm zur nächsten Ausfahrt die {{ costs_scheckbuch / 100 }}&nbsp;€ für das Scheckbuch mit. Falls du das bereits gemacht hast, gibt uns bitte kurz Bescheid, dass dies noch nicht eingetragen wurde.
</div>
{% endif %}
<div class="text-sm p-3">
<h3>Du hast bisher {{ last_trips | length }} deiner 5 Scheckbuch-Ausfahrten gemacht:</h3>
<ol>
{% for last_trip in last_trips %}
<li>{{ log::show_old(log=last_trip, state="completed", only_ones=false, index=loop.index) }}</li>
{% endfor %}
</ol>
</div>
</div>
</div>
{% endif %}
{% if "paid" not in loggedin_user.roles and "Donau Linz" in loggedin_user.roles %}
<div class="grid gap-3 sm:col-span-2 lg:col-span-3">
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"
@ -103,12 +82,12 @@
title="Prognostizierter maximaler Wasserstand am {{ day.day | date(format="%A", locale="de_AT") }}: {{ day.max_waterlevel }} cm">🌊{{ day.max_waterlevel }} cm</a>
{% endif %}
</small>
</h2>
{% if day.weather %}
<div class="bg-gray-300 text-center">
Max temp:&nbsp;{{ day.weather.max_temp | round }}° &bullet; Windböe:&nbsp;{{ day.weather.wind_gust | round }}&nbsp;km/h &bullet; Regen:&nbsp;{{ day.weather.rain_mm | round }}&nbsp;mm
</div>
<small class="inline-block text-xs {% if day.is_pinned %} text-gray-200 {% else %} text-gray-500 dark:text-gray-100 {% endif %}">
Temp:&nbsp;{{ day.weather.max_temp | round }}° &bullet; Windböe:&nbsp;{{ day.weather.wind_gust | round }}&nbsp;km/h &bullet; Regen:&nbsp;{{ day.weather.rain_mm | round }}&nbsp;mm
</small>
{% endif %}
</h2>
{% if day.planned_events | length > 0 or day.trips | length > 0 %}
<div class="grid grid-cols-1 gap-3 mb-3">
{# --- START Events --- #}