Unify feedback and ticket forms
This commit is contained in:
@@ -24,15 +24,22 @@
|
||||
<div class="row animateMeOpacity">
|
||||
<div class="col-lg-12">
|
||||
<h3>Feedback</h3>
|
||||
We would love to hear any ideas, feature requests and overall feedback from your side.
|
||||
We would love to hear any ideas or feature requests from your side.<br/>
|
||||
If you found any issue or bugs, let us know as well, we will resolve that for you as soon as possible.
|
||||
<br/>
|
||||
<br/>
|
||||
<form name="feedbackForm" ng-submit="submitFeedback()">
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.type" required>
|
||||
<option value="feedback">Enhancement / Idea</option>
|
||||
<option value="ticket">Bug Report</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
|
||||
<input type="text" class="form-control" name="subject" placeholder="Enter your idea" ng-model="feedback.subject" ng-maxlength="512" ng-minlength="1" required>
|
||||
<input type="text" class="form-control" name="subject" placeholder="Enter your idea or issue" ng-model="feedback.subject" ng-maxlength="512" ng-minlength="1" required>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.description.$dirty && feedbackForm.description.$invalid) }">
|
||||
<textarea class="form-control" name="description" rows="3" placeholder="Describe your idea" ng-model="feedback.description" ng-minlength="1" required></textarea>
|
||||
<textarea class="form-control" name="description" rows="3" placeholder="Describe your idea or issue" ng-model="feedback.description" ng-minlength="1" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" ng-disabled="feedbackForm.$invalid || feedback.busy"><i class="fa fa-spinner fa-pulse" ng-show="feedback.busy"></i> Submit</button>
|
||||
<span ng-show="feedback.error" class="text-danger text-bold">{{feedback.error}}</span>
|
||||
@@ -42,32 +49,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="card card-large">
|
||||
<div class="grid-item-top">
|
||||
<div class="row animateMeOpacity">
|
||||
<div class="col-lg-12">
|
||||
<h3>Ticket</h3>
|
||||
If you found any issue or bugs, let us know, we will resolve that for you as soon as possible.
|
||||
<br/>
|
||||
<br/>
|
||||
<form name="ticketForm" ng-submit="submitTicket()">
|
||||
<div class="form-group" ng-class="{ 'has-error': (ticketForm.subject.$dirty && ticketForm.subject.$invalid) }">
|
||||
<input type="text" class="form-control" name="subject" placeholder="Enter your issue" ng-model="ticket.subject" ng-maxlength="512" ng-minlength="1" required>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': (ticketForm.description.$dirty && ticketForm.description.$invalid) }">
|
||||
<textarea class="form-control" name="description" rows="3" placeholder="Describe your issue" ng-model="ticket.description" ng-minlength="1" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" ng-disabled="ticketForm.$invalid || ticket.busy"><i class="fa fa-spinner fa-pulse" ng-show="ticket.busy"></i> Submit</button>
|
||||
<span ng-show="ticket.error" class="text-danger text-bold">{{ticket.error}}</span>
|
||||
<span ng-show="ticket.success" class="text-success text-bold">Thank You!</span>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
@@ -8,39 +8,25 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
|
||||
success: false,
|
||||
busy: false,
|
||||
subject: '',
|
||||
description: ''
|
||||
};
|
||||
|
||||
$scope.ticket = {
|
||||
error: null,
|
||||
success: false,
|
||||
busy: false,
|
||||
subject: '',
|
||||
type: '',
|
||||
description: ''
|
||||
};
|
||||
|
||||
function resetFeedback() {
|
||||
$scope.feedback.subject = '';
|
||||
$scope.feedback.description = '';
|
||||
$scope.feedback.type = '';
|
||||
|
||||
$scope.feedbackForm.$setUntouched();
|
||||
$scope.feedbackForm.$setPristine();
|
||||
}
|
||||
|
||||
function resetTicket() {
|
||||
$scope.ticket.subject = '';
|
||||
$scope.ticket.description = '';
|
||||
|
||||
$scope.ticketForm.$setUntouched();
|
||||
$scope.ticketForm.$setPristine();
|
||||
}
|
||||
|
||||
$scope.submitFeedback = function () {
|
||||
$scope.feedback.busy = true;
|
||||
$scope.feedback.success = false;
|
||||
$scope.feedback.error = null;
|
||||
|
||||
Client.feedback($scope.feedback.subject, $scope.feedback.description, function (error) {
|
||||
Client.feedback($scope.feedback.type, $scope.feedback.subject, $scope.feedback.description, function (error) {
|
||||
if (error) {
|
||||
$scope.feedback.error = error;
|
||||
} else {
|
||||
@@ -51,21 +37,4 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
|
||||
$scope.feedback.busy = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submitTicket = function () {
|
||||
$scope.ticket.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;
|
||||
resetTicket();
|
||||
}
|
||||
|
||||
$scope.ticket.busy = false;
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user