Commit 3cff4d6d authored by Phạm Duy Phi's avatar Phạm Duy Phi

no message

parent c853249a
quantrivanphong
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MockProject_01.iml" filepath="$PROJECT_DIR$/.idea/MockProject_01.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="a6b264f9-6d88-45e3-910e-981037057d12" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/classes/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectFrameBounds" extendedState="7">
<option name="x" value="100" />
<option name="y" value="20" />
<option name="width" value="1400" />
<option name="height" value="820" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="quantrivanphong" type="b2602c69:ProjectViewProjectNode" />
<item name="Scratches and Consoles" type="1a2a3e82:ScratchProjectViewPane$MyProjectNode" />
</path>
<path>
<item name="quantrivanphong" type="b2602c69:ProjectViewProjectNode" />
<item name="Scratches and Consoles" type="1a2a3e82:ScratchProjectViewPane$MyProjectNode" />
<item name="Extensions" type="d62648e6:ScratchProjectViewPane$MyRootNode" />
</path>
<path>
<item name="quantrivanphong" type="b2602c69:ProjectViewProjectNode" />
<item name="Scratches and Consoles" type="1a2a3e82:ScratchProjectViewPane$MyProjectNode" />
<item name="Extensions" type="d62648e6:ScratchProjectViewPane$MyRootNode" />
<item name="com.intellij.database" type="1e004dc1:ScratchProjectViewPane$MyRootNode$1$1" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="settings.editor.selected.configurable" value="editor.preferences.gutterIcons" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="a6b264f9-6d88-45e3-910e-981037057d12" name="Default Changelist" comment="" />
<created>1560753907370</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1560753907370</updated>
<workItem from="1560753917649" duration="77000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="77000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="754" extended-state="6" />
<layout>
<window_info id="Image Layers" />
<window_info id="Designer" />
<window_info id="UI Designer" />
<window_info id="Capture Tool" />
<window_info id="Favorites" side_tool="true" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24962178" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Terminal" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Palette" />
<window_info anchor="right" id="Theme Preview" />
<window_info anchor="right" id="Maven" />
<window_info anchor="right" id="Capture Analysis" />
<window_info anchor="right" id="Palette&#9;" />
<window_info anchor="right" id="Database" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
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;
import java.util.List;
@Service
public class CatalogiBusiness {
@Autowired
private CatalogiRepository catalogiRepository;
public Catalogi findCatalogiById(int id){
return catalogiRepository.findCatalogiById(id);
}
public List<Catalogi> findAllCatalogi(){
return catalogiRepository.findAllCatalogi();
}
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";
}
}
package com.itsol.quantrivanphong.access.homepage.business;
import com.itsol.quantrivanphong.access.homepage.repository.NewsRepository;
import com.itsol.quantrivanphong.exception.ResourceNotFoundException;
import com.itsol.quantrivanphong.model.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class NewsBusiness {
@Autowired
private NewsRepository newsRepository;
public List<News> findAllNews(){
return newsRepository.findAllNews();
}
// Find News By News Id
public News findNewsById(int newsId){
return newsRepository.findNewsById(newsId);
}
//Find news By Employee Id
public List<News> findByEmployeeId(int employeeId){
return newsRepository.findByEmployeeId(employeeId);
}
// FInd 4 latest news by câtlogiId
public List<News> findLatestNews(int catalogiId){
return newsRepository.getLatestNews(catalogiId);
}
// Find 4 latest news
public List<News> findAllLatestNews(){
return newsRepository.getAllLatestNews();
}
// Find news By Catalogi
public List<News> findByCatalogiId(int catalogiId){
return newsRepository.findByCatalogiId(catalogiId);
}
public News findNewsByIdAndEmployeeId(int id, int employeeId){
return newsRepository.findByIdAndEmployeeId(id,employeeId);
}
public News findNewsByIdAndAndCatalogiId(int id, int catalogiId){
return newsRepository.findByIdAndAndCatalogiId(id,catalogiId);
}
public News save(News news){
return newsRepository.save(news);
}
public News updateNews(int newsId, News newsDetails){
News news = newsRepository.findNewsById(newsId);
news.setTitle(newsDetails.getTitle());
news.setContent(newsDetails.getContent());
news.setSummary(newsDetails.getSummary());
news.setThumbnail(newsDetails.getThumbnail());
News updateNews = newsRepository.save(news);
return updateNews;
}
//
public String deleteNews(int newsId){
News news = newsRepository.findNewsById(newsId);
if(news == null){
throw new ResourceNotFoundException("News" ,"newsId",newsId);
}
newsRepository.delete(news);
return "ok";
}
}
package com.itsol.quantrivanphong.access.homepage.controller;
import com.itsol.quantrivanphong.access.homepage.business.CatalogiBusiness;
import com.itsol.quantrivanphong.exception.ResourceNotFoundException;
import com.itsol.quantrivanphong.model.Catalogi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/api")
public class CatalogiController {
@Autowired
private CatalogiBusiness catalogiBusiness;
@GetMapping("/catalogies")
public ResponseEntity<List<Catalogi>> getAllNews(){
return ResponseEntity.ok( catalogiBusiness.findAllCatalogi());
}
@GetMapping("/catalogies/{catalogiId}")
public Catalogi getCatalogiById(@PathVariable(value = "catalogiId") int catalogiId){
Catalogi catalogi = catalogiBusiness.findCatalogiById(catalogiId);
if(catalogi == null) {
throw new ResourceNotFoundException("Catalogi", "catalogiId", catalogiId);
}
return 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));
}
}
package com.itsol.quantrivanphong.access.homepage.controller;
import com.itsol.quantrivanphong.access.homepage.business.CatalogiBusiness;
import com.itsol.quantrivanphong.access.homepage.business.NewsBusiness;
import com.itsol.quantrivanphong.exception.ResourceNotFoundException;
import com.itsol.quantrivanphong.manager.employee.business.EmployeeBusiness;
import com.itsol.quantrivanphong.model.Catalogi;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.News;
import com.itsol.quantrivanphong.report.leaveform.controller.Notification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/api")
public class NewsController {
@Autowired
private NewsBusiness newsBusiness;
@Autowired
private CatalogiBusiness catalogiBusiness;
@Autowired
private EmployeeBusiness employeeBusiness;
// get All news
@GetMapping("/news")
public ResponseEntity<List<News>> getAllNews(){
return ResponseEntity.ok(newsBusiness.findAllNews());
}
@GetMapping("/news/{newsId}")
public News getNewsById(@PathVariable(value = "newsId") int newsId){
return newsBusiness.findNewsById(newsId);
}
// get news by employeeId
@GetMapping("/employees/{employeeId}/news")
public List<News> getAllNewsByEmployeeId(@PathVariable(value = "employeeId") int employeeId) {
return newsBusiness.findByEmployeeId(employeeId);
}
// get News by catalogiId
@GetMapping("/catalogi/{catalogiId}/news")
public List<News> getAllNewsByCatalogiId(@PathVariable(value="catalogiId") int catalogiId){
return newsBusiness.findByCatalogiId(catalogiId);
}
@GetMapping("/catalogi/{catalogiId}/news/{newsId}")
public News getNewsByCatalogiId(@PathVariable(value="catalogiId") int catalogiId,
@PathVariable(value="newsId") int newsId){
return newsBusiness.findNewsByIdAndAndCatalogiId(newsId,catalogiId);
}
// get LatestNews by catalogiId
@GetMapping("/catalogi/{catalogiId}/latestNews")
public List<News> getLatestNews(@PathVariable(value="catalogiId") int catalogiId){
return newsBusiness.findLatestNews(catalogiId);
}
//get Latest news
@GetMapping("/catalogi/latestNews")
public List<News> getAllLatestNews(){
return newsBusiness.findAllLatestNews();
}
@GetMapping("/employees/{employeeId}/news/{newsId}")
public News getAllNewsByEmployeeId(@PathVariable(value = "employeeId") int employeeId,
@PathVariable (value = "newsId") int newsId) {
return newsBusiness.findNewsByIdAndEmployeeId(newsId,employeeId);
}
// create news by employeesId, categoriId
@PostMapping("/HR/{employeeId}/catalogies/{catalogiId}/news")
public ResponseEntity createNews(@PathVariable (value = "employeeId") int employeeId,
@PathVariable (value = "catalogiId") int catalogiId,
@Valid @RequestBody News news) {
Employee employee = employeeBusiness.findById(employeeId);
Catalogi catalogi = catalogiBusiness.findCatalogiById(catalogiId);
if(employee == null){
throw new ResourceNotFoundException("Employee" ,"employeeId",employeeId);
}
if(catalogi==null){
throw new ResourceNotFoundException("Catalogi" ,"catalogiId",catalogiId);
}
news.setEmployee(employee);
news.setCatalogi(catalogi);
newsBusiness.save(news);
return ResponseEntity.ok(new Notification(200, "Success"));
}
// Edit news by EmployeeId
@PutMapping("HR/news/{newsId}")
public News updateNews(@PathVariable (value = "newsId") int newsId,
@Valid @RequestBody News newsRequest) {
if (newsBusiness.findNewsById(newsId)== null) {
throw new ResourceNotFoundException("News", "id", newsId);
}
return newsBusiness.updateNews(newsId,newsRequest);
}
//delete news by employeeId and newsId
@DeleteMapping("HR/news/{newsId}")
public ResponseEntity<?> deleteNews(@PathVariable (value = "newsId") int newsId) {
if(newsBusiness.findNewsById(newsId)== null){
throw new ResourceNotFoundException("News","newsId",newsId);
}
return ResponseEntity.ok(newsBusiness.deleteNews(newsId));
}
}
package com.itsol.quantrivanphong.access.homepage.repository;
import com.itsol.quantrivanphong.model.Catalogi;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CatalogiRepository extends JpaRepository<Catalogi, Integer> {
@Query("SELECT u from Catalogi u")
List<Catalogi> findAllCatalogi();
@Query("SELECT u FROM Catalogi u where u.id=:id")
Catalogi findCatalogiById(int id);
}
package com.itsol.quantrivanphong.access.homepage.repository;
import com.itsol.quantrivanphong.model.News;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface NewsRepository extends JpaRepository<News, Integer> {
@Query("SELECT u from News u")
List<News> findAllNews();
@Query("SELECT u FROM News u where u.id=:id")
News findNewsById(int id);
@Query(value="select * from News c where c.catalogi_id = ? ORDER BY c.created_at DESC limit 4",nativeQuery = true)
List<News> getLatestNews(int catalogiId);
@Query(value="select * from News c ORDER BY c.created_at DESC limit 4",nativeQuery = true)
List<News> getAllLatestNews();
List<News> findByEmployeeId(int employeeId);
List<News> findByCatalogiId(int catalogiId);
News findByIdAndEmployeeId(int id,int employeeId);
News findByIdAndAndCatalogiId(int id,int catalogiId);
}
package com.itsol.quantrivanphong.access.login.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EmployeeDTO {
private Integer id;
// tên đăng nhập
private String username;
// mật khẩu truy cập
private String password;
// ảnh đại diện
private String picture;
// họ
private String firstName;
// tên
private String lastName;
// email
private String email;
// số điện thoại
private String phoneNumber;
// tài khoản skype
private String skype;
// tài khoản facebook
private String facebookProfile;
// đối tượng
private String position;
// quê quán
private String homeTown;
// học vấn
private String education;
// trường
private String school;
// khoa
private String department;
// năm tốt nghiệp
private String graduationYear;
// kiểm tra tài khoản
private boolean checked;
// trạng thái kích hoạt
private int status;
}
package com.itsol.quantrivanphong.access.register.bussiness;
import com.itsol.quantrivanphong.access.register.dto.EmailDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
@Component
public class EmailBussiness {
@Autowired
private JavaMailSender sender;
public boolean sendEmail(EmailDTO emailDTO) {
boolean check;
// Recipient's email ID needs to be mentioned.
String to = emailDTO.getRecipientEmail();
// Sender's email ID needs to be mentioned
String from = "hieunv2496@gmail.com";
final String username = "hieunv2496@gmail.com";//change accordingly
final String password = "anhieu1996";//change accordingly
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
// Get the Session object.
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
// Create license default MimeMessage object.
Message message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to));
// Set Subject: header field
message.setSubject(emailDTO.getSubject());
// Send the actual HTML message, as big as you like
message.setContent(
emailDTO.getMessage(),
"text/html");
// Send message
Transport.send(message);
System.out.println("Sent message successfully....");
} catch (MessagingException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return true;
}
}
package com.itsol.quantrivanphong.access.register.controller;
import com.itsol.quantrivanphong.access.register.bussiness.RegisterBussiness;
import com.itsol.quantrivanphong.access.register.dto.RegisterDTO;
import com.itsol.quantrivanphong.exception.InputException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.InputMismatchException;
@RestController
@RequestMapping(path = "/user")
public class RegisterController {
@Autowired
private RegisterBussiness registerBussiness;
@PostMapping(path = "/register", consumes = "application/json", produces = "application/json")
public String register(@RequestBody RegisterDTO registerDTO) {
String mess ;
try {
if(registerDTO.getUsername().trim().equals("")) throw new InputException("Username is not null");
if(registerDTO.getUsername().length()< 5 || registerDTO.getUsername().length() > 18) throw new InputException("Username in 5 - 18 characters");
if(registerDTO.getLastName().equals("")) throw new InputException("Last name is not null");
if(registerDTO.getEmailAddress().equals("")) throw new InputException("Email address is not null");
if(registerDTO.getGraduationYear() < 0) throw new InputException("lỗi năm < 0") ;
mess = registerBussiness.register(registerDTO);
}catch (InputException e){
mess = e.getMessage();
}catch (InputMismatchException e){
mess = e.getMessage();
}catch (Exception e){
mess = e.getMessage();
}
return mess;
}
}
package com.itsol.quantrivanphong.manager.project.project.bussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.report.issue.common.AbstractDaoPage;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import java.util.List;
public interface ProjectBussiness {
// Danh sách dự án tất cả các dự án
List<ProjectDTO> findAllProject();
// upload thông tin dự án
WrapperResult updateProject(ProjectDTO dto);
// thêm dự án mới
WrapperResult saveProject(ProjectDTO dto);
// tìm kiếm dự án theo id
ProjectDTO findByProjectId(Integer id);
// xóa một project
WrapperResult deleteProjectById(Integer ids);
AbstractDaoPage<ProjectDTO> getPageProject(int page, int pageSize);
}
package com.itsol.quantrivanphong.manager.project.project.bussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.report.issue.common.AbstractDaoPage;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class ProjectBussinessImpl implements ProjectBussiness {
private Logger logger = Logger.getLogger(ProjectBussinessImpl.class);
@Autowired
private ProjectRepository projectRepository;
@Override
public List<ProjectDTO> findAllProject() {
try {
return lstDTO(projectRepository.findAll());
} catch (Exception e) {
logger.info("Lỗi findAll " + e.getMessage());
}
return null;
}
@Override
public WrapperResult updateProject(ProjectDTO dto) {
String views = null;
int status = 113;
try {
ProjectDTO projectDTO = findByProjectId(dto.getId());
dto.setStartDate(projectDTO.getStartDate());
dto.setEndDate(projectDTO.getEndDate());
if (dto.getStartDate() == null) {
views = "ngày bắt đầu dự án không được null";
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else if (projectDTO != null) {
ProjectDTO updateProject = modelparseDto(projectRepository.save(dtoParseModels(dto)));
if (updateProject != null) {
views = "sửa thành công project";
status = 200;
}
} else {
views = "không tìm thấy project phù hợp";
}
} catch (Exception e) {
logger.info("Lỗi update" + e.getMessage());
views = "lỗi update project";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult saveProject(ProjectDTO dto) {
String views = null;
int status = 113;
if (projectRepository.findByName(dto.getName()) == null) {
try {
if (dto.getStartDate() == null) {
views = "ngày bắt đầu dự án không được null";
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else {
dto.setStatus(0);
// projectRepository.saveEntity(dtoParseModels(dto));
ProjectDTO saveProject = modelparseDto(projectRepository.save(dtoParseModels(dto)));
if (saveProject != null) {
views = "thêm thành công project !";
status = 200;
} else {
views = "thêm project không thành công!";
}
}
} catch (Exception e) {
logger.info("Lỗi insert " + e.getMessage());
views = "Lỗi thêm dữ liệu";
}
} else {
views = "Đã tồn tại Dự Án";
}
return new WrapperResult(status, views);
}
@Override
public ProjectDTO findByProjectId(Integer id) {
try {
ProjectDTO projectDTO = modelparseDto(projectRepository.findProjectById(id));
if (projectDTO != null) {
return projectDTO;
}
} catch (Exception e) {
logger.info("( Lỗi tìm kiếm ) " + e.getMessage());
}
return null;
}
@Override
public WrapperResult deleteProjectById(Integer id) {
String views = null;
int status = 113;
logger.info("deleteProjectById");
if (findByProjectId(id) != null) {
try {
projectRepository.deleteById(id);
views = "xóa thành công project";
status = 200;
} catch (Exception e) {
logger.info("lỗi :" + e.getMessage());
views = "Lỗi xóa";
}
} else {
views = "dự án không tồn tại không tồn tại";
}
return new WrapperResult(status, views);
}
@Override
public AbstractDaoPage<ProjectDTO> getPageProject(int page, int pageSize) {
AbstractDaoPage<ProjectDTO> abstractDaoPage = new AbstractDaoPage<ProjectDTO>();
List<Project> lstM = getListPage(page,pageSize);
List<ProjectDTO> listDTO = lstDTO(lstM);
abstractDaoPage.setLstResult(listDTO);
abstractDaoPage.setPage(page);
abstractDaoPage.setMaxPageItem(pageSize);
abstractDaoPage.setTotalItem(findAllProject().size());
abstractDaoPage.setTotalPage((int)Math.ceil((double) abstractDaoPage.getTotalItem()/abstractDaoPage.getMaxPageItem()));
return abstractDaoPage;
}
public List<Project> getListPage(int page, int pageSize) {
Pageable paging = PageRequest.of(page,pageSize);
Page<Project> pagedResult = projectRepository.findAll(paging);
if(pagedResult.hasContent()) {
return pagedResult.getContent();
} else {
return new ArrayList<Project>();
}
}
public List<ProjectDTO> lstDTO(List<Project> lstModels) {
List<ProjectDTO> lstDTO = new ArrayList<>();
for (Project project : lstModels) {
lstDTO.add(modelparseDto(project));
}
return lstDTO;
}
public ProjectDTO modelparseDto(Project model) {
ProjectDTO dto = new ProjectDTO();
dto.setId(model.getId());
dto.setName(model.getName());
dto.setDescriptions(model.getDescriptions());
dto.setStartDate(model.getStartDate());
dto.setEndDate(model.getEndDate());
dto.setStatus(model.getStatus());
return dto;
}
public Project dtoParseModels(ProjectDTO projectDTO) {
Project project = new Project();
project.setId(projectDTO.getId());
project.setName(projectDTO.getName());
project.setDescriptions(projectDTO.getDescriptions());
project.setStartDate(projectDTO.getStartDate());
project.setEndDate(projectDTO.getEndDate());
project.setStatus(projectDTO.getStatus());
return project;
}
}
package com.itsol.quantrivanphong.manager.project.project.controller;
import com.itsol.quantrivanphong.manager.project.project.bussiness.ProjectBussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/quan-tri")
public class ProjectController {
@Autowired
private ProjectBussiness projectBussiness;
@GetMapping(value = "/danh-sach-du-an")
public ResponseEntity<List<ProjectDTO>> getAllProject(){
return ResponseEntity.ok(projectBussiness.findAllProject());
}
@GetMapping(value = "/danh-sach-du-an/{page}/{pageSize}")
public ResponseEntity getPageProject(@PathVariable("page") int page, @PathVariable("pageSize") int pageSize){
return ResponseEntity.ok(projectBussiness.getPageProject(page,pageSize));
}
@GetMapping(value = "/chi-tiet-du-an/{id}",produces = SystemConstants.TYPE_JSON)
public ResponseEntity findProjectId(@PathVariable Integer id){
ProjectDTO projectDTO = projectBussiness.findByProjectId(id);
return ResponseEntity.ok(projectDTO);
}
@PostMapping(value = "/them-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity saveProject(@RequestBody ProjectDTO projectDTO){
WrapperResult wrapperResult = projectBussiness.saveProject(projectDTO);
return ResponseEntity.ok(wrapperResult);
}
@PutMapping(value = "/sua-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity updateProject(@RequestBody ProjectDTO projectDTO){
WrapperResult wrapperResult = projectBussiness.updateProject(projectDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProjectById(@RequestBody ProjectDTO projectDTO){
WrapperResult wrapperResult = projectBussiness.deleteProjectById(projectDTO.getId());
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.manager.project.project.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProjectDTO {
private Integer id;
// tên project
private String name;
//mô tả ngắn
private String descriptions;
//ngày bắt đầu của dự án
private Timestamp startDate;
//ngày kết thúc dự án
private Timestamp endDate;
//trạng thái thêm vào dataBase
private Integer status;
// danh sách id
private Integer[] ids;
}
package com.itsol.quantrivanphong.manager.project.project.repository;
import com.itsol.quantrivanphong.model.Project;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectRepository extends JpaRepository<Project,Integer> {
Project findProjectById(Integer id);
Project findProjectByName(String nameProject);
Project findByName(String nameProject);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.bussiness;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import java.util.List;
public interface ProjectGroupBussiness {
// chi tiết nhóm dự án
List<ProjectGroupDTO> getGroupByProjectId(Integer projectId);
// thêm thành viên vào nhóm dự án
WrapperResult saveEmployeeProject(ProjectGroupDTO dto);
// sửa thông tin nhóm dự án, các thành viên out nhóm
WrapperResult updateEmployeeProject(ProjectGroupDTO dto);
// thành viên out dự án
WrapperResult deleteEmployeeProject(Integer id);
WrapperResult updateEmployeeOutGroup(ProjectGroupDTO dto);
ProjectGroupDTO findEmployeeProjectById(Integer id);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.bussiness;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.manager.project.projectgroup.common.EmployeeProject;
import com.itsol.quantrivanphong.manager.project.projectgroup.common.ProjectGroupUtils;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.manager.project.projectgroup.repository.ProjectGroupRepository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.List;
@Service
public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
private Logger logger = Logger.getLogger(ProjectGroupBussinessImpl.class);
@Autowired
private ProjectGroupRepository projectGroupRepository;
@Autowired
private ProjectRepository projectRepository;
@Autowired
private ProjectGroupUtils utils;
@Autowired
private EmployeeProject employeeProject;
@Override
public List<ProjectGroupDTO> getGroupByProjectId(Integer projectId) {
logger.info("getGroupByProjectId");
List<Eproject> lstModels = projectGroupRepository.findByProjectId(projectId);
List<ProjectGroupDTO> lstDTO = utils.getListDTO(lstModels);
return lstDTO;
}
public boolean checkEmployeeInGroupProject(ProjectGroupDTO dto) {
if (dto.getProjectId()!=null) {
List<Eproject> lst = projectGroupRepository.findByProjectId(dto.getProjectId());
for (Eproject eproject : lst) {
if (eproject.getEmployee().getUsername().equals(dto.getUserName())) {
return true;
}
}
}
return false;
}
@Override
public WrapperResult saveEmployeeProject(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("saveEmployeeProject");
Employee employee = employeeProject.findByUsername(dto.getUserName());
if (employee == null) {
views = "Nhân viên không tồn tại !";
} else if (!checkEmployeeInGroupProject(dto)) {
try {
dto.setStatus(1);
dto.setUserId(employee.getId());
dto.setJoinDate(new Timestamp(System.currentTimeMillis()));
Eproject eproject = projectGroupRepository.save(utils.Model(dto));
if (eproject != null) {
views = "thêm thành công nhân viên vào nhóm dự án";
status = 200;
} else {
views = "thêm không thành công!";
}
} catch (Exception e) {
logger.info("Lỗi " + e.getMessage());
}
} else {
status = 113;
views = "thành viên đã tồn tại";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult updateEmployeeProject(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("updateEmployeeProject");
Eproject eproject = projectGroupRepository.findEprojectById(dto.getId());
if (eproject != null) {
eproject.setPosition(dto.getPosition());
Eproject updateProjectGroup = projectGroupRepository.save(eproject);
if (updateProjectGroup != null) {
views = "cập nhật chức vụ thành viên thành công";
status = 200;
}
} else {
views = "đối tượng không tồn tại";
}
return new WrapperResult(status, views);
}
@Override
public ProjectGroupDTO findEmployeeProjectById(Integer id) {
try {
ProjectGroupDTO projectGroupDTO = utils.DTO(projectGroupRepository.findEprojectById(id));
if (projectGroupDTO != null) {
return projectGroupDTO;
}
} catch (Exception e) {
logger.info("Lỗi update EProject " + e.getMessage());
}
return null;
}
@Override
public WrapperResult deleteEmployeeProject(Integer id) {
String views = "";
int status = 113;
logger.info("deleteEmployeeProject");
if (projectGroupRepository.findEprojectById(id) != null) {
projectGroupRepository.deleteById(id);
views = "Bạn đã cho thoát ra khỏi nhóm";
status = 200;
} else {
views = "Thành viên không tồn tại trong nhóm";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult updateEmployeeOutGroup(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("updateEmployeeOutGroup");
Eproject eproject = projectGroupRepository.findEprojectById(dto.getId());
if (eproject != null) {
eproject.setStatus(2);
eproject.setOutDate(new Timestamp(System.currentTimeMillis()));
Eproject updateProjectGroup = projectGroupRepository.save(eproject);
if (updateProjectGroup != null) {
views = "thành viên đã out nhóm";
status = 200;
}
} else {
views = "đối tượng không tồn tại";
}
return new WrapperResult(status, views);
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.common;
import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EmployeeProject extends JpaRepository<Employee,Integer> {
Employee findEmployeeById(Integer employeeId);
Employee findByUsername(String username);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.common;
import com.itsol.quantrivanphong.access.login.dto.EmployeeDTO;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.Project;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class ProjectGroupUtils {
private static Logger logger = Logger.getLogger(ProjectGroupUtils.class);
@Autowired
private EmployeeProject employeeRepository;
@Autowired
private ProjectRepository projectRepository;
public Eproject Model(ProjectGroupDTO dto){
Eproject model = new Eproject();
model.setId(dto.getId());
model.setJoinDate(dto.getJoinDate());
model.setOutDate(dto.getOutDate());
model.setPosition(dto.getPosition());
model.setStatus(dto.getStatus());
try{
Employee findEmployee = employeeRepository.findEmployeeById(dto.getUserId());
if(findEmployee!=null){
model.setEmployee(findEmployee);
}
}catch (Exception e){
logger.info("(Lỗi không tìm thấy Employee) "+e.getMessage());
}
try{
Project project = projectRepository.findProjectById(dto.getProjectId());
if(project!=null){
model.setProject(project);
}
}catch (Exception e){
logger.info("(Lỗi không tìm thấy Project) "+e.getMessage());
}
return model;
}
public ProjectGroupDTO DTO(Eproject models) {
ProjectGroupDTO dto = new ProjectGroupDTO();
dto.setId(models.getId());
// set project
ProjectDTO projectDTO = new ProjectDTO();
BeanUtils.copyProperties(models.getProject(),projectDTO);
dto.setProjectDTO(projectDTO);
// set employee
EmployeeDTO employeeDTO = new EmployeeDTO();
employeeDTO.setId(models.getEmployee().getId());
employeeDTO.setUsername(models.getEmployee().getUsername());
employeeDTO.setLastName(models.getEmployee().getLastName());
employeeDTO.setEmail(models.getEmployee().getEmailAddress());
employeeDTO.setFacebookProfile(models.getEmployee().getFacebookProfile());
employeeDTO.setSkype(models.getEmployee().getSkype());
dto.setEmployeeDTO(employeeDTO);
dto.setJoinDate(models.getJoinDate());
dto.setOutDate(models.getOutDate());
dto.setPosition(models.getPosition());
return dto;
}
public List<ProjectGroupDTO> getListDTO(List<Eproject> lstModel){
if(!lstModel.isEmpty()||lstModel.size()!=0){
List<ProjectGroupDTO> lstDTO = new ArrayList<ProjectGroupDTO>();
for (Eproject eproject:lstModel) {
lstDTO.add(DTO(eproject));
}
return lstDTO;
}
return null;
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.controller;
import com.itsol.quantrivanphong.manager.project.projectgroup.bussiness.ProjectGroupBussiness;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class ProjectGroupController {
@Autowired
private ProjectGroupBussiness projectGroupBussiness;
// thông tin của 1 nhóm dư án theo id của dự án
// Team lead,Hr
@GetMapping(value = "/thong-tin-du-an/{id}")
public ResponseEntity getOneProjectGroup(@PathVariable("id") Integer projectId) {
return ResponseEntity.ok(projectGroupBussiness.getGroupByProjectId(projectId));
}
@GetMapping(value = "/chi-tiet-thanh-vien-du-an/{id}")
public ResponseEntity getOneEmployeeProject(@PathVariable("id") Integer employeeProjectId) {
return ResponseEntity.ok(projectGroupBussiness.findEmployeeProjectById(employeeProjectId));
}
// thêm thành viên vào dự án
// hr,manager, teamlead thêm thành viên
@PostMapping(value = "/them-thanh-vien")
public ResponseEntity addMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
WrapperResult wrapperResult = projectGroupBussiness.saveEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
// cập nhật thông tin thành viên
// manager cập nhật chức vụ cho nhân viên vào xét duyệt vào dự án
@PutMapping(value = "/cap-nhat-chuc-vu-thanh-vien")
public ResponseEntity updatePositionProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
WrapperResult wrapperResult = projectGroupBussiness.updateEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
@PutMapping(value = "/thanh-vien-out-nhom")
public ResponseEntity updateMemberOutProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
WrapperResult wrapperResult = projectGroupBussiness.updateEmployeeOutGroup(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-thanh-vien-du-an")
public ResponseEntity deleteMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO){
WrapperResult wrapperResult = projectGroupBussiness.deleteEmployeeProject(projectGroupDTO.getId());
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.dto;
import com.itsol.quantrivanphong.access.login.dto.EmployeeDTO;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProjectGroupDTO {
private int id;
// chức vụ trong project
private String position;
//ngày vào dự án
private Timestamp joinDate;
// ngày ra dự án
private Timestamp outDate;
private int status;
private Integer userId;
private Integer projectId;
private String userName;
private String nameProject;
private EmployeeDTO employeeDTO;
private ProjectDTO projectDTO;
}
package com.itsol.quantrivanphong.manager.project.projectgroup.repository;
import com.itsol.quantrivanphong.model.Eproject;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProjectGroupRepository extends JpaRepository<Eproject,Integer> {
List<Eproject> findByProjectId(Integer projectId);
Eproject findEprojectById(Integer eProjectId);
}
package com.itsol.quantrivanphong.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "catalogi")
public class Catalogi {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
@Column(name = "name", length = 128)
private String name;
@Column(name = "descriptions")
private String descriptions;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "catalogi")
private List<News> news = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "eproject")
public class Eproject {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
// chức vụ trong project
@Column(name = "position", nullable = false)
private String position;
//ngày vào dự án
@Column(name = "join_date",nullable =false)
private Timestamp joinDate;
// ngày ra dự án
@Column(name = "out_date",nullable = true)
private Timestamp outDate;
@Column(name = "status",nullable = false)
private int status;
@ManyToOne(fetch = FetchType.EAGER)
private Employee employee;
@ManyToOne(fetch = FetchType.EAGER)
private Project project;
@JsonIgnore
@OneToMany(mappedBy = "eproject", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<TimeSheet> timeSheetList = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "issues")
public class Issues {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
// tiêu đề liên quan
@Column(name = "title")
private String title;
//nội dung
@Column(name = "content")
private String actionCode;
// trạng thái vấn đề đó trong project
@Column(name = "status")
private int status;
@Column(name = "startdate")
private Timestamp startDate;
@ManyToOne(fetch = FetchType.EAGER)
private Project project;
@JsonIgnore
@OneToMany(mappedBy = "issues", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<IssuesComment> issuesCommentList = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "issuescomment")
public class IssuesComment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
//nội dung
@Column(name = "content")
private String contentIssuse;
@Column(name = "usercreate")
private String userCreate;
@Column(name = "createdate")
private Timestamp createDate;
@ManyToOne(fetch = FetchType.EAGER)
private Issues issues;
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "leave_type")
@Builder
public class LeaveType {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
@Column(name = "name")
private String name;
@Column(name = "descriptions")
private String descriptions;
@Column(name = "status")
private boolean status;
@JsonIgnore
@OneToMany(mappedBy = "leaveType", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<LeaveForm> leaveFormList = new ArrayList<>();
}
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.*;
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, allowGetters = true)
@Table(name = "news")
public class News extends DateAudit {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
@Column(name = "thumbnail", length = 128)
private String thumbnail;
@Column(name = "title")
private String title;
@Column(name = "summary")
private String summary;
@Column(name = "content")
private String content;
@Column(name = "status")
private boolean status;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "catalogi_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Catalogi catalogi;
@ManyToOne(fetch = FetchType.EAGER)
private Employee employee;
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "project")
public class Project {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
// tên project
@Column(name = "name", nullable = false)
private String name;
//mô tả ngắn
@Column(name = "descriptions")
private String descriptions;
//ngày bắt đầu của dự án
@Column(name = "start_date", nullable = false)
private Timestamp startDate;
//ngày kết thúc dự án
@Column(name = "end_date")
private Timestamp endDate;
//trạng thái
@Column(name = "status",nullable = false)
private Integer status;
@JsonIgnore
@OneToMany(mappedBy = "project", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<Eproject> eprojectList = new ArrayList<>();
@JsonIgnore
@OneToMany(mappedBy = "project", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<ProjectReport> projectReportList = new ArrayList<>();
@JsonIgnore
@OneToMany(mappedBy = "project", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<Issues> issuesList = new ArrayList<>();
}
package com.itsol.quantrivanphong.report.issue.bussiness;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import com.itsol.quantrivanphong.report.issue.repository.IssueRepository;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Service
public class IssueBussinesImpl implements IssueBussiness {
Logger logger = Logger.getLogger(IssueBussinesImpl.class);
@Autowired
private IssueRepository issueRepository;
@Autowired
private ProjectRepository projectRepository;
@Override
public List<Issues> getAllIssue() {
return issueRepository.findAll();
}
@Override
public WrapperResult saveIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
issueDTO.setStatus(0);
issueDTO.setStartDate(new Timestamp(System.currentTimeMillis()));
Issues saveIssues = issueRepository.save(dtoParseModels(issueDTO));
if (saveIssues != null) {
views = "thêm thành công Issues !";
status = 200;
} else {
views = "thêm Issues không thành công!";
}
} catch (Exception e) {
logger.info("Lỗi insert " + e.getMessage());
views = "Lỗi thêm dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult updateIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
Issues issues = issueRepository.findIssuesById(issueDTO.getId());
if (issues != null) {
if (issues.getStatus() == 0) {
issues.setStatus(1);
}else{
issues.setStatus(0);
}
Issues saveIssues = issueRepository.save(issues);
if (saveIssues != null) {
views = "Cập nhật thành công Issues !";
status = 200;
} else {
views = "không thành công!";
}
} else {
views = "Issue không tồn tại!";
}
} catch (Exception e) {
logger.info("Lỗi Cập nhật " + e.getMessage());
views = "Lỗi Cập nhật dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult deleteIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
Issues issues = issueRepository.findIssuesById(issueDTO.getId());
if (issues != null) {
issueRepository.deleteById(issueDTO.getId());
views = "Xóa thành công Issues !";
status = 200;
} else {
views = "Issue không tồn tại!";
}
} catch (Exception e) {
logger.info("Lỗi Delete " + e.getMessage());
views = "Lỗi xóa dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public Issues findIssueById(Integer id) {
return issueRepository.findIssuesById(id);
}
public IssueDTO modelsParseDTO(Issues models) {
IssueDTO issueDTO = new IssueDTO();
BeanUtils.copyProperties(models, issueDTO);
return issueDTO;
}
public Issues dtoParseModels(IssueDTO dto) {
Issues issues = new Issues();
BeanUtils.copyProperties(dto, issues);
issues.setProject(projectRepository.findProjectById(dto.getProjectId()));
return issues;
}
public List<IssueDTO> lstModel(List<Issues> lstModel) {
if (lstModel.size() != 0 && !lstModel.isEmpty()) {
List<IssueDTO> lstDTO = new ArrayList<IssueDTO>();
for (Issues issues : lstModel) {
lstDTO.add(modelsParseDTO(issues));
}
return lstDTO;
}
return null;
}
}
package com.itsol.quantrivanphong.report.issue.bussiness;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import java.util.List;
public interface IssueBussiness {
List<Issues> getAllIssue();
WrapperResult saveIssue(IssueDTO issueDTO);
WrapperResult updateIssue(IssueDTO issueDTO);
WrapperResult deleteIssue(IssueDTO issueDTO);
Issues findIssueById(Integer id);
}
package com.itsol.quantrivanphong.report.issue.common;
import java.util.ArrayList;
import java.util.List;
public class AbstractDaoPage<T> {
private List<T> lstResult = new ArrayList<T>();
// Số page đang đứng
private int page;
// Tổng sô page trong 1 item
private Integer maxPageItem;
// Tổng số page hiện tại
private int totalPage;
// Tổng số item
private int totalItem;
private int Count;
public List<T> getLstResult() {
return lstResult;
}
public void setLstResult(List<T> lstResult) {
this.lstResult = lstResult;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public Integer getMaxPageItem() {
return maxPageItem;
}
public void setMaxPageItem(Integer maxPageItem) {
this.maxPageItem = maxPageItem;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalItem() {
return totalItem;
}
public void setTotalItem(int totalItem) {
this.totalItem = totalItem;
}
public int getCount() {
return (lstResult!=null)?lstResult.size():0;
}
}
package com.itsol.quantrivanphong.report.issue.common;
public class WrapperResult {
private int status;
private String message;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public WrapperResult(int status, String message) {
this.status = status;
this.message = message;
}
}
package com.itsol.quantrivanphong.report.issue.common;
import java.util.List;
public class WrapperResultObject {
private int status;
private String message;
private List<String> lstRole;
private String Role;
public String getRole() {
return Role;
}
public void setRole(String role) {
Role = role;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<String> getLstRole() {
return lstRole;
}
public void setLstRole(List<String> lstRole) {
this.lstRole = lstRole;
}
public WrapperResultObject(int status, String message, List<String> lstRole) {
this.status = status;
this.message = message;
this.lstRole = lstRole;
}
public WrapperResultObject(int status, String message, List<String> lstRole, String role) {
this.status = status;
this.message = message;
this.lstRole = lstRole;
Role = role;
}
}
package com.itsol.quantrivanphong.report.issue.controller;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.bussiness.IssueBussiness;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class IssueController {
@Autowired
private IssueBussiness issueBussiness;
@GetMapping(value = "/danh-sach-issues")
public ResponseEntity getAllIssue(){
return ResponseEntity.ok(issueBussiness.getAllIssue());
}
@GetMapping(value = "/chi-tiet-issues/{id}")
public ResponseEntity getIssueById(@PathVariable("id")Integer id){
Issues issues = issueBussiness.findIssueById(id);
if(issues!=null){
return ResponseEntity.ok(issues);
}
return ResponseEntity.ok("Issues không tồn tại");
}
@PostMapping(value = "/them-issues")
public ResponseEntity saveIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.saveIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
@PutMapping(value = "/sua-issues")
public ResponseEntity editIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.updateIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-issues")
public ResponseEntity deleteIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.deleteIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.report.issue.dto;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IssueDTO {
private Integer id;
private String title;
private String actionCode;
private Timestamp startDate;
private int status;
private Integer projectId;
private ProjectDTO projectDTO;
}
package com.itsol.quantrivanphong.report.issue.repository;
import com.itsol.quantrivanphong.model.Issues;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IssueRepository extends JpaRepository<Issues, Integer> {
Issues findIssuesById(Integer id);
}
package com.itsol.quantrivanphong.report.leaveform.business;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.LeaveForm;
import com.itsol.quantrivanphong.model.LeaveType;
import com.itsol.quantrivanphong.report.leaveform.dto.LeaveFormDTO;
import com.itsol.quantrivanphong.report.leaveform.repository.LeaveFormRepository;
import com.itsol.quantrivanphong.report.leavetype.repository.LeaveTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class LeaveFormBusiness {
@Autowired
LeaveFormRepository leaveFormRepository;
@Autowired
LeaveTypeRepository leaveTypeRepository;
@Autowired
EmployeeRepository employeeRepository;
public List<LeaveForm> findAll() {
return leaveFormRepository.findAll();
}
public String addLeaveForm(LeaveFormDTO leaveFormDTO) {
String message;
Employee employee = employeeRepository.findEmployeeById(leaveFormDTO.getEmployeeId());
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveFormDTO.getLeaveTypeId());
if (employee != null) {
if (leaveType != null) {
LeaveForm leaveForm = leaveFormRepository.save(LeaveForm.builder()
.title(leaveFormDTO.getTitle())
.content(leaveFormDTO.getContent())
.status(false)
.employee(employee)
.leaveType(leaveType).build());
if (leaveForm != null) {
message = "Insert leave form success";
} else {
message = "Insert leave form failed";
}
} else {
message = "Leave Type does not exist";
}
} else {
message = "Employee does not exist";
}
return message;
}
@Transactional
public String deleteLeaveForm(int leaveFormId) {
String message;
LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveFormId);
if (leaveForm != null) {
leaveFormRepository.delete(leaveForm);
if (leaveFormRepository.findLeaveFormById(leaveFormId) != null) {
message = "Delete failed!";
} else {
message = "Delete success!";
}
} else {
message = "Leave Form does not exist";
}
return message;
}
@Transactional
public String updateLeaveForm(LeaveFormDTO leaveFormDTO) {
String message;
Employee employee = employeeRepository.findEmployeeById(leaveFormDTO.getEmployeeId());
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveFormDTO.getLeaveTypeId());
LeaveForm leaveForm = leaveFormRepository.findLeaveFormByEmployeeAndLeaveTypeAndId(employee, leaveType, leaveFormDTO.getId());
if (leaveType != null) {
if (leaveForm != null) {
int i = leaveFormRepository.updateLeaveForm(leaveFormDTO.getTitle(), leaveFormDTO.getContent(), leaveFormDTO.getId());
if (i == 1) {
message = "Update success";
} else {
message = "Update failed";
}
} else {
message = "Leave Type does not exist";
}
} else {
message = "Leave Form does not exist";
}
return message;
}
@Transactional
public String updateLeaveFormStatus(int leaveformId) {
String message;
LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveformId);
if (leaveForm != null) {
if (leaveForm.isStatus()) {
message = "Status can not change";
} else {
int i = leaveFormRepository.updateLeaveFormStatus(leaveformId);
if (i == 1) {
message = "Update status success";
} else {
message = "Update status failed";
}
}
} else {
message = "Leave Form does not exist";
}
return message;
}
public List<LeaveForm> showLeaveFormByEmployeeId(int employeeId) {
Employee employee = employeeRepository.findEmployeeById(employeeId);
if (employee != null) {
if (leaveFormRepository.showLeaveFormById(employee) != null) {
return leaveFormRepository.showLeaveFormById(employee);
} else {
return null;
}
} else {
return null;
}
}
public LeaveForm showLeaveFormById(int id) {
return leaveFormRepository.findLeaveFormById(id);
}
public List<LeaveType> getLeaveTypeList() {
return leaveTypeRepository.findAll();
}
}
package com.itsol.quantrivanphong.report.leaveform.controller;
import com.itsol.quantrivanphong.exception.InputException;
import com.itsol.quantrivanphong.model.LeaveForm;
import com.itsol.quantrivanphong.model.LeaveType;
import com.itsol.quantrivanphong.report.leaveform.business.LeaveFormBusiness;
import com.itsol.quantrivanphong.report.leaveform.dto.LeaveFormDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(path = "/employee")
public class LeaveFormController {
@Autowired
LeaveFormBusiness leaveFormBusiness;
@GetMapping(path = "/leaveform/show")
public ResponseEntity<List<LeaveForm>> showAllLeaveForm() {
return ResponseEntity.ok(leaveFormBusiness.findAll());
}
@PostMapping(path = "/leaveform/add", consumes = "application/json", produces = "application/json")
public ResponseEntity addLeaveForm(@RequestBody LeaveFormDTO leaveFormDTO) {
String message;
try {
if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = leaveFormBusiness.addLeaveForm(leaveFormDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
@DeleteMapping("/leaveform/delete/{leaveformId}")
public ResponseEntity deleteLeaveForm(@PathVariable int leaveformId) {
return ResponseEntity.ok(new Notification(200, leaveFormBusiness.deleteLeaveForm(leaveformId)));
}
@PostMapping(path = "/leaveform/update", consumes = "application/json", produces = "application/json")
public ResponseEntity updateLeaveForm(@RequestBody LeaveFormDTO leaveFormDTO) {
String message;
try {
if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = leaveFormBusiness.updateLeaveForm(leaveFormDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
@PostMapping(path = "/leaveform/{leaveformId}/status")
public ResponseEntity updateLeaveFormStatus(@PathVariable int leaveformId) {
String message;
message = leaveFormBusiness.updateLeaveFormStatus(leaveformId);
return ResponseEntity.ok(new Notification(200, message));
}
@GetMapping("/leaveform/show/{employeeId}")
public ResponseEntity<List<LeaveForm>> showLeaveFormByEmployeeId(@PathVariable int employeeId) {
if (leaveFormBusiness.showLeaveFormByEmployeeId(employeeId) != null) {
return ResponseEntity.ok(leaveFormBusiness.showLeaveFormByEmployeeId(employeeId));
} else {
return null;
}
}
@GetMapping("/leaveform/{id}")
public ResponseEntity<LeaveForm> showLeaveFormById(@PathVariable int id) {
return ResponseEntity.ok(leaveFormBusiness.showLeaveFormById(id));
}
@GetMapping(path = "/leaveType/getAll")
public ResponseEntity<List<LeaveType>> getAllLeaveType() {
return ResponseEntity.ok(leaveFormBusiness.getLeaveTypeList());
}
}
package com.itsol.quantrivanphong.report.leaveform.controller;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Notification {
private int status;
private String view;
}
package com.itsol.quantrivanphong.report.leaveform.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LeaveFormDTO {
private int id;
private String title;
private String content;
private boolean status;
private int employeeId;
private int leaveTypeId;
}
package com.itsol.quantrivanphong.report.leaveform.repository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.LeaveForm;
import com.itsol.quantrivanphong.model.LeaveType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface LeaveFormRepository extends JpaRepository<LeaveForm, Integer> {
// @Query("select lf from LeaveForm lf")
// List<LeaveForm> findAll();
LeaveForm findLeaveFormByEmployeeAndId(Employee employee, int id);
LeaveForm findLeaveFormById(int i);
LeaveForm findLeaveFormByEmployeeAndLeaveTypeAndId(Employee employee, LeaveType leaveType, int id);
@Modifying
@Query("update LeaveForm lf set lf.title = ?1, lf.content = ?2 where lf.id = ?3")
int updateLeaveForm(String title, String content, int id);
@Modifying
@Query("update LeaveForm lf set lf.status = true where lf.id = ?1")
int updateLeaveFormStatus(int id);
@Query("select lf from LeaveForm lf where lf.employee = ?1")
List<LeaveForm> showLeaveFormById(Employee employee);
}
package com.itsol.quantrivanphong.report.leavetype.business;
import com.itsol.quantrivanphong.model.LeaveType;
import com.itsol.quantrivanphong.report.leavetype.dto.LeaveTypeDTO;
import com.itsol.quantrivanphong.report.leavetype.repository.LeaveTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class LeaveTypeBusiness {
@Autowired
LeaveTypeRepository leaveTypeRepository;
public String addLeaveType(LeaveTypeDTO leaveTypeDTO) {
String message;
LeaveType leaveType = leaveTypeRepository.save(LeaveType.builder()
.name(leaveTypeDTO.getName())
.descriptions(leaveTypeDTO.getDescriptions())
.status(true)
.build());
if (leaveType != null) {
message = "Insert leave type success";
} else {
message = "Insert leave type failed";
}
return message;
}
@Transactional
public String deleteLeaveType(int leaveTypeId) {
String message;
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveTypeId);
if (leaveType != null) {
leaveTypeRepository.delete(leaveType);
if (leaveTypeRepository.findLeaveTypeById(leaveTypeId) != null) {
message = "Delete failed!";
} else {
message = "Delete success!";
}
} else {
message = "Leave Form does not exist";
}
return message;
}
@Transactional
public String updateLeaveType(LeaveTypeDTO leaveTypeDTO) {
String message;
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveTypeDTO.getId());
if (leaveType != null) {
int i = leaveTypeRepository.updateLeaveType(leaveTypeDTO.getName(), leaveTypeDTO.getDescriptions(), leaveTypeDTO.getId());
if (i == 1) {
message = "Update success";
} else {
message = "Update failed";
}
} else {
message = "Leave Type does not exist";
}
return message;
}
public List<LeaveType> getLeaveTypeList() {
return leaveTypeRepository.findAll();
}
}
package com.itsol.quantrivanphong.report.leavetype.controller;
import com.itsol.quantrivanphong.exception.InputException;
import com.itsol.quantrivanphong.model.LeaveType;
import com.itsol.quantrivanphong.report.leaveform.controller.Notification;
import com.itsol.quantrivanphong.report.leavetype.business.LeaveTypeBusiness;
import com.itsol.quantrivanphong.report.leavetype.dto.LeaveTypeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(path = "/leavetype")
public class LeaveTypeController {
@Autowired
LeaveTypeBusiness leaveTypeBusiness;
@PostMapping(path = "/add", consumes = "application/json", produces = "application/json")
public ResponseEntity addLeaveForm(@RequestBody LeaveTypeDTO leaveTypeDTO) {
String message;
try {
if (leaveTypeDTO.getName().trim().equals("")) throw new InputException("Tên không được để trống");
if (leaveTypeDTO.getDescriptions().trim().equals("")) throw new InputException("Mô tả không được để trống");
message = leaveTypeBusiness.addLeaveType(leaveTypeDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
@DeleteMapping("/delete/{leaveTypeId}")
public ResponseEntity deleteLeaveForm(@PathVariable int leaveTypeId) {
return ResponseEntity.ok(new Notification(200, leaveTypeBusiness.deleteLeaveType(leaveTypeId)));
}
@PostMapping(path = "/update", consumes = "application/json", produces = "application/json")
public ResponseEntity updateLeaveForm(@RequestBody LeaveTypeDTO leaveTypeDTO) {
String message;
try {
if (leaveTypeDTO.getName().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (leaveTypeDTO.getDescriptions().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = leaveTypeBusiness.updateLeaveType(leaveTypeDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
@GetMapping(path = "/getAll")
public ResponseEntity<List<LeaveType>> getAllLeaveType() {
return ResponseEntity.ok(leaveTypeBusiness.getLeaveTypeList());
}
}
package com.itsol.quantrivanphong.report.leavetype.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LeaveTypeDTO {
private int id;
private String name;
private String descriptions;
private boolean status;
}
package com.itsol.quantrivanphong.report.leavetype.repository;
import com.itsol.quantrivanphong.model.LeaveType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface LeaveTypeRepository extends JpaRepository<LeaveType, Integer> {
LeaveType findLeaveTypeById(int id);
@Modifying
@Query("update LeaveType lt set lt.name = ?1, lt.descriptions = ?2 where lt.id = ?3")
int updateLeaveType(String name, String descriptions, int id);
}
package com.itsol.quantrivanphong.report.timesheet.business;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class TimeSheetBusiness {
@Autowired
TimeSheetRepository timeSheetRepository;
@Autowired
EProjectRepository eProjectRepository;
@Autowired
EmployeeRepository employeeRepository;
public String addTimeSheet(TimeSheetDTO timeSheetDTO) {
String message;
Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId());
Eproject eproject = eProjectRepository.findEprojectByIdAndEmployee(timeSheetDTO.getEprojectId(), employee);
if (eproject != null) {
// SimpleDateFormat formatter= new SimpleDateFormat("dd-MM-yyyy HH:mm");
// Date date = new Date(System.currentTimeMillis());
TimeSheet timeSheet1 = new TimeSheet();
timeSheet1.setTitle(timeSheetDTO.getTitle());
timeSheet1.setContent(timeSheetDTO.getContent());
timeSheet1.setNote(timeSheetDTO.getNote());
timeSheet1.setEproject(eproject);
timeSheet1.setChecked("unapproved");
timeSheet1.setStatus(true);
TimeSheet timeSheet = timeSheetRepository.save(timeSheet1);
if (timeSheet != null) {
message = "Insert Time Sheet success";
} else {
message = "Insert Time Sheet failed";
}
} else {
message = "Eproject does not exist";
}
return message;
}
public String deleteTimeSheet(int timeSheetId) {
String message;
// Employee employee = employeeRepository.findEmployeeById(employee_Id);
// Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
TimeSheet timeSheet = timeSheetRepository.findTimeSheetById(timeSheetId);
if (timeSheet != null) {
timeSheetRepository.delete(timeSheet);
if (timeSheetRepository.findTimeSheetById(timeSheetId) == null) {
message = "Delete success";
} else {
message = "Delete failed";
}
} else {
message = "Time Sheet does not exist";
}
return message;
}
public List<TimeSheet> findAll(){
return timeSheetRepository.findAll();
}
@Transactional
public String updateTimeSheet(TimeSheetDTO timeSheetDTO) {
String message;
Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId());
Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
TimeSheet timeSheet = timeSheetRepository.findTimeSheetByEprojectAndId(eproject, timeSheetDTO.getId());
if (eproject != null) {
if (timeSheet != null) {
int i = timeSheetRepository.updateTimeSheet(timeSheetDTO.getTitle(), timeSheetDTO.getContent()
, timeSheetDTO.getNote(), timeSheetDTO.getId());
if (i == 1) {
message = "Update success";
} else {
message = "Update failed";
}
} else {
message = "TimeSheet does not exist";
}
} else {
message = "Eproject does not exist";
}
return message;
}
@Transactional
public String updateCheck(TimeSheetDTO timeSheetDTO) {
String message;
int i = timeSheetRepository.updateCheck(timeSheetDTO.getChecked(), timeSheetDTO.getId());
if (i == 1) {
message = "Success";
} else {
message = "Failed";
}
return message;
}
// @Transactional
// public String updateLeaveFormStatus(TimeSheetDTO timeSheetDTO) {
// String message;
// TimeSheet timeSheet = timeSheetRepository.findTimeSheetByEmployeeId(timeSheetDTO.getId());
// if (timeSheet != null) {
// int i = timeSheetRepository.updateTimeSheetStatus(timeSheetDTO.isStatus(), timeSheetDTO.getId());
// if (i == 1) {
// message = "Update status success";
// } else {
// message = "Update status failed";
// }
// } else {
// message = "TimeSheet does not exist";
// }
//
// return message;
// }
public List<TimeSheet> findTimeSheetByEmployeeId(int employeeId) {
Employee employee = employeeRepository.findEmployeeById(employeeId);
Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
if (employee != null && eproject != null && timeSheetRepository.showTimeSheetByEproject(eproject) != null) {
return timeSheetRepository.showTimeSheetByEproject(eproject);
} else {
return null;
}
}
public TimeSheet findTimeSheetById(int id) {
return timeSheetRepository.findTimeSheetById(id);
}
public List<Eproject> getEprojectList() {
return eProjectRepository.findAll();
}
}
package com.itsol.quantrivanphong.report.timesheet.controller;
import com.itsol.quantrivanphong.exception.InputException;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.report.leaveform.controller.Notification;
import com.itsol.quantrivanphong.report.timesheet.business.TimeSheetBusiness;
import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(path = "/eproject")
public class TimeSheetController {
@Autowired
TimeSheetBusiness timeSheetBusiness;
@PostMapping(path = "/timesheet/add", consumes = "application/json", produces = "application/json")
public ResponseEntity addTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
String message;
try {
if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = timeSheetBusiness.addTimeSheet(timeSheetDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
// @PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> insertTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
// String message;
// try {
// if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
// if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
// message = timeSheetBusiness.insertTimeSheet(timeSheetDTO);
// } catch (InputException e) {
// message = e.getMessage();
// }
//
// return ResponseEntity.ok(message);
// }
@DeleteMapping("/timesheet/delete/{timesheetId}")
public ResponseEntity deleteTimeSheet(@PathVariable int timesheetId) {
return ResponseEntity.ok(new Notification(200, timeSheetBusiness.deleteTimeSheet(timesheetId)));
}
@GetMapping(path = "/timesheet/show")
public List<TimeSheet> showAllTimeSheet() {
return timeSheetBusiness.findAll();
}
@PostMapping(path = "/timesheet/update", consumes = "application/json", produces = "application/json")
public ResponseEntity updateTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
String message;
try {
if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = timeSheetBusiness.updateTimeSheet(timeSheetDTO);
} catch (InputException e) {
message = e.getMessage();
}
return ResponseEntity.ok(new Notification(200, message));
}
// @PostMapping(path = "/update-status", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> updateLeaveFormStatus(@RequestBody TimeSheetDTO timeSheetDTO) {
// String message;
// message = timeSheetBusiness.updateLeaveFormStatus(timeSheetDTO);
// return ResponseEntity.ok(message);
// }
@GetMapping("/timesheet/show/{employeeId}")
public ResponseEntity<List<TimeSheet>> showTimeSheetByEmployeeId(@PathVariable int employeeId) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetByEmployeeId(employeeId));
}
@GetMapping("/timesheet/{id}")
public ResponseEntity<TimeSheet> showTimeSheetById(@PathVariable int id) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetById(id));
}
@PostMapping(path = "/timesheet/update/check", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> updateCheck(@RequestBody TimeSheetDTO timeSheetDTO) {
return ResponseEntity.ok(timeSheetBusiness.updateCheck(timeSheetDTO));
}
@GetMapping(path = "/getAll")
public List<Eproject> getAllEproject() {
return timeSheetBusiness.getEprojectList();
}
}
\ No newline at end of file
package com.itsol.quantrivanphong.report.timesheet.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TimeSheetDTO {
private int id;
private int employeeId;
private String title;
private String content;
private String note;
private String checked;
private boolean status;
private int eprojectId;
}
package com.itsol.quantrivanphong.report.timesheet.repository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface EProjectRepository extends JpaRepository<Eproject, Integer> {
Eproject findEprojectById(int id);
Eproject findEprojectByEmployee(Employee employee);
Eproject findEprojectByIdAndEmployee(int eProjectId, Employee employee);
//======================================================================================================
// Hieunv
@Query(value = "SELECT * FROM eproject ep JOIN project p on p.id = ep.project_id WHERE p.id = ?1 AND ep.employee_id NOT IN (SELECT e.id FROM employee e JOIN eproject ep ON e.id = ep.employee_id JOIN project p on p.id = ep.project_id JOIN timesheet ts on ts.eproject_id = ep.id WHERE p.id = ?1 AND ts.created_at Like ?2%)", nativeQuery = true)
List<Eproject> listEprojectLack(int projectId, String currentDate);
}
package com.itsol.quantrivanphong.report.timesheet.repository;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.TimeSheet;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> {
TimeSheet findTimeSheetById(int id);
// @Query("select ts from TimeSheet ts order by ts.createdAt desc")
// List<TimeSheet> getAllTimeSheet();
@Modifying
@Query("update TimeSheet ts set ts.title = ?1, ts.content = ?2, ts.note = ?3 where ts.id = ?4")
int updateTimeSheet(String title, String content, String note, int timeSheetId);
@Modifying
@Query("update TimeSheet ts set ts.checked = ?1 where ts.id = ?2")
int updateCheck(String check, int timeSheetId);
// @Modifying
// @Query("update TimeSheet ts set ts.status = ?1 where ts.id = ?2")
// int updateTimeSheetStatus(boolean status, int id);
@Query("select ts from TimeSheet ts where ts.eproject = ?1")
List<TimeSheet> showTimeSheetByEproject(Eproject eproject);
TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheetId);
//==================================================================================================================
//Timesheet Of Hieunv
@Query(value = "SELECT * FROM timesheet ts JOIN eproject ep ON ep.id = ts.eproject_id WHERE ep.project_id = ?1 AND ts.status = true and ts.created_at like ?2%", nativeQuery = true)
List<TimeSheet> findAllTimesheetStatusTrue(int projectId, String currentDate);
@Transactional
@Modifying
@Query(value = "INSERT INTO timesheet(eproject_id, status, created_at, updated_at, checked) VALUES (?1, ?2,current_date(), current_date(),?3)",nativeQuery = true)
void updateLack(int eprojectId, boolean status, String checked);
@Transactional
@Modifying
@Query(value = "update TimeSheet ts set ts.checked = ?1 where ts.id = ?2", nativeQuery = true)
void updateTimesheetChecked(String checked, int id);
@Query(value = "SELECT Count(DISTINCT ts.eproject_id) FROM timesheet ts JOIN eproject ep ON ep.id = ts.eproject_id WHERE ts.status = false AND ep.project_id = ?1 AND created_at >= ?2 AND created_at <= ?3",nativeQuery = true)
int numberEmployeeLack(int ProjectId, String firstDate, String finalDate);
@Query(value = "SELECT * FROM timesheet ts JOIN eproject ep ON ep.id = ts.eproject_id JOIN employee e ON e.id = ep.employee_id WHERE ts.status = false AND created_at >= ?1 AND created_at <= ?2 AND ep.project_id = ?3 AND e.id = ?4", nativeQuery = true)
List<TimeSheet> listDateOfLack(String firstDate, String finalDate, int projectId, int employeeId);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="keywords" content="Glance Design Dashboard Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design"/>
<script type="application/x-javascript"> addEventListener("load", function () {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
} </script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.css" rel='stylesheet' type='text/css'/>
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css'/>
<!-- font-awesome icons CSS -->
<link href="css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="css/Footer-with-social-icons.css">
<link href='css/SidebarNav.min.css' media='all' rel='stylesheet' type='text/css'/>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/modernizr.custom.js"></script>
<link href="//fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i&amp;subset=cyrillic,cyrillic-ext,latin-ext"
rel="stylesheet">
<script src="js/Chart.js"></script>
<script src="js/metisMenu.min.js"></script>
<script src="js/custom.js"></script>
<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>
<script src="js/app.js"></script>
<script src="pages/report/reportController.js"></script>
<script src="pages/employee/employeeController.js"></script>
<script src="pages/project/project/projectController.js"></script>
<script src="pages/project/groupproject/groupProjectController.js"></script>
<script src="pages/project/groupproject/groupProjectViewController.js"></script>
<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/leaveform/leaveFormController.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>
<script src="pages/employee/createEmployeeController.js"></script>
<script src="pages/project/project/projectViewController.js"></script>
<link data-require="bootstrap-css@2.3.2" data-semver="2.3.2" rel="stylesheet"
href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"/>
//font-awesome by Phi
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- end anguarjs app-->
<link href="css/custom.css" rel="stylesheet">
<style>
#chartdiv {
width: 100%;
height: 295px;
}
</style>
<!--pie-chart --><!-- index page sales reviews visitors pie chart -->
<script src="js/pie-chart.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#demo-pie-1').pieChart({
barColor: '#2dde98',
trackColor: '#eee',
lineCap: 'round',
lineWidth: 8,
onStep: function (from, to, percent) {
$(this.element).find('.pie-value').text(Math.round(percent) + '%');
}
});
$('#demo-pie-2').pieChart({
barColor: '#8e43e7',
trackColor: '#eee',
lineCap: 'butt',
lineWidth: 8,
onStep: function (from, to, percent) {
$(this.element).find('.pie-value').text(Math.round(percent) + '%');
}
});
$('#demo-pie-3').pieChart({
barColor: '#ffc168',
trackColor: '#eee',
lineCap: 'square',
lineWidth: 8,
onStep: function (from, to, percent) {
$(this.element).find('.pie-value').text(Math.round(percent) + '%');
}
});
});
</script>
<link href="css/owl.carousel.css" rel="stylesheet">
<script src="js/owl.carousel.js"></script>
<script>
$(document).ready(function () {
$("#owl-demo").owlCarousel({
items: 3,
lazyLoad: true,
autoPlay: true,
pagination: true,
nav: true
});
});
</script>
</head>
<body class="cbp-spmenu-push" ng-app="myApp">
<div ui-view="layout"></div>
</body>
</html>
\ No newline at end of file
/**
* @license AngularJS v1.3.14
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
var $resourceMinErr = angular.$$minErr('$resource');
// Helper functions and regex to lookup a dotted path on an object
// stopping at undefined/null. The path must be composed of ASCII
// identifiers (just like $parse)
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;
function isValidDottedPath(path) {
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
MEMBER_NAME_REGEX.test('.' + path));
}
function lookupDottedPath(obj, path) {
if (!isValidDottedPath(path)) {
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
}
var keys = path.split('.');
for (var i = 0, ii = keys.length; i < ii && obj !== undefined; i++) {
var key = keys[i];
obj = (obj !== null) ? obj[key] : undefined;
}
return obj;
}
/**
* Create a shallow copy of an object and clear other fields from the destination
*/
function shallowClearAndCopy(src, dst) {
dst = dst || {};
angular.forEach(dst, function(value, key) {
delete dst[key];
});
for (var key in src) {
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = src[key];
}
}
return dst;
}
/**
* @ngdoc module
* @name ngResource
* @description
*
* # ngResource
*
* The `ngResource` module provides interaction support with RESTful services
* via the $resource service.
*
*
* <div doc-module-components="ngResource"></div>
*
* See {@link ngResource.$resource `$resource`} for usage.
*/
/**
* @ngdoc service
* @name $resource
* @requires $http
*
* @description
* A factory which creates a resource object that lets you interact with
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
*
* The returned resource object has action methods which provide high-level behaviors without
* the need to interact with the low level {@link ng.$http $http} service.
*
* Requires the {@link ngResource `ngResource`} module to be installed.
*
* By default, trailing slashes will be stripped from the calculated URLs,
* which can pose problems with server backends that do not expect that
* behavior. This can be disabled by configuring the `$resourceProvider` like
* this:
*
* ```js
app.config(['$resourceProvider', function($resourceProvider) {
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
}]);
* ```
*
* @param {string} url A parametrized URL template with parameters prefixed by `:` as in
* `/user/:username`. If you are using a URL with a port number (e.g.
* `http://example.com:8080/api`), it will be respected.
*
* If you are using a url with a suffix, just add the suffix, like this:
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
* or even `$resource('http://example.com/resource/:resource_id.:format')`
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
* can escape it with `/\.`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods. If any of the parameter value is a function, it will be executed every time
* when a param value needs to be obtained for a request (unless the param was overridden).
*
* Each key value in the parameter object is first bound to url template if present and then any
* excess keys are appended to the url search query after the `?`.
*
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
* URL `/path/greet?salutation=Hello`.
*
* If the parameter value is prefixed with `@` then the value for that parameter will be extracted
* from the corresponding property on the `data` object (provided when calling an action method). For
* example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of `someParam`
* will be `data.someProp`.
*
* @param {Object.<Object>=} actions Hash with declaration of custom actions that should extend
* the default set of resource actions. The declaration should be created in the format of {@link
* ng.$http#usage $http.config}:
*
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
* action2: {method:?, params:?, isArray:?, headers:?, ...},
* ...}
*
* Where:
*
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
* your resource object.
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
* `DELETE`, `JSONP`, etc).
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
* the parameter value is a function, it will be executed every time when a param value needs to
* be obtained for a request (unless the param was overridden).
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
* like for the resource-level urls.
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
* see `returns` section.
* - **`transformRequest`** –
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* request body and headers and returns its transformed (typically serialized) version.
* By default, transformRequest will contain one function that checks if the request data is
* an object and serializes to using `angular.toJson`. To prevent this behavior, set
* `transformRequest` to an empty array: `transformRequest: []`
* - **`transformResponse`** –
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* transform function or an array of such functions. The transform function takes the http
* response body and headers and returns its transformed (typically deserialized) version.
* By default, transformResponse will contain one function that checks if the response looks like
* a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior, set
* `transformResponse` to an empty array: `transformResponse: []`
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
* GET request, otherwise if a cache instance built with
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
* caching.
* - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
* should abort the request when resolved.
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
* XHR object. See
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
* for more information.
* - **`responseType`** - `{string}` - see
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
* with `http response` object. See {@link ng.$http $http interceptors}.
*
* @param {Object} options Hash with custom settings that should extend the
* default `$resourceProvider` behavior. The only supported option is
*
* Where:
*
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
* slashes from any calculated URL will be stripped. (Defaults to true.)
*
* @returns {Object} A resource "class" object with methods for the default set of resource actions
* optionally extended with custom `actions`. The default set contains these actions:
* ```js
* { 'get': {method:'GET'},
* 'save': {method:'POST'},
* 'query': {method:'GET', isArray:true},
* 'remove': {method:'DELETE'},
* 'delete': {method:'DELETE'} };
* ```
*
* Calling these methods invoke an {@link ng.$http} with the specified http method,
* destination and parameters. When the data is returned from the server then the object is an
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
* read, update, delete) on server-side data like this:
* ```js
* var User = $resource('/user/:userId', {userId:'@id'});
* var user = User.get({userId:123}, function() {
* user.abc = true;
* user.$save();
* });
* ```
*
* It is important to realize that invoking a $resource object method immediately returns an
* empty reference (object or array depending on `isArray`). Once the data is returned from the
* server the existing reference is populated with the actual data. This is a useful trick since
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
* object results in no rendering, once the data arrives from the server then the object is
* populated with the data and the view automatically re-renders itself showing the new data. This
* means that in most cases one never has to write a callback function for the action methods.
*
* The action methods on the class object or instance object can be invoked with the following
* parameters:
*
* - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
* - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
* - non-GET instance actions: `instance.$action([parameters], [success], [error])`
*
*
* Success callback is called with (value, responseHeaders) arguments. Error callback is called
* with (httpResponse) argument.
*
* Class actions return empty instance (with additional properties below).
* Instance actions return promise of the action.
*
* The Resource instances and collection have these additional properties:
*
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
* instance or collection.
*
* On success, the promise is resolved with the same resource instance or collection object,
* updated with data from server. This makes it easy to use in
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
* rendering until the resource(s) are loaded.
*
* On failure, the promise is resolved with the {@link ng.$http http response} object, without
* the `resource` property.
*
* If an interceptor object was provided, the promise will instead be resolved with the value
* returned by the interceptor.
*
* - `$resolved`: `true` after first server interaction is completed (either with success or
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
* data-binding.
*
* @example
*
* # Credit card resource
*
* ```js
// Define CreditCard class
var CreditCard = $resource('/user/:userId/card/:cardId',
{userId:123, cardId:'@id'}, {
charge: {method:'POST', params:{charge:true}}
});
// We can retrieve a collection from the server
var cards = CreditCard.query(function() {
// GET: /user/123/card
// server returns: [ {id:456, number:'1234', name:'Smith'} ];
var card = cards[0];
// each item is an instance of CreditCard
expect(card instanceof CreditCard).toEqual(true);
card.name = "J. Smith";
// non GET methods are mapped onto the instances
card.$save();
// POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
// server returns: {id:456, number:'1234', name: 'J. Smith'};
// our custom method is mapped as well.
card.$charge({amount:9.99});
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
});
// we can create an instance as well
var newCard = new CreditCard({number:'0123'});
newCard.name = "Mike Smith";
newCard.$save();
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
expect(newCard.id).toEqual(789);
* ```
*
* The object returned from this function execution is a resource "class" which has "static" method
* for each action in the definition.
*
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
* `headers`.
* When the data is returned from the server then the object is an instance of the resource type and
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
* operations (create, read, update, delete) on server-side data.
```js
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(user) {
user.abc = true;
user.$save();
});
```
*
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
* in the response that came from the server as well as $http header getter function, so one
* could rewrite the above example and get access to http headers as:
*
```js
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(u, getResponseHeaders){
u.abc = true;
u.$save(function(u, putResponseHeaders) {
//u => saved user object
//putResponseHeaders => $http header getter
});
});
```
*
* You can also access the raw `$http` promise via the `$promise` property on the object returned
*
```
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123})
.$promise.then(function(user) {
$scope.user = user;
});
```
* # Creating a custom 'PUT' request
* In this example we create a custom method on our resource to make a PUT request
* ```js
* var app = angular.module('app', ['ngResource', 'ngRoute']);
*
* // Some APIs expect a PUT request in the format URL/object/ID
* // Here we are creating an 'update' method
* app.factory('Notes', ['$resource', function($resource) {
* return $resource('/notes/:id', null,
* {
* 'update': { method:'PUT' }
* });
* }]);
*
* // In our controller we get the ID from the URL using ngRoute and $routeParams
* // We pass in $routeParams and our Notes factory along with $scope
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
function($scope, $routeParams, Notes) {
* // First get a note object from the factory
* var note = Notes.get({ id:$routeParams.id });
* $id = note.id;
*
* // Now call update passing in the ID first then the object you are updating
* Notes.update({ id:$id }, note);
*
* // This will PUT /notes/ID with the note object in the request payload
* }]);
* ```
*/
angular.module('ngResource', ['ng']).
provider('$resource', function() {
var provider = this;
this.defaults = {
// Strip slashes by default
stripTrailingSlashes: true,
// Default actions configuration
actions: {
'get': {method: 'GET'},
'save': {method: 'POST'},
'query': {method: 'GET', isArray: true},
'remove': {method: 'DELETE'},
'delete': {method: 'DELETE'}
}
};
this.$get = ['$http', '$q', function($http, $q) {
var noop = angular.noop,
forEach = angular.forEach,
extend = angular.extend,
copy = angular.copy,
isFunction = angular.isFunction;
/**
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
* (pchar) allowed in path segments:
* segment = *pchar
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* pct-encoded = "%" HEXDIG HEXDIG
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriSegment(val) {
return encodeUriQuery(val, true).
replace(/%26/gi, '&').
replace(/%3D/gi, '=').
replace(/%2B/gi, '+');
}
/**
* This method is intended for encoding *key* or *value* parts of query component. We need a
* custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
* have to be encoded per http://tools.ietf.org/html/rfc3986:
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
*/
function encodeUriQuery(val, pctEncodeSpaces) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
}
function Route(template, defaults) {
this.template = template;
this.defaults = extend({}, provider.defaults, defaults);
this.urlParams = {};
}
Route.prototype = {
setUrlParams: function(config, params, actionUrl) {
var self = this,
url = actionUrl || self.template,
val,
encodedVal;
var urlParams = self.urlParams = {};
forEach(url.split(/\W/), function(param) {
if (param === 'hasOwnProperty') {
throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
}
if (!(new RegExp("^\\d+$").test(param)) && param &&
(new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
urlParams[param] = true;
}
});
url = url.replace(/\\:/g, ':');
params = params || {};
forEach(self.urlParams, function(_, urlParam) {
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
if (angular.isDefined(val) && val !== null) {
encodedVal = encodeUriSegment(val);
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
return encodedVal + p1;
});
} else {
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
leadingSlashes, tail) {
if (tail.charAt(0) == '/') {
return tail;
} else {
return leadingSlashes + tail;
}
});
}
});
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
if (self.defaults.stripTrailingSlashes) {
url = url.replace(/\/+$/, '') || '/';
}
// then replace collapse `/.` if found in the last URL path segment before the query
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
// replace escaped `/\.` with `/.`
config.url = url.replace(/\/\\\./, '/.');
// set params - delegate param encoding to $http
forEach(params, function(value, key) {
if (!self.urlParams[key]) {
config.params = config.params || {};
config.params[key] = value;
}
});
}
};
function resourceFactory(url, paramDefaults, actions, options) {
var route = new Route(url, options);
actions = extend({}, provider.defaults.actions, actions);
function extractParams(data, actionParams) {
var ids = {};
actionParams = extend({}, paramDefaults, actionParams);
forEach(actionParams, function(value, key) {
if (isFunction(value)) { value = value(); }
ids[key] = value && value.charAt && value.charAt(0) == '@' ?
lookupDottedPath(data, value.substr(1)) : value;
});
return ids;
}
function defaultResponseInterceptor(response) {
return response.resource;
}
function Resource(value) {
shallowClearAndCopy(value || {}, this);
}
Resource.prototype.toJSON = function() {
var data = extend({}, this);
delete data.$promise;
delete data.$resolved;
return data;
};
forEach(actions, function(action, name) {
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
Resource[name] = function(a1, a2, a3, a4) {
var params = {}, data, success, error;
/* jshint -W086 */ /* (purposefully fall through case statements) */
switch (arguments.length) {
case 4:
error = a4;
success = a3;
//fallthrough
case 3:
case 2:
if (isFunction(a2)) {
if (isFunction(a1)) {
success = a1;
error = a2;
break;
}
success = a2;
error = a3;
//fallthrough
} else {
params = a1;
data = a2;
success = a3;
break;
}
case 1:
if (isFunction(a1)) success = a1;
else if (hasBody) data = a1;
else params = a1;
break;
case 0: break;
default:
throw $resourceMinErr('badargs',
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
arguments.length);
}
/* jshint +W086 */ /* (purposefully fall through case statements) */
var isInstanceCall = this instanceof Resource;
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
var httpConfig = {};
var responseInterceptor = action.interceptor && action.interceptor.response ||
defaultResponseInterceptor;
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
undefined;
forEach(action, function(value, key) {
if (key != 'params' && key != 'isArray' && key != 'interceptor') {
httpConfig[key] = copy(value);
}
});
if (hasBody) httpConfig.data = data;
route.setUrlParams(httpConfig,
extend({}, extractParams(data, action.params || {}), params),
action.url);
var promise = $http(httpConfig).then(function(response) {
var data = response.data,
promise = value.$promise;
if (data) {
// Need to convert action.isArray to boolean in case it is undefined
// jshint -W018
if (angular.isArray(data) !== (!!action.isArray)) {
throw $resourceMinErr('badcfg',
'Error in resource configuration for action `{0}`. Expected response to ' +
'contain an {1} but got an {2}', name, action.isArray ? 'array' : 'object',
angular.isArray(data) ? 'array' : 'object');
}
// jshint +W018
if (action.isArray) {
value.length = 0;
forEach(data, function(item) {
if (typeof item === "object") {
value.push(new Resource(item));
} else {
// Valid JSON values may be string literals, and these should not be converted
// into objects. These items will not have access to the Resource prototype
// methods, but unfortunately there
value.push(item);
}
});
} else {
shallowClearAndCopy(data, value);
value.$promise = promise;
}
}
value.$resolved = true;
response.resource = value;
return response;
}, function(response) {
value.$resolved = true;
(error || noop)(response);
return $q.reject(response);
});
promise = promise.then(
function(response) {
var value = responseInterceptor(response);
(success || noop)(value, response.headers);
return value;
},
responseErrorInterceptor);
if (!isInstanceCall) {
// we are creating instance / collection
// - set the initial promise
// - return the instance / collection
value.$promise = promise;
value.$resolved = false;
return value;
}
// instance call
return promise;
};
Resource.prototype['$' + name] = function(params, success, error) {
if (isFunction(params)) {
error = success; success = params; params = {};
}
var result = Resource[name].call(this, params, this, success, error);
return result.$promise || result;
};
});
Resource.bind = function(additionalParamDefaults) {
return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
};
return Resource;
}
return resourceFactory;
}];
});
})(window, window.angular);
/**
*
*/
angular.module("myApp", ["ngAnimate","ngResource", "ui.router", "ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$urlRouterProvider.otherwise("/employees");
$stateProvider
.state("layout1", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout1.html"
}
}
})
.state("layout3", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout3.html"
}
}
})
.state("layout2", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout2.html"
}
}
})
.state("layout4", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout4.html"
}
}
})
.state("employees", {
parent: 'layout1',
url: "/employees",
views: {
"content": {
templateUrl: "pages/employee/employee.html",
controller: "employeeController"
}
}
})
.state("createEmployee", {
parent: 'layout1',
url: "/createEmployee",
params: {
emp: null
},
views: {
"content": {
templateUrl: "pages/employee/createEmployee.html",
controller: "createEmployeeController"
}
}
})
.state("leaveform", {
parent: 'layout1',
url: "/leaveform",
views: {
"content": {
templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController"
}
}
})
.state("leaveFormDetail", {
parent: 'layout1',
url: "/leaveformdetail/:id",
views: {
"content": {
templateUrl: "pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController"
}
}
})
.state("timesheet",{
parent:'layout1',
url:"/timesheet",
views:{
"content":{
templateUrl:"pages/timesheet/timesheet.html",
controller:"timeSheetController"
}
}
})
.state("timesheetDetail",{
parent:'layout1',
url:"/timesheetDetail/:id",
views:{
"content":{
templateUrl:"pages/timesheet/timeSheetDetail.html",
controller:"timeSheetDetailController"
}
}
})
.state("CatagoriManagement",{
parent:'layout1',
url:"/management/catagori",
views:{
"content":{
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"
}
}
})
//report
.state("reportProject", {
parent: 'layout1',
url: "/report/project",
views: {
"content": {
templateUrl: "pages/report/timeSheetReport.html",
controller: "reportController"
}
}
})
.state("reportTimeSheet", {
parent: 'layout1',
url: "/report/project/:ID/timeSheet",
views: {
"content": {
templateUrl: "pages/report/timeSheetListViews.html",
controller: "timeSheetListController"
}
}
})
.state("reportEmployee", {
parent: 'layout1',
url: "/report/project/:ID/employee",
views: {
"content": {
templateUrl: "pages/report/employeeListViews.html",
controller: "listLackOfReportController"
}
}
})
//
.state("report2", {
parent: 'layout1',
url: "/report/project2",
views: {
"content": {
templateUrl: "pages/report/reportPage.html",
controller: "reportController"
}
}
})
.state("allReport", {
parent: 'layout1',
url: "/report/project/:ID/allReport",
views: {
"content": {
templateUrl: "pages/report/reportListPage.html",
controller: "allProjectReportController"
}
}
})
.state("reportDetail", {
parent: 'layout1',
url: "/report/reportDetail/:ID",
views: {
"content": {
templateUrl: "pages/report/reportDetailPage.html",
controller: "projectReportDetailController"
}
}
})
.state("reportEmployeeLack", {
parent: 'layout1',
url: "/report/project/:ID/employeeReport",
views: {
"content": {
templateUrl: "pages/report/employeeListViews1.html",
controller: "listEmployeeLackController"
}
}
})
.state("project", {
parent: 'layout1',
url: "/project",
views: {
"content": {
templateUrl: "pages/project/project/projectListViews.html",
controller: "projectViewsController"
}
}
})
.state("addproject", {
parent: 'layout1',
url: "/addproject",
views: {
"content": {
templateUrl: "pages/project/project/projectAddViews.html",
controller: "insertProject"
}
}
})
.state("editproject", {
parent: 'layout1',
url: "/editproject/:ID",
views: {
"content": {
templateUrl: "pages/project/project/projectEditViews.html",
controller: "loadProjectDetail"
}
}
})
.state("groupProjectByProjectId", {
parent: 'layout1',
url: "/groupProjectByProjectId/:ID",
params: {ID: null},
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectView.html",
controller: "groupProjectShowController"
}
}
})
.state("addEmployeeProject", {
parent: 'layout1',
url: "/addEmployeeProject",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectAddView.html",
controller: "insertEmployeeProject"
}
}
})
.state("editEmployeeProject", {
parent: 'layout1',
url: "/editEmployeeProject/:ID",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectEditView.html",
controller: "loadEmployeeProjectDetail"
}
}
})
.state("issues", {
parent: 'layout1',
url: "/issues",
views: {
"content": {
templateUrl: "pages/issue/IssueView.html",
controller: "IssuesShowController"
}
}
})
.state("addIssues", {
parent: 'layout1',
url: "/addIssues",
views: {
"content": {
templateUrl: "pages/issue/IssueAdd.html",
controller: "IssuesAddController"
}
}
})
.state("IssuesComment", {
parent: 'layout1',
url: "/issuescomment/:IssuesId",
views: {
"content": {
templateUrl: "pages/issue/IssueDetailViews.html",
controller: "loadIssuesDetail"
}
}
})
.state("login", {
parent: 'layout2',
url: "/login",
views: {
"content": {
templateUrl: "pages/login/login.html",
controller: "loginController"
}
}
})
.state("register", {
parent: 'layout2',
url: "/register",
views: {
"content": {
templateUrl: "pages/login/register.html",
controller: "loginController"
}
}
})
.state("forgot-password", {
parent: 'layout2',
url: "/forgot-password",
views: {
"content": {
templateUrl: "pages/login/forgot-password.html",
controller: "loginController"
}
}
})
.state("gioithieu", {
parent: 'app',
url: "/gioithieu",
views: {
"content": {
templateUrl: "pages/gioithieu/gioithieu.htm",
controller: "gioithieuController"
}
}
})
});
angular
.module('myApp')
.filter('lmto', lmto);
function lmto() {
return function (items, limit, offset) {
if (items.length > 0) {
return items.slice(offset, offset + limit);
} else {
return [];
}
};
}
<div class="main-content">
<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
<!--left-fixed -navigation-->
<aside class="sidebar-left">
<nav class="navbar navbar-inverse">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".collapse"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h1>
<a class="navbar-brand" href="index.html">
<i class="fa fa-users" aria-hidden="true"></i>
Human
<span
class="dashboard_text">Resource Management
</span>
</a>
</h1>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<li class="treeview">
<a ui-sref="employees">
<i class="fa fa-user" aria-hidden="true"></i>
<span>Employee</span>
</a>
</li>
<!-- PhungDung-->
<li class="treeview">
<a ui-sref="project">
<i class="fa fa-laptop"></i>
<span>Project</span>
</a>
</li>
<li class="treeview">
<a ui-sref="issues">
<i class="fa fa-laptop"></i>
<span>Quản Lý Issues</span>
</a>
</li>
<!-- END DUng-->
<li class="treeview">
<li class="treeview">
<a ui-sref="CatagoriManagement">
<i class="fa fa-newspaper-o" aria-hidden="true"></i>
<span>News</span>
</a>
</li>
<li>
<a ui-sref="leaveform">
<i class="fa fa-file-text-o" aria-hidden="true"></i>
<span>Leave From</span>
</a>
<a href="/employee/leavefrom.html"></a>
</li>
<li class="treeview">
<a ui-sref="timesheet" >
<i class="fa fa-edit"></i>
<span>Timesheet</span>
</a>
</li>
<li class="treeview">
<a ui-sref="report2">
<i class="fa fa-envelope"></i>
<span>Report</span>
</a>
</li>
</ul>
</div>
</nav>
</aside>
</div>
<div class="sticky-header header-section ">
<div class="header-left">
<button id="showLeftPush">
<i class="fa fa-bars"></i>
</button>
<div class="profile_details_left">
<ul class="nofitications-dropdown">
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-envelope"></i>
<span class="badge">4</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 3 new messages</h3>
</div>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/1.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li class="odd">
<a href="#">
<div class="user_img">
<img src="images/4.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/3.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/2.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all messages</a>
</div>
</li>
</ul>
</li>
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-bell"></i>
<span class="badge blue">4</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 3 new notification</h3>
</div>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/4.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li class="odd">
<a href="#">
<div class="user_img">
<img src="images/1.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/3.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/2.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all notifications</a>
</div>
</li>
</ul>
</li>
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-tasks"></i>
<span class="badge blue1">8</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 8 pending task</h3>
</div>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Database update</span>
<span class="percentage">40%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar yellow" style="width:40%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Dashboard done</span>
<span class="percentage">90%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar green" style="width:90%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Mobile App</span>
<span class="percentage">33%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar red" style="width: 33%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Issues fixed</span>
<span class="percentage">80%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar blue" style="width: 80%;"></div>
</div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all pending tasks</a>
</div>
</li>
</ul>
</li>
</ul>
<div class="clearfix"></div>
</div>
<!--notification menu end -->
<div class="clearfix"></div>
</div>
</nav>
<!-- /.Navbar-->
<div class="header-right">
<!--search-box-->
<div class="search-box">
<form class="input">
<input class="sb-search-input input__field--madoka" placeholder="Search..." type="search"
id="input-31"/>
<label class="input__label" for="input-31">
<svg class="graphic" width="100%" height="100%" viewBox="0 0 404 77" preserveAspectRatio="none">
<path d="m0,0l404,0l0,77l-404,0l0,-77z"/>
</svg>
</label>
</form>
</div>
<!--//end-search-box-->
<!-- -->
<div class="profile_details">
<ul>
<li class="dropdown profile_details_drop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<div class="profile_img">
<span class="prfil-img"><img src="images/2.jpg" alt=""> </span>
<div class="user-name">
<p>Admin Name</p>
<span>Administrator</span>
</div>
<i class="fa fa-angle-down lnr"></i>
<i class="fa fa-angle-up lnr"></i>
<div class="clearfix"></div>
</div>
</a>
<ul class="dropdown-menu drp-mnu">
<li>
<a href="#">
<i class="fa fa-cog"></i>
Settings
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user"></i>
My Account
</a>
</li>
<li>
<a href="#">
<i class="fa fa-suitcase"></i>
Profile
</a>
</li>
<li>
<a href="#">
<i class="fa fa-sign-out"></i>
Logout
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<!-- //header-ends -->
<!-- main content start-->
<div id="page-wrapper">
<div class="main-page">
<div ui-view="content">
</div>
</div>
</div>
<!--footer-->
<div class="content">
</div>
<footer id="myFooter">
<div class="container">
<div class="row">
<div class="col-sm-3 myCols">
<h5>Get started</h5>
<ul>
<li>
<a href="#">Home</a>
</li>
<li>
<a href="#">Sign up</a>
</li>
<li>
<a href="#">Downloads</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>About us</h5>
<ul>
<li>
<a href="#">Company Information</a>
</li>
<li>
<a href="#">Contact us</a>
</li>
<li>
<a href="#">Reviews</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>Support</h5>
<ul>
<li>
<a href="#">FAQ</a>
</li>
<li>
<a href="#">Help desk</a>
</li>
<li>
<a href="#">Forums</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>Legal</h5>
<ul>
<li>
<a href="#">Terms of Service</a>
</li>
<li>
<a href="#">Terms of Use</a>
</li>
<li>
<a href="#">Privacy Policy</a>
</li>
</ul>
</div>
</div>
</div>
<div class="social-networks">
<a href="#" class="twitter">
<i class="fa fa-twitter"></i>
</a>
<a href="#" class="facebook">
<i class="fa fa-facebook-official"></i>
</a>
<a href="#" class="google">
<i class="fa fa-google-plus"></i>
</a>
</div>
<!--//footer-->
</footer>
</div>
<link rel="stylesheet" href="../css/bootstrap-combined.min.css">
<body class="animsition">
<!-- Header -->
<header>
<!-- Header Mobile -->
<div class="wrap-header-mobile">
<!-- Logo moblie -->
<div class="logo-mobile">
<a href="index.html"><img src="images/logo_1.png" alt="IMG-LOGO"></a>
</div>
<!-- Button show menu -->
<div class="btn-show-menu-mobile hamburger hamburger--squeeze m-r--8">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</div>
</div>
<!-- Menu Mobile -->
<div class="menu-mobile">
<ul class="topbar-mobile">
<li class="right-topbar">
<a href="#">
<span class="fab fa-facebook-f"></span>
</a>
<a href="#">
<span class="fab fa-twitter"></span>
</a>
<a href="#">
<span class="fab fa-pinterest-p"></span>
</a>
<a href="#">
<span class="fab fa-vimeo-v"></span>
</a>
<a href="#">
<span class="fab fa-youtube"></span>
</a>
</li>
</ul>
<ul class="main-menu-m">
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="category-01.html">Categories</a>
</li>
<li>
<a href="category-02.html">Entertainment </a>
</li>
<li>
<a href="category-01.html">Business</a>
</li>
<li>
<a href="category-02.html">Travel</a>
</li>
<li>
<a href="category-01.html">Life Style</a>
</li>
<li>
<a href="category-02.html">Video</a>
</li>
</ul>
</div>
<!-- -->
<div class="wrap-logo container">
<!-- Logo desktop -->
<div class="logo">
<a href="index.html"><img src="images/logo_1.png" alt="LOGO"></a>
</div>
</div>
<!-- -->
<div class="wrap-main-nav">
<div class="main-nav">
<!-- Menu desktop -->
<nav class="menu-desktop">
<a class="logo-stick" href="index.html">
<img src="images/icons/logo-01.png" alt="LOGO">
</a>
<ul class="main-menu">
<li>
<a href="index.html">Home</a>
</li>
<li class="mega-menu-item category">
<a href="#">Categories</a>
<div class="sub-mega-menu">
<div class="nav flex-column nav-pills" role="tablist">
<div data-ng-repeat="catagori in catagories">
<a ng-click="show(catagori.id)" class="nav-link " data-toggle="pill" href="#{{catagori.id}}" role="tab">{{catagori.name}}</a>
</div>
</div>
<div class="tab-content">
<span data-ng-repeat="catagori in catagories">
<span class="tab-pane" id="{{catagori.id}}" role="tabpanel"></span>
</span>
<div class="row">
<div class="col-3" data-ng-repeat="news in newestNews">
<!-- Item post -->
<div >
<a href="http://localhost:8080/index.html#/news/{{news.id}}" class="wrap-pic-w hov1 trans-03">
<img src="{{news.thumbnail}}" alt="IMG">
</a>
<div class="p-t-10">
<h5 class="p-b-5">
<a href="http://localhost:8080/index.html#/news/{{news.id}}" class="f1-s-5 cl3 hov-cl10 trans-03">
{{news.content}}
</a>
</h5>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
<li>
<a href="index.html">About Us</a>
</li>
<li>
<a href="#">Login</a>
</li>
<li>
<a href="#s">Sign up</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<!-- Headline -->
<div class="container">
<div class="bg0 flex-wr-sb-c p-rl-20 p-tb-8">
<div class="f2-s-1 p-r-30 size-w-0 m-tb-6 flex-wr-s-c">
<span class="text-uppercase cl2 p-r-8">
Welcome :
</span>
<span class="dis-inline-block cl6 slide100-txt pos-relative size-w-0" data-in="fadeInDown" data-out="fadeOutDown">
<span class="dis-inline-block slide100-txt-item animated visible-false">
Have a nice day!
</span>
<span class="dis-inline-block slide100-txt-item animated visible-false">
Discover our page with amazing news!!
</span>
<span class="dis-inline-block slide100-txt-item animated visible-false">
You are awesome!
</span>
</span>
</div>
<div class="pos-relative size-a-2 bo-1-rad-22 of-hidden bocl11 m-tb-6">
<input class="f1-s-1 cl6 plh9 s-full p-l-25 p-r-45" type="text" name="search" placeholder="Search">
<button class="flex-c-c size-a-1 ab-t-r fs-20 cl2 hov-cl10 trans-03">
<i class="zmdi zmdi-search"></i>
</button>
</div>
</div>
</div>
<!--body-->
<div>
<div ui-view="content"></div>
</div>
<footer>
<div class="bg2 p-t-40 p-b-25">
<div class="container">
<div class="row">
<div class="col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<a href="index.html">
<img class="max-s-full" src="images/icons/logo-02.png" alt="LOGO">
</a>
</div>
<div>
<p class="f1-s-1 cl11 p-b-16">
Thanks for visiting our page!
</p>
<p class="f1-s-1 cl11 p-b-16">
Any questions? Call us on 0968099149
</p>
<div class="p-t-15">
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-facebook-f"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-twitter"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-pinterest-p"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-vimeo-v"></span>
</a>
<a href="#" class="fs-18 cl11 hov-cl10 trans-03 m-r-8">
<span class="fab fa-youtube"></span>
</a>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<h5 class="f1-m-7 cl0">
Popular Posts
</h5>
</div>
<ul>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-01.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Donec metus orci, malesuada et lectus vitae
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 17
</span>
</div>
</li>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-02.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Lorem ipsum dolor sit amet, consectetur
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 16
</span>
</div>
</li>
<li class="flex-wr-sb-s p-b-20">
<a href="#" class="size-w-4 wrap-pic-w hov1 trans-03">
<img src="images/popular-post-03.jpg" alt="IMG">
</a>
<div class="size-w-5">
<h6 class="p-b-5">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03">
Suspendisse dictum enim quis imperdiet auctor
</a>
</h6>
<span class="f1-s-3 cl6">
Feb 15
</span>
</div>
</li>
</ul>
</div>
<div class="col-sm-6 col-lg-4 p-b-20">
<div class="size-h-3 flex-s-c">
<h5 class="f1-m-7 cl0">
Category
</h5>
</div>
<ul class="m-t--12">
<li class="how-bor1 p-rl-5 p-tb-10" data-ng-repeat="catagori in catagories">
<a href="#" class="f1-s-5 cl11 hov-cl10 trans-03 p-tb-8">
{{catagori.name}}
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</footer>
<!-- Back to top -->
<div class="btn-back-to-top" id="myBtn">
<span class="symbol-btn-back-to-top">
<span class="fas fa-angle-up"></span>
</span>
</div>
<!-- Modal Video 01-->
<div class="modal fade" id="modal-video-01" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document" data-dismiss="modal">
<div class="close-mo-video-01 trans-0-4" data-dismiss="modal" aria-label="Close">&times;</div>
<div class="wrap-video-mo-01">
<div class="video-mo-01">
<iframe src="https://www.youtube.com/embed/wJnBTPUQS5A?rel=0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
<script src="../js/main.js"></script>
<!-- <script src="../js/ui-bootstrap-tpls-0.3.0.min.js"></script>-->
</body>
<div class="container" style="text-align: center">
<h1>Chào Mừng bạn đến với trang ADMIN</h1>
</div>
\ No newline at end of file
angular.module("myApp").controller("adminController", function($scope, $http,$window) {
console.log("adminController");
});
\ No newline at end of file
<div class="container">
<table class="table">
<form>
<div class="form-row">
<div class="row">
<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>
</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>
</div>
\ No newline at end of file
angular.module("myApp").factory('News', function ($resource) {
return $resource('http://localhost:8081/api/news/:id', {id: '@myNewsId'},{
'get': {
method: 'GET',
isArray: false
}
});
});
angular.module('myApp').factory('Catagories', function ($resource) {
return $resource('http://localhost:8081/api/catalogies/:id', {id: '@myCatagoriesId'});
});
angular.module('myApp').factory('LatestNews', function ($resource) {
return $resource('http://localhost:8081/api/catalogi/:id/latestNews', {id: '@CatagoriesId'},{
'get': {
method: 'GET',
isArray: true
}
});
});
angular.module('myApp').factory('NewsByCatagori', function ($resource) {
return $resource('http://localhost:8081/api/catalogi/:id/news', {id: '@catagoriesId'},{
'get': {
method: 'GET',
isArray: true
}
});
});
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
<form name="myForm" novalidate ng-submit="createNews(newsAdd)" >
<table border= 1>
<tr>
<td>Thumbnail</td>
<td><input type="text" data-ng-model="newsAdd.thumbnail" /></td>
</tr>
<tr>
<td>Title</td>
<td><input type="text" ng-model="newsAdd.title" /></td>
</tr>
<tr>
<td>Content</td>
<td><input type="text" data-ng-model="newsAdd.content" /></td>
</tr>
<tr>
<td>Status</td>
<td><input type="text" data-ng-model="newsAdd.status" /></td>
</tr>
<tr>
<td colspan="2">
<input data-ng-disabled="myForm.$invalid" type="submit" value="Submit" class="blue-button" />
</td>
</tr>
</table>
</form>
<div class="container">
<div><a ui-sref="CatagoriManagement" style="padding:20px">Home</a></div>
<div >
<a href="#/management/HR/1/catagori/{{catagoriById.id}}/createNews"> Add News</a>
<div style="margin-top: 25px;">
<table class="table" >
<thead>
<tr>
<tr>
<div ng-if="catagoriById.name == 'Office'">
<a href="#/management/catagori/5" style="float:left"><< Back </a>
</div>
<div ng-if="catagoriById.name == 'Outdoor Activity'">
<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/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 Activity'">
<a href="#/management/catagori/4" style="float:right">Next >></a>
</div>
<div ng-if="catagoriById.name == 'Projects'">
<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>
</div>
<td colspan="12"><h1 style="font-size: 30px;text-align: center">{{catagoriById.name}}</h1></td>
</tr>
<th>STT</th>
<th>News title</th>
<th>Create Date</th>
<th>Content</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="myNews in catagoriById.news">
<td>{{$index + 1}}</td>
<td>{{myNews.title}}</td>
<td>{{myNews.createdAt}}</td>
<td>{{myNews.content}}</td>
<td><a href="#/management/catagori/{{catagoriById.id}}/news/{{myNews.id}}" style="color:green;border: 1px solid black;padding: 10px;" >Edit</a> </td>
<td><button type="button" style="color:red;border: 1px solid black;padding: 10px;" ng-click="deleteNews(myNews.id)">Delete</button> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--<div class="card-header">-->
<!-- <i class="fas fa-table"></i> Thêm mới dự án-->
<!--</div>-->
<!--<div class="card-body">-->
<!-- <form ng-submit="insertIssues(Issues)">-->
<!-- <label>Tên Dự Án</label>-->
<!-- <select ng-model="Issues.projectId" autofocus="autofocus"-->
<!-- required="required">-->
<!-- <option value="">==> Tên Dự Án</option>-->
<!-- <option ng-repeat="project in listProject" value="{{project.id}}">{{project.name}}</option>-->
<!-- </select><br/>-->
<!-- <label>Tiêu đề</label>-->
<!-- <input type="text" ng-model="Issues.title" id="title" placeholder="Tiêu Đề"-->
<!-- required="required"><br/>-->
<!-- <label>Nội Dung</label>-->
<!-- <input type="text" ng-model="Issues.actionCode" id="actionCode" placeholder="Nội dung issues"-->
<!-- required="required"><br/>-->
<!-- <div>-->
<!-- <h1>{{view.message}}</h1>-->
<!-- <input type="submit" value="Save">-->
<!-- <input type="reset" value="Reset">-->
<!-- <button type="button" ui-sref="issues">Back</button>-->
<!-- </div>-->
<!-- </form>-->
<!--</div>-->
<div class="container">
<form ng-submit="insertIssues(Issues)">
<label>Tên Dự Án</label>
<select ng-model="Issues.projectId" autofocus="autofocus"
required="required">
<option value="">==> Tên Dự Án</option>
<option ng-repeat="project in listProject" value="{{project.id}}">{{project.name}}</option>
</select><br/>
<label>Tiêu đề</label>
<input type="text" ng-model="Issues.title" id="title" placeholder="Tiêu Đề"
required="required"><br/>
<label>Nội Dung</label>
<input type="text" ng-model="Issues.actionCode" id="actionCode" placeholder="Nội dung issues"
required="required"><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="issues">Back</button>
</div>
</form>
</div>
\ No newline at end of file
angular.module("myApp").controller('IssuesShowController', function ($scope,$stateParams,$http,$state,$filter) {
//lấy danh sách +phân trang+tìm kiếm
$scope.ListIssues = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
//mới thêm
$scope.makeEmployee = function () {
$scope.ListIssues = [];
for (i = 1; i <= 100; i++) {
$scope.ListIssues.push({text: 'issue ' + i, done: false});
}
};
$scope.keyword = "";
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.ListIssues, {'title': $scope.keyword}).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.ListIssues.length / $scope.numPerPage);
};
function getAll() {
$http.get('http://localhost:8081/danh-sach-issues').then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.ListIssues = response.data;
}
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
//end
//update
$scope.updateIssues = function (issue) {
if (confirm("Bạn có muốn thay đổi trạng thái không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/sua-issues',
data: angular.toJson(issue),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
//error code
console.log("can't update data!!");
}
}
};
});
\ No newline at end of file
<div class="col-lg-8">
<hr>
<p style="text-align: center">Tên Dự Án : {{loadIssues.project.name | uppercase}}</p>
<hr>
<p class="lead">Tiêu Đề: {{loadIssues.title | uppercase}}</p>
<blockquote class="blockquote">
<p class="mb-0">NỘI DUNG ISSUES : {{loadIssues.actionCode}}</p>
</blockquote>
<hr>
<!-- Comments Form -->
<div class="card my-4">
<h5 class="card-header">Comment:</h5>
<div class="card-body">
<form ng-submit="saveComment(IssuesComment)">
<div class="form-group">
<textarea ng-model="IssuesComment.contentIssuse" class="form-control" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Đăng Comments</button>
<input class="btn btn-primary" type="reset" value="Reset">
</form>
</div>
</div>
<!-- Single Comment -->
<div class="media mb-4" ng-controller="showComment()" ng-repeat="comment in CommentIssues">
<div class="media-body">
<h5 class="mt-0">UserName</h5><p>Thời gian đăng</p>
-<p>Nội dung comment</p>-
</div>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addIssues" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input class="search" ng-model="keyword" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2>Danh Sách Issue</h2>
<table class="table">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Issue</th>
<th>Ngày Tạo</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="issue in ListIssues| filter:{title:keyword} |lmto:3:3*(currentPage-1) track by $index">
<td>{{ issue.project.name }}</td>
<td>{{ issue.title }}</td>
<td>{{ issue.startDate | date:"dd/MM/yyyy" }}</td>
<td>
<span ng-if="issue.status == 0" style="color: #34ce57">Đang fix</span>
<span ng-if="issue.status == 1" style="color: #0e90d2">Đã fix xong</span>
</td>
<td style="width: 200px">
<a ui-sref="IssuesComment({IssuesId : issue.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết </a>
<a ng-click="updateIssues(issue)">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="IssuesDeleteController"
data-ng-click="IssuesDelete(issue)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
</div>
</div>
var app = angular.module("myApp").controller('loadIssuesDetail', function ($scope, $stateParams, $http, $state) {
$http.get('http://localhost:8081/chi-tiet-issues/' + $stateParams.IssuesId).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.loadIssues = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
$scope.saveComment = function (IssuesComment) {
IssuesComment.issueId = $scope.loadIssues.id;
$http({
method: 'POST',
url: 'http://localhost:8081/tao-comment',
data: angular.toJson(IssuesComment),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
//hiện thị danh sách comment
});
app.controller('showComment',showComment)
function showComment($scope, $http) {
$http.get('http://localhost:8081/Comment/' + $scope.loadIssues.id).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.CommentIssues = response.data
$scope.numPages = function () {
return Math.ceil($scope.CommentIssues.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListCommentIssues = $scope.CommentIssues.slice(begin, end);
});
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<script>
function showAddLeaveFormFunction() {
var x = document.getElementById("addDivLF");
var n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = " Back";
} else {
x.style.display = "none";
n.value = "Add Leave Form";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>Leave Form</b></h2>
<label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addLeaveForm" class="btn btn-success" type="submit" name="addTS" value="Add Leave Form" data-toggle="modal" onclick="showAddLeaveFormFunction()"/>
<div class="col-sm-4 pull-right">
<label>PageSize:</label>
<select ng-value="leaveFormPerPage" ng-model="leaveFormPerPage" class="form-control">
<option>3</option>
<option>5</option>
<option>50</option>
<option>100</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="addDivLF" style="display: none">
<h2><b>Add Leave Form</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.employeeId"/>
</td>
</tr>
<tr>
<td><label>Leave Type Id</label></td>
<td>
<!-- <input type="text" maxlength="10" value="" ng-model="lfdto.leaveTypeId" style="width: 100%;"/>-->
<select ng-model="lfdto.leaveTypeId">
<option value="">Select Leave Type</option>
<option ng-repeat="lf in leaveTypeList" value="{{lf.id}}">{{lf.name}}</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" class="btn-primary" data-toggle="modal" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" class="btn-danger" data-toggle="modal" value="Clear" ng-click="lfdto = null"/>
</td>
</tr>
</table>
</div>
<div id="updateDivLF" style="display: none">
<h2><b>Edit Leave Form</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" class="btn-primary" data-toggle="modal" name="submit" value="Confirm" ng-click="update();"/>
<!-- <input type="submit" class="btn-danger" data-toggle="modal" name="clear" value="Clear" ng-click="lfdto = null"/>-->
<input type="submit" class="btn-dark" data-toggle="modal" name="close" value="Close" onclick="document.getElementById('updateDivLF').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Employee</th>
<th>Leave Type</th>
<th>Create At</th>
<th>Status</th>
<th colspan="4"></th>
</tr>
</thead>
<tbody>
<tr class="lff" ng-repeat="lf in searched = (leaveFormList | filter:search | orderBy : base :reverse) | beginningLeaveForm:(currentPage-1)*leaveFormPerPage | limitTo:leaveFormPerPage">
<td>{{$index + 1}}</td>
<td>{{lf.title}}</td>
<td>{{lf.content}}</td>
<td>{{lf.employee.lastName}}</td>
<td>{{lf.leaveType.name}}</td>
<td>{{lf.updatedAt}}</td>
<td id="checkStatus">{{lf.status}}</td>
<td><a ui-sref="leaveFormDetail({id: lf.id})" data-toggle="modal"><i class="fa fa-eye" data-toggle="tooltip" title="View"></i></a></td>
<td><a ui-sref="leaveForm" ng-click="getLf(lf);" onclick="document.getElementById('updateDivLF').style.display = 'block'" class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="leaveForm" ng-click="delete(lf);" class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a></td>
<!-- <td><a ui-sref="leaveForm" ng-click="updateStatus(lf)" data-toggle="modal"><i id="approved" class="fa fa-check" data-toggle="tooltip" title="Approved"></i></a></td>-->
</tr>
</tbody>
</table>
</div>
<div class="col-md-12" ng-show="filterLeaveForm == 0">
<div class="col-md-12">
<h4>No records found..</h4>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 pull-left">
<h5>Showing {{ searched.length }} of {{ entireLeaveForm}} entries</h5>
</div>
<uib-pagination total-items="filterLeaveForm" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pagePosition(currentPage)" rotate="true"
items-per-page="leaveFormPerPage"></uib-pagination>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp")
.filter('beginningLeaveForm', function() {
return function(input, begin) {
if (input) {
begin = +begin;
return input.slice(begin);
}
return [];
}
})
.controller("leaveFormController", function($scope, $http, $state) {
console.log("Leave Form controller");
$scope.lf = {
"id": "",
"title": "",
"content": "",
"employee": "",
"leaveType": "",
"updatedAt": "",
"status": ""
};
$scope.lfdto = {
"id": "",
"title": "",
"content": "",
"employeeId": "",
"leaveTypeId": ""
};
//get all leave form
$http({
method : 'GET',
url : "http://localhost:8081/employee/leaveform/show"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormList = response.data;
$scope.currentPage = 1;
$scope.leaveFormPerPage = 3;
$scope.filterLeaveForm = $scope.leaveFormList.length;
$scope.entireLeaveForm = $scope.leaveFormList.length;
}, function errorCallback(response) {
console.log(response)
});
$scope.pagePosition = function(pageNumber) {
$scope.currentPage = pageNumber;
};
$scope.filter = function() {
$timeout(function() {
$scope.filterLeaveForm = $scope.searched.length;
}, 20);
};
$scope.sortWith = function(base) {
$scope.base = base;
$scope.reverse = !$scope.reverse;
};
//get all leave type
$http({
method : 'GET',
url : "http://localhost:8081/employee/leaveType/getAll"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveTypeList=response.data;
}, function errorCallback(response) {
console.log(response)
});
//delete leave form
$scope.delete = function (lf) {
$http({
method : 'DELETE',
url : "http://localhost:8081/employee/leaveform/delete/" + lf.id
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
};
$scope.save = save;
function save(){
console.log($scope.lfdto);
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/add",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$scope.getLf = getLf;
function getLf(lf) {
$scope.lfdto.id = lf.id;
$scope.lfdto.title = lf.title;
$scope.lfdto.content = lf.content;
$scope.lfdto.employeeId = lf.employee.id;
$scope.lfdto.leaveTypeId = lf.leaveType.id;
}
$scope.update = update;
function update(){
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/update",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$scope.updateStatus = updateStatus;
function updateStatus(lf){
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/"+lf.id+"/status",
// data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
<div class="container">
<div class="row">
<div class="col-sm-12">
<div>
<br><br>
<div>
<tr>
<legend><p>Tiêu đề</p>{{leaveFormDetail.title}}</legend>
<h3>Nội dung</h3>
<td>{{leaveFormDetail.content}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<!-- <input type="submit" name="submit" value="Duyệt" ui-sref="leaveForm" ng-click="updateStatus(leaveFormDetail.id)"/>-->
<input type="submit" name="submit" value="Quay lại" ui-sref="leaveform"/>
</tr>
</div>
<br><br>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("leaveFormDetailController", function($scope, $http, $stateParams, $state) {
console.log("Leave Form Detail Controller");
$http({
method : 'GET',
url : "http://localhost:8081/employee/leaveform/" + $stateParams.id
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormDetail=response.data;
}, function errorCallback(response) {
console.log(response)
});
$scope.updateStatus = updateStatus;
function updateStatus(id){
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/"+id+"/status",
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
\ No newline at end of file
<div class="card card-login mx-auto mt-5">
<div class="card-header">Reset Password</div>
<div class="card-body">
<div class="text-center mb-4">
<h4>Lấy lại mật khẩu bằng Email đăng ký?</h4>
</div>
<form>
<div class="form-group">
<div class="form-label-group">
<input type="email" id="inputEmail" class="form-control" placeholder="Enter email address"
required="required" autofocus="autofocus">
<label for="inputEmail">Enter email address</label>
</div>
</div>
<a class="btn btn-primary btn-block" href="login.html">Reset Password</a>
</form>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="register">Đăng ký tài khoản</a>
<a class="d-block small" ui-sref="login">Đăng Nhập</a>
</div>
</div>
</div>
\ No newline at end of file
<div class="card card-login mx-auto mt-5">
<div class="card-header" style="text-align: center">Đăng Nhập Hệ Thống</div>
<div class="card-body">
<form>
<div class="form-group">
<div class="form-label-group">
<input type="text" id="username" class="form-control" placeholder="Tên Đăng Nhập"
autofocus="autofocus" required>
<label for="username">Tên Đăng Nhập</label>
</div>
</div>
<div class="form-group">
<div class="form-label-group">
<input type="password" id="inputPassword" class="form-control" placeholder="Mật Khẩu"
required="required">
<label for="inputPassword">Mật Khẩu</label>
</div>
</div>
<input class="btn btn-primary btn-block" type="submit" value="Đăng Nhập"/>
</form>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="register">Đăng Ký</a>
<a class="d-block small" ui-sref="forgot-password">Lấy Lại Mật Khẩu?</a>
</div>
</div>
</div>
\ No newline at end of file
angular.module("myApp").controller("loginController", function($scope, $http,$window) {
console.log("loginController");
});
\ No newline at end of file
<div class="card card-register mx-auto mt-5">
<div class="card-header" style="text-align: center">ĐĂNG KÝ TÀI KHOẢN</div>
<div class="card-body">
<form>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="username" id="username" class="form-control" placeholder="Tên truy cập"
required="required" autofocus="autofocus">
<label for="username">Tên Đăng Nhập</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="name" id="name" class="form-control" placeholder="Họ và Tên"
required="required">
<label for="name">Họ và Tên</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="email" ng-model="email" id="email" class="form-control"
placeholder="Email đăng ký" required="required">
<label for="Email">Email đăng ký</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="tel" ng-model="phonenumber" id="phonenumber" class="form-control"
placeholder="SDT" required="required">
<label for="phonenumber">SDT</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Object" id="Object" class="form-control"
placeholder="Đối tượng" required="required">
<label for="Object">Đối Tượng</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="skype" id="skype" class="form-control"
placeholder="nick skype" required="required">
<label for="skype">Nick Skype</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="facebook" id="facebook" class="form-control"
placeholder="facebook" required="required">
<label for="facebook">facebook</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="HocVan" id="HocVan" class="form-control"
placeholder="Học Vấn" required="required">
<label for="HocVan">Học Vấn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="QueQuan" id="QueQuan" class="form-control"
placeholder="Quê Quán" required="required">
<label for="QueQuan">Quê Quán</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Truong" id="Truong" class="form-control"
placeholder="Trường" required="required">
<label for="Truong">Trường</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Khoa" id="Khoa" class="form-control"
placeholder="Khoa" required="required">
<label for="Khoa">Khoa</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="NamTotNghiep" id="NamTotNghiep" class="form-control"
placeholder="Năm tốt nghiệp" required="required">
<label for="NamTotNghiep">Năm tốt nghiệp</label>
</div>
</div>
</div>
</div>
<a class="btn btn-primary btn-block" href="#">Register</a>
</form>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="login">Dăng Nhập</a>
<a class="d-block small" ui-sref="forgot-password">Lấy lại mật khẩu?</a>
</div>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="row">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<h1 style="text-align: center">Thành thành viên mới của dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<select ng-model="employeeProject.projectId" autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}</option>
</select>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="employeeProject.userName" id="employee"
placeholder="Tài khoản nhân viên" required="required">
<label>Chức Vụ</label>
<select ng-model="employeeProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select>
</div>
</div>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<form ng-controller="updateGroutpProject" ng-submit="updatePositionProject(gruopProject)" name="formProject">
<input type="hidden" ng-model="gruopProject.id" id="id"><br/>
<input type="hidden" ng-model="gruopProject.projectDTO.id" id="idProject"><br/>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="gruopProject.employeeDTO.username" id="descriptions"
placeholder="Tài khoản nhân viên"
ng-disabled="true">
<label>Chức Vụ</label>
<select ng-model="gruopProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="groupProjectByProjectId({ID: gruopProject.projectDTO.id})">Back</button>
</div>
</form>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addEmployeeProject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<tr></tr>
<h2 style="text-align: center">Thành Viên Trong Nhóm Dự Án</h2>
<table class="table">
<thead>
<tr>
<th>Tài khoản</th>
<th>Tên</th>
<th>Email</th>
<th>Chức Vụ</th>
<th>Ngày Vào</th>
<th>Ngày Ra</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="gruopProject in listGruopProject |filter:search| lmto:3:3*(currentPage-1) track by $index">
<td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td>
<td>{{ gruopProject.position}}</td>
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td style="width: 200px">
<a ui-sref="editEmployeeProject({ID: gruopProject.id})">
<button class="btn btn-primary btn-xs" data-title="Cập Nhật" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
<button type="button" ui-sref="project">Back</button>
</div>
</div>
\ No newline at end of file
angular.module("myApp").controller('groupProjectShowController', function ($scope,$stateParams,$http,$filter) {
$scope.listGruopProject = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.listGruopProject).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.listGruopProject.length / $scope.numPerPage);
};
function getAll() {
$http.get('http://localhost:8081/thong-tin-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listGruopProject = response.data;
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
}
});
\ No newline at end of file
<div class="container">
<form ng-controller="insertProject" ng-submit="insert_project()">
<h1 style=" text-align: center">Thêm mới dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<input type="text" maxlength="29" ng-model="project.name" required="required"/>
<label>Mô tả ngắn</label>
<input type="text" maxlength="29" ng-model="project.descriptions" required="required"/>
<label>Ngày bắt đầu</label>
<input type="date" maxlength="29" ng-model="project.startDate" required="required"/>
<label>Ngày kết thúc</label>
<input type="date" maxlength="29" ng-model="project.endDate" required="required"/>
</div>
</div>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
var app = angular.module('myApp');
// app.controller('showProject', showProject);
app.controller('insertProject', insertProject);
app.controller('deleteProject', deleteProject);
app.controller('updateProject', updateProject);
app.controller('loadProjectDetail', loadProjectDetail);
function insertProject($scope, $http, $state) {
$scope.insert_project = function () {
$http({
method: 'POST',
url: 'http://localhost:8081/quan-tri/them-du-an',
data: angular.toJson($scope.project),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
};
// delete project theo id
function deleteProject($scope, $window, $http,$state) {
$scope.deleteProject = function (project) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8081/quan-tri/xoa-du-an',
data: $scope.project,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
};
//tạo controller sửa theo id
function updateProject($scope, $http, $state) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/quan-tri/sua-du-an',
data: angular.toJson($scope.project),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
function errorCallback(error) {
//error code
console.log("can't update data!!");
}
}
};
};
function loadProjectDetail($scope, $stateParams, $http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<div class="container">
<div class="row">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<h1 style="text-align: center">Cập nhật dự án dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<input type="text" maxlength="29" ng-model="project.name" required="required"/>
<label>Mô tả ngắn</label>
<input type="text" maxlength="29" ng-model="project.descriptions" required="required"/>
<label>Trạng Thái</label>
<select ng-model="project.status" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option value="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option>
</select><br/>
<input type="hidden" ng-model="project.id" id="id"><br/>
</div>
</div>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addproject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<!-- <input type="text" ng-model="search" placeholder="Search">-->
<input class="search" ng-model="keyword" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2 style="text-align: center">Thông tin dự án</h2>
<table class="table">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th style="width: 250px">Thao Tác</th>
</tr>
</thead>
<tbody>
<tr class="vide"
ng-repeat="project in listProject| filter:{name:keyword} | lmto:3:3*(currentPage-1) track by $index">
<td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>
<span ng-if="project.status == 0" style="color: #34ce57">Dự Kiến</span>
<span ng-if="project.status == 1" style="color: #0e90d2">Đang Tiến Hành</span>
<span ng-if="project.status == 2" style="color: #b21f2d">Hoàn Thành</span>
</td>
<!-- thao tác-->
<td style="width: 250px">
<a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết Nhóm</a>
<a ui-sref="editproject({ID: project.id})">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteProject" data-ng-click="deleteProject(project.id)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
</div>
</div>
angular.module("myApp").controller('projectViewsController', function ($scope, $http,$filter) {
$scope.listProject = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
//mới thêm
$scope.makeEmployee = function () {
$scope.listProject = [];
for (i = 1; i <= 100; i++) {
$scope.listProject.push({text: 'project ' + i, done: false});
}
};
$scope.keyword = "";
//mới thêm
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.listProject, {'name': $scope.keyword}).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.listProject.length / $scope.numPerPage);
};
function getAll() {
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data;
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
});
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <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;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in employeesList|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="listEmployeeLackController">
<form>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;"> <br>
<div ng-show="detail">
<div>
Số lần thiếu báo cáo: {{listEmployeeLackDetails.numberOflack}}
</div>
<div>
<table class="table table-bordered" id="" width="100%" cellspacing="0">
<tbody>
<tr>
<th>Ngày thiếu:</th>
<td data-ng-repeat="dt in listEmployeeLackDetails.timeSheetList" >{{dt.createdAt | date:"dd/MM/yyyy"}} </td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-show="inputDate">
<label for="startDate">Ngày Bắt Đầu</label>
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required" style="width: auto">
<label for="endDate">Ngày Kết Thúc</label>
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required" style="width: auto">
</div>
<div>
<a ng-click="listEmployeeLacks($stateParams.ID,request.firstDate, request.finalDate)" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="show"> Hiển thị </a>
<a ng-click="cancelView()" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="cancel"> Đóng </a>
</div>
</form>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in listEmployee|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ng-click="listEmployeeLackDetail(emp.id)" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
<div><a ng-click="history.go(-1);" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" > Trở Về</a></div>
</div>
</div>
</div>
</div>
\ No newline at end of file
var app = angular.module('myApp');
app.controller('reportController',projectList);
app.controller('timeSheetListController' , timeSheetList);
app.controller('updateTimeSheetStatusController',updateTimeSheetStatus);
app.controller('updateTimeSheetCheckedController', updateTimeSheetChecked);
app.controller('listLackOfReportController',employeeList);
app.controller('insertProjectReportController', insertProjectReport);
app.controller('allProjectReportController',allProjectReport);
app.controller('projectReportDetailController', projectReportDetail);
app.controller('deleteReportController',deleteReport);
app.controller('listEmployeeLackController',listEmployeeLack);
// app.controller('listEmployeeLackDetailController',listEmployeeLackDetail);
// Danh sách các dự án đang triển khai
function projectList($scope, $http) {
$http({
method: 'GET',
url:"http://localhost:8081/admin/report/project",
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.projects = response.data;
}, function errorCallback(response) {
console.log(response)
});
}
//======================================================================================================================
// Danh Sách Báo cáo ngày của dự án đó
function timeSheetList($scope, $http, $stateParams){
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID+"/timeSheet/"+$scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheets= response.data;
console.log($scope.timeSheets);
}, function errorCallback(error) {
console.log(error)
});
}
function updateTimeSheetStatus($scope, $window, $http) {
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
$scope.updateTimeSheetStatus = function (id) {
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/" + id + "/update/" + $scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.timeSheetsMessages=response.data;
alert($scope.timeSheetsMessages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Update False !!!");
}
}
};
};
function updateTimeSheetChecked($scope, $window, $http) {
$scope.updateTimeSheetChecked = function (id, check) {
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/timeSheet/update/" + id ,
data: check,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.timeSheetsMessages=response.data;
alert($scope.timeSheetsMessages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("UPDATE FALSE !!!");
}
}
};
};
// Danh Sách Các Thành viên Thiếu Báo Cáo Ngày Của Dự Án
function employeeList($scope, $http, $stateParams){
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
console.log($scope.request.currentDate);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID+"/employee/"+$scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.employeesList= response.data;
console.log($scope.employeesList);
}, function errorCallback(response) {
console.log(response)
});
}
//======================================================================================================================
function insertProjectReport($scope, $window, $http) {
$scope.insertReport = function (id, firstDate, finalDate) {
$scope.request = {
"projectId": id,
"firstPoint": "",
"finalPoint": ""
}
$scope.request.firstPoint = firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).slice(-2) + '-' + ('0' + firstDate.getDate()).slice(-2);
$scope.request.finalPoint = finalDate.getFullYear() + '-' + ('0' + (finalDate.getMonth() + 1)).slice(-2) + '-' + ('0' + finalDate.getDate()).slice(-2);
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/newReport",
data: $scope.request,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.messages=response.data;
alert($scope.messages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Create FALSE !!!");
}
}
};
};
function allProjectReport($scope, $http, $stateParams){
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID +"/allReport",
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.ProjectReports= response.data;
console.log($scope.ProjectReports);
}, function errorCallback(response) {
console.log(response)
});
}
function projectReportDetail($scope, $http, $stateParams){
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/report/"+$stateParams.ID,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.projectReportDetails= response.data;
console.log($scope.projectReportDetails);
}, function errorCallback(response) {
console.log(response)
});
}
function deleteReport($scope, $window, $http, $state) {
$scope.deleteReport = function (id) {
if (confirm("Bạn có muốn xóa ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/report/delete/" + id,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.messages=response.data;
$state.reload();
alert($scope.messages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Delete FALSE !!!");
}
}
};
};
//======================================================================================================================
function listEmployeeLack($scope, $window, $http, $stateParams) {
//button setting
$scope.inputDate = true;
$scope.cancel = false;
$scope.show = true;
$scope.detail = false;
//Date
$scope.request = {
"firstPoint": "",
"finalPoint": ""
}
$scope.listEmployeeLacks = function (id, firstDate, finalDate) {
$scope.request.firstPoint = firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).slice(-2) + '-' + ('0' + firstDate.getDate()).slice(-2);
$scope.request.finalPoint = finalDate.getFullYear() + '-' + ('0' + (finalDate.getMonth() + 1)).slice(-2) + '-' + ('0' + finalDate.getDate()).slice(-2);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/" + $stateParams.ID + "/employee/" + $scope.request.firstPoint + "/" + $scope.request.finalPoint,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.listEmployee = response.data;
console.log($scope.listEmployee);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log(error);
}
};
$scope.listEmployeeLackDetail = function (employeeId) {
//button setting
$scope.inputDate = false;
$scope.cancel = true;
$scope.show = false;
$scope.detail = true;
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/" + $stateParams.ID + "/employee/" + employeeId + "/" + $scope.request.firstPoint + "/" + $scope.request.finalPoint,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.listEmployeeLackDetails = response.data;
console.log($scope.listEmployeeLackDetails);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log(error);
}
};
$scope.cancelView = function(){
$scope.inputDate = true;
$scope.cancel = false;
$scope.show = true;
$scope.detail = false;
};
};
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Báo cáo chi tiết
</div>
<div class="card-body" ng-controller="projectReportDetailController">
<div>
<h4>Tên Dự Án:</h4><br>
<p>{{projectReportDetails.projectName}}</p>
<h4>Team Leader</h4>
<p>{{projectReportDetails.teamLeader}}</p>
<h4>Số Thành Viên</h4>
<p>{{projectReportDetails.numberOfMember}}</p>
<h4>Điểm</h4>
<p>{{projectReportDetails.calendarEffort}}</p>
<h4>Số Thành Viên Thiếu Báo Cáo</h4>
<p>{{projectReportDetails.lackOfReport}}</p>
<h4>Khoảng Thời Gian</h4>
<p>{{projectReportDetails.firstDate}} --> {{projectReportDetails.firstDate}}</p>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh sách báo cáo theo thời gian của dự án
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="allProjectReportController">
<div ng-controller="deleteReportController">
<!-- <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;">
{{messages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên Dự Án</th>
<th>Team Leader</th>
<th>Số Thành Viên</th>
<th>Điểm Nỗ Lực</th>
<th>Số TV Thiếu Báo Cáo</th>
<th>Thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pr in ProjectReports|filter:search">
<td>{{$index+1}}</td>
<td>{{pr.projectName}}</td>
<td>{{pr.teamLeader}}</td>
<td>{{pr.numberOfMember}}</td>
<td>{{pr.calendarEffort}}</td>
<td>{{pr.lackOfReport}}</td>
<td>{{pr.firstDate | date:"dd/MM/yyyy"}} <br>--> {{pr.finalDate | date:"dd/MM/yyyy"}}</td>
<td><a ui-sref="reportDetail({ID: pr.id})" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="deleteReport(pr.id)" class="btn btn-warning btn-circle btn-sm">Xóa </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!--<div class="card mb-3">-->
<!-- <div class="card-header">-->
<!-- <i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)-->
<!-- </div>-->
<!-- <div class="card-body">-->
<!-- <div class="table-responsive" ng-controller="reportController">-->
<!-- <div ng-controller="insertProjectReportController">-->
<!--&lt;!&ndash; <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;">&ndash;&gt;-->
<!--&lt;!&ndash; Thêm </a>&ndash;&gt;-->
<!-- <input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">-->
<!-- {{messages.view}}-->
<!-- <table class="table table-bordered" id="dataTable" width="100%"-->
<!-- cellspacing="0">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>STT</th>-->
<!-- <th>Tên dự án</th>-->
<!-- <th>Mô tả</th>-->
<!-- <th>Thời gian </th>-->
<!-- <th>Trạng thái</th>-->
<!-- <th>Chọn khoảng thời gian</th>-->
<!-- <th>Menu</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <form>-->
<!-- <tr data-ng-repeat="pro in projects|filter:search">-->
<!-- <td>{{$index+1}}</td>-->
<!-- <td>{{pro.name}}</td>-->
<!-- <td>{{pro.descriptions}}</td>-->
<!-- <td>{{pro.startDate | date:"dd/MM/yyyy"}} <br>&ndash;&gt; {{pro.endDate | date:"dd/MM/yyyy"}}</td>-->
<!-- <td>{{pro.status}}</td>-->
<!-- <td class="form-label-group" >-->
<!--&lt;!&ndash; <label for="startDate">Ngày Bắt Đầu</label>&ndash;&gt;-->
<!-- <input type="date" ng-model="request.firstDate" id="startDate" class="form-control"-->
<!-- placeholder="điểm đầu" required="required">-->
<!--&lt;!&ndash; <label for="endDate">Ngày Kết Thúc</label>&ndash;&gt;-->
<!-- <input type="date" ng-model="request.finalDate" id="endDate" class="form-control"-->
<!-- placeholder="điểm cuối" required="required">-->
<!-- </td>-->
<!-- <td>-->
<!-- <a ng-click="insertReport(pro.id, request.firstDate, request.finalDate)" class="btn btn-info btn-circle btn-sm">Thêm mới báo cáo></a><br>-->
<!-- <a ui-sref="allReport({ID: pro.id})" class="btn btn-warning btn-circle btn-sm">Danh sách báo cáo</a> <br>-->
<!-- <a ui-sref="reportEmployeeLack({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </form>-->
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<div class="container">
<div class="row" ng-controller="reportController" >
<div class="col-md-8" ng-controller="insertProjectReportController">
<h4>{{messages.view}}</h4>
<tr></tr>
<input class="search" ng-model="search" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2>Danh Sách Dự án (Đang được triển khai)</h2>
<table class="table">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian </th>
<th>Trạng thái</th>
<th>Chọn khoảng thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr class="vide"
data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}} <br>--> {{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td class="form-label-group" >
<!-- <label for="startDate">Ngày Bắt Đầu</label>-->
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required">
<!-- <label for="endDate">Ngày Kết Thúc</label>-->
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required">
</td>
<td>
<a ng-click="insertReport(pro.id, request.firstDate, request.finalDate)" class="btn btn-info btn-circle btn-sm">Thêm mới báo cáo></a><br>
<a ui-sref="allReport({ID: pro.id})" class="btn btn-warning btn-circle btn-sm">Danh sách báo cáo</a> <br>
<a ui-sref="reportEmployeeLack({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="employeePerPage"></uib-pagination>
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Timesheet Dự án
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <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;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tiêu đề</th>
<th>Nội dung</th>
<th>Ghi chú</th>
<th>Ngày tạo</th>
<th>trạng thái duyệt</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="item in timeSheets|filter:search">
<td>{{$index+1}}</td>
<td>{{item.title}}</td>
<td>{{item.content}}</td>
<td>{{item.note}}</td>
<td>{{item.createdAt | date:"dd/MM/yyyy" }}</td>
<td>
<select ng-model="item.checked" class="form-control" autofocus="autofocus" required="required">
<!-- <option value="">==> Trạng Thái</option>-->
<option value="unapproved">Chưa duyệt</option>
<option value="approved">Đã duyệt</option>
<option value="deny">Từ chối</option>
</select>
</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="updateTimeSheetChecked(item.id, item.checked)" class="btn btn-warning btn-circle btn-sm">Duyệt </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="reportController">
<div ng-controller="updateTimeSheetStatusController">
<!-- <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;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian bắt đầu</th>
<th>Thời gian kết thúc</th>
<th>Trạng thái</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td><a ui-sref="reportTimeSheet({ID: pro.id})" class="btn btn-info btn-circle btn-sm">Ds báo cáo ngày </a><br>
<a ng-click="updateTimeSheetStatus(pro.id)" class="btn btn-warning btn-circle btn-sm">khởi tạo tv thiếu báo cáo</a> <br>
<a ui-sref="reportEmployee({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp")
.filter('beginningTimeSheet', function() {
return function(input, begin) {
if (input) {
begin = +begin;
return input.slice(begin);
}
return [];
}
})
.controller("timeSheetController", function($scope, $http, $state) {
console.log("Time Sheet controller");
$scope.ts = {
"title": "",
"content": "",
"note": ""
};
$scope.tsdto = {
"id": "",
"title": "",
"content": "",
"note": "",
"eprojectId": "",
"employeeId": ""
};
//get all time sheet
$http({
method: 'GET',
url: "http://localhost:8081/eproject/timesheet/show"
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheetList = response.data;
$scope.currentPage = 1;
$scope.timeSheetPerPage = 3;
$scope.filterTimeSheet = $scope.timeSheetList.length;
$scope.entireTimeSheet = $scope.timeSheetList.length;
}, function errorCallback(response) {
console.log(response)
});
$scope.pagePosition = function(pageNumber) {
$scope.currentPage = pageNumber;
};
$scope.filter = function() {
$timeout(function() {
$scope.filterTimeSheet = $scope.searched.length;
}, 20);
};
$scope.sortWith = function(base) {
$scope.base = base;
$scope.reverse = !$scope.reverse;
};
//get all eproject
$http({
method: 'GET',
url: "http://localhost:8081/eproject/getAll"
}).then(function successCallback(response) {
console.log(response);
$scope.eProjectList = response.data;
}, function errorCallback(response) {
console.log(response)
});
//delete time sheet
$scope.delete = function (ts) {
$http({
method: 'DELETE',
url: "http://localhost:8081/eproject/timesheet/delete/" + ts.id
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
};
$scope.save = save;
function save() {
console.log($scope.tsdto);
$http({
method: 'POST',
url: "http://localhost:8081/eproject/timesheet/add",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$scope.getTs = getTs;
function getTs(ts) {
$scope.tsdto.id = ts.id;
$scope.tsdto.title = ts.title;
$scope.tsdto.content = ts.content;
$scope.tsdto.note = ts.note;
$scope.tsdto.employeeId = ts.eproject.employee.id;
}
$scope.update = update;
function update() {
$http({
headers: "content-type: application/json",
method: 'POST',
url: "http://localhost:8081/eproject/timesheet/update",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
<div class="container">
<div class="row">
<div class="col-sm-12">
<div>
<br><br>
<div>
<tr>
<legend><p>Tiêu đề</p>{{timeSheetDetail.title}}</legend>
<h3>Nội dung</h3>
<td>{{timeSheetDetail.content}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<h3>Ghi chú</h3>
<td>{{timeSheetDetail.note}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<h3>Trạng thái</h3>
<td>{{timeSheetDetail.checked}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<input type="text" name="check" placeholder="Nhận xét" ng-model="check"/>
<input type="submit" name="submit" value="Xác nhận" ng-click="updateCheck(timeSheetDetail.id, check);" ui-sref="leaveFormDetail"/>
<input type="submit" name="submit" value="Quay lại" ui-sref="timesheet"/>
</tr>
</div>
<br><br>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("timeSheetDetailController", function($scope, $http, $stateParams, $state) {
console.log("Time Sheet Detail Controller");
$scope.tsd = {
"id": "",
"checked": ""
};
$http({
method : 'GET',
url : "http://localhost:8081/eproject/timesheet/" + $stateParams.id
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheetDetail=response.data;
}, function errorCallback(response) {
console.log(response)
});
$scope.updateCheck = function updateCheck(id, check){
$scope.tsd.id = id;
$scope.tsd.checked = check;
$http({
headers: {"Content-Type": "application/json"},
method : 'POST',
url : "http://localhost:8081/eproject/timesheet/update/check",
data: $scope.tsd
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
\ No newline at end of file
<script>
function showAddTimeSheetFunction() {
var x = document.getElementById("addDivTS");
var n = document.getElementById("addTimeSheet");
if (x.style.display === "none") {
x.style.display = "block";
n.value = "Close";
} else {
x.style.display = "none";
n.value = "Add TimeSheet";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>TimeSheet</b></h2>
<label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add TimeSheet" onclick="showAddTimeSheetFunction()"/>
<div class="col-sm-4 pull-right">
<label>PageSize:</label>
<select ng-value="timeSheetPerPage" ng-model="timeSheetPerPage" class="form-control">
<option>3</option>
<option>5</option>
<option>50</option>
<option>100</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="addDivTS" style="display: none">
<h2><b>Add TimeSheet</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Employee Project Id</label></td>
<!-- <td>-->
<!-- <input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId" style="width: 100%;"/>-->
<!-- </td>-->
<td>
<select ng-model="tsdto.eprojectId">
<option value="">Select Project</option>
<option ng-repeat="ep in eProjectList" value="{{ep.id}}">{{ep.project.name}}</option>
</select>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.employeeId"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" class="btn-primary" data-toggle="modal" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" class="btn-dark" data-toggle="modal" value="Clear" ng-click="tsdto = null"/>
</td>
</tr>
</table>
</div>
<div id="updateDivTS" style="display: none">
<h2><b>Edit TimeSheet</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note" style="width: 100%;"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" class="btn-primary" data-toggle="modal" name="submit" value="Confirm" ng-click="update();"/>
<!-- <input type="submit" class="btn-primary" data-toggle="modal" name="clear" value="Clear" ng-click="tsdto = null"/>-->
<input type="submit" class="btn-dark" data-toggle="modal" name="close" value="Close" onclick="document.getElementById('updateDivTS').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Note</th>
<th>Project</th>
<th>Create at</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<tr class="tss" ng-repeat="ts in searched = (timeSheetList | filter:search | orderBy : base :reverse) | beginningTimeSheet:(currentPage-1)*timeSheetPerPage | limitTo:timeSheetPerPage">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
<td>{{ts.note}}</td>
<td>{{ts.eproject.project.name}}</td>
<td>{{ts.updatedAt}}</td>
<td><a ui-sref="timesheetDetail({id: ts.id})"data-toggle="modal"><i class="fa fa-eye" data-toggle="tooltip" title="View"></i></a></td>
<td><a ui-sref="timeSheet" ng-click="getTs(ts);" onclick="document.getElementById('updateDivTS').style.display = 'block'"class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="timeSheet" ng-click="delete(ts);"class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a></td>
</tr>
<!-- <tr>-->
<!-- <h6><code>rotate</code> defaulted to <code>true</code> and <code>force-ellipses</code> set to <code>true</code>:</h6>-->
<!-- <ul uib-pagination total-items="getAllTimesheet()" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-link-number="true" ng-change ="pageChangedIndex()" items-per-page = "timesheetPerPage" ></ul>-->
<!-- </tr>-->
</tbody>
</table>
</div>
<div class="col-md-12" ng-show="filterTimeSheet == 0">
<div class="col-md-12">
<h4>No records found..</h4>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 pull-left" ng-show="filterTimeSheet > 0">
<h5>Showing {{ searched.length }} of {{ entireTimeSheet}} entries</h5>
</div>
<uib-pagination total-items="filterTimeSheet" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pagePosition(currentPage)" rotate="true"
items-per-page="timeSheetPerPage"></uib-pagination>
</div>
</div>
</div>
</div>
</div>
\ 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