parent
64311e9652
commit
82423ec467
@ -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')}</label>
|
||||
<Select
|
||||
containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2"
|
||||
getSelectionLabel={(option) => getContactLabel(option)}
|
||||
getOptionLabel={(option) => getContactLabel(option)}
|
||||
itemFilter={(label, filterText, option) => label
|
||||
.toLowerCase()
|
||||
.includes(
|
||||
filterText.toLowerCase()
|
||||
) || option.id.toString().startsWith(filterText.toLowerCase())}
|
||||
) || option.value.id
|
||||
.toString()
|
||||
.startsWith(filterText.toLowerCase())}
|
||||
items={contacts}
|
||||
showChevron={true}
|
||||
placeholder={$_('no-contact-selected')}
|
||||
noOptionsMessage={$_('no-contact-found')}
|
||||
bind:selectedValue={editable.contact}
|
||||
bind:selectedValue={contact}
|
||||
on:select={(selectedValue) => (editable.contact = selectedValue.detail.value)}
|
||||
on:clear={() => (editable.contact = null)} />
|
||||
</div>
|
||||
<!-- -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user