From dba1e08c5d1b7a1619f5a4c4af760a74ba1950e7 Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Mon, 24 Jun 2024 16:58:19 +0200 Subject: [PATCH 1/8] [TASK] quick restructure of user screen --- templates/admin/user/index.html.tera | 126 +++++++++++++++------------ 1 file changed, 68 insertions(+), 58 deletions(-) diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index 409de92..09b9b5b 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -36,72 +36,82 @@ placeholder="Suchen nach (Name, [yes|no]-role:, has-[no-]membership-pdf)" /> -
-
+
{% for user in users %}
-
-
- -
+ data-filter="{{ user.name }} {% for role in roles %} {% if role.name in user.roles %} yes-role:{{ role.name }} {% else %} no-role:{{ role.name }} {% endif %} role-{{ role }} {% endfor %} {% if user.membership_pdf %}has-membership-pdf{% else %}has-no-membership-pdf{% endif %}" class="border-t bg-white dark:bg-primary-900 py-3 px-4 relative"> +
+ + + {{ user.name }} {% if user.last_access %} (last access: {{ user.last_access | date }}) {% endif %} - {% if user.pw %} - Passwort zurücksetzen - {% endif %} - {% if not user.last_access and "admin" in loggedin_user.roles %} - Willkommensmail verschicken - {% endif %} -
-
- {% for role in roles %} - {{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }} - {% endfor %} - {% if user.membership_pdf %} - Beitrittserklärung herunterladen - {% else %} - {{ macros::input(label='Beitrittserklärung', name='membership_pdf', id=loop.index, type="file", readonly=allowed_to_edit == false, accept='application/pdf') }} - {% endif %} - {{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address, readonly=allowed_to_edit == false) }} - {% if allowed_to_edit %} - {{ macros::select(label="Familie", data=families, name='family_id', selected_id=user.family_id, display=['names'], default="Keine Familie", new_last_entry='Neue Familie anlegen') }} - {% endif %} -
-
- {% if allowed_to_edit %} - - {% endif %} -
+ + + + {{ user.roles }} + + + + +
+ {% if user.pw %} + Passwort zurücksetzen + {% endif %} + {% if not user.last_access and "admin" in loggedin_user.roles %} + Willkommensmail verschicken + {% endif %} +
+ +
+ {% for role in roles %} + {{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }} + {% endfor %} +
+ {% if user.membership_pdf %} + Beitrittserklärung herunterladen + {% else %} + {{ macros::input(label='Beitrittserklärung', name='membership_pdf', id=loop.index, type="file", readonly=allowed_to_edit == false, accept='application/pdf') }} + {% endif %} + {{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address, readonly=allowed_to_edit == false) }} + {% if allowed_to_edit %} + {{ macros::select(label="Familie", data=families, name='family_id', selected_id=user.family_id, display=['names'], default="Keine Familie", new_last_entry='Neue Familie anlegen') }} + {% endif %} +
+
+ {% if allowed_to_edit %} + + {% endif %} +
+
{% endfor %} -
{% endblock content %} -- 2.45.2 From 1ad65095689ded0e457b61a3aee8d5e526b1e957 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 24 Jun 2024 19:56:35 +0200 Subject: [PATCH 2/8] minor visual improvements --- templates/admin/user/index.html.tera | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index 09b9b5b..faca738 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -41,19 +41,20 @@ {% for user in users %}
-
+
{{ user.name }} {% if user.last_access %} - (last access: - {{ user.last_access | date }}) + • ⏳ {{ user.last_access | date }} {% endif %} - {{ user.roles }} + {% for role in user.roles %} + {{ role }}{% if not loop.last %}, {% endif %} + {% endfor %} -- 2.45.2 From 4237fafdff77195115c35854348283278a01b232 Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 13 Jul 2024 19:58:13 +0100 Subject: [PATCH 3/8] fix error, where log entries can't be added with boats with only steering --- frontend/main.ts | 4 +- frontend/tests/log.spec.ts | 54 ++++++++++++++++++++++++++ seeds.sql | 1 + templates/includes/forms/log.html.tera | 2 +- templates/includes/macros.html.tera | 7 ++-- 5 files changed, 62 insertions(+), 6 deletions(-) diff --git a/frontend/main.ts b/frontend/main.ts index 88bbd54..1cb7271 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -158,9 +158,9 @@ function selectBoatChange() { } if (event.detail.customProperties.convert_handoperated_possible) { - only_steering.removeAttribute('disabled'); + only_steering.removeAttribute('readonly'); }else { - only_steering.setAttribute('disabled', 'disabled'); + only_steering.setAttribute('readonly', 'readonly'); } const destination = ( diff --git a/frontend/tests/log.spec.ts b/frontend/tests/log.spec.ts index bc74ec4..890762b 100644 --- a/frontend/tests/log.spec.ts +++ b/frontend/tests/log.spec.ts @@ -190,3 +190,57 @@ test("Kiosk can start and finish trip", async ({ page }, testInfo) => { await expect(page.locator('body')).toContainText('Ottensheim (25 km)'); await expect(page.locator('body')).toContainText('Ruderer: cox2, rower2'); }); + +test("Cox can start and finish trip with cox steering only", async ({ page }, testInfo) => { + await page.goto("/auth"); + await page.getByPlaceholder("Name").click(); + await page.getByPlaceholder("Name").fill("cox2"); + await page.getByPlaceholder("Name").press("Tab"); + await page.getByPlaceholder("Passwort").fill("cox"); + await page.getByPlaceholder("Passwort").press("Enter"); + + await page.goto("/"); + await page.getByRole("link", { name: "Ausfahrt eintragen" }).click(); + if (testInfo.project.name.includes("Mobile")) { + // No left boat selector on mobile views + await page.getByText('-- Wähle ein Boot aus ---').nth(1).click(); + await page.getByRole("option", { name: "cox_only_steering_boat" }).click(); + } else { + await page.getByText('2+', { exact: true }).click(); + await page.getByText("cox_only_steering_boat", { exact: true }).click(); + } + + // Trip starts 2 hours ago + const datetimeSelector = '#departure'; + const currentValue = await page.$eval(datetimeSelector, el => el.value); + const currentDate = new Date(currentValue); + currentDate.setMinutes(currentDate.getMinutes()); + currentDate.setHours(currentDate.getHours() - new Date().getTimezoneOffset()/60 - 2); + const newDatetime = currentDate.toISOString().slice(0, 16); + await page.$eval(datetimeSelector, (el, value) => el.value = value, newDatetime); + + await expect(page.locator("#shipmaster-newrowerjs")).toContainText("cox"); + await expect(page.locator("#steering_person-newrowerjs")).toContainText( + "rower2 cox", + ); + await page.getByRole("button", { name: "Ausfahrt eintragen" }).click(); + await expect(page.locator("body")).toContainText( + "Ausfahrt erfolgreich hinzugefügt", + ); + await expect(page.locator("body")).toContainText("cox_only_steering_boat"); + + await page.goto("/log"); + await page.locator("div:nth-child(2) > .border-0").click(); + + await page.getByRole("combobox", { name: "Destination" }).click(); + await page.getByRole("combobox", { name: "Destination" }).fill("Ottensheim"); + await page.getByRole("button", { name: "Ausfahrt beenden" }).click(); + await expect(page.locator("body")).toContainText( + "Ausfahrt korrekt eingetragen", + ); + + await page.goto('/log/show'); + await expect(page.locator('body')).toContainText('cox_only_steering_boat'); + await expect(page.locator('body')).toContainText('(cox2)'); + await expect(page.locator('body')).toContainText('Ottensheim (25 km)'); +}); diff --git a/seeds.sql b/seeds.sql index ceb2296..d832416 100644 --- a/seeds.sql +++ b/seeds.sql @@ -55,6 +55,7 @@ INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Kaputtes Boot :-(' INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Sehr kaputtes Boot :-((', 7, 1); INSERT INTO "boat" (name, amount_seats, location_id) VALUES ('Ottensheim Boot', 7, 2); INSERT INTO "boat" (name, amount_seats, location_id, owner) VALUES ('second_private_boat_from_rower', 1, 1, 2); +INSERT INTO "boat" (name, amount_seats, location_id, default_shipmaster_only_steering) VALUES ('cox_only_steering_boat', 3, 1, true); INSERT INTO "logbook_type" (name) VALUES ('Wanderfahrt'); INSERT INTO "logbook_type" (name) VALUES ('Regatta'); INSERT INTO "logbook" (boat_id, shipmaster,steering_person, shipmaster_only_steering, departure) VALUES (2, 2, 2, false, strftime('%Y', 'now') || '-12-24 10:00'); diff --git a/templates/includes/forms/log.html.tera b/templates/includes/forms/log.html.tera index 7395747..6a5fb50 100644 --- a/templates/includes/forms/log.html.tera +++ b/templates/includes/forms/log.html.tera @@ -36,7 +36,7 @@
Bootssteuerung
- {{ macros::checkbox(label='handgesteuert', name='shipmaster_only_steering', disabled=true) }} + {{ macros::checkbox(label='handgesteuert', name='shipmaster_only_steering', readonly=true) }}
{{ log::rower_select(id="newrower", selected=[], class="col-span-4", init=true) }} diff --git a/templates/includes/macros.html.tera b/templates/includes/macros.html.tera index d8c2b8e..0549f5b 100644 --- a/templates/includes/macros.html.tera +++ b/templates/includes/macros.html.tera @@ -137,14 +137,15 @@ {% if readonly %}readonly{% endif %}>
{% endmacro input %} -{% macro checkbox(label, name, id='', checked=false, class='', disabled=false) %} +{% macro checkbox(label, name, id='', checked=false, class='', disabled=false, readonly=false) %} -- 2.45.2 From 088fe989957d77a02318b337de419b164a63deff Mon Sep 17 00:00:00 2001 From: philipp Date: Sat, 13 Jul 2024 20:03:10 +0100 Subject: [PATCH 4/8] fix test --- frontend/tests/log.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/tests/log.spec.ts b/frontend/tests/log.spec.ts index 890762b..942d196 100644 --- a/frontend/tests/log.spec.ts +++ b/frontend/tests/log.spec.ts @@ -221,7 +221,7 @@ test("Cox can start and finish trip with cox steering only", async ({ page }, te await expect(page.locator("#shipmaster-newrowerjs")).toContainText("cox"); await expect(page.locator("#steering_person-newrowerjs")).toContainText( - "rower2 cox", + "cox", ); await page.getByRole("button", { name: "Ausfahrt eintragen" }).click(); await expect(page.locator("body")).toContainText( -- 2.45.2 From bd6fbe772e23f2653074e210886e35c1ba591cb4 Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Tue, 16 Jul 2024 14:32:40 +0200 Subject: [PATCH 5/8] [BUGFIX] vorstand-no-admin.png --- templates/admin/user/index.html.tera | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index faca738..16371e8 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -41,20 +41,30 @@ {% for user in users %}
-
+
{{ user.name }} + {% if not user.last_access and "admin" in loggedin_user.roles and user.mail %} +
+ • Willkommensmail verschicken +
+ {% endif %} + {% if user.last_access %} - • ⏳ {{ user.last_access | date }} + • ⏳ {{ user.last_access | date }} {% endif %}
- {% for role in user.roles %} - {{ role }}{% if not loop.last %}, {% endif %} - {% endfor %} + {% for role in user.roles %} + {{ role }}{% if not loop.last %}, {% endif %} + {% endfor %}
@@ -64,12 +74,8 @@ enctype="multipart/form-data" class="w-full mt-2"> {% if user.pw %} - Passwort zurücksetzen - {% endif %} - {% if not user.last_access and "admin" in loggedin_user.roles %} - Willkommensmail verschicken + Passwort zurücksetzen {% endif %}
-- 2.45.2 From 16fbeea81b005f53d18f326a285093562d52b2e0 Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Tue, 16 Jul 2024 14:38:27 +0200 Subject: [PATCH 6/8] [BUGFIX] only-event.png --- templates/planned.html.tera | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/planned.html.tera b/templates/planned.html.tera index 84ae217..33c4394 100644 --- a/templates/planned.html.tera +++ b/templates/planned.html.tera @@ -391,7 +391,7 @@
{# --- START Add Buttons --- #} {% if "manage_events" in loggedin_user.roles or "cox" in loggedin_user.roles %} -
+
{% if "manage_events" in loggedin_user.roles %} + class="relative inline-block w-full bg-primary-900 hover:bg-primary-950 focus:bg-primary-950 dark:bg-primary-950 text-white py-2 text-sm font-semibold + {% if "cox" in loggedin_user.roles %} + rounded-bl-md + {% else %} + rounded-b-md + {% endif %} + "> {% include "includes/plus-icon" %} Event -- 2.45.2 From 0e5fd25e61cf711fac42eefc497ecc1a7f2bbabe Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 16 Jul 2024 16:38:12 +0100 Subject: [PATCH 7/8] format tera files --- templates/admin/user/index.html.tera | 134 +++++++++++++-------------- templates/planned.html.tera | 12 +-- 2 files changed, 69 insertions(+), 77 deletions(-) diff --git a/templates/admin/user/index.html.tera b/templates/admin/user/index.html.tera index 16371e8..b2a8f9b 100644 --- a/templates/admin/user/index.html.tera +++ b/templates/admin/user/index.html.tera @@ -36,89 +36,87 @@ placeholder="Suchen nach (Name, [yes|no]-role:, has-[no-]membership-pdf)" />
-
- {% for user in users %} -
-
- +
+ {% for user in users %} +
+
+ {{ user.name }} - {% if not user.last_access and "admin" in loggedin_user.roles and user.mail %} -
- • Willkommensmail verschicken -
- {% endif %} - - {% if user.last_access %} - • ⏳ {{ user.last_access | date }} + • Willkommensmail verschicken + {% endif %} + {% if user.last_access %}• ⏳ {{ user.last_access | date }}{% endif %}
- - {% for role in user.roles %} - {{ role }}{% if not loop.last %}, {% endif %} - {% endfor %} + {% for role in user.roles %} + {{ role }} + {% if not loop.last %},{% endif %} + {% endfor %}
-
- {% if user.pw %} - Passwort zurücksetzen - {% endif %} -
- -
- {% for role in roles %} - {{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }} - {% endfor %} -
- {% if user.membership_pdf %} - Beitrittserklärung herunterladen - {% else %} - {{ macros::input(label='Beitrittserklärung', name='membership_pdf', id=loop.index, type="file", readonly=allowed_to_edit == false, accept='application/pdf') }} - {% endif %} - {{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone, readonly=allowed_to_edit == false) }} - {{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address, readonly=allowed_to_edit == false) }} - {% if allowed_to_edit %} - {{ macros::select(label="Familie", data=families, name='family_id', selected_id=user.family_id, display=['names'], default="Keine Familie", new_last_entry='Neue Familie anlegen') }} - {% endif %} -
-
- {% if allowed_to_edit %} - - {% endif %} -
-
-
- {% endfor %} + {% if user.pw %} + Passwort zurücksetzen + {% endif %} +
+ +
+ {% for role in roles %} + {{ macros::checkbox(label=role.name, name="roles[" ~ role.id ~ "]", id=loop.index , checked=role.name in user.roles, disabled=allowed_to_edit == false) }} + {% endfor %} +
+ {% if user.membership_pdf %} + Beitrittserklärung herunterladen + {% else %} + {{ macros::input(label='Beitrittserklärung', name='membership_pdf', id=loop.index, type="file", readonly=allowed_to_edit == false, accept='application/pdf') }} + {% endif %} + {{ macros::input(label='DOB', name='dob', id=loop.index, type="text", value=user.dob, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Weight (kg)', name='weight', id=loop.index, type="text", value=user.weight, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Sex', name='sex', id=loop.index, type="text", value=user.sex, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Mitglied seit', name='member_since_date', id=loop.index, type="text", value=user.member_since_date, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Geburtsdatum', name='birthdate', id=loop.index, type="text", value=user.birthdate, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Mail', name='mail', id=loop.index, type="text", value=user.mail, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Nickname', name='nickname', id=loop.index, type="text", value=user.nickname, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Notizen', name='notes', id=loop.index, type="text", value=user.notes, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Telefon', name='phone', id=loop.index, type="text", value=user.phone, readonly=allowed_to_edit == false) }} + {{ macros::input(label='Adresse', name='address', id=loop.index, type="text", value=user.address, readonly=allowed_to_edit == false) }} + {% if allowed_to_edit %} + {{ macros::select(label="Familie", data=families, name='family_id', selected_id=user.family_id, display=['names'], default="Keine Familie", new_last_entry='Neue Familie anlegen') }} + {% endif %} +
+
+ {% if allowed_to_edit %} + + {% endif %} + +
+
+ {% endfor %}
{% endblock content %} diff --git a/templates/planned.html.tera b/templates/planned.html.tera index 33c4394..84ceb49 100644 --- a/templates/planned.html.tera +++ b/templates/planned.html.tera @@ -391,16 +391,10 @@
{# --- START Add Buttons --- #} {% if "manage_events" in loggedin_user.roles or "cox" in loggedin_user.roles %} -
+
{% if "manage_events" in loggedin_user.roles %} - Date: Tue, 23 Jul 2024 08:57:43 +0200 Subject: [PATCH 8/8] new text to make clear who's responsible for fee payment --- templates/planned.html.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/planned.html.tera b/templates/planned.html.tera index 84ceb49..0dfab7c 100644 --- a/templates/planned.html.tera +++ b/templates/planned.html.tera @@ -50,7 +50,7 @@ target="_blank" rel="noopener noreferrer">hier) melde dich bitte bei it@rudernlinz.at. @Studenten: Bitte die aktuelle Studienbestätigung an it@rudernlinz.at schicken.
- Wir aktualisieren den Ruderassistent unregelmäßig mit unserem Bankkonto. Falls du schon bezahlt hast, kannst du diese Nachricht getrost ignorieren :^) + Unsere Kassiere aktualisieren den Ruderassistent unregelmäßig mit unserem Bankkonto. Falls du schon bezahlt hast, kannst du diese Nachricht getrost ignorieren. Wenn du schon vor "einigen Wochen" bezahlt hast bitte bei kassier@rudernlinz.at nachfragen :^)
-- 2.45.2