parent
64311e9652
commit
82423ec467
@ -20,6 +20,7 @@
|
|||||||
let contacts = [];
|
let contacts = [];
|
||||||
export let params;
|
export let params;
|
||||||
$: editable = {};
|
$: editable = {};
|
||||||
|
$: contact = {};
|
||||||
$: data_loaded = false;
|
$: data_loaded = false;
|
||||||
$: data_changed = !(JSON.stringify(editable) === original);
|
$: data_changed = !(JSON.stringify(editable) === original);
|
||||||
$: isAddress1Valid = editable.address?.address1?.trim().length !== 0;
|
$: isAddress1Valid = editable.address?.address1?.trim().length !== 0;
|
||||||
@ -46,9 +47,16 @@
|
|||||||
editable = editable;
|
editable = editable;
|
||||||
original_object = Object.assign(editable, value);
|
original_object = Object.assign(editable, value);
|
||||||
original = JSON.stringify(value);
|
original = JSON.stringify(value);
|
||||||
});
|
GroupContactService.groupContactControllerGetAll().then((val) => {
|
||||||
GroupContactService.groupContactControllerGetAll().then((val) => {
|
contacts = val.map((r) => {
|
||||||
contacts = val;
|
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 modal_open = false;
|
||||||
let delete_org = {};
|
let delete_org = {};
|
||||||
@ -359,18 +367,19 @@
|
|||||||
class="font-medium text-gray-700">{$_('contact')}</label>
|
class="font-medium text-gray-700">{$_('contact')}</label>
|
||||||
<Select
|
<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"
|
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
|
itemFilter={(label, filterText, option) => label
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(
|
.includes(
|
||||||
filterText.toLowerCase()
|
filterText.toLowerCase()
|
||||||
) || option.id.toString().startsWith(filterText.toLowerCase())}
|
) || option.value.id
|
||||||
|
.toString()
|
||||||
|
.startsWith(filterText.toLowerCase())}
|
||||||
items={contacts}
|
items={contacts}
|
||||||
showChevron={true}
|
showChevron={true}
|
||||||
placeholder={$_('no-contact-selected')}
|
placeholder={$_('no-contact-selected')}
|
||||||
noOptionsMessage={$_('no-contact-found')}
|
noOptionsMessage={$_('no-contact-found')}
|
||||||
bind:selectedValue={editable.contact}
|
bind:selectedValue={contact}
|
||||||
|
on:select={(selectedValue) => (editable.contact = selectedValue.detail.value)}
|
||||||
on:clear={() => (editable.contact = null)} />
|
on:clear={() => (editable.contact = null)} />
|
||||||
</div>
|
</div>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user