diff --git a/src/App.svelte b/src/App.svelte index 0ec9b765..c8964a12 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -27,12 +27,13 @@ storeName: "lfk_admin", description: "LfK! admin dashbaord", }); - window.onunhandledrejection = event => { - if(event.reason.toString() == "Error: Unauthorized"){ - console.log("Found 1") - localForage.clear(); - location.replace("/"); - }}; + window.onunhandledrejection = (event) => { + if (event.reason.toString() == "Error: Unauthorized") { + console.log("Found 1"); + localForage.clear(); + location.replace("/"); + } + }; // import Login from "./components/auth/Login.svelte"; import Dashboard from "./components/dashboard/Dashboard.svelte"; @@ -61,6 +62,8 @@ import ResetPassword from "./components/auth/ResetPassword.svelte"; import Contacts from "./components/contacts/Contacts.svelte"; import ContactDetail from "./components/contacts/ContactDetail.svelte"; + import Donors from "./components/donors/Donors.svelte"; + import DonorDetail from "./components/donors/DonorDetail.svelte"; store.init(); registerSW(); @@ -143,6 +146,14 @@ + + + + + + + + diff --git a/src/components/dashboard/Dashboard.svelte b/src/components/dashboard/Dashboard.svelte index fc89308c..a007fe91 100644 --- a/src/components/dashboard/Dashboard.svelte +++ b/src/components/dashboard/Dashboard.svelte @@ -54,83 +54,108 @@ {/if} {#if store.state.jwtinfo.userdetails.permissions.includes('USER:GET')} - - - {$_('users')} - - {/if} - {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:GET')} - - - - {$_('runners')} - - {/if} - {#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:GET')} - - - {$_('teams')} - - {/if} - {#if store.state.jwtinfo.userdetails.permissions.includes('TRACK:GET')} - - - {$_('tracks')} - - {/if} + + {$_('users')} + + {/if} + {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:GET')} + + + + {$_('runners')} + + {/if} + {#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:GET')} + + + {$_('teams')} + +{/if} +{#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:GET')} + + + + {$_('donors')} + +{/if} +{#if store.state.jwtinfo.userdetails.permissions.includes('TRACK:GET')} + - - {$_('contacts')} + href="/tracks/"> + + {$_('tracks')} + {/if} + + + {$_('contacts')} + +
-
{ - navOpen = true; - }} class="flex items-center justify-between w-full px-4 bg-white border-b h-14 md:hidden">
+
{ + navOpen = true; + }} + class="flex items-center justify-between w-full px-4 bg-white border-b h-14 md:hidden"> + +
diff --git a/src/components/donors/AddDonorModal.svelte b/src/components/donors/AddDonorModal.svelte new file mode 100644 index 00000000..0e20915a --- /dev/null +++ b/src/components/donors/AddDonorModal.svelte @@ -0,0 +1,404 @@ + + +{#if modal_open} +
{ + modal_open = false; + }}> +
+ +
+{/if} diff --git a/src/components/donors/ConfirmDonorDeletion.svelte b/src/components/donors/ConfirmDonorDeletion.svelte new file mode 100644 index 00000000..01100045 --- /dev/null +++ b/src/components/donors/ConfirmDonorDeletion.svelte @@ -0,0 +1,92 @@ + + +{#if modal_open} +
+
+ +
+{/if} diff --git a/src/components/donors/DonorDetail.svelte b/src/components/donors/DonorDetail.svelte new file mode 100644 index 00000000..dd083c3a --- /dev/null +++ b/src/components/donors/DonorDetail.svelte @@ -0,0 +1,382 @@ + + + +{#await promise} + {$_('loading-donor-details')} +{:then} +
+ +
+ {original_data.firstname} + {original_data.middlename || ''} + {original_data.lastname} + + {#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:DELETE')} + {#if delete_triggered} + + + {/if} + {#if !delete_triggered} + + {/if} + {/if} + {#if !delete_triggered} + + {/if} + +
+ +
+ {$_('total-donation-amount')}: + {(editable.donationAmount/100).toFixed(2).toLocaleString("de-DE", {valute: "EUR"})}€ +
+
+ + + {#if !isFirstnameValid} + + {$_('first-name-is-required')} + + {/if} +
+
+ + +
+
+ + + {#if !isLastnameValid} + + {$_('last-name-is-required')} + + {/if} +
+
+ + + {#if !isEmailValid} + + {$_('valid-email-is-required')} + + {/if} +
+
+ + + {#if !isPhoneValidOrEmpty} + + {$_('valid-international-phone-number-is-required')} + + {/if} +
+
+
+ +
+
+ +
+
+ {#if editable.address_checked === true} +
+ + + {#if !isAddress1Valid} + + {$_('address-is-required')} + + {/if} +
+
+ + +
+
+ + + {#if !iszipcodevalid} + + {$_('valid-zipcode-postal-code-is-required')} + + {/if} +
+
+ + + {#if !iscityvalid} + + {$_('valid-city-is-required')} + + {/if} +
+ {/if} +
+{:catch error} + +{/await} diff --git a/src/components/donors/Donors.svelte b/src/components/donors/Donors.svelte new file mode 100644 index 00000000..b879b8d0 --- /dev/null +++ b/src/components/donors/Donors.svelte @@ -0,0 +1,29 @@ + + +
+ + {$_('donors')} + {#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:CREATE')} + + {/if} + + +
+ +{#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:CREATE')} + +{/if} diff --git a/src/components/donors/DonorsEmptyState.svelte b/src/components/donors/DonorsEmptyState.svelte new file mode 100644 index 00000000..4cf520a3 --- /dev/null +++ b/src/components/donors/DonorsEmptyState.svelte @@ -0,0 +1,12 @@ + + +
+

+ + {$_('there-are-no-donors-yet')}
+ {$_('add-your-first-donor')} +

+
diff --git a/src/components/donors/DonorsOverview.svelte b/src/components/donors/DonorsOverview.svelte new file mode 100644 index 00000000..dd43f7ca --- /dev/null +++ b/src/components/donors/DonorsOverview.svelte @@ -0,0 +1,185 @@ + + + { + modal_open = false; + active_deletes[event.detail.id] = false; + }} + bind:modal_open + bind:delete_donor /> +{#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:GET')} + {#await donors_promise} + + {:then} + {#if current_donors.length === 0} + + {:else} + +
+ + + + + + + + + + + + {#each current_donors as donor} + {#if donor.firstname + .toLowerCase() + .includes( + searchvalue.toLowerCase() + ) || donor.middlename + .toLowerCase() + .includes( + searchvalue.toLowerCase() + ) || donor.lastname + .toLowerCase() + .includes( + searchvalue.toLowerCase() + ) || should_display_based_on_id(donor.id)} + + + + + + {#if active_deletes[donor.id] === true} + + {:else} + + {/if} + + {/if} + {/each} + +
+ {$_('name')} + + {$_('contact-information')} + + {$_('donations')} + + {$_('total-donation-amount')} + + {$_('action')} +
+
+
+
+ {donor.firstname} + {donor.middlename || ''} + {donor.lastname} +
+
+
+
+ {#if donor.email} +
{donor.email}
+ {/if} + {#if donor.phone} +
{donor.phone}
+ {/if} + {#if donor.address.address1 !== null} + {donor.address.address1}
+ {donor.address.address2 || ''}
+ {donor.address.postalcode} + {donor.address.city} + {donor.address.country} + {/if} +
TODO + {(donor.donationAmount/100).toFixed(2).toLocaleString("de-DE", {valute: "EUR"})}€ + + + + + {$_('details')} + {#if store.state.jwtinfo.userdetails.permissions.includes('DONOR:DELETE')} + + {/if} +
+
+ {/if} + {:catch error} +
+ + {$_('general_promise_error')} + {error} + +
+ {/await} +{/if} diff --git a/src/components/donors/donors_empty.svg b/src/components/donors/donors_empty.svg new file mode 100644 index 00000000..6602b11a --- /dev/null +++ b/src/components/donors/donors_empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/locales/de.json b/src/locales/de.json index 38499adb..010c9146 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -4,7 +4,9 @@ "about": "Über", "action": "Aktionen", "active": "Aktiv", + "add-donor": "Sponsor:in erstellen", "add-your-first-contact": "Erstelle den ersten Kontakt", + "add-your-first-donor": "Erstelle die erste Sponsor:in", "add-your-first-organization": "Erstelle die erste Organisation", "add-your-first-runner": "Erstelle die erste Läufer:in", "add-your-first-team": "Erstelle das erste Team", @@ -12,6 +14,7 @@ "add-your-first-user": "Erstelle die erste Benutzer:in", "address": "Adresse", "address-is-required": "Du musst eine Adresse angeben", + "all-associated-donations-will-get-deleted-as-well": "Alle Sponsorings dieser Sponsor:in werden ebenfalls gelöscht", "all-associated-runners-will-be-deleted-too": "Alle zugehörigen Läufer:innen werden auch gelöscht!", "all-associated-teams-and-runners-will-be-deleted-too": "Alle assoziierten Teams und Läufer:innen werden auch gelöscht!", "apartment-suite-etc": "Apartment, Wohnung, etc.", @@ -23,6 +26,7 @@ "by": "von", "cancel": "Abbrechen", "cancel-delete": "Löschen abbrechen", + "cancel-keep-donor": "Abbrechen, Sponsor:in behalten", "cancel-keep-organization": "Abbrechen und Organisation bearbeiten", "cancel-keep-team": "Abbrechen, Team behalten", "cannot-reset-your-password-directly": "Schade. \nWir können das Passwort leider nicht direkt zurücksetzen.\nBitte sende uns eine Mail in der du deine Identität bestätigst.", @@ -31,6 +35,7 @@ "configure-the-tracks-and-minimum-lap-times": "Bearbeite die Tracks und ihre minimale Rundenzeit", "confirm": "Bestätigen", "confirm-delete": "Löschung Bestätigen", + "confirm-delete-donor-with-all-donations": "Bestätigen, Sponsor:in mit allen Sponsorings löschen", "confirm-delete-organization-and-associated-teams-runners": "Bestätugung, lösche die Organisation und alle zugehörigen Teams und Läufer:innen.", "confirm-delete-team-and-associated-runners": "Bestätigung, lösche das Team mitsamt seinen Läufer:innen.", "confirm-deletion": "Löschung Bestätigen", @@ -45,6 +50,7 @@ "count_teams": "Teams (Anzahl)", "create": "Erstellen", "create-a-new-contact": "Kontakt erstellen", + "create-a-new-donor": "Neue Sponsor:in erstellen", "create-a-new-organization": "Neue Organisatio anlegen", "create-a-new-runner": "Neue Läufer:in erstellen", "create-a-new-team": "Erstelle ein neues Team", @@ -79,6 +85,7 @@ }, "delete": "Löschen", "delete-contact": "Kontakt löschen", + "delete-donor": "Sponsor:in löschen", "delete-organization": "Organisation löschen", "delete-runner": "Läufer:in löschen", "delete-team": "Team Löschen", @@ -90,6 +97,14 @@ "distance-in-km": "Distanz (in KM)", "do-you-want-to-delete-the-organization-delete_org-name": "Möchtest du die Organisation {orgname} löschen?", "do-you-want-to-delete-the-team-delete_team-name": "Möchtest du das Team {teamname} löschen?", + "do-you-want-to-delete-this-donor-with-all-related-donations": "Möchtest du diese Sponsor:in mit all ihren Sponsorings löschen?", + "donations": "Sponsorings", + "donor-added": "Sponsor:in hinzugefügt", + "donor-deleted": "Sponsor:in gelöscht", + "donor-is-being-added": "Sponsor:in wird hinzugefügt...", + "donor-is-being-updated": "Sponsor:in wird aktualisiert", + "donors": "Sponsor:innen", + "donors-are-being-loaded": "Sponsor:innen werden geladen", "dont-have-your-email-connected": "Deine E-Mail ist nicht verknüpft?", "dont-panic-were-resetting-it": "Keine Panik, wir setzen es zurück ✌", "e-mail-adress": "E-Mail-Adresse", @@ -135,6 +150,7 @@ "license": "Lizenz", "licenses-are-being-loaded": "Lizenzen werden geladen...", "loading-contact-details": "Kontaktdaten werden geladen ...", + "loading-donor-details": "Lade Details", "loading-runners": "Läufer:innen werden geladen...", "log_in": "Anmelden", "log_in_to_your_account": "Bitte melde dich an", @@ -174,6 +190,7 @@ "permissions-updated": "Berechtigungen aktualisiert!", "phone": "Telefon", "please-provide-a-password": "Bitte gebe ein Passwort an...", + "please-provide-the-nessecary-information-to-add-a-new-donor": "Bitte mach die Notwendigen Angaben, um eine neue Sponsor:in zu erstellen", "please-provide-the-required-csv-xlsx-file": "Bitte eine CSV oder XLSX Datei hochladen.", "please-provide-the-required-information-to-add-a-new-contact": "Bitte gebe alle nötigen Informationen an, im den neuen Kontakt zu erstellen.", "please-provide-the-required-information-to-add-a-new-organization": "Bitte gebe alle nötigen Informationen an, im die neue Organisation zu erstellen.", @@ -186,6 +203,7 @@ "privacy-loading": "Datenschutzerklärung lädt...", "profile-picture": "Profilbild", "read-license": "Lizenz-Text lesen", + "receipt-needed": "Spendenquittung benötigt", "repo_link": "Link", "request-a-new-reset-mail": "Neue Reset-Mail anfordern", "reset-my-password": "Passwort zurücksetzen", @@ -214,12 +232,14 @@ "teams-are-being-loaded": "Teams werden geladen ...", "the-provided-phone-number-is-invalid-less-than-br-greater-than-please-enter-a-valid-international-number": "Die angegebene Telefonnummer ist nicht korrekt.
Bitte gebe eine Telefonnummer im internationalen Format an...", "there-are-no-contacts-added-yet": "Es wurden noch keine Kontakte hinzugefügt.", + "there-are-no-donors-yet": "Es gibt noch keine Sponsor:innen", "there-are-no-organizations-added-yet": "Es wurden noch keine Organisationen hinzugefügt.", "there-are-no-runners-added-yet": "Es wurden noch keine Läufer:innen hinzugefügt.", "there-are-no-teams-added-yet": "Es wurden noch keine Teams hinzugefügt.", "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", "total-distance": "gelaufene Strecke", + "total-donation-amount": "Gesamte Spenden", "total-donations": "Spendensumme", "total-scans": "gesamte Scans", "track-added": "Track hinzugefügt", @@ -231,6 +251,7 @@ "track-name-must-not-be-empty": "Der Name muss angegeben werden", "tracks": "Tracks", "updated-contact": "Kontakt aktualisiert!", + "updated-donor": "Sponsor:in wurde aktualisiert", "updated-organization": "Organisation wurde aktualisiert", "updating-organization": "Organisation wird aktualisiert", "updating-runner": "Läufer:in wird aktualisiert.", diff --git a/src/locales/en.json b/src/locales/en.json index 55d4b841..9869997b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -4,7 +4,9 @@ "about": "About", "action": "Action", "active": "Active", + "add-donor": "add donor", "add-your-first-contact": "Add your first contact", + "add-your-first-donor": "add your first donor", "add-your-first-organization": "Add your first organization", "add-your-first-runner": "Add your first runner", "add-your-first-team": "Add your first team", @@ -12,6 +14,7 @@ "add-your-first-user": "Add your first user", "address": "Address", "address-is-required": "Address is required", + "all-associated-donations-will-get-deleted-as-well": "All associated donations will get deleted as well", "all-associated-runners-will-be-deleted-too": "All associated runners will be deleted too!", "all-associated-teams-and-runners-will-be-deleted-too": "All associated teams and runners will be deleted too!", "apartment-suite-etc": "Apartment, suite, etc.", @@ -23,6 +26,7 @@ "by": "by", "cancel": "Cancel", "cancel-delete": "Cancel Delete", + "cancel-keep-donor": "Cancel, keep donor", "cancel-keep-organization": "Cancel, keep organization", "cancel-keep-team": "Cancel, keep team", "cannot-reset-your-password-directly": "Bummer. We unfortunately cannot reset your password directly. Please send us a mail and confirm your identity", @@ -31,6 +35,7 @@ "configure-the-tracks-and-minimum-lap-times": "configure the tracks & minimum lap times", "confirm": "Confirm", "confirm-delete": "Confirm Delete", + "confirm-delete-donor-with-all-donations": "Confirm, delete donor with all donations", "confirm-delete-organization-and-associated-teams-runners": "Confirm, delete organization and associated teams+runners.", "confirm-delete-team-and-associated-runners": "Confirm, delete team and associated runners.", "confirm-deletion": "Confirm Deletion", @@ -45,6 +50,7 @@ "count_teams": "# Teams", "create": "Create", "create-a-new-contact": "Create a new contact", + "create-a-new-donor": "Create a new donor", "create-a-new-organization": "Create a new Organization", "create-a-new-runner": "Create a new Runner", "create-a-new-team": "Create a new team", @@ -79,6 +85,7 @@ }, "delete": "Delete", "delete-contact": "Delete Contact", + "delete-donor": "Delete donor", "delete-organization": "Delete Organization", "delete-runner": "Delete Runner", "delete-team": "Delete Team", @@ -90,6 +97,14 @@ "distance-in-km": "Distance in km", "do-you-want-to-delete-the-organization-delete_org-name": "Do you want to delete the organization {orgname}?", "do-you-want-to-delete-the-team-delete_team-name": "Do you want to delete the team {teamname}?", + "do-you-want-to-delete-this-donor-with-all-related-donations": "Do you want to delete this donor with all related donations", + "donations": "Donations", + "donor-added": "Donor added", + "donor-deleted": "donor deleted", + "donor-is-being-added": "Donor is being added...", + "donor-is-being-updated": "Donor is being updated", + "donors": "Donors", + "donors-are-being-loaded": "donors are being loaded", "dont-have-your-email-connected": "Don't have your email connected?", "dont-panic-were-resetting-it": "Don't panic, we're resetting it ✌", "e-mail-adress": "E-Mail Adress", @@ -135,6 +150,7 @@ "license": "License", "licenses-are-being-loaded": "Licenses are being loaded...", "loading-contact-details": "Loading contact details...", + "loading-donor-details": "Loading donor details", "loading-runners": "loading runners...", "log_in": "Log in", "log_in_to_your_account": "Log in to your account", @@ -174,6 +190,7 @@ "permissions-updated": "Permissions updated!", "phone": "Phone", "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-required-csv-xlsx-file": "Please provide the required csv/ xlsx file", "please-provide-the-required-information-to-add-a-new-contact": "Please provide the required information to add a new contact.", "please-provide-the-required-information-to-add-a-new-organization": "Please provide the required information to add a new organization.", @@ -186,6 +203,7 @@ "privacy-loading": "Privacy loading...", "profile-picture": "Profile Picture", "read-license": "Read License", + "receipt-needed": "Receipt needed", "repo_link": "Link", "request-a-new-reset-mail": "Request a new reset mail", "reset-my-password": "Reset my password", @@ -214,12 +232,14 @@ "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...", "there-are-no-contacts-added-yet": "There are no contacts added yet.", + "there-are-no-donors-yet": "There are no donors yet", "there-are-no-organizations-added-yet": "There are no organizations added yet.", "there-are-no-runners-added-yet": "There are no runners added yet.", "there-are-no-teams-added-yet": "There are no teams added yet.", "there-are-no-users-added-yet": "There are no users added yet.", "this-might-take-a-moment": "This might take a moment 👀", "total-distance": "total distance", + "total-donation-amount": "total donation amount", "total-donations": "total donations", "total-scans": "total scans", "track-added": "Track added", @@ -231,6 +251,7 @@ "track-name-must-not-be-empty": "Track name must not be empty", "tracks": "Tracks", "updated-contact": "Updated contact!", + "updated-donor": "updated donor", "updated-organization": "updated organization", "updating-organization": "updating organization", "updating-runner": "Updating runner...",