2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
no-return-assign,
|
|
|
|
no-undef,
|
|
|
|
no-unused-vars,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* DS207: Consider shorter variations of null checks
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-01-07 06:04:30 -05:00
|
|
|
define(['base'], App =>
|
2018-11-05 05:06:39 -05:00
|
|
|
App.controller('GroupPlanContactController', function($scope, $modal, $http) {
|
|
|
|
$scope.form = {}
|
|
|
|
$scope.sent = false
|
|
|
|
$scope.sending = false
|
|
|
|
$scope.error = false
|
|
|
|
return ($scope.contactUs = function() {
|
|
|
|
if ($scope.form.email == null) {
|
|
|
|
console.log('email not set')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
$scope.sending = true
|
|
|
|
const ticketNumber = Math.floor((1 + Math.random()) * 0x10000).toString(
|
|
|
|
32
|
|
|
|
)
|
|
|
|
const data = {
|
|
|
|
_csrf: window.csrfToken,
|
|
|
|
name: $scope.form.name || $scope.form.email,
|
|
|
|
email: $scope.form.email,
|
|
|
|
labels: `${$scope.form.source} accounts`,
|
|
|
|
message: 'Please contact me with more details',
|
|
|
|
subject: `${$scope.form.name} - Group Enquiry - ${
|
|
|
|
$scope.form.position
|
|
|
|
} - ${$scope.form.university}`,
|
|
|
|
inbox: 'accounts'
|
|
|
|
}
|
|
|
|
|
|
|
|
const request = $http.post('/support', data)
|
|
|
|
|
|
|
|
request.catch(function() {
|
|
|
|
$scope.error = true
|
|
|
|
return $scope.$apply()
|
|
|
|
})
|
|
|
|
|
|
|
|
return request.then(function(response) {
|
|
|
|
$scope.sent = true
|
2019-10-23 08:22:50 -04:00
|
|
|
eventTracking.send(
|
2018-11-05 05:06:39 -05:00
|
|
|
'subscription-funnel',
|
|
|
|
'plans-page',
|
|
|
|
'group-inquiry-sent'
|
|
|
|
)
|
|
|
|
$scope.error = response.status !== 200
|
|
|
|
return $scope.$apply()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}))
|