change select properly if boat is selected on the left
This commit is contained in:
parent
9d08ee5a9d
commit
514561321e
@ -72,9 +72,9 @@ function initBoatActions() {
|
||||
choiceObjects['newrower'].config.maxItemCount = rowers;
|
||||
choiceObjects['newrower'].removeActiveItems(rowers);
|
||||
let boatSelect = <HTMLSelectElement>document.querySelector('#boat_id');
|
||||
if(boatSelect && select.dataset.id) {
|
||||
boatSelect.value = select.dataset.id;
|
||||
}
|
||||
|
||||
choiceObjects['boat_id'].setChoiceByValue(select.dataset.id);
|
||||
|
||||
(rowers === 0 ? choiceObjects['newrower'].disable() : choiceObjects['newrower'].enable());
|
||||
}
|
||||
});
|
||||
|
@ -64,8 +64,6 @@ async fn index(
|
||||
|
||||
let on_water = Logbook::on_water(db).await;
|
||||
|
||||
println!("{on_water:?}");
|
||||
|
||||
let mut context = Context::new();
|
||||
if let Some(msg) = flash {
|
||||
context.insert("flash", &msg.into_inner());
|
||||
@ -111,8 +109,20 @@ async fn kiosk(
|
||||
kiosk: KioskCookie,
|
||||
) -> Template {
|
||||
let boats = Boat::all_at_location(db, kiosk.0).await;
|
||||
let coxes = User::cox(db).await;
|
||||
let users = User::all(db).await;
|
||||
let coxes: Vec<UserWithWaterStatus> = futures::future::join_all(
|
||||
User::cox(db)
|
||||
.await
|
||||
.into_iter()
|
||||
.map(|user| UserWithWaterStatus::from_user(user, db)),
|
||||
)
|
||||
.await;
|
||||
let users: Vec<UserWithWaterStatus> = futures::future::join_all(
|
||||
User::all(db)
|
||||
.await
|
||||
.into_iter()
|
||||
.map(|user| UserWithWaterStatus::from_user(user, db)),
|
||||
)
|
||||
.await;
|
||||
let logtypes = LogType::all(db).await;
|
||||
let distances = Logbook::distances(db).await;
|
||||
|
||||
|
@ -35,12 +35,20 @@
|
||||
<select name="shipmaster" id="shipmaster" class="input rounded-md h-10">
|
||||
<optgroup label="Steuerleute">
|
||||
{% for cox in coxes %}
|
||||
<option value="{{ cox.id }}" {% if cox.on_water %} disabled="disabled" {% else %} {% if cox.id == shipmaster %} selected {% endif %} {% endif %}>{{ cox.name }} {% if cox.on_water %} (am Wasser) {% endif %}</option>
|
||||
<option value="{{ cox.id }}" {% if cox.on_water %} disabled="disabled" {% else %} {% if cox.id == shipmaster %} selected {% endif %} {% endif %}>{{ cox.name }}
|
||||
{% if cox.on_water %}
|
||||
(am Wasser)
|
||||
{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
<optgroup label="Mitglieder">
|
||||
{% for user in users | filter(attribute="is_cox", value=false) %}
|
||||
<option value="{{ user.id }}" {% if user.id == shipmaster %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{ user.name }} {% if user.on_water %} (am Wasser) {% endif %}</option>
|
||||
<option value="{{ user.id }}" {% if user.id == shipmaster %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{ user.name }}
|
||||
{% if user.on_water %}
|
||||
(am Wasser)
|
||||
{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
@ -105,7 +113,12 @@
|
||||
{% set_global sel = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<option value="{{ user.id }}" {% if sel %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>{{user.name}} {% if user.on_water %} (am Wasser) {% endif %}</option>
|
||||
<option value="{{ user.id }}" {% if sel %} selected {% endif %} {% if user.on_water %} disabled="disabled" {% endif %}>
|
||||
{{user.name}}
|
||||
{% if user.on_water %}
|
||||
(am Wasser)
|
||||
{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user