Skip to content

Commit b37b101

Browse files
committed
Employer - History - Done
1 parent d5ca79f commit b37b101

13 files changed

+122
-151
lines changed

src/main/webapp/scripts/controllers/applyToJobEmployee.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ angular.module('jobzz')
2424
$location.path('/employee/home').replace();
2525
}
2626

27-
}, function () {
28-
//Empty
2927
});
3028

31-
3229
};
3330

3431
$scope.closeDialog = function () {

src/main/webapp/scripts/controllers/changePostEmployee.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ angular.module('jobzz')
3535
$scope.closeDialog();
3636
}
3737

38-
}, function () {
39-
//Empty
4038
});
4139

4240
}
Lines changed: 72 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,93 @@
11
angular.module('jobzz')
2-
.controller('ChangePostEmployerCtrl', ['$scope', '$rootScope', '$http', 'postService', 'dateToStringService', function ($scope, $rootScope, $http, postService, dateToStringService) {
3-
$scope.currentDate = new Date();
4-
5-
$scope.minDate = new Date(
6-
$scope.currentDate.getFullYear(),
7-
$scope.currentDate.getMonth(),
8-
$scope.currentDate.getDate());
9-
10-
$scope.maxDate = new Date(
11-
$scope.currentDate.getFullYear() + 10,
12-
$scope.currentDate.getMonth(),
13-
$scope.currentDate.getDate());
14-
15-
var getJobs = function () {
16-
var req = {
17-
method: 'GET',
18-
dataType: 'json',
19-
url: '/register/get/jobs',
20-
headers: {
21-
'Content-Type': 'application/json; charset=utf-8'
22-
}
23-
};
2+
.controller('ChangePostEmployerCtrl', ['$scope', '$rootScope', '$http', 'postService', 'dateToStringService',
3+
function ($scope, $rootScope, $http, postService, dateToStringService) {
244

25-
$http(req).then(function (response) {
26-
$scope.jobs = response.data.jobs;
27-
}, function () {
28-
//Empty
29-
});
5+
$scope.currentDate = new Date();
306

31-
};
7+
$scope.minDate = new Date(
8+
$scope.currentDate.getFullYear(),
9+
$scope.currentDate.getMonth(),
10+
$scope.currentDate.getDate());
3211

33-
getJobs();
12+
$scope.maxDate = new Date(
13+
$scope.currentDate.getFullYear() + 10,
14+
$scope.currentDate.getMonth(),
15+
$scope.currentDate.getDate());
3416

35-
$scope.post = $.extend(true, {}, postService.getPost());
36-
$scope.post.endDate = new Date($scope.post.endDate);
37-
$scope.post.startDate = new Date($scope.post.startDate);
38-
$scope.latlng = [$scope.post.latitude, $scope.post.longitude];
17+
(function () {
18+
var req = {
19+
method: 'GET',
20+
dataType: 'json',
21+
url: '/register/get/jobs',
22+
headers: {
23+
'Content-Type': 'application/json; charset=utf-8'
24+
}
25+
};
3926

40-
$scope.$on('mapInitialized', function (event, map) {
41-
window.setTimeout(function () {
42-
window.google.maps.event.trigger(map, 'resize');
43-
map.setCenter(new google.maps.LatLng($scope.post.latitude, $scope.post.longitude));
44-
}, 100)
45-
});
27+
$http(req).then(function (response) {
28+
$scope.jobs = response.data.jobs;
29+
});
4630

47-
$scope.getPos = function (event) {
48-
$scope.post.latitude = event.latLng.lat();
49-
$scope.post.longitude = event.latLng.lng();
31+
})();
5032

51-
$scope.latlng = [event.latLng.lat(), event.latLng.lng()];
52-
};
33+
$scope.post = $.extend(true, {}, postService.getPost());
34+
$scope.post.endDate = new Date($scope.post.endDate);
35+
$scope.post.startDate = new Date($scope.post.startDate);
36+
$scope.latlng = [$scope.post.latitude, $scope.post.longitude];
5337

54-
$scope.closeDialog = function () {
55-
$rootScope.panelRef && $rootScope.panelRef.close().then(function () {
56-
angular.element(document.querySelector('.dialog-button')).focus();
57-
$rootScope.panelRef.destroy();
38+
$scope.$on('mapInitialized', function (event, map) {
39+
window.setTimeout(function () {
40+
window.google.maps.event.trigger(map, 'resize');
41+
map.setCenter(new google.maps.LatLng($scope.post.latitude, $scope.post.longitude));
42+
}, 100)
5843
});
59-
};
6044

45+
$scope.getPos = function (event) {
46+
$scope.post.latitude = event.latLng.lat();
47+
$scope.post.longitude = event.latLng.lng();
48+
49+
$scope.latlng = [event.latLng.lat(), event.latLng.lng()];
50+
};
51+
52+
$scope.closeDialog = function () {
53+
$rootScope.panelRef && $rootScope.panelRef.close().then(function () {
54+
angular.element(document.querySelector('.dialog-button')).focus();
55+
$rootScope.panelRef.destroy();
56+
});
57+
};
6158

62-
$scope.changePost = function () {
6359

64-
if ($scope.post.startDate <= $scope.post.endDate) {
60+
$scope.changePost = function () {
6561

66-
var req = {
67-
method: 'PUT',
68-
dataType: 'json',
69-
url: '/employer/update/post',
70-
headers: {
71-
'Content-Type': 'application/json; charset=utf-8'
72-
},
73-
data: $scope.post
74-
};
62+
if ($scope.post.startDate <= $scope.post.endDate) {
7563

76-
$http(req).then(function (response) {
64+
var req = {
65+
method: 'PUT',
66+
dataType: 'json',
67+
url: '/employer/update/post',
68+
headers: {
69+
'Content-Type': 'application/json; charset=utf-8'
70+
},
71+
data: $scope.post
72+
};
7773

78-
if (response.data.isUpdate) {
79-
var oldPost = postService.getPost();
74+
$http(req).then(function (response) {
8075

81-
oldPost.name = $scope.post.name;
82-
oldPost.description = $scope.post.description;
83-
oldPost.startDate = dateToStringService.dateToString($scope.post.startDate);
84-
oldPost.endDate = dateToStringService.dateToString($scope.post.endDate);
85-
oldPost.latitude = $scope.post.latitude;
86-
oldPost.longitude = $scope.post.longitude;
76+
if (response.data.isUpdate) {
77+
var oldPost = postService.getPost();
8778

88-
$scope.closeDialog();
89-
}
79+
oldPost.name = $scope.post.name;
80+
oldPost.description = $scope.post.description;
81+
oldPost.startDate = dateToStringService.dateToString($scope.post.startDate);
82+
oldPost.endDate = dateToStringService.dateToString($scope.post.endDate);
83+
oldPost.latitude = $scope.post.latitude;
84+
oldPost.longitude = $scope.post.longitude;
9085

91-
}, function () {
92-
//Empty
93-
});
86+
$scope.closeDialog();
87+
}
88+
89+
});
90+
}
9491
}
95-
}
9692

97-
}]);
93+
}]);
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
angular.module('jobzz')
2-
.controller('DeletePostEmployerCtrl', ['$scope', '$rootScope', '$http', '$mdPanel', '$location', 'postService', function ($scope, $rootScope, $http, $mdPanel, $location, postService) {
3-
$scope.post = postService.getPost();
4-
5-
$scope.closeDialog = function () {
6-
$rootScope.panelRef && $rootScope.panelRef.close().then(function () {
7-
angular.element(document.querySelector('.dialog-button')).focus();
8-
$rootScope.panelRef.destroy();
9-
});
10-
};
11-
12-
$scope.deletePost = function () {
13-
14-
var req = {
15-
method: 'DELETE',
16-
dataType: 'json',
17-
url: '/employer/delete/post',
18-
headers: {
19-
'Content-Type': 'application/json; charset=utf-8'
20-
},
21-
data: $scope.post
2+
.controller('DeletePostEmployerCtrl', ['$scope', '$rootScope', '$http', '$mdPanel', '$location', 'postService',
3+
function ($scope, $rootScope, $http, $mdPanel, $location, postService) {
4+
5+
$scope.post = postService.getPost();
6+
7+
$scope.closeDialog = function () {
8+
$rootScope.panelRef && $rootScope.panelRef.close().then(function () {
9+
angular.element(document.querySelector('.dialog-button')).focus();
10+
$rootScope.panelRef.destroy();
11+
});
2212
};
2313

24-
$http(req).then(function (response) {
14+
$scope.deletePost = function () {
15+
16+
var req = {
17+
method: 'DELETE',
18+
dataType: 'json',
19+
url: '/employer/delete/post',
20+
headers: {
21+
'Content-Type': 'application/json; charset=utf-8'
22+
},
23+
data: $scope.post
24+
};
25+
26+
$http(req).then(function (response) {
2527

26-
if (response.data.isDeleted) {
27-
$scope.closeDialog();
28+
if (response.data.isDeleted) {
29+
$scope.closeDialog();
2830

29-
$location.path('/employer/home').replace();
30-
}
31+
$location.path('/employer/home').replace();
32+
}
3133

32-
}, function () {
33-
//Empty
34-
});
34+
});
3535

36-
}
36+
}
3737

38-
}]);
38+
}]);

src/main/webapp/scripts/controllers/employer.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ angular.module('jobzz')
6161
$rootScope.panelRef = result;
6262
});
6363

64-
}, function () {
65-
//Empty
6664
});
6765

6866
};
@@ -95,9 +93,8 @@ angular.module('jobzz')
9593
$http(req).then(function (response) {
9694
$scope.employer = response.data;
9795
$scope.employer.profilePicture = userProfilePictureService.employerProfilePicture($scope.employer.profilePicture);
98-
}, function () {
99-
//Empty
10096
});
97+
10198
})();
10299

103100
}]);

src/main/webapp/scripts/controllers/findJobEmployee.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ angular.module('jobzz')
1717
$scope.job.startDate = $scope.minDate;
1818
$scope.job.endDate = $scope.maxDate;
1919

20-
var getJobs = function () {
20+
(function () {
2121
var req = {
2222
method: 'GET',
2323
dataType: 'json',
@@ -31,13 +31,9 @@ angular.module('jobzz')
3131

3232
$scope.jobs = response.data;
3333

34-
}, function () {
35-
// Empty
3634
});
3735

38-
};
39-
40-
getJobs();
36+
})();
4137

4238
$scope.findJob = function () {
4339

@@ -105,11 +101,8 @@ angular.module('jobzz')
105101

106102
}
107103

108-
}, function () {
109-
// Empty
110104
});
111105

112-
113106
};
114107

115108
}]);
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
angular.module('jobzz')
2-
.controller('HistoryEmployerCtrl', ['$scope', function ($scope) {
2+
.controller('HistoryEmployerCtrl', ['$scope', '$http', function ($scope, $http) {
33

4-
$scope.posts = [{
5-
name: 'Test',
6-
description: 'Test',
7-
startDate: new Date(),
8-
endDate: new Date,
9-
status: 3,
10-
employeePostings: []
11-
}];
4+
(function () {
5+
var req = {
6+
method: 'GET',
7+
dataType: 'json',
8+
url: '/employer/history/posts',
9+
headers: {
10+
'Content-Type': 'application/json; charset=utf-8'
11+
}
12+
};
13+
14+
$http(req).then(function (response) {
15+
$scope.posts = response.data;
16+
});
17+
})();
1218

1319
}]);

src/main/webapp/scripts/controllers/homeEmployer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ angular.module('jobzz')
1414

1515
$http(req).then(function (response) {
1616
$rootScope.posts = response.data;
17-
}, function () {
18-
//Empty
1917
});
2018
};
2119

src/main/webapp/scripts/controllers/newPostEmployer.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ angular.module('jobzz').controller('NewPostEmployerCtrl', ['$scope', '$rootScope
1616
$scope.post.latitude = 44.4266978;
1717
$scope.post.longitude = 26.1024562;
1818

19-
var getJobs = function () {
19+
(function () {
2020
var req = {
2121
method: 'GET',
2222
dataType: 'json',
@@ -28,13 +28,9 @@ angular.module('jobzz').controller('NewPostEmployerCtrl', ['$scope', '$rootScope
2828

2929
$http(req).then(function (response) {
3030
$scope.jobs = response.data.jobs;
31-
}, function () {
32-
//Empty
3331
});
3432

35-
};
36-
37-
getJobs();
33+
})();
3834

3935
$scope.$on('mapInitialized', function (event, map) {
4036
window.setTimeout(function () {
@@ -78,8 +74,6 @@ angular.module('jobzz').controller('NewPostEmployerCtrl', ['$scope', '$rootScope
7874
$scope.closeDialog();
7975
}
8076

81-
}, function () {
82-
//Empty
8377
});
8478
}
8579
}

0 commit comments

Comments
 (0)