-
-
Save ColadaFF/f4f61390062d368073dd776028cd8714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import {Grid, Row, Col} from 'react-flexbox-grid'; | |
import {connect} from 'react-redux'; | |
import {bindActionCreators} from 'redux'; | |
import {clientsFindServer} from './actions'; | |
import ClientListItem from './ClientListItem'; | |
import SearchBarClient from './SearchBarClient'; | |
import Pagination from './Pagination'; | |
class ClientsFind extends Component { | |
componentWillMount(){ | |
if(window.localStorage.getItem('sessionToken') === "" || window.localStorage.getItem('sessionToken') === undefined){ | |
redirectUrl("/login"); | |
} | |
} | |
_mapClientItems(item, idx) { | |
return <ClientListItem | |
key={idx} | |
dataName={item.name} | |
dataDocumentType={item.documentType} | |
dataDocument={item.document} | |
dataAccountManager={item.accountManager} | |
dataEconomicGroup={item.economicGroup} | |
dataIsProspect={item.prospect} | |
dataIsAccess={item.access} | |
/> | |
} | |
render() { | |
const {clientItems} = this.props; | |
return ( | |
<div id="page-container" className=" condensed full-height" style={{width:"100%", "backgroundColor":"#E7ECED"}}> | |
<SearchBarClient /> | |
<div style={{margin:"0px 0px 10px 10px"}}> | |
<div className="news-page content"> | |
<div className=""> | |
<div className="team-modal"> | |
{clientItems.map(this._mapClientItems)} | |
</div> | |
</div> | |
</div> | |
</div> | |
<Pagination /> | |
</div> | |
) | |
} | |
} | |
function mapDispatchToProps(dispatch){ | |
return bindActionCreators({ | |
clientsFindServer | |
}, dispatch); | |
} | |
function mapStateToProps({clientR}, ownerProps){ | |
return { | |
clientItems: clientR.get('responseClients') | |
}; | |
} | |
export default connect(mapStateToProps, mapDispatchToProps)(ClientsFind); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Immutable from 'immutable'; | |
import {CLIENTS_FIND} from './constants'; | |
const initialState = Immutable.Map({ | |
status: "processed", | |
keyword: "reducer", | |
responseClients: [] | |
}); | |
export default (state = initialState, action) => { | |
switch (action.type) { | |
case CLIENTS_FIND: | |
const response = action.payload.data; | |
return state.withMutations(map => { | |
map | |
.set('status', 'processed') | |
.set('responseClients', response.listClients); | |
}) | |
break; | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment