Noty fixes to application controlleNoty fixes to application controllerr

This commit is contained in:
HooVee
2016-08-15 21:02:59 +03:00
parent 2cdad88101
commit 9d56dccfbf
+34 -9
View File
@@ -131,11 +131,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $
$scope.send_appl = function(id) {
$http.post("/members/api/request/" + id).then(
function(response) {
$window.alert("Onnistui");
noty({
text: "Onnistui",
layout: "bottomRight",
type: "success",
timeout: 10000
});
$location.path("#/applications");
},
function(response) {
$window.alert("Epäonnistui");
noty({
text: "Epäonnistui",
layout: "bottomRight",
type: "success",
timeout: 10000
});
$location.path("#/applications");
}
);
@@ -143,11 +153,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $
$scope.delete_appl = function(id) {
$http.delete("/members/api/request/" + id).then(
function(response) {
$window.alert("Onnistui");
noty({
text: "Onnistui",
layout: "bottomRight",
type: "success",
timeout: 10000
});
$location.path("#/applications");
},
function(response) {
$window.alert("Epäonnistui");
noty({
text: "Epäonnistui",
layout: "bottomRight",
type: "success",
timeout: 10000
});
$location.path("#/applications");
}
);
@@ -157,16 +177,21 @@ app.controller("applController", function($scope, $http, $route, $routeParams, $
app.controller("appleditController", function($scope, $http, $route, $routeParams, $window, $location){
$scope.application = {"id": $routeParams.id};
$http.get("/members/api/request/"+$scope.application.id).then(function(response){
$scope.application = response.data;
$scope.application_data = response.data;
});
$scope.sendappl = function() {
$http.put("/members/api/request"+$scope.application.id, $scope.application).then(function(data){
$window.alert("Jäsentiedot tallennettu");
$http.put("/members/api/request/"+$scope.application_data.id, $scope.application_data).then(function(data){
noty({
text: "Jäsentiedot tallennettu",
layout: "bottomRight",
type: "success",
timeout: 10000
});
$location.path("#/applications");
});
}
};
$scope.cancelappl = function() { //user canceled. return to applications
$location.path("#/applications");
}
};
});