forked from Ruderverein-Donau-Linz/rowt
Merge commit 'bc9c5198d1a1df7526ee95de9411f8e7d0a60894' into dark-mode
This commit is contained in:
commit
2fd053efed
@ -104,7 +104,6 @@ function setMaxAmountRowers(name: string, rowers: number) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
let input = <HTMLElement>document.querySelector('#'+name);
|
let input = <HTMLElement>document.querySelector('#'+name);
|
||||||
|
|
||||||
if(input) {
|
if(input) {
|
||||||
choiceObjects[name].config.maxItemCount = rowers;
|
choiceObjects[name].config.maxItemCount = rowers;
|
||||||
if (rowers === 0) {
|
if (rowers === 0) {
|
||||||
@ -201,7 +200,6 @@ interface ChoiceEvent extends Event{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initNewChoice(select: HTMLInputElement) {
|
function initNewChoice(select: HTMLInputElement) {
|
||||||
|
|
||||||
let seats = 0;
|
let seats = 0;
|
||||||
if (select.dataset && select.dataset.seats) {
|
if (select.dataset && select.dataset.seats) {
|
||||||
seats = +select.dataset.seats;
|
seats = +select.dataset.seats;
|
||||||
|
@ -124,7 +124,7 @@ pub enum LogbookCreateError {
|
|||||||
|
|
||||||
impl From<LogbookUpdateError> for LogbookCreateError {
|
impl From<LogbookUpdateError> for LogbookCreateError {
|
||||||
fn from(value: LogbookUpdateError) -> Self {
|
fn from(value: LogbookUpdateError) -> Self {
|
||||||
return match value {
|
match value {
|
||||||
LogbookUpdateError::NotYourEntry => LogbookCreateError::NotYourEntry,
|
LogbookUpdateError::NotYourEntry => LogbookCreateError::NotYourEntry,
|
||||||
LogbookUpdateError::TooManyRowers(a, b) => LogbookCreateError::TooManyRowers(a, b),
|
LogbookUpdateError::TooManyRowers(a, b) => LogbookCreateError::TooManyRowers(a, b),
|
||||||
LogbookUpdateError::RowerCreateError(a, b) => {
|
LogbookUpdateError::RowerCreateError(a, b) => {
|
||||||
@ -140,7 +140,7 @@ impl From<LogbookUpdateError> for LogbookCreateError {
|
|||||||
LogbookUpdateError::UserNotAllowedToUseBoat => {
|
LogbookUpdateError::UserNotAllowedToUseBoat => {
|
||||||
LogbookCreateError::UserNotAllowedToUseBoat
|
LogbookCreateError::UserNotAllowedToUseBoat
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ ORDER BY departure DESC
|
|||||||
return Err(LogbookUpdateError::SteeringPersonNotInRowers);
|
return Err(LogbookUpdateError::SteeringPersonNotInRowers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !boat.shipmaster_allowed(&user).await && self.shipmaster != user.id {
|
if !boat.shipmaster_allowed(user).await && self.shipmaster != user.id {
|
||||||
//second part:
|
//second part:
|
||||||
//shipmaster has
|
//shipmaster has
|
||||||
//entered a
|
//entered a
|
||||||
|
@ -67,11 +67,7 @@ async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
async fn index(
|
async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_>>) -> Template {
|
||||||
db: &State<SqlitePool>,
|
|
||||||
user: NonGuestUser,
|
|
||||||
flash: Option<FlashMessage<'_>>,
|
|
||||||
) -> Template {
|
|
||||||
let users = User::ergo(db).await;
|
let users = User::ergo(db).await;
|
||||||
|
|
||||||
let thirty = sqlx::query_as!(
|
let thirty = sqlx::query_as!(
|
||||||
@ -94,7 +90,7 @@ async fn index(
|
|||||||
if let Some(msg) = flash {
|
if let Some(msg) = flash {
|
||||||
context.insert("flash", &msg.into_inner());
|
context.insert("flash", &msg.into_inner());
|
||||||
}
|
}
|
||||||
context.insert("loggedin_user", &user.user);
|
context.insert("loggedin_user", &user);
|
||||||
context.insert("users", &users);
|
context.insert("users", &users);
|
||||||
context.insert("thirty", &thirty);
|
context.insert("thirty", &thirty);
|
||||||
context.insert("dozen", &dozen);
|
context.insert("dozen", &dozen);
|
||||||
@ -113,7 +109,7 @@ pub struct ErgoToAdd<'a> {
|
|||||||
async fn new_thirty(
|
async fn new_thirty(
|
||||||
db: &State<SqlitePool>,
|
db: &State<SqlitePool>,
|
||||||
mut data: Form<ErgoToAdd<'_>>,
|
mut data: Form<ErgoToAdd<'_>>,
|
||||||
created_by: NonGuestUser,
|
created_by: User,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
||||||
|
|
||||||
@ -139,10 +135,7 @@ async fn new_thirty(
|
|||||||
|
|
||||||
Log::create(
|
Log::create(
|
||||||
db,
|
db,
|
||||||
format!(
|
format!("{} created thirty-ergo entry: {data:?}", created_by.name),
|
||||||
"{} created thirty-ergo entry: {data:?}",
|
|
||||||
created_by.user.name
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@ -153,7 +146,7 @@ async fn new_thirty(
|
|||||||
async fn new_dozen(
|
async fn new_dozen(
|
||||||
db: &State<SqlitePool>,
|
db: &State<SqlitePool>,
|
||||||
mut data: Form<ErgoToAdd<'_>>,
|
mut data: Form<ErgoToAdd<'_>>,
|
||||||
created_by: NonGuestUser,
|
created_by: User,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
let user = User::find_by_id(db, data.user as i32).await.unwrap();
|
||||||
|
|
||||||
@ -179,10 +172,7 @@ async fn new_dozen(
|
|||||||
|
|
||||||
Log::create(
|
Log::create(
|
||||||
db,
|
db,
|
||||||
format!(
|
format!("{} created dozen-ergo entry: {data:?}", created_by.name),
|
||||||
"{} created dozen-ergo entry: {data:?}",
|
|
||||||
created_by.user.name
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -217,12 +217,10 @@ async fn create_kiosk(
|
|||||||
User::find_by_id(db, boat.owner.unwrap() as i32)
|
User::find_by_id(db, boat.owner.unwrap() as i32)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
} else if let Some(shipmaster) = data.shipmaster {
|
||||||
|
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
||||||
} else {
|
} else {
|
||||||
if let Some(shipmaster) = data.shipmaster {
|
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
|
||||||
User::find_by_id(db, shipmaster as i32).await.unwrap()
|
|
||||||
} else {
|
|
||||||
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
Log::create(
|
Log::create(
|
||||||
db,
|
db,
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</small>
|
</small>
|
||||||
{% set amount_rowers = log.rowers | length %}
|
{% set amount_rowers = log.rowers | length %}
|
||||||
{% set amount_guests = log.boat.amount_seats - amount_rowers -1 %}
|
{% set amount_guests = log.boat.amount_seats - amount_rowers %}
|
||||||
{% if allowed_to_close and state == "on_water" %}
|
{% if allowed_to_close and state == "on_water" %}
|
||||||
{{ log::home(log=log, only_ones=only_ones) }}
|
{{ log::home(log=log, only_ones=only_ones) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -19,6 +19,29 @@
|
|||||||
{% include "includes/question-icon" %}
|
{% include "includes/question-icon" %}
|
||||||
<span class="sr-only">FAQs</span>
|
<span class="sr-only">FAQs</span>
|
||||||
</a>
|
</a>
|
||||||
|
{% if loggedin_user.is_guest and loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
||||||
|
data-sidebar="true"
|
||||||
|
data-trigger="sidebar"
|
||||||
|
data-header="Ergo Challenge"
|
||||||
|
data-body="#mobile-menu-guest"
|
||||||
|
>
|
||||||
|
{% include "includes/book" %}
|
||||||
|
<span class="sr-only">Ergo</span>
|
||||||
|
</a>
|
||||||
|
<div class="hidden">
|
||||||
|
<div id="mobile-menu-guest">
|
||||||
|
<a
|
||||||
|
href="/ergo"
|
||||||
|
class="block w-100 py-2 hover:text-primary-600 border-t"
|
||||||
|
>
|
||||||
|
Ergo
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if not loggedin_user.is_guest %}
|
{% if not loggedin_user.is_guest %}
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
@ -78,7 +101,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %} {% if loggedin_user.is_admin %}
|
{% endif %}
|
||||||
|
{% if loggedin_user.is_admin %}
|
||||||
<a
|
<a
|
||||||
href="/admin/user"
|
href="/admin/user"
|
||||||
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
|
||||||
@ -151,7 +175,7 @@
|
|||||||
<option selected value>{{ default }}</option>
|
<option selected value>{{ default }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for d in data %}
|
{% for d in data %}
|
||||||
<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}, "owner": {{ d["owner"] }}}'{% endif %}>
|
<option value="{{ d.id }}" {% if d.id == selected_id %} selected {% endif %} {% if extras != '' %} {% for extra in extras %} {% if extra != 'on_water' %} data- {{extra}}={{d[extra]}} {% else %} {% if d[extra] %} disabled {% endif %} {% endif %} {% endfor %} {% endif %} {% if show_seats %} data-custom-properties='{"amount_seats": {{ d["amount_seats"] }}, "owner": "{{ d["owner"] }}"}'{% endif %}>
|
||||||
{% for displa in display -%}
|
{% for displa in display -%}
|
||||||
{%- if d[displa] -%}
|
{%- if d[displa] -%}
|
||||||
{{- d[displa] -}}
|
{{- d[displa] -}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user