diff --git a/src/components/cards/Cards.svelte b/src/components/cards/Cards.svelte index d45409de..15b067bc 100644 --- a/src/components/cards/Cards.svelte +++ b/src/components/cards/Cards.svelte @@ -11,29 +11,29 @@ - + {$_("cards")} - {#if store.state.jwtinfo.userdetails.permissions.includes("CARD:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("add-card")} - - { - bulk_modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-bulk-cards")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("CARD:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("add-card")} + + { + bulk_modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-bulk-cards")} + + {/if} diff --git a/src/components/contacts/Contacts.svelte b/src/components/contacts/Contacts.svelte index ba0f4048..48c5deed 100644 --- a/src/components/contacts/Contacts.svelte +++ b/src/components/contacts/Contacts.svelte @@ -8,20 +8,20 @@ - + {$_("contacts")} - {#if store.state.jwtinfo.userdetails.permissions.includes("CONTACT:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-a-new-contact")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("CONTACT:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-a-new-contact")} + + {/if} diff --git a/src/components/donations/Donations.svelte b/src/components/donations/Donations.svelte index c32e1d8b..de3b4446 100644 --- a/src/components/donations/Donations.svelte +++ b/src/components/donations/Donations.svelte @@ -9,20 +9,20 @@ - + {$_("donations")} - {#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("add-donation")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("add-donation")} + + {/if} diff --git a/src/components/donors/Donors.svelte b/src/components/donors/Donors.svelte index dabd99dd..bb051b65 100644 --- a/src/components/donors/Donors.svelte +++ b/src/components/donors/Donors.svelte @@ -9,61 +9,61 @@ - + {$_("donors")} - {#if store.state.jwtinfo.userdetails.permissions.includes("DONOR:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("add-donor")} - - {/if} - {#if store.state.jwtinfo.userdetails.permissions.includes("DONOR:GET")} - { - const data = current_donors - .filter((d) => d.receiptNeeded === true) - .map(function (d) { - d.address.address2 = - d.address.address2 === "" ? "" : " " + d.address.address2; - const address = `${d.address.address1}${d.address.address2}, ${d.address.postalcode} ${d.address.city}, ${d.address.country}`; - return [ - d.firstname, - d.middlename, - d.lastname, - (d.paidDonationAmount/100).toFixed(2), - address, - ]; - }); - let csv = `${$_("csv_import__firstname")};${$_( - "csv_import__middlename" - )};${$_("csv_import__lastname")};${$_( - "total_donation_amount_in_eur" - )};${$_("address")}\n`; - data.forEach(function (row) { - csv += row.join(";"); - csv += "\n"; + + {#if store.state.jwtinfo.userdetails.permissions.includes("DONOR:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("add-donor")} + + {/if} + {#if store.state.jwtinfo.userdetails.permissions.includes("DONOR:GET")} + { + const data = current_donors + .filter((d) => d.receiptNeeded === true) + .map(function (d) { + d.address.address2 = + d.address.address2 === "" ? "" : " " + d.address.address2; + const address = `${d.address.address1}${d.address.address2}, ${d.address.postalcode} ${d.address.city}, ${d.address.country}`; + return [ + d.firstname, + d.middlename, + d.lastname, + (d.paidDonationAmount/100).toFixed(2), + address, + ]; }); - let hiddenElement = document.createElement("a"); - hiddenElement.href = "data:text/csv;charset=utf-8," + encodeURI(csv); - hiddenElement.target = "_blank"; - hiddenElement.download = `${$_( - "filename_sponsoringquittungsliste" - )}.csv`; - hiddenElement.click(); - hiddenElement.remove(); - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("sponsoring-quittungs-liste_herunterladen")} - - {/if} - + let csv = `${$_("csv_import__firstname")};${$_( + "csv_import__middlename" + )};${$_("csv_import__lastname")};${$_( + "total_donation_amount_in_eur" + )};${$_("address")}\n`; + data.forEach(function (row) { + csv += row.join(";"); + csv += "\n"; + }); + let hiddenElement = document.createElement("a"); + hiddenElement.href = "data:text/csv;charset=utf-8," + encodeURI(csv); + hiddenElement.target = "_blank"; + hiddenElement.download = `${$_( + "filename_sponsoringquittungsliste" + )}.csv`; + hiddenElement.click(); + hiddenElement.remove(); + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("sponsoring-quittungs-liste_herunterladen")} + + {/if} diff --git a/src/components/groups/Groups.svelte b/src/components/groups/Groups.svelte index 26ff88dc..04eedc0c 100644 --- a/src/components/groups/Groups.svelte +++ b/src/components/groups/Groups.svelte @@ -8,20 +8,20 @@ - + {$_("user-groups")} - {#if store.state.jwtinfo.userdetails.permissions.includes("USERGROUP:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("add-user-group")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("USERGROUP:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("add-user-group")} + + {/if} diff --git a/src/components/orgs/Orgs.svelte b/src/components/orgs/Orgs.svelte index 18d49972..f565cdcd 100644 --- a/src/components/orgs/Orgs.svelte +++ b/src/components/orgs/Orgs.svelte @@ -10,31 +10,31 @@ - + {$_("organizations")} - {#if store.state.jwtinfo.userdetails.permissions.includes("ORGANIZATION:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-organization")} - - {/if} - {#if store.state.jwtinfo.userdetails.permissions.includes("RUNNER:IMPORT")} - { - import_modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("import-runners")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("ORGANIZATION:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-organization")} + + {/if} + {#if store.state.jwtinfo.userdetails.permissions.includes("RUNNER:IMPORT")} + { + import_modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("import-runners")} + + {/if} diff --git a/src/components/runners/Runners.svelte b/src/components/runners/Runners.svelte index 8939d510..624a39f7 100644 --- a/src/components/runners/Runners.svelte +++ b/src/components/runners/Runners.svelte @@ -11,29 +11,29 @@ - + {$_("runners")} - {#if store.state.jwtinfo.userdetails.permissions.includes("RUNNER:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("laeufer-hinzufuegen")} - - { - import_modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("import-runners")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("RUNNER:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("laeufer-hinzufuegen")} + + { + import_modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("import-runners")} + + {/if} diff --git a/src/components/scans/Scans.svelte b/src/components/scans/Scans.svelte index c809e82e..9e5ac9bb 100644 --- a/src/components/scans/Scans.svelte +++ b/src/components/scans/Scans.svelte @@ -9,20 +9,20 @@ - + {$_("scans")} - {#if store.state.jwtinfo.userdetails.permissions.includes("SCAN:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("add-scan")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("SCAN:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("add-scan")} + + {/if} diff --git a/src/components/scanstations/ScanStations.svelte b/src/components/scanstations/ScanStations.svelte index 74983244..e0d7c97e 100644 --- a/src/components/scanstations/ScanStations.svelte +++ b/src/components/scanstations/ScanStations.svelte @@ -24,20 +24,20 @@ - + {$_("scanstations")} - {#if store.state.jwtinfo.userdetails.permissions.includes("STATION:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-a-new-scanstation")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("STATION:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-a-new-scanstation")} + + {/if} { modal_open = false; diff --git a/src/components/statsclients/StatsClients.svelte b/src/components/statsclients/StatsClients.svelte index 12ebf758..de6e864f 100644 --- a/src/components/statsclients/StatsClients.svelte +++ b/src/components/statsclients/StatsClients.svelte @@ -11,20 +11,20 @@ - + {$_("statsclients")} - {#if store.state.jwtinfo.userdetails.permissions.includes("STATSCLIENT:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-a-new-statsclient")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("STATSCLIENT:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-a-new-statsclient")} + + {/if} - + {$_("teams")} - {#if store.state.jwtinfo.userdetails.permissions.includes("TEAM:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-team")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("TEAM:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-team")} + + {/if} diff --git a/src/components/tracks/TracksOverview.svelte b/src/components/tracks/TracksOverview.svelte index 96aabcbd..aa30cd56 100644 --- a/src/components/tracks/TracksOverview.svelte +++ b/src/components/tracks/TracksOverview.svelte @@ -19,18 +19,18 @@ - - Tracks - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-track")} - - + + {$_("tracks")} + + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-track")} + {#await tracks_promise} - + {$_("users")} - {#if store.state.jwtinfo.userdetails.permissions.includes("USER:CREATE")} - { - modal_open = true; - }} - type="button" - class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" - > - {$_("create-user")} - - {/if} - + + {#if store.state.jwtinfo.userdetails.permissions.includes("USER:CREATE")} + { + modal_open = true; + }} + type="button" + class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm" + > + {$_("create-user")} + + {/if}