From f1ceef05fca603f76480df47623941a4ec6a18d1 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 24 Feb 2021 19:25:31 +0100 Subject: [PATCH] Added basic overview with emptystate ref #79 --- src/components/donations/Donations.svelte | 29 +++ .../donations/DonationsEmptyState.svelte | 12 ++ .../donations/DonationsOverview.svelte | 185 ++++++++++++++++++ src/components/donations/donations.svg | 1 + 4 files changed, 227 insertions(+) create mode 100644 src/components/donations/Donations.svelte create mode 100644 src/components/donations/DonationsEmptyState.svelte create mode 100644 src/components/donations/DonationsOverview.svelte create mode 100644 src/components/donations/donations.svg diff --git a/src/components/donations/Donations.svelte b/src/components/donations/Donations.svelte new file mode 100644 index 00000000..8603c66a --- /dev/null +++ b/src/components/donations/Donations.svelte @@ -0,0 +1,29 @@ + + +
+ + Donations + {#if store.state.jwtinfo.userdetails.permissions.includes('DONATION:CREATE')} + + {/if} + + +
+ + diff --git a/src/components/donations/DonationsEmptyState.svelte b/src/components/donations/DonationsEmptyState.svelte new file mode 100644 index 00000000..d19419bd --- /dev/null +++ b/src/components/donations/DonationsEmptyState.svelte @@ -0,0 +1,12 @@ + + +
+

+ + There are no donations yet
+ add your fist donation +

+
diff --git a/src/components/donations/DonationsOverview.svelte b/src/components/donations/DonationsOverview.svelte new file mode 100644 index 00000000..dd43f7ca --- /dev/null +++ b/src/components/donations/DonationsOverview.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/donations/donations.svg b/src/components/donations/donations.svg new file mode 100644 index 00000000..13a97190 --- /dev/null +++ b/src/components/donations/donations.svg @@ -0,0 +1 @@ + \ No newline at end of file