Commit 293afb1c authored by Valeriy Panov's avatar Valeriy Panov
Browse files

#132 Location: editable latitude and longitude

parent fc59320c
......@@ -5,6 +5,7 @@ import Table, {TableBody, TableCell, TableFooter, TableHead, TableRow} from 'mat
import Paper from 'material-ui/Paper';
import Button from 'material-ui/Button';
import * as PropTypes from 'prop-types';
import * as moment from 'moment';
import {Page} from '../../../model/common.model';
......@@ -103,7 +104,7 @@ class DataTable extends React.Component<IDataTableProps, any> {
{ e.title }
</Link>
</TableCell>
<TableCell className={ `${ classes.tableCell } ${ classes.creationDate }` }>{ e.createdDate }</TableCell>
<TableCell className={ `${ classes.tableCell } ${ classes.creationDate }` }>{ e.createdDate && moment(e.createdDate).format('YYYY-DD-MM h:mm') }</TableCell>
{ showStatus && <TableCell className={ `${ classes.tableCell }` }>{ e.published ? 'published' : 'ongoing' }</TableCell> }
<TableCell className={ `${ classes.tableCell } ${ classes.edit }` }>
<Link to={ `${path}/${e.uuid}` }>
......
......@@ -52,25 +52,25 @@ class DatasetStepper extends React.Component<IDatasetProps, any> {
const {children, classes, ...rest} = this.props;
return (
<Grid container spacing={0}>
<Grid container spacing={ 0 }>
<TopSection/>
<Grid item xs={12} md={9} xl={10} className={classes.leftColumn}>
<Grid container spacing={0} className={classes.contentWrapper}>
<StepNavigation showStepName bottomDivider {...rest}/>
<Grid item xs={12} className={classes.content}>
<div className={classes.greyBackground}>
{React.cloneElement(children, rest)}
<Grid item xs={ 12 } md={ 9 } xl={ 10 } className={ classes.leftColumn }>
<Grid container spacing={ 0 } className={ classes.contentWrapper }>
<StepNavigation showStepName bottomDivider { ...rest }/>
<Grid item xs={ 12 } className={ classes.content }>
<div className={ classes.greyBackground }>
{ React.cloneElement(children, rest) }
</div>
</Grid>
<StepNavigation topDivider {...rest}/>
<StepNavigation topDivider { ...rest }/>
</Grid>
</Grid>
<Grid item xs={12} md={3} xl={2}>
<ProgressMenu {...rest} />
<Grid item xs={ 12 } md={ 3 } xl={ 2 }>
<ProgressMenu { ...rest } />
</Grid>
<BottomSection/>
</Grid>
)
);
};
}
......
import * as React from 'react';
import {withStyles} from 'material-ui/styles';
import {isNumeric} from '../../../../../../utilities';
let Map;
let Marker;
let TileLayer;
......@@ -74,7 +76,7 @@ class FormMap extends React.Component<IFormMapProps, any> {
const {decimalLatitude, decimalLongitude} = locations.find((e) => !!e);
let position = null;
if (decimalLatitude.input.value && decimalLongitude.input.value) {
if (isNumeric(decimalLatitude.input.value) && isNumeric(decimalLongitude.input.value)) {
position = {
lat: decimalLatitude.input.value,
lng: decimalLongitude.input.value,
......@@ -84,7 +86,7 @@ class FormMap extends React.Component<IFormMapProps, any> {
return (
<div className={ classes.leafletContainer }>
<Map
center={ this.state }
center={ position || this.state }
onClick={ this.onMapClick }
onMouseout={ this.props.onMouseOut }
zoom={ 6 }
......
......@@ -92,13 +92,13 @@ class TimingAndLocationForm extends React.Component<ILoginContainerProps, any> {
name={ `${location}.decimalLatitude` }
component={ TextField }
label="Latitude*"
disabled
onBlur={ this.save(fields, index) }
/>
<Field
name={ `${location}.decimalLongitude` }
component={ TextField }
label="Longitude*"
disabled
onBlur={ this.save(fields, index) }
/>
<Fields
......
......@@ -75,3 +75,7 @@ export function clearCookies() {
const cookies = require('es-cookie');
['authorities', 'access_token'].forEach((key) => cookies.remove(key));
}
export function isNumeric(value: any): boolean {
return !isNaN(value - parseFloat(value));
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment