|
|
@ -120,7 +120,7 @@ class ContactEdit extends React.PureComponent {
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|
collections: Array<EteSync.CollectionInfo>,
|
|
|
|
collections: Array<EteSync.CollectionInfo>,
|
|
|
|
initialCollection?: string,
|
|
|
|
initialCollection?: string,
|
|
|
|
contact?: ContactType,
|
|
|
|
item?: ContactType,
|
|
|
|
onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void;
|
|
|
|
onSave: (contact: ContactType, journalUid: string, originalContact?: ContactType) => void;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -140,8 +140,8 @@ class ContactEdit extends React.PureComponent {
|
|
|
|
journalUid: '',
|
|
|
|
journalUid: '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (this.props.contact !== undefined) {
|
|
|
|
if (this.props.item !== undefined) {
|
|
|
|
const contact = this.props.contact;
|
|
|
|
const contact = this.props.item;
|
|
|
|
|
|
|
|
|
|
|
|
this.state.uid = contact.uid;
|
|
|
|
this.state.uid = contact.uid;
|
|
|
|
this.state.fn = contact.fn ? contact.fn : '';
|
|
|
|
this.state.fn = contact.fn ? contact.fn : '';
|
|
|
@ -248,8 +248,8 @@ class ContactEdit extends React.PureComponent {
|
|
|
|
onSubmit(e: React.FormEvent<any>) {
|
|
|
|
onSubmit(e: React.FormEvent<any>) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
let contact = (this.props.contact) ?
|
|
|
|
let contact = (this.props.item) ?
|
|
|
|
this.props.contact.clone()
|
|
|
|
this.props.item.clone()
|
|
|
|
:
|
|
|
|
:
|
|
|
|
new ContactType(new ICAL.Component(['vcard', [], []]))
|
|
|
|
new ContactType(new ICAL.Component(['vcard', [], []]))
|
|
|
|
;
|
|
|
|
;
|
|
|
@ -293,7 +293,7 @@ class ContactEdit extends React.PureComponent {
|
|
|
|
setProperty('title', this.state.title);
|
|
|
|
setProperty('title', this.state.title);
|
|
|
|
setProperty('note', this.state.note);
|
|
|
|
setProperty('note', this.state.note);
|
|
|
|
|
|
|
|
|
|
|
|
this.props.onSave(contact, this.state.journalUid, this.props.contact);
|
|
|
|
this.props.onSave(contact, this.state.journalUid, this.props.item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
@ -313,14 +313,14 @@ class ContactEdit extends React.PureComponent {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<React.Fragment>
|
|
|
|
<React.Fragment>
|
|
|
|
<h2>
|
|
|
|
<h2>
|
|
|
|
{this.props.contact ? 'Edit Contact' : 'New Contact'}
|
|
|
|
{this.props.item ? 'Edit Contact' : 'New Contact'}
|
|
|
|
</h2>
|
|
|
|
</h2>
|
|
|
|
<form style={styles.form} onSubmit={this.onSubmit}>
|
|
|
|
<form style={styles.form} onSubmit={this.onSubmit}>
|
|
|
|
<SelectField
|
|
|
|
<SelectField
|
|
|
|
style={styles.fullWidth}
|
|
|
|
style={styles.fullWidth}
|
|
|
|
value={this.state.journalUid}
|
|
|
|
value={this.state.journalUid}
|
|
|
|
floatingLabelText="Saving to"
|
|
|
|
floatingLabelText="Saving to"
|
|
|
|
disabled={this.props.contact !== undefined}
|
|
|
|
disabled={this.props.item !== undefined}
|
|
|
|
onChange={(contact: object, key: number, payload: any) => this.handleChange('journalUid', payload)}
|
|
|
|
onChange={(contact: object, key: number, payload: any) => this.handleChange('journalUid', payload)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{this.props.collections.map((x) => (
|
|
|
|
{this.props.collections.map((x) => (
|
|
|
|