diff --git a/lib/actions/field-trip.js b/lib/actions/field-trip.js index 0b667dbf1..dafa74ebc 100644 --- a/lib/actions/field-trip.js +++ b/lib/actions/field-trip.js @@ -33,6 +33,7 @@ import { setPendingRequests, updateOtpUrlParams } from './api' +import { setLocation } from './map' import { toggleCallHistory } from './call-taker' if (typeof fetch === 'undefined') require('isomorphic-fetch') @@ -534,8 +535,8 @@ function prepareQueryParams(request, outbound) { const hasExistingLocations = currentQuery.from || currentQuery.to const locations = !hasExistingLocations || - window.confirm( - 'Use custom set locations? Pressing "Cancel" will use the locations you have typed in. Pressing "OK" will use the locations currently saved to the field trip' + !window.confirm( + 'Use custom set locations? Pressing "OK" will use the locations you have typed in. Pressing "Cancel" will use the locations currently saved to the field trip' ) ? await planParamsToQueryAsync(locationsToGeocode, config) : { from: currentQuery.from, to: currentQuery.to } @@ -1078,6 +1079,8 @@ export function clearActiveFieldTrip() { return function (dispatch) { dispatch(setActiveFieldTrip(null)) dispatch(clearActiveSearch()) + dispatch(setLocation({ location: null, locationType: 'from' })) + dispatch(setLocation({ location: null, locationType: 'to' })) dispatch(setQueryParam({ numItineraries: undefined })) dispatch(clearSaveable()) } diff --git a/lib/components/admin/field-trip-list.js b/lib/components/admin/field-trip-list.js index f74dbe841..29728d403 100644 --- a/lib/components/admin/field-trip-list.js +++ b/lib/components/admin/field-trip-list.js @@ -129,7 +129,7 @@ class FieldTripList extends Component { } _onCloseActiveFieldTrip = () => { - this.props.setActiveFieldTrip(null) + this.props.clearActiveFieldTrip() } _getReportUrl = () => { @@ -268,6 +268,7 @@ const mapStateToProps = (state) => { } const mapDispatchToProps = { + clearActiveFieldTrip: fieldTripActions.clearActiveFieldTrip, fetchFieldTripDetails: fieldTripActions.fetchFieldTripDetails, fetchFieldTrips: fieldTripActions.fetchFieldTrips, setActiveFieldTrip: fieldTripActions.setActiveFieldTrip, diff --git a/lib/components/form/add-place-button.tsx b/lib/components/form/add-place-button.tsx index 5cecd5d11..ce585331b 100644 --- a/lib/components/form/add-place-button.tsx +++ b/lib/components/form/add-place-button.tsx @@ -22,7 +22,7 @@ const AddPlaceButton = ({ const disabled = !from || !to || maxPlacesDefined return (