Upstream sync

This commit is contained in:
Senad Uka
2018-05-28 15:28:19 +02:00
parent 372b3883a0
commit 3969863cbf
10 changed files with 175 additions and 60 deletions

View File

@@ -151,7 +151,9 @@ export class NEMTLocation extends React.Component {
long: 0,
name: '',
address: '',
}
},
searchingProvider: false,
providerList: [],
}
this.addCustomLabel = this.addCustomLabel.bind(this);
@@ -257,7 +259,7 @@ export class NEMTLocation extends React.Component {
return p;
});
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers }));
this.setState(Object.assign(this.state, { nearbyPlaces: nearByPlaces, providers: providers, providerList: nearByPlaces }));
}
});
} else {
@@ -343,7 +345,7 @@ export class NEMTLocation extends React.Component {
buttonText = buttonText.substring(0, self.state.textSize);
buttonText += '...';
}
self.setState(Object.assign(self.state, { buttonValue: buttonText, inputValue: name.address }));
self.setState(Object.assign(self.state, { buttonValue: buttonText, inputValue: name.address, searchingProvider: false, providerList: [] }));
}).catch(console.error);
}
@@ -569,7 +571,7 @@ export class NEMTLocation extends React.Component {
updateTextSearch(searchText, dtSource, params) {
let self = this;
self.setState(Object.assign(self.state, { inputValue: searchText }));
self.setState(Object.assign(self.state, { inputValue: searchText, searchingProvider: true }));
if (searchText.length >= 3) {
let lat = 0;
let long = 0;
@@ -618,9 +620,11 @@ export class NEMTLocation extends React.Component {
clickResult.npi = p.fivePartKeyGroups[0].providerNum;
}
return p;
var listItem = (<ListItem primaryText={p.providerName} secondaryText={clickResult.address} key={p.mukId} rightIcon={<MapsLocalHospital />} onClick={(event) => this.handlePlaceChanged(clickResult)} />)
return listItem;
});
this.setState(Object.assign(this.state, { providers: providers }));
this.setState(Object.assign(this.state, { providerList: providers }));
dtSource = self.state.providers;
}
});
@@ -1331,14 +1335,14 @@ export class NEMTLocation extends React.Component {
{customAddresses}
<ListItem primaryText="Add Custom Shortcut" rightIcon={<ArrowDropRight />} leftIcon={<MapsLocalHospital />} onClick={(e) => this.handleAddAddress(e, 'custom')} />
</List>)
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Provider's name or address" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Provider's name or address" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
} else {
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Member's address or a nearby intersection or public place" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
autosuggest = (<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.providers} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateTextSearch} fullWidth={true} floatingLabelText="Enter the Member's address or a nearby intersection or public place" onNewRequest={this.handleAutocomplete} searchText={this.state.inputValue} />)
}
let listItem = (
<div className="" id="container">
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={5} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
{autosuggest}
<List>
{this.state.currentLocation}
@@ -1352,8 +1356,21 @@ export class NEMTLocation extends React.Component {
<List style={customListStyle}>
{this.state.nearbyPlaces}
</List>
</div >
</div>
)
if (this.state.searchingProvider) {
listItem = (
<div className="" id="container">
<AutoComplete dataSourceConfig={datasourceConfig} dataSource={this.state.locations} filter={this.filterResults} maxSearchResults={50} onUpdateInput={this.updateLocationValue} fullWidth={true} floatingLabelText="Center Location" onNewRequest={this.handleAutoCompleteLocation} searchText={this.state.locationValue} />
{autosuggest}
<List style={customListStyle}>
{this.state.providerList}
</List>
</div>
)
}
if (this.state.addLocation) {
listItem = (
<div className="" id="container">