🧹 ContactOverview refinement

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

View File

@ -2,18 +2,15 @@
import { t, _ } from "svelte-i18n";
import Toastify from "toastify-js";
import { GroupContactService } from "@odit/lfk-client-js";
const promise = GroupContactService.groupContactControllerGetAll()
const promise = GroupContactService.groupContactControllerGetAll();
import { users as usersstore } from "../store.js";
import store from "../store";
import TeamsEmptyState from "./TeamsEmptyState.svelte";
// import ConfirmTeamDeletion from "./ConfirmTeamDeletion.svelte";
$: searchvalue = "";
$: active_deletes = [];
export let current_teams = [];
let modal_open = false;
let delete_team = {};
export let contacts = [];
usersstore.subscribe((val) => {
current_teams = val;
contacts = val;
});
promise.then((data) => {
usersstore.set(data);
@ -29,7 +26,7 @@
<p class="text-sm">{$_('this-might-take-a-moment')}</p>
</div>
{:then}
{#if current_teams.length === 0}
{#if contacts.length === 0}
<TeamsEmptyState />
{:else}
<input
@ -64,7 +61,7 @@
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{#each current_teams as t}
{#each contacts as t}
{#if Object.values(t)
.toString()
.toLowerCase()
@ -87,7 +84,7 @@
<a
href="../orgs/{t.parentGroup.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{t.parentGroup.name}</a>
{:else}no organization specified{/if}
{:else}no groups{/if}
</div>
</div>
</div>
@ -115,19 +112,18 @@
Delete</button>
<button
on:click={() => {
RunnerTeamService.runnerTeamControllerRemove(t.id, false)
GroupContactService.groupContactControllerRemove(t.id, true)
.then((resp) => {
current_teams = current_teams.filter((obj) => obj.id !== t.id);
contacts = contacts.filter((obj) => obj.id !== t.id);
Toastify({
text: 'Organization deleted',
text: 'Contact deleted',
duration: 500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
})
.catch((err) => {
modal_open = true;
delete_team = t;
//
});
}}
tabindex="0"