ContactsEmptyState

ref #50
This commit is contained in:
Philipp Dormann 2021-02-13 20:13:05 +01:00
parent 054c7faaac
commit a7098df9cf
2 changed files with 27 additions and 11 deletions

View File

@ -0,0 +1,17 @@
<script>
import { _ } from "svelte-i18n";
import AddContactModal from "./AddContactModal.svelte";
import team_empty from "./team_empty.svg";
let modal_open = false;
let current_contacts = [];
</script>
<div class="text-center items-center justify-center">
<p class="mb-16 text-lg text-gray-500">
<img class="w-full h-44" src={team_empty} alt="" />
<span class="font-bold">There are no contacts added yet.</span><br />
<span>Add your first contact</span>
</p>
</div>
<AddContactModal bind:modal_open bind:current_contacts />

View File

@ -6,7 +6,7 @@
current_contacts=result; current_contacts=result;
}) })
import store from "../store"; import store from "../store";
// import TeamsEmptyState from "./TeamsEmptyState.svelte"; import ContactsEmptyState from "./ContactsEmptyState.svelte";
$: searchvalue = ""; $: searchvalue = "";
$: active_deletes = []; $: active_deletes = [];
export let current_contacts = []; export let current_contacts = [];
@ -22,7 +22,7 @@
</div> </div>
{:then} {:then}
{#if current_contacts.length === 0} {#if current_contacts.length === 0}
<!-- <TeamsEmptyState /> --> <ContactsEmptyState />
{:else} {:else}
{JSON.stringify(current_contacts)} {JSON.stringify(current_contacts)}
<input <input
@ -99,9 +99,12 @@
<div class="flex items-center"> <div class="flex items-center">
<div class="ml-4"> <div class="ml-4">
<div class="text-sm font-medium text-gray-900"> <div class="text-sm font-medium text-gray-900">
{#if t.contact} <!-- {JSON.stringify(t.address)} -->
{JSON.stringify(t.contact)} {t.address.address1}<br>
{:else}no contact specified{/if} {t.address.address2 || ''}<br>
{t.address.postalcode}
{t.address.city}
{t.address.country}
</div> </div>
</div> </div>
</div> </div>
@ -118,20 +121,16 @@
Delete</button> Delete</button>
<button <button
on:click={() => { on:click={() => {
GroupContactService.runnerTeamControllerRemove(t.id, false) GroupContactService.groupContactControllerRemove(t.id, false)
.then((resp) => { .then((resp) => {
current_contacts = current_contacts.filter((obj) => obj.id !== t.id); current_contacts = current_contacts.filter((obj) => obj.id !== t.id);
Toastify({ Toastify({
text: 'Organization deleted', text: 'Contact deleted',
duration: 500, duration: 500,
backgroundColor: backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)', 'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast(); }).showToast();
}) })
.catch((err) => {
modal_open = true;
delete_team = t;
});
}} }}
tabindex="0" tabindex="0"
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">Confirm class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">Confirm