staging #260
@ -17,22 +17,52 @@ pub struct Boathouse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Boathouse {
|
impl Boathouse {
|
||||||
pub async fn get(db: &SqlitePool) -> HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 4]>> {
|
pub async fn get(db: &SqlitePool) -> HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 12]>> {
|
||||||
let mut ret: HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 4]>> = HashMap::new();
|
let mut ret: HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 12]>> = HashMap::new();
|
||||||
|
|
||||||
let mut mountain = HashMap::new();
|
let mut mountain = HashMap::new();
|
||||||
mountain.insert("mountain", [None, None, None, None]);
|
mountain.insert(
|
||||||
mountain.insert("water", [None, None, None, None]);
|
"mountain",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
mountain.insert(
|
||||||
|
"water",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
ret.insert("mountain-aisle", mountain);
|
ret.insert("mountain-aisle", mountain);
|
||||||
|
|
||||||
let mut middle = HashMap::new();
|
let mut middle = HashMap::new();
|
||||||
middle.insert("mountain", [None, None, None, None]);
|
middle.insert(
|
||||||
middle.insert("water", [None, None, None, None]);
|
"mountain",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
middle.insert(
|
||||||
|
"water",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
ret.insert("middle-aisle", middle);
|
ret.insert("middle-aisle", middle);
|
||||||
|
|
||||||
let mut water = HashMap::new();
|
let mut water = HashMap::new();
|
||||||
water.insert("mountain", [None, None, None, None]);
|
water.insert(
|
||||||
water.insert("water", [None, None, None, None]);
|
"mountain",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
water.insert(
|
||||||
|
"water",
|
||||||
|
[
|
||||||
|
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||||
|
],
|
||||||
|
);
|
||||||
ret.insert("water-aisle", water);
|
ret.insert("water-aisle", water);
|
||||||
|
|
||||||
let boathouses = sqlx::query_as!(
|
let boathouses = sqlx::query_as!(
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
{% set aisle = aisle_name ~ "-aisle" %}
|
{% set aisle = aisle_name ~ "-aisle" %}
|
||||||
{% set place = boathouse[aisle][side_name] %}
|
{% set place = boathouse[aisle][side_name] %}
|
||||||
{% if place[level] %}
|
{% if place[level] %}
|
||||||
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0" href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
|
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0"
|
||||||
|
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
|
||||||
{% elif boats | length > 0 %}
|
{% elif boats | length > 0 %}
|
||||||
<details>
|
<details>
|
||||||
<summary>Kein Boot</summary>
|
<summary>Kein Boot</summary>
|
||||||
@ -33,11 +34,29 @@
|
|||||||
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 1) }}
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 1) }}
|
||||||
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 2) }}
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 2) }}
|
||||||
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 3) }}
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 3) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 4) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 5) }}
|
||||||
|
{% set show_additional = false %}
|
||||||
|
{% if aisle_name == "mountain" %}
|
||||||
|
{% set show_additional = true %}
|
||||||
|
{% elif aisle_name == "middle" and side_name == "mountain" %}
|
||||||
|
{% set show_additional = true %}
|
||||||
|
{% endif %}
|
||||||
|
{% if show_additional %}
|
||||||
|
<hr />
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 6) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 7) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 8) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 9) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 10) }}
|
||||||
|
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 11) }}
|
||||||
|
{% endif %}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro show_side %}
|
{% endmacro show_side %}
|
||||||
{% macro show_aisle(name, last=false) %}
|
{% macro show_aisle(name, last=false) %}
|
||||||
<div id="{{ name }}-aisle" class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
|
<div id="{{ name }}-aisle"
|
||||||
|
class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
|
||||||
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
|
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
|
||||||
{{ self::show_side(aisle_name = name, side_name = "water") }}
|
{{ self::show_side(aisle_name = name, side_name = "water") }}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user