Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QLNS_N01
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Văn Hiếu
QLNS_N01
Commits
8b8c4034
Commit
8b8c4034
authored
5 years ago
by
đinh thị đầm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new page
parent
19c5ecee
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1276 additions
and
204 deletions
+1276
-204
src/main/java/com/itsol/quantrivanphong/access/homepage/business/CatalogiBusiness.java
...rivanphong/access/homepage/business/CatalogiBusiness.java
+10
-0
src/main/java/com/itsol/quantrivanphong/access/homepage/controller/CatalogiController.java
...nphong/access/homepage/controller/CatalogiController.java
+9
-1
src/main/java/com/itsol/quantrivanphong/model/Catalogi.java
src/main/java/com/itsol/quantrivanphong/model/Catalogi.java
+3
-4
src/main/java/com/itsol/quantrivanphong/model/News.java
src/main/java/com/itsol/quantrivanphong/model/News.java
+11
-7
src/main/resources/public/index.html
src/main/resources/public/index.html
+5
-2
src/main/resources/public/js/angular-resource.js
src/main/resources/public/js/angular-resource.js
+668
-0
src/main/resources/public/js/app.js
src/main/resources/public/js/app.js
+50
-16
src/main/resources/public/layout/layout1.html
src/main/resources/public/layout/layout1.html
+1
-1
src/main/resources/public/layout/layout2.html
src/main/resources/public/layout/layout2.html
+346
-3
src/main/resources/public/pages/employee/createEmployee.html
src/main/resources/public/pages/employee/createEmployee.html
+68
-65
src/main/resources/public/pages/homepage/HomeService.js
src/main/resources/public/pages/homepage/HomeService.js
+4
-4
src/main/resources/public/pages/homepage/MyHomeController.js
src/main/resources/public/pages/homepage/MyHomeController.js
+95
-0
src/main/resources/public/pages/homepage/homeController.js
src/main/resources/public/pages/homepage/homeController.js
+0
-95
src/main/resources/public/pages/homepage/newsManagements.html
...main/resources/public/pages/homepage/newsManagements.html
+6
-6
No files found.
src/main/java/com/itsol/quantrivanphong/access/homepage/business/CatalogiBusiness.java
View file @
8b8c4034
package
com.itsol.quantrivanphong.access.homepage.business
;
import
com.itsol.quantrivanphong.access.homepage.repository.CatalogiRepository
;
import
com.itsol.quantrivanphong.exception.ResourceNotFoundException
;
import
com.itsol.quantrivanphong.model.Catalogi
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -23,4 +24,13 @@ public class CatalogiBusiness {
public
Catalogi
save
(
Catalogi
catalogi
){
return
catalogiRepository
.
save
(
catalogi
);
}
public
String
deleteCatalogi
(
int
catalogiId
){
Catalogi
catalogi
=
catalogiRepository
.
findCatalogiById
(
catalogiId
);
if
(
catalogi
==
null
){
throw
new
ResourceNotFoundException
(
"News"
,
"newsId"
,
catalogiId
);
}
catalogiRepository
.
delete
(
catalogi
);
return
"ok"
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/itsol/quantrivanphong/access/homepage/controller/CatalogiController.java
View file @
8b8c4034
...
...
@@ -30,9 +30,17 @@ public class CatalogiController {
return
catalogi
;
}
@PostMapping
(
"/catalogi"
)
@PostMapping
(
"
HR
/catalogi"
)
public
Catalogi
createCatalogi
(
@Valid@RequestBody
Catalogi
catalogi
)
{
return
catalogiBusiness
.
save
(
catalogi
);
}
@DeleteMapping
(
"HR/catalogi/{catalogiId}"
)
public
ResponseEntity
<?>
deleteNews
(
@PathVariable
(
value
=
"catalogiId"
)
int
catalogiId
)
{
if
(
catalogiBusiness
.
findCatalogiById
(
catalogiId
)==
null
){
throw
new
ResourceNotFoundException
(
"News"
,
"newsId"
,
catalogiId
);
}
return
ResponseEntity
.
ok
(
catalogiBusiness
.
deleteCatalogi
(
catalogiId
));
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/itsol/quantrivanphong/model/Catalogi.java
View file @
8b8c4034
package
com.itsol.quantrivanphong.model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -31,9 +30,9 @@ public class Catalogi {
private
String
descriptions
;
@
JsonIgnore
@OneToMany
(
mappedBy
=
"catalogi"
,
fetch
=
FetchType
.
LAZY
,
cascade
=
CascadeType
.
ALL
)
private
List
<
News
>
newsList
=
new
ArrayList
<>();
@
OneToMany
(
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
LAZY
,
mappedBy
=
"catalogi"
)
private
List
<
News
>
news
=
new
ArrayList
<>();
}
This diff is collapsed.
Click to expand it.
src/main/java/com/itsol/quantrivanphong/model/News.java
View file @
8b8c4034
package
com.itsol.quantrivanphong.model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.itsol.quantrivanphong.audit.DateAudit
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.annotations.OnDelete
;
import
org.hibernate.annotations.OnDeleteAction
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
...
...
@@ -14,7 +17,7 @@ import javax.persistence.*;
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners
(
AuditingEntityListener
.
class
)
@JsonIgnoreProperties
(
value
=
{
"createdAt"
,
"updatedAt"
},
allowGetters
=
true
)
@JsonIgnoreProperties
(
value
=
{
"createdAt"
,
"updatedAt"
},
allowGetters
=
true
)
@Table
(
name
=
"news"
)
public
class
News
extends
DateAudit
{
...
...
@@ -37,16 +40,17 @@ public class News extends DateAudit {
@Column
(
name
=
"status"
)
private
boolean
status
;
// @JsonIgnore
@ManyToOne
(
fetch
=
FetchType
.
EAGER
)
// @JoinColumn(name = "catalogid", nullable = false)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
,
optional
=
false
)
@JoinColumn
(
name
=
"catalogi_id"
,
nullable
=
false
)
@OnDelete
(
action
=
OnDeleteAction
.
CASCADE
)
@JsonIgnore
private
Catalogi
catalogi
;
// @JsonIgnore
@ManyToOne
(
fetch
=
FetchType
.
EAGER
)
// @JoinColumn(name = "employeeid", nullable = false)
private
Employee
employee
;
private
Employee
employee
;
}
This diff is collapsed.
Click to expand it.
src/main/resources/public/index.html
View file @
8b8c4034
...
...
@@ -33,6 +33,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script
src=
"//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js"
></script>
<script
src=
"js/angular-route.js"
></script>
<script
src=
"js/angular-ui-router.min.js"
></script>
<script
src=
"js/angular-resource.js"
></script>
<script
src=
"//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-animate.js"
></script>
<script
src=
"//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"
></script>
<script
src=
"//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js"
></script>
...
...
@@ -45,9 +46,10 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script
src=
"pages/issue/IssueAddControlelr.js"
></script>
<script
src=
"pages/issue/IssueController.js"
></script>
<script
src=
"pages/issue/IssuesDetailController.js"
></script>
<script
src=
"pages/issue/IssuesDeleteController.js"
></script>
>
<script
src=
"pages/issue/IssuesDeleteController.js"
></script>
<script
src=
"pages/leaveform/leaveFormController.js"
></script>
<script
src=
"pages/homepage/homeController.js"
></script>
<script
src=
"pages/homepage/MyHomeController.js"
></script>
<script
src=
"pages/homepage/HomeService.js"
></script>
<script
src=
"pages/timesheet/timeSheetController.js"
></script>
<script
src=
"pages/timesheet/timeSheetDetailController.js"
></script>
<script
src=
"pages/leaveform/leaveFormDetailController.js"
></script>
...
...
@@ -119,6 +121,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
</script>
</head>
<body
class=
"cbp-spmenu-push"
ng-app=
"myApp"
>
<div
ui-view=
"layout"
></div>
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/public/js/angular-resource.js
0 → 100644
View file @
8b8c4034
This diff is collapsed.
Click to expand it.
src/main/resources/public/js/app.js
View file @
8b8c4034
/**
*
*/
angular
.
module
(
"
myApp
"
,
[
"
ngAnimate
"
,
"
ui.router
"
,
"
ui.bootstrap
"
]).
config
(
function
(
$stateProvider
,
$urlRouterProvider
,
$locationProvider
)
{
angular
.
module
(
"
myApp
"
,
[
"
ngAnimate
"
,
"
ngResource
"
,
"
ui.router
"
,
"
ui.bootstrap
"
]).
config
(
function
(
$stateProvider
,
$urlRouterProvider
,
$locationProvider
)
{
$locationProvider
.
hashPrefix
(
''
);
$urlRouterProvider
.
otherwise
(
"
/employees
"
);
...
...
@@ -107,13 +107,50 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
})
.
state
(
"
news
"
,{
.
state
(
"
CatagoriManagement
"
,{
parent
:
'
layout1
'
,
url
:
"
/
news
"
,
url
:
"
/
management/catagori
"
,
views
:{
"
content
"
:{
templateUrl
:
"
pages/homepage/catagoriManagements.html
"
,
controller
:
"
homeController
"
templateUrl
:
"
pages/homepage/catagoriManagements.html
"
,
controller
:
"
MyHomeController
"
}
}
})
.
state
(
"
newsManagement
"
,{
parent
:
'
layout1
'
,
url
:
"
/management/catagori/:myCatagoriId
"
,
params
:{
myCatagoriId
:
null
},
views
:{
"
content
"
:{
templateUrl
:
"
pages/homepage/newsManagements.html
"
,
controller
:
"
MyHomeController
"
}
}
})
.
state
(
"
newsEditManagement
"
,{
parent
:
'
layout1
'
,
url
:
"
/management/catagori/:myCatagoriEditId/news/:myNewsEditId
"
,
views
:{
"
content
"
:{
templateUrl
:
"
pages/homepage/newsEditManagement.html
"
,
controller
:
"
MyHomeController
"
}
}
})
.
state
(
"
newsAddManagement
"
,{
parent
:
'
layout1
'
,
url
:
"
/management/HR/:employeeId/catagori/:myCatagoriAddId/createNews
"
,
views
:{
"
content
"
:{
templateUrl
:
"
pages/homepage/newsAddManagement.html
"
,
controller
:
"
MyHomeController
"
}
}
})
...
...
@@ -195,9 +232,6 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
})
//danh sách các dự án
.
state
(
"
project
"
,
{
parent
:
'
layout1
'
,
url
:
"
/project
"
,
...
...
@@ -208,7 +242,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//thêm mới dự án
.
state
(
"
addproject
"
,
{
parent
:
'
layout1
'
,
url
:
"
/addproject
"
,
...
...
@@ -219,7 +253,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//sửa thông tin dự án
.
state
(
"
editproject
"
,
{
parent
:
'
layout1
'
,
url
:
"
/editproject/:ID
"
,
...
...
@@ -230,7 +264,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//danh sách thành viên trong nhóm dự án
.
state
(
"
groupProjectByProjectId
"
,
{
parent
:
'
layout1
'
,
url
:
"
/groupProjectByProjectId/:ID
"
,
...
...
@@ -242,7 +276,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//thêm thành viên vào nhóm dự án
.
state
(
"
addEmployeeProject
"
,
{
parent
:
'
layout1
'
,
url
:
"
/addEmployeeProject
"
,
...
...
@@ -253,7 +287,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
//sửa thông tin nhân viên trong nhóm
.
state
(
"
editEmployeeProject
"
,
{
parent
:
'
layout1
'
,
url
:
"
/editEmployeeProject/:ID
"
,
...
...
@@ -264,7 +298,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// danh sách project vào các issues
.
state
(
"
issues
"
,
{
parent
:
'
layout1
'
,
url
:
"
/issues
"
,
...
...
@@ -275,7 +309,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// thêm mới issues
.
state
(
"
addIssues
"
,
{
parent
:
'
layout1
'
,
url
:
"
/addIssues
"
,
...
...
@@ -286,7 +320,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
}
})
// thêm mới issues
.
state
(
"
IssuesComment
"
,
{
parent
:
'
layout1
'
,
url
:
"
/issuescomment/:IssuesId
"
,
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/public/layout/layout1.html
View file @
8b8c4034
...
...
@@ -50,7 +50,7 @@
<!-- END DUng-->
<li
class=
"treeview"
>
<li
class=
"treeview"
>
<a
ui-sref=
"
news
"
>
<a
ui-sref=
"
CatagoriManagement
"
>
<i
class=
"fa fa-newspaper-o"
aria-hidden=
"true"
></i>
<span>
News
</span>
</a>
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/public/layout/layout2.html
View file @
8b8c4034
This diff is collapsed.
Click to expand it.
src/main/resources/public/pages/employee/createEmployee.html
View file @
8b8c4034
<div
class=
"container"
>
<table
class=
"table"
>
<form>
<div
class=
"form-row"
>
<div
class=
"col"
>
<tr>
<td><label>
User Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.username"
/>
</td>
</tr>
<tr>
<td><label>
First Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.firstName"
/>
</td>
</tr>
<tr>
<td><label>
Last Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.lastName"
/>
</td>
</tr>
<tr>
<td><label
id=
"email"
for=
"email"
>
Email
</label></td>
<td>
<input
class=
"form-check-label"
type=
"email"
maxlength=
"150"
ng-model=
"emp.emailAddress"
/>
</td>
</tr>
<tr>
<td><label>
Phone
</label></td>
<td>
<input
type=
"text"
maxlength=
"10"
value=
""
ng-model=
"emp.phoneNumber"
/>
</td>
</tr>
</div>
<div
class=
"col"
>
<tr>
<td><label>
Education
</label></td>
<td>
<input
type=
"text"
ng-model=
"emp.education"
/>
</td>
</tr>
<tr>
<td><label>
Home town
</label></td>
<td><input
type=
"text"
ng-model=
"emp.homeTown"
/></td>
</tr>
<tr>
<td><label>
Department
</label></td>
<td><input
type=
"text"
ng-model=
"emp.department"
/></td>
</tr>
<tr>
<td><label>
Position
</label></td>
<td><input
type=
"text"
ng-model=
"emp.position"
/></td>
</tr>
<tr>
</div>
<table
class=
"table"
>
<form>
<div
class=
"form-row"
>
<div
class=
"col"
>
<tr>
<td><label>
User Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.username"
/>
<span
style=
"color:red"
ng-show=
"myForm.emp.username.$dirty && myForm.emp.username.$invalid"
>
<span
ng-show=
"myForm.emp.username.$error.required"
>
Username is required.
</span>
</span>
</td>
</tr>
<tr>
<td><label>
First Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.firstName"
/>
</td>
</tr>
<tr>
<td><label>
Last Name
</label></td>
<td>
<input
type=
"text"
maxlength=
"29"
ng-model=
"emp.lastName"
/>
</td>
</tr>
<tr>
<td><label
id=
"email"
for=
"email"
>
Email
</label></td>
<td>
<input
class=
"form-check-label"
type=
"email"
maxlength=
"150"
ng-model=
"emp.emailAddress"
/>
</td>
</tr>
<tr>
<td><label>
Phone
</label></td>
<td>
<input
type=
"text"
maxlength=
"10"
value=
""
ng-model=
"emp.phoneNumber"
/>
</td>
</tr>
</div>
<div
class=
"col"
>
<tr>
<td><label>
Education
</label></td>
<td>
<input
type=
"text"
ng-model=
"emp.education"
/>
</td>
</tr>
<tr>
<td><label>
Home town
</label></td>
<td><input
type=
"text"
ng-model=
"emp.homeTown"
/></td>
</tr>
<tr>
<td><label>
Department
</label></td>
<td><input
type=
"text"
ng-model=
"emp.department"
/></td>
</tr>
<tr>
<td><label>
Position
</label></td>
<td><input
type=
"text"
ng-model=
"emp.position"
/></td>
</tr>
<tr>
</div>
</form>
<td></td>
<td>
<input
class=
"btn btn-primary"
type=
"submit"
name=
"submit"
value=
"submit"
ng-click=
"save();"
/>
<input
class=
"btn btn-primary"
type=
"submit"
name=
"clear"
value=
"clear"
ng-click=
" emp = null"
/>
</td>
</tr>
</table>
</div>
</form>
<td></td>
<td>
<input
class=
"btn btn-primary"
type=
"submit"
name=
"submit"
value=
"submit"
ng-click=
"save();"
/>
<input
class=
"btn btn-primary"
type=
"submit"
name=
"clear"
value=
"clear"
ng-click=
" emp = null"
/>
</td>
</tr>
</table>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/public/pages/homepage/HomeService.js
View file @
8b8c4034
angular
.
module
(
"
myApp
"
).
factory
(
'
News
'
,
function
(
$resource
)
{
return
$resource
(
'
http://localhost:808
0
/api/news/:id
'
,
{
id
:
'
@myNewsId
'
},{
return
$resource
(
'
http://localhost:808
1
/api/news/:id
'
,
{
id
:
'
@myNewsId
'
},{
'
get
'
:
{
method
:
'
GET
'
,
isArray
:
false
...
...
@@ -9,11 +9,11 @@ angular.module("myApp").factory('News', function ($resource) {
});
angular
.
module
(
'
myApp
'
).
factory
(
'
Catagories
'
,
function
(
$resource
)
{
return
$resource
(
'
http://localhost:8080
/api/catalogies/:id
'
,
{
id
:
'
@myCatagoriesId
'
});
return
$resource
(
'
http://localhost:8081
/api/catalogies/:id
'
,
{
id
:
'
@myCatagoriesId
'
});
});
angular
.
module
(
'
myApp
'
).
factory
(
'
LatestNews
'
,
function
(
$resource
)
{
return
$resource
(
'
http://localhost:808
0
/api/catalogi/:id/latestNews
'
,
{
id
:
'
@CatagoriesId
'
},{
return
$resource
(
'
http://localhost:808
1
/api/catalogi/:id/latestNews
'
,
{
id
:
'
@CatagoriesId
'
},{
'
get
'
:
{
method
:
'
GET
'
,
isArray
:
true
...
...
@@ -22,7 +22,7 @@ angular.module('myApp').factory('LatestNews', function ($resource) {
});
angular
.
module
(
'
myApp
'
).
factory
(
'
NewsByCatagori
'
,
function
(
$resource
)
{
return
$resource
(
'
http://localhost:808
0
/api/catalogi/:id/news
'
,
{
id
:
'
@catagoriesId
'
},{
return
$resource
(
'
http://localhost:808
1
/api/catalogi/:id/news
'
,
{
id
:
'
@catagoriesId
'
},{
'
get
'
:
{
method
:
'
GET
'
,
isArray
:
true
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/public/pages/homepage/MyHomeController.js
0 → 100644
View file @
8b8c4034
angular
.
module
(
"
myApp
"
).
controller
(
'
MyHomeController
'
,
function
(
$scope
,
$http
,
$state
,
News
,
$window
,
$stateParams
,
Catagories
,
LatestNews
)
{
$scope
.
catagories
=
Catagories
.
query
();
$scope
.
currentPage
=
1
,
$scope
.
numPerPage
=
6
,
$scope
.
maxSize
=
5
;
$scope
.
catagoriDetail
=
Catagories
.
get
({},
{
myCatagoriesId
:
$stateParams
.
catagoriId
}).
$promise
.
then
(
function
(
value
)
{
$scope
.
todos
=
value
.
news
;
$scope
.
catagori
=
value
;
$scope
.
numPages
=
function
()
{
return
Math
.
ceil
(
$scope
.
todos
.
length
/
$scope
.
numPerPage
);
};
console
.
log
(
$scope
.
todos
.
length
);
$scope
.
$watch
(
'
currentPage + numPerPage
'
,
function
()
{
var
begin
=
((
$scope
.
currentPage
-
1
)
*
$scope
.
numPerPage
)
,
end
=
begin
+
$scope
.
numPerPage
;
$scope
.
myNews
=
$scope
.
todos
.
slice
(
begin
,
end
);
});
},
function
(
error
)
{
console
.
log
()
}
);
$scope
.
newsById
=
News
.
get
({},
{
myNewsId
:
$stateParams
.
Id1
});
$scope
.
show
=
function
(
id
){
$scope
.
newestNews
=
LatestNews
.
get
({},
{
CatagoriesId
:
id
});
};
$scope
.
catagoriById
=
Catagories
.
get
({},
{
myCatagoriesId
:
$stateParams
.
myCatagoriId
});
//Delete News
$scope
.
deleteNews
=
function
(
newsId
)
{
if
(
confirm
(
"
Delete?
"
))
{
$http
({
method
:
'
DELETE
'
,
url
:
'
http://localhost:8080/api/HR/news/
'
+
newsId
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
delete OK
"
);
$state
.
reload
();
},
function
(
data
,
status
)
{
$state
.
reload
();
});
}
};
//Edit news
$scope
.
newsEditById
=
News
.
get
({},
{
myNewsId
:
$stateParams
.
myNewsEditId
});
$scope
.
editNews
=
function
(
newsEditById
)
{
if
(
confirm
(
"
Update?
"
))
{
$http
({
method
:
'
PUT
'
,
url
:
'
http://localhost:8081/api/HR/news/
'
+
newsEditById
.
id
,
data
:
angular
.
toJson
(
newsEditById
),
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
update OK
"
);
$state
.
go
(
'
newsManagement
'
,{
myCatagoriId
:
$stateParams
.
myCatagoriEditId
});
},
function
(
data
,
status
)
{
console
.
log
(
status
);
});
}
};
//Add News
$scope
.
createNews
=
function
(
newsAdd
)
{
if
(
confirm
(
"
Add?
"
))
{
$http
({
method
:
'
POST
'
,
url
:
'
http://localhost:8081/api/HR/
'
+
$stateParams
.
employeeId
+
'
/catalogies/
'
+
$stateParams
.
myCatagoriAddId
+
'
/news
'
,
data
:
angular
.
toJson
(
newsAdd
),
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
update OK
"
);
$state
.
go
(
'
newsManagement
'
,{
myCatagoriId
:
$stateParams
.
myCatagoriAddId
});
},
function
(
data
,
status
)
{
console
.
log
(
status
);
});
}
};
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/public/pages/homepage/homeController.js
deleted
100644 → 0
View file @
19c5ecee
angular
.
module
(
"
myApp
"
).
controller
(
'
homeController
'
,
function
(
$scope
,
$http
,
$state
,
News
,
$window
,
$stateParams
,
Catagories
,
LatestNews
)
{
$scope
.
catagories
=
Catagories
.
query
();
$scope
.
currentPage
=
1
,
$scope
.
numPerPage
=
6
,
$scope
.
maxSize
=
5
;
$scope
.
catagoriDetail
=
Catagories
.
get
({},
{
myCatagoriesId
:
$stateParams
.
catagoriId
}).
$promise
.
then
(
function
(
value
)
{
$scope
.
todos
=
value
.
news
;
$scope
.
catagori
=
value
;
$scope
.
numPages
=
function
()
{
return
Math
.
ceil
(
$scope
.
todos
.
length
/
$scope
.
numPerPage
);
};
console
.
log
(
$scope
.
todos
.
length
);
$scope
.
$watch
(
'
currentPage + numPerPage
'
,
function
()
{
var
begin
=
((
$scope
.
currentPage
-
1
)
*
$scope
.
numPerPage
)
,
end
=
begin
+
$scope
.
numPerPage
;
$scope
.
myNews
=
$scope
.
todos
.
slice
(
begin
,
end
);
});
},
function
(
error
)
{
console
.
log
()
}
);
$scope
.
newsById
=
News
.
get
({},
{
myNewsId
:
$stateParams
.
Id1
});
$scope
.
show
=
function
(
id
){
$scope
.
newestNews
=
LatestNews
.
get
({},
{
CatagoriesId
:
id
});
};
$scope
.
catagoriById
=
Catagories
.
get
({},
{
myCatagoriesId
:
$stateParams
.
myCatagoriId
});
//Delete News
$scope
.
deleteNews
=
function
(
newsId
)
{
if
(
confirm
(
"
Delete?
"
))
{
$http
({
method
:
'
DELETE
'
,
url
:
'
http://localhost:8080/api/HR/news/
'
+
newsId
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
delete OK
"
);
$state
.
reload
();
},
function
(
data
,
status
)
{
$state
.
reload
();
});
}
};
//Edit news
$scope
.
newsEditById
=
News
.
get
({},
{
myNewsId
:
$stateParams
.
myNewsEditId
});
$scope
.
editNews
=
function
(
newsEditById
)
{
if
(
confirm
(
"
Update?
"
))
{
$http
({
method
:
'
PUT
'
,
url
:
'
http://localhost:8080/api/HR/news/
'
+
newsEditById
.
id
,
data
:
angular
.
toJson
(
newsEditById
),
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
update OK
"
);
$state
.
go
(
'
newsManagement
'
,{
myCatagoriId
:
$stateParams
.
myCatagoriEditId
});
},
function
(
data
,
status
)
{
console
.
log
(
status
);
});
}
};
//Add News
$scope
.
createNews
=
function
(
newsAdd
)
{
if
(
confirm
(
"
Add?
"
))
{
$http
({
method
:
'
POST
'
,
url
:
'
http://localhost:8080/api/HR/
'
+
$stateParams
.
employeeId
+
'
/catalogies/
'
+
$stateParams
.
myCatagoriAddId
+
'
/news
'
,
data
:
angular
.
toJson
(
newsAdd
),
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}).
then
(
function
(
response
)
{
console
.
log
(
"
update OK
"
);
$state
.
go
(
'
newsManagement
'
,{
myCatagoriId
:
$stateParams
.
myCatagoriAddId
});
},
function
(
data
,
status
)
{
console
.
log
(
status
);
});
}
};
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/public/pages/homepage/newsManagements.html
View file @
8b8c4034
...
...
@@ -12,25 +12,25 @@
<tr>
<div
ng-if=
"catagoriById.name == 'Office'"
>
<a
href=
"#/management/catagori/
4
"
style=
"float:left"
><
<
Back
</
a
>
<a
href=
"#/management/catagori/
5
"
style=
"float:left"
><
<
Back
</
a
>
</div>
<div
ng-if=
"catagoriById.name == 'Outdoor Activiy'"
>
<div
ng-if=
"catagoriById.name == 'Outdoor Activi
t
y'"
>
<a
href=
"#/management/catagori/1"
style=
"float:left"
><
<
Back
</
a
>
</div>
<div
ng-if=
"catagoriById.name == 'Projects'"
>
<a
href=
"#/management/catagori/2"
style=
"float:left"
><
<
Back
</
a
>
</div>
<div
ng-if=
"catagoriById.name == 'Recruitments'"
>
<a
href=
"#/management/catagori/
3
"
style=
"float:left"
><
<
Back
</
a
>
<a
href=
"#/management/catagori/
4
"
style=
"float:left"
><
<
Back
</
a
>
</div>
<div
ng-if=
"catagoriById.name == 'Office'"
>
<a
href=
"#/management/catagori/2"
style=
"float:right"
>
Next >>
</a>
</div>
<div
ng-if=
"catagoriById.name == 'Outdoor Activiy'"
>
<a
href=
"#/management/catagori/
3
"
style=
"float:right"
>
Next >>
</a>
<div
ng-if=
"catagoriById.name == 'Outdoor Activi
t
y'"
>
<a
href=
"#/management/catagori/
4
"
style=
"float:right"
>
Next >>
</a>
</div>
<div
ng-if=
"catagoriById.name == 'Projects'"
>
<a
href=
"#/management/catagori/
4
"
style=
"float:right"
>
Next >>
</a>
<a
href=
"#/management/catagori/
5
"
style=
"float:right"
>
Next >>
</a>
</div>
<div
ng-if=
"catagoriById.name == 'Recruitments'"
>
<a
href=
"#/management/catagori/1"
style=
"float:right"
>
Next >>
</a>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment