diff --git a/src/components/auth/Login.svelte b/src/components/auth/Login.svelte index 35fbbe38..6be88339 100644 --- a/src/components/auth/Login.svelte +++ b/src/components/auth/Login.svelte @@ -5,6 +5,7 @@ store.init(); import { OpenAPI, AuthService } from "@odit/lfk-client-js"; import Footer from "../general/Footer.svelte"; + import isEmail from "validator/es/lib/isEmail"; import Toastify from "toastify-js"; // ------ let username = config.default_username || ""; @@ -36,10 +37,19 @@ text: $_("login_is_checked"), duration: 500, }).showToast(); - AuthService.authControllerLogin({ - username, - password, - }) + let postdata = {}; + if (isEmail(username)) { + postdata = { + email: username, + password, + }; + } else { + postdata = { + username, + password, + }; + } + AuthService.authControllerLogin(postdata) .then(async (result) => { await localForage.setItem("logindata", result); OpenAPI.TOKEN = result.access_token; diff --git a/src/components/donations/DonationsOverview.svelte b/src/components/donations/DonationsOverview.svelte index d067c1f6..c417614b 100644 --- a/src/components/donations/DonationsOverview.svelte +++ b/src/components/donations/DonationsOverview.svelte @@ -74,20 +74,12 @@ .toLowerCase() .includes( searchvalue.toLowerCase() - ) || donation.donor.middlename - .toLowerCase() - .includes( - searchvalue.toLowerCase() - ) || donation.donor.lastname + ) || donation.donor.lastname .toLowerCase() .includes( searchvalue.toLowerCase() ) || donation.runner?.firstname .toLowerCase() - .includes( - searchvalue.toLowerCase() - ) || donation.runner?.middlename - .toLowerCase() .includes( searchvalue.toLowerCase() ) || donation.runner?.lastname diff --git a/src/components/donors/DonorsOverview.svelte b/src/components/donors/DonorsOverview.svelte index 86ddf16a..88984241 100644 --- a/src/components/donors/DonorsOverview.svelte +++ b/src/components/donors/DonorsOverview.svelte @@ -88,11 +88,7 @@ .toLowerCase() .includes( searchvalue.toLowerCase() - ) || donor.middlename - .toLowerCase() - .includes( - searchvalue.toLowerCase() - ) || donor.lastname + ) || donor.lastname .toLowerCase() .includes( searchvalue.toLowerCase() diff --git a/src/components/runners/ImportRunnerModal.svelte b/src/components/runners/ImportRunnerModal.svelte index 63088e64..1932ca1c 100644 --- a/src/components/runners/ImportRunnerModal.svelte +++ b/src/components/runners/ImportRunnerModal.svelte @@ -19,6 +19,11 @@ export let current_runners; export let import_modal_open; $: searchvalue = ""; + $: importButtonEnabled = + recent_processed && + (!(selected_org_or_team == "" || selected_org_or_team == null) || + !(passed_org?.id == null || passed_org?.id == 0) || + !(passed_team?.id == null || passed_team?.id == 0)); const dispatch = createEventDispatcher(); function cancelModal() { json_output = []; @@ -44,7 +49,10 @@ groups = groups.concat(orgs); RunnerTeamService.runnerTeamControllerGetAll().then((val) => { const teams = val.map((r) => { - return { label: `${r.parentGroup.name} > ${r.name}`, value: `TEAM_${r.id}` }; + return { + label: `${r.parentGroup.name} > ${r.name}`, + value: `TEAM_${r.id}`, + }; }); groups = groups.concat(teams); }); @@ -120,6 +128,13 @@ .catch((err) => { toast.hideToast(); recent_processed = true; + Toastify({ + text: $_("error-during-import"), + duration: 500, + backgroundColor: + "linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)", + }).showToast(); + cancelModal(); }); } if (opened_from === "TeamDetail") { @@ -137,6 +152,13 @@ .catch((err) => { toast.hideToast(); recent_processed = true; + Toastify({ + text: $_("error-during-import"), + duration: 500, + backgroundColor: + "linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)", + }).showToast(); + cancelModal(); }); } if (opened_from === "RunnerOverview") { @@ -160,6 +182,13 @@ .catch((err) => { toast.hideToast(); recent_processed = true; + Toastify({ + text: $_("error-during-import"), + duration: 500, + backgroundColor: + "linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)", + }).showToast(); + cancelModal(); }); } if (selected_org_or_team.includes("TEAM_")) { @@ -182,6 +211,13 @@ .catch((err) => { toast.hideToast(); recent_processed = true; + Toastify({ + text: $_("error-during-import"), + duration: 500, + backgroundColor: + "linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)", + }).showToast(); + cancelModal(); }); } } @@ -195,7 +231,7 @@ use:focusTrap use:clickOutside on:click_outside={() => { - import_modal_open = false; + cancelModal(); }}>
@@ -349,6 +385,8 @@
@@ -187,7 +187,7 @@ generateSponsoringContract('en'); }} type="submit" - class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" + class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" role="menuitem"> {$_('english')} @@ -249,11 +249,7 @@ .toLowerCase() .includes( searchvalue.toLowerCase() - ) || runner.middlename - .toLowerCase() - .includes( - searchvalue.toLowerCase() - ) || runner.lastname + ) || runner.lastname .toLowerCase() .includes( searchvalue.toLowerCase() diff --git a/src/components/scans/ScansOverview.svelte b/src/components/scans/ScansOverview.svelte index 81ccec1e..c653d614 100644 --- a/src/components/scans/ScansOverview.svelte +++ b/src/components/scans/ScansOverview.svelte @@ -81,10 +81,6 @@ .includes( searchvalue.toLowerCase() ) || scan.runner?.firstname - .toLowerCase() - .includes( - searchvalue.toLowerCase() - ) || scan.runner?.middlename .toLowerCase() .includes( searchvalue.toLowerCase() diff --git a/src/components/scanstations/CopyScanStationTokenModal.svelte b/src/components/scanstations/CopyScanStationTokenModal.svelte index 2067b175..6fa4db58 100644 --- a/src/components/scanstations/CopyScanStationTokenModal.svelte +++ b/src/components/scanstations/CopyScanStationTokenModal.svelte @@ -86,7 +86,7 @@
+ class="block text-sm font-medium text-gray-700">{$_('token')}

Bitte gebe eine Telefonnummer im internationalen Format an...", "the-scans-distance-must-be-greater-than-0m": "Die Distanz muss größer als 0m sein.", + "the-scanstations-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again": "Der Scannerstation Token wird nur einmal angezeigt - du kannst ihn nicht ändern oder ihn dir nochmal anzeigen lassen!", "there-are-no-contacts-added-yet": "Es wurden noch keine Kontakte hinzugefügt.", "there-are-no-donations-yet": "Es gibt noch keine Sponsorings", "there-are-no-donors-yet": "Es gibt noch keine Sponsor:innen", @@ -334,6 +345,7 @@ "there-are-no-users-added-yet": "Es wurden noch keine Benutzer hinzugefügt.", "this-might-take-a-moment": "Das könnte einen kleinen Moment dauern", "this-scanstation-is": "Diese Station ist", + "token": "Token", "total-distance": "gelaufene Strecke", "total-donation-amount": "Gesamtbetrag", "total-donations": "Spendensumme", diff --git a/src/locales/en.json b/src/locales/en.json index 24544ac8..07991ac5 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -45,6 +45,7 @@ "change-your-password-here": "Change your password here", "changing-your-password": "Changing your password", "city": "City", + "click-to-copy-token-to-clipboard": "Click to copy the token to your clipboard", "close": "Close", "configure-the-tracks-and-minimum-lap-times": "configure the tracks & minimum lap times", "confirm": "Confirm", @@ -62,6 +63,7 @@ "contact-is-not-a-member-in-any-group": "Contact is not a member in any group", "contacts": "Contacts", "contacts-are-being-loaded": "contacts are being loaded...", + "copied-token-to-clipboard": "Copied token to clipboard", "count_organizations": "# Organizations", "count_teams": "# Teams", "create": "Create", @@ -124,6 +126,7 @@ "description-optional": "Description (optional)", "deselect-all": "deselect all", "details": "Details", + "disabled": "disabled", "distance": "Distance", "distance-donation": "distance donation", "distance-in-km": "Distance in km", @@ -151,7 +154,10 @@ "edit-permissions": "edit permissions", "email_address_or_username": "Email / username", "enabled": "enabled", + "enabled_large": "Enabled", "english": "English", + "error-during-import": "Error during import", + "error-whyile-copying-to-clipboard": "Error while copying to clipboard", "error_on_login": "Error on login", "erteilte": "Directly granted", "everything-concerning-your-profile": "Everything concerning your profile", @@ -256,6 +262,7 @@ "permissions": "Permissions", "permissions-updated": "Permissions updated!", "phone": "Phone", + "please-copy-the-token-and-store-it-somewhere-save": "Please copy the token and store it somewhere safe.", "please-provide-a-password": "Please provide a password...", "please-provide-the-nessecary-information-to-add-a-new-donor": "Please provide the nessecary information to add a new donor", "please-provide-the-nessecary-information-to-create-a-new-donation": "Please provide the nessecary information to create a new donation", @@ -268,6 +275,7 @@ "please-provide-the-required-information-to-add-a-new-team": "Please provide the required information to add a new team.", "please-provide-the-required-information-to-add-a-new-track": "Please provide the required information to add a new track.", "please-provide-the-required-information-to-add-a-new-user": "Please provide the required information to add a new user.", + "please-provide-the-required-information-to-create-a-new-scanstation": "Please provide the required information to create a new scanstation", "please-request-a-new-reset-mail": "Please request a new reset mail...", "privacy": "Privacy", "privacy-loading": "Privacy loading...", @@ -297,6 +305,8 @@ "scans": "Scans", "scans-are-being-loaded": "Scans are being loaded", "scanstation": "Scanstation", + "scanstation-added": "Scanstation added", + "scanstation-is-being-added": "Adding scanstation...", "scanstations": "Scanstations", "scanstations-are-being-loaded": "Loading scanstations...", "search-for-an-organization-by-name-or-id": "Search for an organization (by name or id)", @@ -323,6 +333,7 @@ "teams-are-being-loaded": "teams are being loaded...", "the-provided-phone-number-is-invalid-less-than-br-greater-than-please-enter-a-valid-international-number": "the provided phone number is invalid.
please enter a valid international number...", "the-scans-distance-must-be-greater-than-0m": "The scan's distance must be greater than 0m", + "the-scanstations-api-token-will-only-get-displayed-once-you-wont-be-able-to-change-or-view-it-again": "The scanstation api token will only get displayed once - you won't be able to change or view it again!", "there-are-no-contacts-added-yet": "There are no contacts added yet.", "there-are-no-donations-yet": "There are no donations yet", "there-are-no-donors-yet": "There are no donors yet", @@ -334,6 +345,7 @@ "there-are-no-users-added-yet": "There are no users added yet.", "this-might-take-a-moment": "This might take a moment 👀", "this-scanstation-is": "This scanstation is", + "token": "Token", "total-distance": "total distance", "total-donation-amount": "total donation amount", "total-donations": "total donations",