Compare commits
	
		
			2 Commits
		
	
	
		
			bb502a4561
			...
			f687e18195
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f687e18195 | |||
| e55f380c4f | 
@@ -773,3 +773,4 @@ function replaceStrings() {
 | 
				
			|||||||
    weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag");
 | 
					    weekday.innerHTML = weekday.innerHTML.replace("Freitag", "Markttag");
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
use chrono::NaiveDate;
 | 
					use chrono::{Local, NaiveDate};
 | 
				
			||||||
use serde::Serialize;
 | 
					use serde::Serialize;
 | 
				
			||||||
use sqlx::SqlitePool;
 | 
					use sqlx::SqlitePool;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -164,6 +164,11 @@ 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!(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@ 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},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -84,6 +85,7 @@ 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,
 | 
				
			||||||
@@ -187,6 +189,7 @@ 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",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,8 @@
 | 
				
			|||||||
                            <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 %}, {% endif -%}
 | 
					                                    {%- if not loop.last %},
 | 
				
			||||||
 | 
					                                    {% endif -%}
 | 
				
			||||||
                                {% endfor %}
 | 
					                                {% endfor %}
 | 
				
			||||||
                            </small>
 | 
					                            </small>
 | 
				
			||||||
                        </span>
 | 
					                        </span>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,42 @@
 | 
				
			|||||||
 | 
					{% 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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,7 @@
 | 
				
			|||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                {{ macros::boatreservation() }}
 | 
					                {{ macros::boatreservation() }}
 | 
				
			||||||
 | 
					                {{ macros::plannedtrips() }}
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,6 +35,7 @@
 | 
				
			|||||||
                    {% endif %}
 | 
					                    {% endif %}
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                {{ macros::boatreservation() }}
 | 
					                {{ macros::boatreservation() }}
 | 
				
			||||||
 | 
					                {{ macros::plannedtrips() }}
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user