seperate upload and report screens
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { Container, Form, Loader } from "semantic-ui-react";
|
||||
|
||||
import MainMenu from '../../components/MainMenu';
|
||||
import { fetchDoorLockCharges } from "../../store/actions";
|
||||
|
||||
class DoorLockCharges extends Component {
|
||||
|
||||
render () {
|
||||
const { pending } = this.props.pending;
|
||||
return (
|
||||
<Container>
|
||||
<MainMenu/>
|
||||
<h3>Door Lock Charges</h3>
|
||||
<hr/>
|
||||
<Form>
|
||||
<Form.Group widths="equal">
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="Start date"
|
||||
type="date"
|
||||
/>
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="End date"
|
||||
type="date"
|
||||
/>
|
||||
</Form.Group>
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="Select DLock file"
|
||||
type="file"
|
||||
/>
|
||||
<Form.Button onClick={this.props.fetchDoorLockCharges}>Generate Report</Form.Button>
|
||||
</Form>
|
||||
{
|
||||
pending && <Loader active />
|
||||
}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
incidents: state.doorLockCharges.incidents,
|
||||
pending: state.doorLockCharges.pending,
|
||||
error: state.doorLockCharges.error,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
fetchDoorLockCharges: () => fetchDoorLockCharges(dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DoorLockCharges);
|
||||
@@ -1,37 +1,34 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { Container } from 'semantic-ui-react';
|
||||
import { Container, Form } from "semantic-ui-react";
|
||||
|
||||
import MainMenu from '../../components/MainMenu';
|
||||
|
||||
class Home extends Component {
|
||||
state = {
|
||||
apiStatus: 'loading',
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
fetch('/api')
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.status === 1) {
|
||||
this.setState({apiStatus: 'working'});
|
||||
} else {
|
||||
this.setState({apiStatus: 'NOT WORKING !'});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.setState({apiStatus: `ERROR : ${err}`});
|
||||
})
|
||||
}
|
||||
|
||||
render () {
|
||||
const {apiStatus} = this.state;
|
||||
return (
|
||||
<Container>
|
||||
<MainMenu/>
|
||||
<h3>CRM Integration</h3>
|
||||
<h3>Report</h3>
|
||||
<hr/>
|
||||
<h5>Integration API Status : {apiStatus}</h5>
|
||||
<Form>
|
||||
<Form.Group widths="equal">
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="Start date"
|
||||
type="date"
|
||||
/>
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="End date"
|
||||
type="date"
|
||||
/>
|
||||
</Form.Group>
|
||||
<Form.Button>Generate Report</Form.Button>
|
||||
</Form>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
39
client/src/scenes/UploadDLockData/index.js
Normal file
39
client/src/scenes/UploadDLockData/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { Container, Form } from "semantic-ui-react";
|
||||
|
||||
import MainMenu from '../../components/MainMenu';
|
||||
import { uploadDoorLockData } from "../../store/actions";
|
||||
|
||||
class UploadDLockData extends Component {
|
||||
|
||||
render () {
|
||||
return (
|
||||
<Container>
|
||||
<MainMenu/>
|
||||
<h3>DLock Data</h3>
|
||||
<hr/>
|
||||
<Form>
|
||||
<Form.Input
|
||||
fluid
|
||||
required
|
||||
label="Select DLock file"
|
||||
type="file"
|
||||
/>
|
||||
<Form.Button onClick={this.props.uploadDoorLockData}>Upload</Form.Button>
|
||||
</Form>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
uploadDoorLockData: () => uploadDoorLockData(dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(UploadDLockData);
|
||||
Reference in New Issue
Block a user