From 51ba1c852cad6243e935409da1eacecc5dcfa5fa Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 16 May 2025 16:40:58 +0200 Subject: [PATCH] feat(tools): Added tool for fast sponsoring creation --- package.json | 1 + pnpm-lock.yaml | 15 ++ src/App.svelte | 4 + src/components/dashboard/Dashboard.svelte | 20 ++ src/components/tools/DonationCreate.svelte | 300 +++++++++++++++++++++ src/locales/de.json | 10 +- src/locales/en.json | 6 +- 7 files changed, 352 insertions(+), 4 deletions(-) create mode 100644 src/components/tools/DonationCreate.svelte diff --git a/package.json b/package.json index f9f6a61c..5f644bf3 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "html5-qrcode": "^2.3.8", "localforage": "1.10.0", "papaparse": "^5.5.2", + "svelecte": "3", "svelte": "3.58.0", "svelte-french-toast": "1.2.0", "svelte-i18n": "4.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f5f5368b..83334919 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,6 +38,9 @@ importers: papaparse: specifier: ^5.5.2 version: 5.5.2 + svelecte: + specifier: '3' + version: 3.17.3 svelte: specifier: 3.58.0 version: 3.58.0 @@ -1983,6 +1986,9 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + svelecte@3.17.3: + resolution: {integrity: sha512-wnvoRxJIFFkm+CmXgjL4R3i/TcuYUIBkE+jDJSBD7AdSOzk1K6u3+nW4zwxaGT29zyZpiZkWeiy7lO62r5F+tg==} + svelte-french-toast@1.2.0: resolution: {integrity: sha512-5PW+6RFX3xQPbR44CngYAP1Sd9oCq9P2FOox4FZffzJuZI2mHOB7q5gJBVnOiLF5y3moVGZ7u2bYt7+yPAgcEQ==} peerDependencies: @@ -2004,6 +2010,9 @@ packages: svelte-select@3.17.0: resolution: {integrity: sha512-ITmX/XUiSdkaILmsTviKRkZPaXckM5/FA7Y8BhiUPoamaZG/ZDyOo6ydjFu9fDVFTbwoAUGUi6HBjs+ZdK2AwA==} + svelte-tiny-virtual-list@2.1.2: + resolution: {integrity: sha512-jeP/WMvgFUR4mYXHGPiCexjX5DuzSO+3xzHNhxfcsFyy+uYPtnqI5UGb383swpzQAyXB0OBqYfzpYihD/5gxnA==} + svelte-writable-derived@3.1.1: resolution: {integrity: sha512-w4LR6/bYZEuCs7SGr+M54oipk/UQKtiMadyOhW0PTwAtJ/Ai12QS77sLngEcfBx2q4H8ZBQucc9ktSA5sUGZWw==} peerDependencies: @@ -3946,6 +3955,10 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + svelecte@3.17.3: + dependencies: + svelte-tiny-virtual-list: 2.1.2 + svelte-french-toast@1.2.0(svelte@3.58.0): dependencies: svelte: 3.58.0 @@ -3968,6 +3981,8 @@ snapshots: svelte-select@3.17.0: {} + svelte-tiny-virtual-list@2.1.2: {} + svelte-writable-derived@3.1.1(svelte@3.58.0): dependencies: svelte: 3.58.0 diff --git a/src/App.svelte b/src/App.svelte index 324aedc5..2b6f5b6b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -72,6 +72,7 @@ import StatsClientDetail from "./components/statsclients/StatsClientDetail.svelte"; import CardReplacement from "./components/tools/CardReplacement.svelte"; import ScanClient from "./components/tools/ScanClient.svelte"; + import DonationCreate from "./components/tools/DonationCreate.svelte"; store.init(); @@ -144,6 +145,9 @@ + + + diff --git a/src/components/dashboard/Dashboard.svelte b/src/components/dashboard/Dashboard.svelte index 9c7e67c1..a7f98067 100644 --- a/src/components/dashboard/Dashboard.svelte +++ b/src/components/dashboard/Dashboard.svelte @@ -105,6 +105,26 @@ {$_("scanclient")} + + + + + + {$_("donation-quick-add")} +

{$_("management")}

diff --git a/src/components/tools/DonationCreate.svelte b/src/components/tools/DonationCreate.svelte new file mode 100644 index 00000000..6b143b0b --- /dev/null +++ b/src/components/tools/DonationCreate.svelte @@ -0,0 +1,300 @@ + + +
+

{$_("fast_donation_create")}

+ +
+
+

+ {$_("runner")} +

+ { + donorinfo.lastname = e.target.value; + }} + type="text" + name="lastname" + class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2" + /> +
+
+
+ {#if donorinfo.id == 0} + + {:else} + + {/if} +
+
+ +
+
+ {#if address_checked} +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ {/if} +
+
+

+ {$_("amount-per-kilometer")} +

+
+ 0} + class:focus:border-red-500={!amount > 0} + class:focus:ring-red-500={!amount > 0} + bind:value={amount} + type="number" + step="0.01" + name="donation_amount_eur" + class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm border-neutral-300 border bg-neutral-50 text-neutral-800 p-2" + placeholder="2.00" + /> + +
+
+
+

+ {$_("confirm")} +

+ + {amount <= 0 || + runnerinfo.id == 0 || + (donorinfo.firstname.length == 0 && donorinfo.lastname.length == 0)} + {amount} - {runnerinfo.id} - {donorinfo.id} - {donorinfo.firstname} - {donorinfo.lastname} +
+
+ + + diff --git a/src/locales/de.json b/src/locales/de.json index 4863f57b..7f1a2f2a 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -203,7 +203,7 @@ "donations": "Sponsorings", "donations-are-being-loaded": "Sponsorings werden geladen...", "done": "✅ Fertig", - "donor": "Sponsor", + "donor": "Sponsor:in", "donor-added": "Sponsor hinzugefügt", "donor-deleted": "Sponsor gelöscht", "donor-has-no-associated-donations": "Keine Sponsorings", @@ -381,7 +381,7 @@ "request-a-new-reset-mail": "Neue Reset-Mail anfordern", "reset-my-password": "Passwort zurücksetzen", "reset-password": "Passwort zurücksetzen", - "runner": "Läufer", + "runner": "Läufer:in", "runner-added": "Läufer hinzugefügt", "runner-deleted": "Läufer gelöscht", "runner-import": "Läufer Import", @@ -535,5 +535,9 @@ "management": "Verwaltung", "system": "System", "mobile-scanclient": "Mobiler Scanclient", - "scanclient": "Scanclient" + "scanclient": "Scanclient", + "fast_donation_create": "Sponsoring-Schnellanlage", + "creating-donation": "Sponsoring wird erstellt...", + "donation-created": "Sponsoring erstellt", + "donation-quick-add": "Sponsoringschnelleingabe" } diff --git a/src/locales/en.json b/src/locales/en.json index 582b864b..910ad961 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -534,5 +534,9 @@ "quick-tools": "Tools", "system": "System", "mobile-scanclient": "Mobile scanclient", - "scanclient": "Scanclient" + "scanclient": "Scanclient", + "fast_donation_create": "Mass donation creator", + "creating-donation": "Creating donation...", + "donation-created": "Created sponsoring", + "donation-quick-add": "Mass sponsoring creation" }