diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index bdbf3ba11..1ce905813 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -469,6 +469,32 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', }).error(defaultErrorHandler(callback)); }; + Client.prototype.feedback = function (subject, description, callback) { + var data = { + type: 'feedback', + subject: subject, + description: description + }; + + $http.post(client.apiOrigin + '/api/v1/cloudron/feedback', data).success(function (data, status) { + if (status !== 201) return callback(new ClientError(status, data)); + callback(null); + }).error(defaultErrorHandler(callback)); + }; + + Client.prototype.ticket = function (subject, description, callback) { + var data = { + type: 'ticket', + subject: subject, + description: description + }; + + $http.post(client.apiOrigin + '/api/v1/cloudron/feedback', data).success(function (data, status) { + if (status !== 201) return callback(new ClientError(status, data)); + callback(null); + }).error(defaultErrorHandler(callback)); + }; + Client.prototype.createUser = function (username, email, callback) { var data = { username: username, diff --git a/webadmin/src/views/support.html b/webadmin/src/views/support.html index 963d653db..d5b503a87 100644 --- a/webadmin/src/views/support.html +++ b/webadmin/src/views/support.html @@ -27,14 +27,14 @@ We would love to hear any ideas, feature requests and overall feedback from your side.

-
+
- +
- +
@@ -53,14 +53,14 @@ If you found any issue or bugs, let us know, we will resolve that for you as soon as possible.

-
+
- +
- +
diff --git a/webadmin/src/views/support.js b/webadmin/src/views/support.js index 65ecc148d..56098bc58 100644 --- a/webadmin/src/views/support.js +++ b/webadmin/src/views/support.js @@ -2,4 +2,51 @@ angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) { + $scope.busy = false; + + $scope.feedback = { + error: null, + success: false, + subject: '', + description: '' + }; + + $scope.ticket = { + error: null, + success: false, + subject: '', + description: '' + }; + + $scope.submitFeedback = function () { + $scope.busy = true; + $scope.feedback.success = false; + $scope.feedback.error = null; + + Client.feedback($scope.feedback.subject, $scope.feedback.description, function (error) { + if (error) { + $scope.feedback.error = error; + } else { + $scope.feedback.success = true; + } + + $scope.busy = false; + }); + }; + + $scope.submitTicket = function () { + $scope.busy = true; + $scope.ticket.success = false; + $scope.ticket.error = null; + + Client.ticket($scope.ticket.subject, $scope.ticket.description, function (error) { + if (error) { + $scope.ticket.error = error; + } else { + $scope.ticket.success = true; + } + + $scope.busy = false; + }); + }; }]);