diff --git a/react_usse/src/App.js b/react_usse/src/App.js index c47fd888..efadfdd2 100644 --- a/react_usse/src/App.js +++ b/react_usse/src/App.js @@ -21,6 +21,7 @@ class App extends Component { this.cookies = cookies; this.setState({ price: cookies.get('price') }) this.setState({ minPrice: cookies.get('minPrice') }) + this.setState({ minPerceel: cookies.get('minPerceel') }) this.setState({ afstandNFI: cookies.get('NFI') }) this.setState({ afstandHoogstraat: cookies.get('Hoogstraat') }) this.setState({ afstandBakkersdijk: cookies.get('Bakkersdijk') }) @@ -63,9 +64,15 @@ class App extends Component { const cookies = this.cookies.set(naar, minuten, { path: '/' }) this.setState({ cookies: cookies }) } + + onUpdateMinPerceel = (minPerceel) => { + this.setState({ minPerceel: parseInt(minPerceel.trim())}) + const cookies = this.cookies.set('minPerceel', minPerceel, { path: '/' }) + this.setState({ cookies: cookies }) + } render() { - const { allLocations, query, price, minPrice, afstandNFI, afstandHoogstraat, afstandKorhoen, afstandBakkersdijk } = this.state + const { allLocations, query, price, minPrice, minPerceel, afstandNFI, afstandHoogstraat, afstandKorhoen, afstandBakkersdijk } = this.state let showingLocations if (query || price || afstandNFI || afstandHoogstraat || afstandKorhoen || afstandBakkersdijk) { showingLocations = allLocations; @@ -87,6 +94,12 @@ class App extends Component { location.price >= price ) } + if(minPerceel){ + const perceel = parseInt(minPerceel) + showingLocations = showingLocations.filter((location) => + location.perceel_area >= perceel + ) + } if(afstandNFI){ showingLocations = showingLocations.filter((location) => location.nfi_location.duration <= (afstandNFI * 60) @@ -130,12 +143,14 @@ class App extends Component { onUpdateMinPrice={this.updatePriceMin} onUpdateAfstand={this.updateAfstand} onToggleMenu={this.onToggleMenu} + onUpdateMinPerceel={this.onUpdateMinPerceel} onListItemClick={this.onListItemClick} showDetails={this.state.showDetails} selectedLocation={this.state.selectedLocation} locationData={this.state.locationData} maxPrice={this.state.price} minPrice={this.state.minPrice} + minPerceel={this.state.minPerceel} afstandNFI={this.state.afstandNFI} afstandHoogstraat={this.state.afstandHoogstraat} afstandKorhoen={this.state.afstandKorhoen} diff --git a/react_usse/src/MapContainer.js b/react_usse/src/MapContainer.js index b2a438d7..471a40b9 100644 --- a/react_usse/src/MapContainer.js +++ b/react_usse/src/MapContainer.js @@ -107,6 +107,7 @@ class LeafletMap extends Component { let { markers} = this.props let { maxPrice} = this.props let {minPrice} = this.props + let {minPerceel} = this.props let { afstandNFI} = this.props let { afstandHoogstraat} = this.props let { afstandKorhoen} = this.props @@ -174,6 +175,14 @@ class LeafletMap extends Component { {afstandBakkersdijk} +
+
  • Minimaal Perceel opervlakte
  • + { + this.props.onUpdateMinPerceel(e.target.value) + }} /> + {minPerceel} +
    +
      {this.props.query && this.props.locations.length === 0 && ( @@ -210,7 +219,7 @@ class LeafletMap extends Component { // marker.price_m2 - Prijs: {marker.price} Per m2: {marker.price_m2_total}
      + Prijs: {marker.price} Per m2: {marker.price_m2_total} perceel: {marker.perceel_area}
      NFI: {Math.floor(marker.nfi_location.distance / 1000)} km, {Math.floor(marker.nfi_location.duration / 60)} minuten
      Korhoen: {Math.floor(marker.korhoen_location.distance / 1000)} km, {Math.floor(marker.korhoen_location.duration / 60)} minuten
      Bakkersdijk: {Math.floor(marker.bakkersdijk_location.distance / 1000)} km, {Math.floor(marker.bakkersdijk_location.duration / 60)} minuten