homeflowjs 0.13.22 → 0.13.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/properties/properties-map/drawable-map.js +8 -0
- package/properties/properties-map/geonames-map.js +28 -0
- package/utils/stamp-duty-calculator/english-rates.js +1 -1
- package/utils/stamp-duty-calculator/scottish-rates.js +1 -1
- package/utils/stamp-duty-calculator/welsh-rates.js +11 -20
package/package.json
CHANGED
@@ -146,6 +146,9 @@ export default class DrawableMap extends DraggableMap {
|
|
146
146
|
});
|
147
147
|
|
148
148
|
this.map.on("draw:drawstart", e => {
|
149
|
+
if (!Homeflow.get('initial_properties_payload')) {
|
150
|
+
Homeflow.set('initial_properties_payload', this.properties);
|
151
|
+
}
|
149
152
|
this.first = false;
|
150
153
|
this.map.removeLayer(this.marker_layer);
|
151
154
|
if (this.nonClusteringMarkerLayer) { this.map.removeLayer(this.nonClusteringMarkerLayer); }
|
@@ -242,6 +245,11 @@ export default class DrawableMap extends DraggableMap {
|
|
242
245
|
store.dispatch(setSearchField({ poly: null }));
|
243
246
|
this.updateURL();
|
244
247
|
Homeflow.kickEvent('deletebannertoggled');
|
248
|
+
if (Homeflow.get('initial_properties_payload')) {
|
249
|
+
const initialProperties = Homeflow.get('initial_properties_payload');
|
250
|
+
this.properties = initialProperties;
|
251
|
+
this.setMarkers();
|
252
|
+
}
|
245
253
|
if (this.circle != null) {
|
246
254
|
this.map.addLayer(this.circle);
|
247
255
|
this.onMapDrag();
|
@@ -7,6 +7,9 @@ import { setInitialSearch, setPlace, setSearchField } from '../../actions/search
|
|
7
7
|
import { buildQueryString } from '../../search/property-search/property-search';
|
8
8
|
import mapLoader from './map-loader';
|
9
9
|
import './geonames.css';
|
10
|
+
import Toastify from 'toastify-js';
|
11
|
+
import 'toastify-js/src/toastify.css';
|
12
|
+
import { sanitizeText } from '../../utils/index';
|
10
13
|
|
11
14
|
export default class GeonamesMap extends DraggableMap {
|
12
15
|
constructor() {
|
@@ -69,6 +72,16 @@ export default class GeonamesMap extends DraggableMap {
|
|
69
72
|
this.map.on('zoomend', () => {
|
70
73
|
this.setMarkerTypeforZoomLevel()
|
71
74
|
|
75
|
+
const zoomLevel = this.map.getZoom();
|
76
|
+
const pagination = store.getState().properties?.pagination;
|
77
|
+
const propertiesShown = this.properties.length;
|
78
|
+
|
79
|
+
if (zoomLevel > this.locationPinsMaxZoomLevel
|
80
|
+
&& zoomLevel < 16
|
81
|
+
&& pagination?.total_count > propertiesShown) {
|
82
|
+
this.showToastMessage('Too many properties to show. Zoom in.');
|
83
|
+
}
|
84
|
+
|
72
85
|
this.setMarkers();
|
73
86
|
});
|
74
87
|
|
@@ -420,6 +433,21 @@ export default class GeonamesMap extends DraggableMap {
|
|
420
433
|
}
|
421
434
|
}
|
422
435
|
|
436
|
+
showToastMessage(message) {
|
437
|
+
const primaryColour = store.getState().app.themePreferences.primaryColour;
|
438
|
+
Toastify({
|
439
|
+
duration: 5000,
|
440
|
+
close: true,
|
441
|
+
gravity: 'bottom',
|
442
|
+
position: 'center',
|
443
|
+
stopOnFocus: true,
|
444
|
+
text: sanitizeText(message),
|
445
|
+
escapeMarkup: false,
|
446
|
+
className: 'properties-map-toast',
|
447
|
+
style: { background: primaryColour, marginBottom: '200px', },
|
448
|
+
}).showToast();
|
449
|
+
}
|
450
|
+
|
423
451
|
onMapDrag({ markerPlaceId } = { markerPlaceId: null }) {
|
424
452
|
this.showLoader();
|
425
453
|
|
@@ -18,7 +18,7 @@ const englishRates = (price, firstTimeBuyer, additionalProperty, ukResident) =>
|
|
18
18
|
}
|
19
19
|
|
20
20
|
// Additional property
|
21
|
-
if (additionalProperty && price >=40000) {
|
21
|
+
if (additionalProperty && price >= 40000) {
|
22
22
|
rate1 = calculateRange(price, 0, 250000, 0.03);
|
23
23
|
rate2 = calculateRange(price, 250000, 925000, 0.08);
|
24
24
|
rate3 = calculateRange(price, 925000, 1500000, 0.13);
|
@@ -59,44 +59,35 @@ const welshRates = (price, additionalProperty, ukResident) => {
|
|
59
59
|
|
60
60
|
if (!additionalProperty) {
|
61
61
|
// Rate 2
|
62
|
-
if (price -
|
63
|
-
if ((price -
|
64
|
-
rate2 = (
|
62
|
+
if (price - 225000 > 0) {
|
63
|
+
if ((price - 225000) > (400000 - 225000)) {
|
64
|
+
rate2 = (400000 - 225000) * 0.06;
|
65
65
|
} else {
|
66
|
-
rate2 = (price -
|
66
|
+
rate2 = (price - 225000) * 0.06;
|
67
67
|
}
|
68
68
|
}
|
69
69
|
|
70
70
|
// Rate 3
|
71
|
-
if (price - 250000 > 0) {
|
72
|
-
if ((price - 250000) > (400000 - 250000)) {
|
73
|
-
rate3 = (400000 - 250000) * 0.05;
|
74
|
-
} else {
|
75
|
-
rate3 = (price - 250000) * 0.05;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
// Rate 4
|
80
71
|
if (price - 400000 > 0) {
|
81
72
|
if ((price - 400000) > (750000 - 400000)) {
|
82
|
-
|
73
|
+
rate3 = (750000 - 400000) * 0.075;
|
83
74
|
} else {
|
84
|
-
|
75
|
+
rate3 = (price - 400000) * 0.075;
|
85
76
|
}
|
86
77
|
}
|
87
78
|
|
88
|
-
// Rate
|
79
|
+
// Rate 4
|
89
80
|
if (price - 750000 > 0) {
|
90
81
|
if ((price - 750000) > (1500000 - 750000)) {
|
91
|
-
|
82
|
+
rate4 = (1500000 - 750000) * 0.10;
|
92
83
|
} else {
|
93
|
-
|
84
|
+
rate4 = (price - 750000) * 0.10;
|
94
85
|
}
|
95
86
|
}
|
96
87
|
|
97
|
-
// Rate
|
88
|
+
// Rate 5
|
98
89
|
if (price - 1500000 > 0) {
|
99
|
-
|
90
|
+
rate5 = (price - 1500000) * 0.12;
|
100
91
|
}
|
101
92
|
}
|
102
93
|
|