🐞 fixed null addresses in ContactsOverview

ref #50
This commit is contained in:
Philipp Dormann 2021-02-15 17:52:20 +01:00
parent 0f013304ef
commit 6a91bd53e2

View File

@ -2,9 +2,11 @@
import { _ } from "svelte-i18n";
import Toastify from "toastify-js";
import { GroupContactService } from "@odit/lfk-client-js";
const promise = GroupContactService.groupContactControllerGetAll().then(result=>{
current_contacts=result;
})
const promise = GroupContactService.groupContactControllerGetAll().then(
(result) => {
current_contacts = result;
}
);
import store from "../store";
import ContactsEmptyState from "./ContactsEmptyState.svelte";
$: searchvalue = "";
@ -77,18 +79,18 @@
<div class="flex items-center">
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">
{#if t.groups.length>0}
{#each t.groups as g}
{#if g.responseType==="RUNNERORGANIZATION"}
<a
href="../orgs/{g.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{g.name}</a>
{:else}
<a
href="../teams/{g.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{g.name}</a>
{/if}
{/each}
{#if t.groups.length > 0}
{#each t.groups as g}
{#if g.responseType === 'RUNNERORGANIZATION'}
<a
href="../orgs/{g.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{g.name}</a>
{:else}
<a
href="../teams/{g.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{g.name}</a>
{/if}
{/each}
{:else}no groups{/if}
</div>
</div>
@ -98,11 +100,13 @@
<div class="flex items-center">
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">
{t.address.address1}<br>
{t.address.address2 || ''}<br>
{t.address.postalcode}
{t.address.city}
{t.address.country}
{#if t.address.address1 !== null}
{t.address.address1}<br />
{t.address.address2 || ''}<br />
{t.address.postalcode}
{t.address.city}
{t.address.country}
{/if}
</div>
</div>
</div>
@ -119,16 +123,19 @@
Delete</button>
<button
on:click={() => {
GroupContactService.groupContactControllerRemove(t.id, false)
.then((resp) => {
current_contacts = current_contacts.filter((obj) => obj.id !== t.id);
GroupContactService.groupContactControllerRemove(t.id, false).then(
(resp) => {
current_contacts = current_contacts.filter(
(obj) => obj.id !== t.id
);
Toastify({
text: 'Contact deleted',
duration: 500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
})
}
);
}}
tabindex="0"
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">Confirm