From 33b06dc582565ee3c7a21c5cf6e113cbc5b69d81 Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Thu, 28 Sep 2023 17:31:20 +0200 Subject: [PATCH] [TASK] style boat damage screen --- frontend/main.ts | 4 +- templates/boatdamages.html.tera | 101 +++++++++++++++---------- templates/includes/forms/log.html.tera | 6 +- 3 files changed, 69 insertions(+), 42 deletions(-) diff --git a/frontend/main.ts b/frontend/main.ts index 05d67a6..4593315 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -92,7 +92,8 @@ function reloadPage() { } function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') { - let curSelection = choiceObjects['newrower'].getValue(true); + if(choiceObjects['newrower']) { + let curSelection = choiceObjects['newrower'].getValue(true); let amount_to_delete = (curSelection).length - rowers; if (amount_to_delete > 0){ @@ -135,6 +136,7 @@ function setMaxAmountRowers(rowers: number, isShipmasterSteering='false') { only_steering.parentElement?.parentElement?.parentElement?.classList.add('opacity-50'); } } + } } function initBoatActions() { diff --git a/templates/boatdamages.html.tera b/templates/boatdamages.html.tera index 3d29f28..dfd2c92 100644 --- a/templates/boatdamages.html.tera +++ b/templates/boatdamages.html.tera @@ -9,51 +9,76 @@

Bootschäden

{% if flash %} - {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3") }} + {{ macros::alert(message=flash.1, type=flash.0, class="sm:col-span-2 lg:col-span-3 mt-3") }} {% endif %} -

Neuen Schaden eintragen

-
- {{ log::boat_select(only_ones=false) }} - {{ macros::input(label='Beschreibung des Schadens', name='desc', type='text', required=true) }} - {{ macros::checkbox(label='Boot sperren', name='lock_boat', type='text', required=true) }} - -
- +

+ Neuen Schaden -
+ + {% include "includes/plus-icon" %} + Neuen Schaden eintragen + +

+ + +
+ + +
+ +
{% for boatdamage in boatdamages %} - Boat: {{ boatdamage.boat.name }} - Desc: {{ boatdamage.desc }} - Schaden eingetragen von {{ boatdamage.user_created.name }} am/um {{ boatdamage.created_at | date(format='%d. %m. %Y %H:%M') }} - {% if boatdamage.is_lock %} - Boot gesperrt - {% endif %} - {% if boatdamage.fixed_at %} - Repariert von {{ boatdamage.user_fixed.name }} am/um {{ boatdamage.fixed_at | date(format='%d. %m. %Y %H:%M') }} - {% elif loggedin_user.is_cox %} -
- - {% if loggedin_user.is_tech %} - - {% else %} - - {% endif %} -
- {% endif %} - {% if boatdamage.verified_at %} - Verifziert von {{ boatdamage.user_verified.name }} am/um {{ boatdamage.verified_at | date(format='%d. %m. %Y %H:%M') }} - {% elif loggedin_user.is_tech and boatdamage.fixed_at %} -
- - -
- {% endif %} -
- {% endfor %} +
+
+ {{ boatdamage.created_at | date(format='%d.%m.%Y') }} ({{ boatdamage.boat.name }}){% if boatdamage.boat.damage %}(Boot gesperrt){% endif %} +
{{ boatdamage.desc }}
+ + Schaden eingetragen von {{ boatdamage.user_created.name }} am/um {{ boatdamage.created_at | date(format='%d.%m.%Y (%H:%M)') }} + + {% if boatdamage.fixed_at %} + Repariert von {{ boatdamage.user_fixed.name }} am/um {{ boatdamage.fixed_at | date(format='%d.%m.%Y (%H:%M)') }} + {% else %} + {% if loggedin_user.is_cox %} +
+ + {% if loggedin_user.is_tech %} + + {% else %} + + {% endif %} +
+ {% endif %} + {% endif %} + + {% if boatdamage.verified_at %} + Verifziert von {{ boatdamage.user_verified.name }} am/um {{ boatdamage.verified_at | date(format='%d.%m.%Y (%H:%M)') }} + {% else %} + {% if loggedin_user.is_tech and boatdamage.fixed_at %} +
+ + +
+ {% endif %} + {% endif %} +
+
+ {% endfor %} {% endblock content%} diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index df88d4d..75a5179 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -100,12 +100,12 @@ {% endmacro new %} -{% macro boat_select(only_ones) %} +{% macro boat_select(only_ones, id="boat_id") %} {% if not only_ones %} - {{ macros::select(label="Boot", data=boats, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-4") }} + {{ macros::select(label="Boot", data=boats, name="boat_id", id=id, display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-4") }} {% else %} {% set ones = boats | filter(attribute="amount_seats", value=1) %} - {{ macros::select(label="Boot", data=ones, name='boat_id', display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-4") }} + {{ macros::select(label="Boot", data=ones, name="boat_id", id=id, display=["name", " (","amount_seats", " x)"], extras=["default_shipmaster_only_steering", "amount_seats", "on_water"], wrapper_class="col-span-4") }} {% endif %} {% endmacro boat_select %}