Commit ffc2f5df by littleploy

update coinexchange

parent 0e7d55e8
......@@ -299,6 +299,7 @@ class Home extends Component {
}
}
}
// console.log(allValues);
feeds.push(mapValues);
}
......@@ -334,9 +335,93 @@ class Home extends Component {
return table;
};
getBox = () => {
const { currentFeed, revenueFeed, peopleFeed, remoteFeed, fingerPrintFeed, keycardFeed } = this.props.feedData;
if(this.props.selectedFeed && this.props.selectedFeed.type=="door"){
return (<div>
{/* <Row>
<Mapbox />
</Row> */}
<Row>
<DataCard
item={Data[0]}
feedData={currentFeed}
datavalue={[{ title: 'last', value: this.state.currentLast }]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[1]}
feedData={revenueFeed}
datavalue={[
{ title: 'total', value: this.state.revenueTotal },
// { title: 'avg', value: this.state.revenueAvg },
// { title: 'max', value: this.state.revenueMax },
// { title: 'min', value: this.state.revenueMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[2]}
feedData={peopleFeed}
datavalue={[
{ title: 'total', value: this.state.peopleTotal },
// { title: 'avg', value: this.state.peopleAvg },
// { title: 'max', value: this.state.peopleMax },
// { title: 'min', value: this.state.peopleMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[3]}
feedData={remoteFeed}
datavalue={[
{ title: 'total', value: this.state.remoteTotal },
// { title: 'avg', value: this.state.remoteAvg },
// { title: 'max', value: this.state.remoteMax },
// { title: 'min', value: this.state.remoteMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[4]}
feedData={fingerPrintFeed}
datavalue={[
{ title: 'total', value: this.state.fingerPrintTotal },
// { title: 'avg', value: this.state.fingerPrintAvg },
// { title: 'max', value: this.state.fingerPrintMax },
// { title: 'min', value: this.state.fingerPrintMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[5]}
feedData={keycardFeed}
datavalue={[
{ title: 'total', value: this.state.keycardTotal },
// { title: 'avg', value: this.state.keycardAvg },
// { title: 'max', value: this.state.keycardMax },
// { title: 'min', value: this.state.keycardMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
</Row>
<Row>
<DataTable table={this.state.table} size={currentFeed ? currentFeed.length: 0} deviceList={this.state.deviceList} />
</Row></div>);
}else if(this.props.selectedFeed && this.props.selectedFeed.type=="coinexchange"){
return (<div><Row>
<DataTable table={this.state.table} size={currentFeed ? currentFeed.length: 0} deviceList={this.state.deviceList} />
</Row></div>)
}
}
render() {
const { currentFeed, revenueFeed, peopleFeed, remoteFeed, fingerPrintFeed, keycardFeed } = this.props.feedData;
return (
<>
<NavBar />
......@@ -348,72 +433,7 @@ class Home extends Component {
<Row>
<Mapbox />
</Row>
<Row>
<DataCard
item={Data[0]}
feedData={currentFeed}
datavalue={[{ title: 'last', value: this.state.currentLast }]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[1]}
feedData={revenueFeed}
datavalue={[
{ title: 'total', value: this.state.revenueTotal },
// { title: 'avg', value: this.state.revenueAvg },
// { title: 'max', value: this.state.revenueMax },
// { title: 'min', value: this.state.revenueMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[2]}
feedData={peopleFeed}
datavalue={[
{ title: 'total', value: this.state.peopleTotal },
// { title: 'avg', value: this.state.peopleAvg },
// { title: 'max', value: this.state.peopleMax },
// { title: 'min', value: this.state.peopleMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[3]}
feedData={remoteFeed}
datavalue={[
{ title: 'total', value: this.state.remoteTotal },
// { title: 'avg', value: this.state.remoteAvg },
// { title: 'max', value: this.state.remoteMax },
// { title: 'min', value: this.state.remoteMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[4]}
feedData={fingerPrintFeed}
datavalue={[
{ title: 'total', value: this.state.fingerPrintTotal },
// { title: 'avg', value: this.state.fingerPrintAvg },
// { title: 'max', value: this.state.fingerPrintMax },
// { title: 'min', value: this.state.fingerPrintMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
<DataCard
item={Data[5]}
feedData={keycardFeed}
datavalue={[
{ title: 'total', value: this.state.keycardTotal },
// { title: 'avg', value: this.state.keycardAvg },
// { title: 'max', value: this.state.keycardMax },
// { title: 'min', value: this.state.keycardMin },
]}
breakdown={this.props.selectedFeed ? this.props.selectedFeed.breakdown: "minutes"}
/>
</Row>
<Row>
<DataTable table={this.state.table} size={currentFeed ? currentFeed.length: 0} deviceList={this.state.deviceList} />
</Row>
{this.getBox()}
</Container>
</>
);
......
......@@ -30,6 +30,7 @@ class GetDataSelection extends Component {
.endOf('month'),
],
},
type: this.props.allLocationInfo[0].type
};
submitSelectedRange = () => {
......@@ -38,6 +39,7 @@ class GetDataSelection extends Component {
const startDateTimeStamp = moment(startDate).valueOf();
const endDateTimeStamp = moment(endDate).valueOf();
const devices = allLocationInfo.find(element => element.locationid === location).devicesId;
const type = allLocationInfo.find(element => element.locationid === location).type;
this.props.getSelectedFeed(
devices,
location,
......@@ -45,7 +47,8 @@ class GetDataSelection extends Component {
startDate: startDateTimeStamp,
endDate: endDateTimeStamp,
},
breakdown
breakdown,
type
);
};
......
......@@ -17,15 +17,25 @@ class Mapbox extends Component {
componentDidUpdate = (prevProps, prevState) => {
if (this.props.allLocationInfo) {
console.log(this.props.selectFeed)
console.log(prevProps.selectFeed)
if (prevProps.selectedFeed !== this.props.selectedFeed) {
const data1 = this.props.allLocationInfo;
const { location } = this.props.selectedFeed;
const currentIndex = data1.findIndex(element => element.locationid === location);
this.setState({
data: data1,
center: data1[currentIndex].position,
active: data1[currentIndex],
});
if(this.props.selectedFeed.type!="door"){
const data1 = this.props.allLocationInfo.filter(location => location.type === "door");
const { location } = this.props.selectedFeed;
const currentIndex = data1.findIndex(element => element.locationid === location);
this.setState({
data: data1,
center: data1[currentIndex].position,
active: data1[currentIndex],
});
}else{
this.setState({
data: [],
center: null,
active: null,
});
}
}
}
};
......
export const GET_RANGE_DATA = 'GET_RANGE_DATA';
export const getSelectedFeedAction = (devices, location, range, breakdown) => ({
export const getSelectedFeedAction = (devices, location, range, breakdown, type) => ({
type: GET_RANGE_DATA,
selectedFeed: { devices, location, range, breakdown },
selectedFeed: { devices, location, range, breakdown, type },
});
export const getSelectedFeed = (devices, location, range, breakdown) => dispatch => {
return dispatch(getSelectedFeedAction(devices, location, range, breakdown));
export const getSelectedFeed = (devices, location, range, breakdown, type) => dispatch => {
return dispatch(getSelectedFeedAction(devices, location, range, breakdown, type));
};
Markdown is supported
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