|
|
@ -7,6 +7,7 @@ import MenuItem from 'material-ui/MenuItem';
|
|
|
|
|
|
|
|
|
|
|
|
import DateTimePicker from './DateTimePicker';
|
|
|
|
import DateTimePicker from './DateTimePicker';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import * as uuid from 'uuid';
|
|
|
|
import * as ICAL from 'ical.js';
|
|
|
|
import * as ICAL from 'ical.js';
|
|
|
|
|
|
|
|
|
|
|
|
import * as EteSync from './api/EteSync';
|
|
|
|
import * as EteSync from './api/EteSync';
|
|
|
@ -15,6 +16,7 @@ import { EventType } from './pim-types';
|
|
|
|
|
|
|
|
|
|
|
|
class EventEdit extends React.Component {
|
|
|
|
class EventEdit extends React.Component {
|
|
|
|
state: {
|
|
|
|
state: {
|
|
|
|
|
|
|
|
uid: string,
|
|
|
|
title: string;
|
|
|
|
title: string;
|
|
|
|
allDay: boolean;
|
|
|
|
allDay: boolean;
|
|
|
|
start: string;
|
|
|
|
start: string;
|
|
|
@ -34,6 +36,7 @@ class EventEdit extends React.Component {
|
|
|
|
constructor(props: any) {
|
|
|
|
constructor(props: any) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
|
|
|
|
uid: '',
|
|
|
|
title: '',
|
|
|
|
title: '',
|
|
|
|
allDay: false,
|
|
|
|
allDay: false,
|
|
|
|
location: '',
|
|
|
|
location: '',
|
|
|
@ -45,12 +48,15 @@ class EventEdit extends React.Component {
|
|
|
|
if (this.props.event !== undefined) {
|
|
|
|
if (this.props.event !== undefined) {
|
|
|
|
const event = this.props.event;
|
|
|
|
const event = this.props.event;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.state.uid = event.uid;
|
|
|
|
this.state.title = event.title ? event.title : '';
|
|
|
|
this.state.title = event.title ? event.title : '';
|
|
|
|
this.state.allDay = event.startDate.isDate;
|
|
|
|
this.state.allDay = event.startDate.isDate;
|
|
|
|
this.state.start = event.startDate.toString();
|
|
|
|
this.state.start = event.startDate.toString();
|
|
|
|
this.state.end = event.endDate.toString();
|
|
|
|
this.state.end = event.endDate.toString();
|
|
|
|
this.state.location = event.location ? event.location : '';
|
|
|
|
this.state.location = event.location ? event.location : '';
|
|
|
|
this.state.description = event.description ? event.description : '';
|
|
|
|
this.state.description = event.description ? event.description : '';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.state.uid = uuid.v4();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (props.journalUid) {
|
|
|
|
if (props.journalUid) {
|
|
|
@ -89,6 +95,7 @@ class EventEdit extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let event = new EventType();
|
|
|
|
let event = new EventType();
|
|
|
|
|
|
|
|
event.uid = this.state.uid;
|
|
|
|
event.summary = this.state.title;
|
|
|
|
event.summary = this.state.title;
|
|
|
|
event.startDate = ICAL.Time.fromString(this.state.start);
|
|
|
|
event.startDate = ICAL.Time.fromString(this.state.start);
|
|
|
|
event.endDate = ICAL.Time.fromString(this.state.end);
|
|
|
|
event.endDate = ICAL.Time.fromString(this.state.end);
|
|
|
|