send feeback to google forms
This commit is contained in:
parent
11b4ec1fcc
commit
db8f16c362
2 changed files with 33 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('sendFeedbackController', function($scope, $state, $stateParams, gettextCatalog) {
|
angular.module('copayApp.controllers').controller('sendFeedbackController', function($scope, $state, $log, $http, $httpParamSerializer, $stateParams, gettextCatalog, popupService, configService, lodash) {
|
||||||
|
var URL = "https://docs.google.com/forms/d/e/1FAIpQLSfHHAKb-CKjQnsuC_36IFaXlGsqLd5tZh79ywNfSADoVsw-gQ/formResponse";
|
||||||
$scope.score = parseInt($stateParams.score);
|
$scope.score = parseInt($stateParams.score);
|
||||||
switch ($scope.score) {
|
switch ($scope.score) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
@ -25,14 +26,38 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.sendFeedback = function() {
|
$scope.sendFeedback = function(feedback) {
|
||||||
//Feedback entered in feedback flow should be sent to BWS, and BWS should send a plain-text email to feedback@bitpay.com with a reply-to going to the user's email address. (From the onboarding process)
|
|
||||||
$state.go('feedback.thanks', {
|
var config = configService.getSync();
|
||||||
score: $stateParams.score,
|
var dataSrc = {
|
||||||
skipped: false
|
"entry.490635314": lodash.values(config.emailFor)[0] || 'no email setted',
|
||||||
|
"entry.1447064148": feedback,
|
||||||
|
"entry.2142850951": $stateParams.score
|
||||||
|
};
|
||||||
|
|
||||||
|
$http(_post(dataSrc)).then(function(data) {
|
||||||
|
$log.info("SUCCESS: Feedback sent");
|
||||||
|
$state.go('feedback.thanks', {
|
||||||
|
score: $stateParams.score,
|
||||||
|
skipped: false
|
||||||
|
});
|
||||||
|
}, function(data) {
|
||||||
|
$log.info("Could not send feedback");
|
||||||
|
popupService.showAlert(gettextCatalog.getString("Error"), gettextCatalog.getString("Could not send feedback, try again please"));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _post = function(dataSrc) {
|
||||||
|
return {
|
||||||
|
method: 'POST',
|
||||||
|
url: URL,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||||
|
},
|
||||||
|
data: $httpParamSerializer(dataSrc)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
$scope.skip = function() {
|
$scope.skip = function() {
|
||||||
$state.go('feedback.thanks', {
|
$state.go('feedback.thanks', {
|
||||||
score: $scope.score,
|
score: $scope.score,
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@
|
||||||
<span translate>{{comment}}</span>
|
<span translate>{{comment}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<textarea placeholder="Is there anything we could do to improve your experience?" row="40"></textarea>
|
<textarea ng-model="feedback" placeholder="Is there anything we could do to improve your experience?" row="40"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="padding">
|
<div class="padding">
|
||||||
<button type="submit" class="button button-full button-primary" ng-click="sendFeedback()" translate>
|
<button ng-disabled="!feedback" type="submit" class="button button-full button-primary" ng-click="sendFeedback(feedback)" translate>
|
||||||
Send
|
Send
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue