Compare commits

..

No commits in common. "f687e181955124d219ba49116448e03b5aab8f57" and "bb502a4561fae041250d14752984fc0cae073f24" have entirely different histories.

8 changed files with 8 additions and 59 deletions

View File

@ -773,4 +773,3 @@ function replaceStrings() {
weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag"); weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag");
}); });
} }

View File

@ -1,4 +1,4 @@
use chrono::{Local, NaiveDate}; use chrono::NaiveDate;
use serde::Serialize; use serde::Serialize;
use sqlx::SqlitePool; use sqlx::SqlitePool;
@ -164,11 +164,6 @@ WHERE trip.id=?
} }
} }
pub async fn get_for_today(db: &SqlitePool) -> Vec<TripWithUserAndType> {
let today = Local::now().date_naive();
Self::get_for_day(db, today).await
}
pub async fn get_for_day(db: &SqlitePool, day: NaiveDate) -> Vec<TripWithUserAndType> { pub async fn get_for_day(db: &SqlitePool, day: NaiveDate) -> Vec<TripWithUserAndType> {
let day = format!("{day}"); let day = format!("{day}");
let trips = sqlx::query_as!( let trips = sqlx::query_as!(

View File

@ -24,7 +24,6 @@ use crate::model::{
LogbookDeleteError, LogbookUpdateError, LogbookDeleteError, LogbookUpdateError,
}, },
logtype::LogType, logtype::LogType,
trip::Trip,
user::{AdminUser, DonauLinzUser, User, UserWithDetails, VorstandUser}, user::{AdminUser, DonauLinzUser, User, UserWithDetails, VorstandUser},
}; };
@ -85,7 +84,6 @@ async fn index(
} }
context.insert("boats", &boats); context.insert("boats", &boats);
context.insert("planned_trips", &Trip::get_for_today(db).await);
context.insert( context.insert(
"reservations", "reservations",
&BoatReservation::all_future_with_groups(db).await, &BoatReservation::all_future_with_groups(db).await,
@ -189,7 +187,6 @@ async fn kiosk(
context.insert("flash", &msg.into_inner()); context.insert("flash", &msg.into_inner());
} }
context.insert("planned_trips", &Trip::get_for_today(db).await);
context.insert("boats", &boats); context.insert("boats", &boats);
context.insert( context.insert(
"reservations", "reservations",

View File

@ -61,8 +61,7 @@
<small class="block text-gray-600 dark:text-gray-100"> <small class="block text-gray-600 dark:text-gray-100">
{% for role in user.roles -%} {% for role in user.roles -%}
{{ role }} {{ role }}
{%- if not loop.last %}, {%- if not loop.last %}, {% endif -%}
{% endif -%}
{% endfor %} {% endfor %}
</small> </small>
</span> </span>

View File

@ -262,12 +262,12 @@
<input type="hidden" name="logtype" value="{{ log.logtype }}" /> <input type="hidden" name="logtype" value="{{ log.logtype }}" />
<input type="submit" value="Updaten" /> <input type="submit" value="Updaten" />
</form> </form>
<a href="/log/{{ log.id }}/delete" <a href="/log/{{ log.id }}/delete"
class="w-28 btn btn-alert" class="w-28 btn btn-alert"
onclick="return confirm('Willst du diesen Logbucheintrag wirklich löschen?');"> onclick="return confirm('Willst du diesen Logbucheintrag wirklich löschen?');">
{% include "includes/delete-icon" %} {% include "includes/delete-icon" %}
Löschen Löschen
</a> </a>
{% endif %} {% endif %}
</details> </details>
</div> </div>

View File

@ -1,42 +1,3 @@
{% macro plannedtrips() %}
{% if planned_trips %}
<script>
function setChoiceByLabel(choicesInstance, label) {
const choices = choicesInstance.config.choices;
const normalizedLabel = label.trim().replace(/\n/g, '');
const choice = choices.find(c => {
const choiceLabel = c.label.trim().replace(/\n/g, '');
return choiceLabel === normalizedLabel;
});
if (choice) {
choicesInstance.setChoiceByValue(choice.value);
} else {
console.warn(`Choice with label "${normalizedLabel}" not found`);
}
}
</script>
<div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2 mt-3">
<h2 class="h2">Heute geplante Ausfahrten</h2>
<div class="grid grid-cols-1 gap-3 mb-3 w-full">
{% for planned_trip in planned_trips | sort(attribute='planned_starting_time') %}
<div class="pt-2 px-3 border-t text-primary-900 dark:text-white">
<strong class="block">
{{ planned_trip.cox_name }} ({{ planned_trip.rower | length + 1 }} Personen)
<small>{{ planned_trip.planned_starting_time }}</small>
<button class="btn btn-primary"
onclick="choiceObjects['newrower'].removeActiveItems(-1);choiceObjects['newrower'].setChoiceByValue('{{ planned_trip.cox_id }}'); {% for rower in planned_trip.rower %}setChoiceByLabel(choiceObjects['newrower'], '{{ rower.name }}'){% endfor %} ">
👥
</button>
</strong>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endmacro plannedtrips %}
{% macro boatreservation() %} {% macro boatreservation() %}
<div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2 mt-3"> <div class="bg-white dark:bg-primary-900 rounded-md shadow pb-2 mt-3">
<h2 class="h2">Reservierungen ({{ reservations | length }})</h2> <h2 class="h2">Reservierungen ({{ reservations | length }})</h2>

View File

@ -53,7 +53,6 @@
</div> </div>
</div> </div>
{{ macros::boatreservation() }} {{ macros::boatreservation() }}
{{ macros::plannedtrips() }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -35,7 +35,6 @@
{% endif %} {% endif %}
</div> </div>
{{ macros::boatreservation() }} {{ macros::boatreservation() }}
{{ macros::plannedtrips() }}
</div> </div>
</div> </div>
</div> </div>