|
|
@ -1,8 +1,9 @@
|
|
|
|
import * as React from 'react';
|
|
|
|
import * as React from 'react';
|
|
|
|
import { Route, Switch } from 'react-router';
|
|
|
|
import { Route, Switch } from 'react-router';
|
|
|
|
import RaisedButton from 'material-ui/RaisedButton';
|
|
|
|
import Button from '@material-ui/core/Button';
|
|
|
|
import IconEdit from 'material-ui/svg-icons/editor/mode-edit';
|
|
|
|
import IconEdit from '@material-ui/icons/Edit';
|
|
|
|
import IconChangeHistory from 'material-ui/svg-icons/action/change-history';
|
|
|
|
import IconChangeHistory from '@material-ui/icons/ChangeHistory';
|
|
|
|
|
|
|
|
import { withStyles } from '@material-ui/core/styles';
|
|
|
|
|
|
|
|
|
|
|
|
import { RouteComponentProps, withRouter } from 'react-router';
|
|
|
|
import { RouteComponentProps, withRouter } from 'react-router';
|
|
|
|
|
|
|
|
|
|
|
@ -96,12 +97,23 @@ type CollectionRoutesPropsType = RouteComponentProps<{}> & {
|
|
|
|
onItemSave: (item: PimType, journalUid: string, originalContact?: PimType) => void;
|
|
|
|
onItemSave: (item: PimType, journalUid: string, originalContact?: PimType) => void;
|
|
|
|
onItemDelete: (item: PimType, journalUid: string) => void;
|
|
|
|
onItemDelete: (item: PimType, journalUid: string) => void;
|
|
|
|
onItemCancel: () => void;
|
|
|
|
onItemCancel: () => void;
|
|
|
|
|
|
|
|
classes: any;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const CollectionRoutes = withRouter(
|
|
|
|
const styles = (theme: any) => ({
|
|
|
|
|
|
|
|
button: {
|
|
|
|
|
|
|
|
marginLeft: theme.spacing.unit,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
leftIcon: {
|
|
|
|
|
|
|
|
marginRight: theme.spacing.unit,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CollectionRoutes = withStyles(styles)(withRouter(
|
|
|
|
class CollectionRoutesInner extends React.PureComponent<CollectionRoutesPropsType> {
|
|
|
|
class CollectionRoutesInner extends React.PureComponent<CollectionRoutesPropsType> {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const props = this.props;
|
|
|
|
const props = this.props;
|
|
|
|
|
|
|
|
const { classes } = this.props;
|
|
|
|
const ComponentEdit = props.componentEdit;
|
|
|
|
const ComponentEdit = props.componentEdit;
|
|
|
|
const ComponentView = props.componentView;
|
|
|
|
const ComponentView = props.componentView;
|
|
|
|
|
|
|
|
|
|
|
@ -157,28 +169,33 @@ const CollectionRoutes = withRouter(
|
|
|
|
render={({match, history}) => (
|
|
|
|
render={({match, history}) => (
|
|
|
|
<Container>
|
|
|
|
<Container>
|
|
|
|
<div style={{textAlign: 'right', marginBottom: 15}}>
|
|
|
|
<div style={{textAlign: 'right', marginBottom: 15}}>
|
|
|
|
<RaisedButton
|
|
|
|
<Button
|
|
|
|
label="Change History"
|
|
|
|
variant="contained"
|
|
|
|
style={{marginLeft: 15}}
|
|
|
|
className={classes.button}
|
|
|
|
icon={<IconChangeHistory />}
|
|
|
|
|
|
|
|
onClick={() =>
|
|
|
|
onClick={() =>
|
|
|
|
history.push(routeResolver.getRoute(
|
|
|
|
history.push(routeResolver.getRoute(
|
|
|
|
props.routePrefix + '._id.log',
|
|
|
|
props.routePrefix + '._id.log',
|
|
|
|
{itemUid: match.params.itemUid}))
|
|
|
|
{itemUid: match.params.itemUid}))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
>
|
|
|
|
|
|
|
|
<IconChangeHistory className={classes.leftIcon} />
|
|
|
|
<RaisedButton
|
|
|
|
Change History
|
|
|
|
label="Edit"
|
|
|
|
</Button>
|
|
|
|
secondary={true}
|
|
|
|
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
color="secondary"
|
|
|
|
|
|
|
|
variant="contained"
|
|
|
|
|
|
|
|
className={classes.button}
|
|
|
|
style={{marginLeft: 15}}
|
|
|
|
style={{marginLeft: 15}}
|
|
|
|
icon={<IconEdit />}
|
|
|
|
|
|
|
|
onClick={() =>
|
|
|
|
onClick={() =>
|
|
|
|
history.push(routeResolver.getRoute(
|
|
|
|
history.push(routeResolver.getRoute(
|
|
|
|
props.routePrefix + '._id.edit',
|
|
|
|
props.routePrefix + '._id.edit',
|
|
|
|
{itemUid: match.params.itemUid}))
|
|
|
|
{itemUid: match.params.itemUid}))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
>
|
|
|
|
|
|
|
|
<IconEdit className={classes.leftIcon} />
|
|
|
|
|
|
|
|
Edit
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<ComponentView item={props.items[match.params.itemUid]} />
|
|
|
|
<ComponentView item={props.items[match.params.itemUid]} />
|
|
|
|
</Container>
|
|
|
|
</Container>
|
|
|
@ -188,7 +205,7 @@ const CollectionRoutes = withRouter(
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
class Pim extends React.PureComponent {
|
|
|
|
class Pim extends React.PureComponent {
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|