diff --git a/src/components/orgs/OrgDetail.svelte b/src/components/orgs/OrgDetail.svelte index ca14e5f0..d0dc8bd4 100644 --- a/src/components/orgs/OrgDetail.svelte +++ b/src/components/orgs/OrgDetail.svelte @@ -20,6 +20,7 @@ let contacts = []; export let params; $: editable = {}; + $: contact = {}; $: data_loaded = false; $: data_changed = !(JSON.stringify(editable) === original); $: isAddress1Valid = editable.address?.address1?.trim().length !== 0; @@ -46,9 +47,16 @@ editable = editable; original_object = Object.assign(editable, value); original = JSON.stringify(value); - }); - GroupContactService.groupContactControllerGetAll().then((val) => { - contacts = val; + GroupContactService.groupContactControllerGetAll().then((val) => { + contacts = val.map((r) => { + return { label: getContactLabel(r), value: r }; + }); + if (editable.contact) { + contact = contacts.find((g) => g.value.id == editable.contact.id); + } else { + contact = null; + } + }); }); let modal_open = false; let delete_org = {}; @@ -359,18 +367,19 @@ class="font-medium text-gray-700">{$_('contact')}