Fix the toggle address confirmed checkbox so the latitude/longitude gets set

Before when you checked and unchecked the checkbox it was toggling the :isConfirmed variable.
This commit is contained in:
Cillian O'Ruanaidh
2021-04-22 22:16:47 +01:00
parent 12704af143
commit 1e96f92df2
2 changed files with 5 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris
$scope.select = RegistrationService.select
$scope.geocodedAddress = ''
$scope.latLong = null
$scope.addressConfirmed
$scope.addressConfirmed = false
$scope.steps = ['details', 'contact', 'type', 'about', 'images', 'social']
# Filter countries without states since the form requires a state to be selected.
@@ -39,9 +39,9 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris
$scope.map = {center: {latitude: location.lat(), longitude: location.lng()}, zoom: 16 }
)
$scope.confirmAddressChange = (isConfirmed) ->
$scope.addressConfirmed = isConfirmed
if isConfirmed
$scope.toggleAddressConfirmed = ->
$scope.addressConfirmed = !$scope.addressConfirmed
if $scope.addressConfirmed
$scope.enterprise.address.latitude = $scope.latLong.latitude
$scope.enterprise.address.longitude = $scope.latLong.longitude
else

View File

@@ -10,7 +10,7 @@
%input.button.primary{ type: "button", value: "{{'registration.steps.details.locate_address' | t}}", ng: { click: "locateAddress()" } }
.center{ ng: {if: "latLong"}}
.field
%input{ type: 'checkbox', id: 'confirm_address', name: 'confirm_address', ng: { model: 'addressConfirmed', change: 'confirmAddressChange(confirmAddress)'} }
%input{ type: 'checkbox', id: 'confirm_address', name: 'confirm_address', ng: { click: 'toggleAddressConfirmed()' } }
%label{ for: 'confirm_address' } {{'registration.steps.details.confirm_address' | t}}
.small-12.medium-9.large-12.columns.end{ ng: {if: "latLong"}}
.field