Commit 1f63c01a authored by phùng văn dung's avatar phùng văn dung

update 09/06/2019

parent d7fc59c8
......@@ -17,6 +17,7 @@
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
......
server.port=8080
server.port=8081
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name= com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/qtvp_01
spring.datasource.username=root
spring.datasource.password=12345678
......@@ -8,7 +8,8 @@ spring.datasource.password=12345678
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
server.servlet.session.timeout=30s
# ===============================
......@@ -18,7 +19,7 @@ spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=hieunv2496@gmail.com
spring.mail.password=anhieu1996
>>>>>>> master
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.auth=true
......
......@@ -52,7 +52,27 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
views: {
"content": {
templateUrl: "pages/project/project/projectListViews.html",
controller: "projectController"
controller: "showProject"
}
}
})
.state("addproject", {
parent: 'layout3',
url: "/addproject",
views: {
"content": {
templateUrl: "pages/project/project/projectAddViews.html",
controller: "insertProject"
}
}
})
.state("editproject", {
parent: 'layout3',
url: "/editproject",
views: {
"content": {
templateUrl: "pages/project/project/projectAddViews.html",
controller: "editProject"
}
}
})
......
......@@ -33,7 +33,7 @@
<!-- Sidebar -->
<ul class="sidebar navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown"
<a class="nav-link dropdown-toggle" id="pagesDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-fw fa-folder"></i>
<span>Quản Trị Văn Phòng</span>
......
......@@ -26,7 +26,7 @@ angular.module("myApp").controller("employeeController", function($scope, $http)
console.log($scope.emp);
$http({
method : 'POST',
url : "http://localhost:8080/list_employee/",
url : "http://localhost:8081/list_employee/",
data: $scope.emp
}).then(function successCallback(response) {
console.log(response);
......@@ -79,7 +79,7 @@ angular.module("myApp").controller("employeeController", function($scope, $http)
$http({
method : 'GET',
url : "http://localhost:8080/list_employee/"
url : "http://localhost:8081/list_employee/"
}).then(function successCallback(response) {
console.log(response);
......
<div class="container">
Project works
</div>
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="card-body">
<form ng-controller="insertProject" ng-submit="insert_project()">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.name" id="name" class="form-control"
<input type="text" ng-model="project.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus">
<label for="name">Tên Dự Án</label>
<span>{{lstProject.name}}</span>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.descriptions" id="descriptions"
<input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
......@@ -29,14 +28,14 @@
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="lstProject.startDate" id="startDate" class="form-control"
<input type="date" ng-model="project.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="lstProject.endDate" id="endDate" class="form-control"
<input type="date" ng-model="project.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
......
......@@ -8,7 +8,6 @@ function showProject($scope, $http) {
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
//success code
console.log(response.data);
{
$scope.listProject = response.data
......@@ -20,8 +19,7 @@ function showProject($scope, $http) {
console.log("can't get data!!");
}
};
// tạo controllers insert APT
// tạo controllers insert API
function insertProject($scope, $http) {
$scope.insert_project = function () {
$http({
......@@ -31,7 +29,7 @@ function insertProject($scope, $http) {
url: 'http://localhost:8081/quan-tri/them-du-an',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.lstProject),
data: angular.toJson($scope.project),
//kiểu dữ liệu API
headers: {
'Content-Type': 'application/json'
......@@ -41,7 +39,7 @@ function insertProject($scope, $http) {
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.href = 'http://localhost:8081';
$window.location.href = 'http://localhost:8081/#!/';
}
//tạo funtion kiểm tra nếu thất bại
......@@ -63,22 +61,49 @@ function deleteProject($scope, $window, $http) {
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
$window.location.href = 'http://localhost:8081';
}, function (data, status) {
});
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.href = 'http://localhost:8081/#!/';
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
};
};
//tạo controller sửa theo id
function updateProject($scope, $window, $http) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/quan-tri/xoa-du-an',
data: $scope.project,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo service lấy id của đường dẫn
angular.module('ProjectApiModule.Services', []).factory('projectGetService', function ($resource) {
return $resource('http://localhost:8081/quan-tri/chi-tiet-du-an/:id', {id: '@myCarId'}, {
update: {
method: 'PUT'
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.href = 'http://localhost:8081/#!/';
}
});
});
//service kiểm tra id có tồn tại không
\ No newline at end of file
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
};
};
function editProject($scope){
}
\ No newline at end of file
......@@ -3,9 +3,9 @@
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="card-body">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
......@@ -27,7 +27,8 @@
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.statusGet }}</td>
<td><a data-ng-href="#" class="btn btn-info btn-circle btn-sm">
Xem </a> <a data-ng-href="#" class="btn btn-warning btn-circle btn-sm">
Xem </a>
<a ui-sref="editproject" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteProject"
data-ng-click="deleteProject(project)">Xóa</a>
......
/**
*
*/
angular.module("myApp").controller("projectController", function($scope, $http,$window) {
console.log("projectController");
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment