|
@@ -1,6 +1,6 @@
|
1
|
1
|
angular.module('app')
|
2
|
|
- .controller('PkGuidController', ['$scope', 'pkGuidBusiness', 'AppUtilsBusiness',
|
3
|
|
- function($scope, pkGuidBusiness, AppUtilsBusiness) {
|
|
2
|
+ .controller('PkGuidController', ['$scope', 'pkGuidBusiness', 'AppUtilsBusiness', '$mdDialog',
|
|
3
|
+ function($scope, pkGuidBusiness, AppUtilsBusiness, $mdDialog) {
|
4
|
4
|
|
5
|
5
|
$scope.selected = [];
|
6
|
6
|
|
|
@@ -13,9 +13,58 @@ angular.module('app')
|
13
|
13
|
$scope.pkGuids = null;
|
14
|
14
|
$scope.error = null;
|
15
|
15
|
|
|
16
|
+ $scope.askRemoveOne = function (pkguid) {
|
|
17
|
+ var confirm = $mdDialog.confirm()
|
|
18
|
+ .title('Confirm deletion')
|
|
19
|
+ .textContent('Do you really want to delete PkGuid \'' + pkguid.someText + '\'?')
|
|
20
|
+ .ok('Delete')
|
|
21
|
+ .cancel('Cancel');
|
|
22
|
+ $mdDialog.show(confirm).then(function() {
|
|
23
|
+ $scope.error = null;
|
|
24
|
+ $scope.promise = pkGuidBusiness.deleteDbo(pkguid.id).then(function(data)
|
|
25
|
+ {
|
|
26
|
+ $scope.getPkGuids();
|
|
27
|
+ }, function(error)
|
|
28
|
+ {
|
|
29
|
+ $scope.error = error;
|
|
30
|
+ });
|
|
31
|
+ }, function () {});
|
|
32
|
+ };
|
|
33
|
+
|
|
34
|
+ $scope.askRemoveSelected = function () {
|
|
35
|
+ var confirm = $mdDialog.confirm()
|
|
36
|
+ .title('Confirm deletion')
|
|
37
|
+ .textContent('Do you really want to delete ' + $scope.selected.length + ' PkGuids?')
|
|
38
|
+ .ok('Delete')
|
|
39
|
+ .cancel('Cancel');
|
|
40
|
+ $mdDialog.show(confirm).then(function() {
|
|
41
|
+ $scope.error = null;
|
|
42
|
+ $scope.removeFirstSelected();
|
|
43
|
+
|
|
44
|
+ }, function () {});
|
|
45
|
+ };
|
|
46
|
+
|
|
47
|
+ $scope.removeFirstSelected = function() {
|
|
48
|
+ if ($scope.selected.length == 0) {
|
|
49
|
+ $scope.getPkGuids();
|
|
50
|
+ }
|
|
51
|
+ else {
|
|
52
|
+ pkGuidBusiness.deleteDbo($scope.selected[0].id)
|
|
53
|
+ .then(function(data)
|
|
54
|
+ {
|
|
55
|
+ $scope.selected = $scope.selected.splice(1);
|
|
56
|
+ $scope.removeFirstSelected();
|
|
57
|
+ }, function(error)
|
|
58
|
+ {
|
|
59
|
+ $scope.error = error;
|
|
60
|
+ });
|
|
61
|
+ }
|
|
62
|
+ };
|
|
63
|
+
|
16
|
64
|
$scope.getPkGuids = function()
|
17
|
65
|
{
|
18
|
66
|
$scope.error = null;
|
|
67
|
+ $scope.selected = [];
|
19
|
68
|
var orderBy = AppUtilsBusiness.convertOrderBy($scope.query.order);
|
20
|
69
|
$scope.promise = pkGuidBusiness.getMultiple(orderBy, $scope.query.page - 1, $scope.query.limit).then(function(data)
|
21
|
70
|
{
|