연차관리 커밋
This commit is contained in:
parent
90cbdace02
commit
99f2e79478
@ -133,6 +133,7 @@ public class SecurityConfig {
|
||||
UserVO loginVO = new UserVO();
|
||||
loginVO.setUserName( userDetails.getUser().getUserName());
|
||||
loginVO.setBiostarId( userDetails.getUser().getBiostarId());
|
||||
loginVO.setUniqId( userDetails.getUser().getUniqId());
|
||||
request.getSession().setAttribute("loginVO", loginVO);
|
||||
|
||||
// 요청 URL의 호스트를 추출 (디버깅용)
|
||||
|
||||
@ -9,6 +9,7 @@ import com.itn.admin.itn.code.mapper.domain.CodeDetailVO;
|
||||
import com.itn.admin.itn.code.mapper.domain.CodeVO;
|
||||
import com.itn.admin.itn.code.server.CodeDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -35,7 +36,7 @@ public class CodeDetailServiceImpl implements CodeDetailService {
|
||||
public String getCodeName(String codeGroupId, String codeId) {
|
||||
CodeDetailVO codeDetailVO = codeDetailMapper.findById(codeGroupId, codeId);
|
||||
log.info("codeDetailVO: {}", codeDetailVO);
|
||||
return codeDetailVO.getCodeName();
|
||||
return StringUtils.isEmpty(codeDetailVO.getCodeName()) ? null : codeDetailVO.getCodeName() ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.itn.admin.itn.leave.mapper;
|
||||
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO; // 추가
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeavePlanVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ItnLeaveMapper {
|
||||
// LeaveStatus 관련
|
||||
LeaveStatusVO selectLeaveStatusByUserIdAndYear(String uniqId, String year);
|
||||
int insertLeaveStatus(LeaveStatusVO leaveStatusVO);
|
||||
int updateLeaveStatus(LeaveStatusVO leaveStatusVO);
|
||||
|
||||
// LeavePlan 관련
|
||||
List<LeavePlanVO> selectLeavePlansByUserIdAndYear(String uniqId, String year);
|
||||
LeavePlanVO selectLeavePlanById(Long planId);
|
||||
int insertLeavePlan(LeavePlanVO leavePlanVO);
|
||||
int updateLeavePlan(LeavePlanVO leavePlanVO);
|
||||
int deleteLeavePlan(Long planId);
|
||||
|
||||
// 관리자용
|
||||
List<LeavePlanVO> selectAllPendingLeavePlans();
|
||||
int updateLeavePlanStatusAndReason(LeavePlanVO leavePlanVO); // 추가: 연차 계획 상태 및 반려 사유 업데이트
|
||||
|
||||
// LeaveChangeRequest 관련
|
||||
int insertLeaveChangeRequest(LeaveChangeRequestVO leaveChangeRequestVO); // 추가: 연차 변경 요청 삽입
|
||||
LeaveChangeRequestVO selectLeaveChangeRequestById(Long changeRequestId); // 추가: 연차 변경 요청 상세 조회
|
||||
int updateLeaveChangeRequestStatus(LeaveChangeRequestVO leaveChangeRequestVO); // 추가: 연차 변경 요청 상태 업데이트
|
||||
List<LeaveChangeRequestVO> selectAllPendingLeaveChangeRequests(); // 추가: 모든 승인 대기 중인 연차 변경 요청 조회
|
||||
|
||||
LeaveChangeRequestVO selectItnLeaveChangeRequestById(Long changeRequestId);
|
||||
|
||||
List<LeaveChangeRequestVO> getChangeHistoryByPlanId(Long planId);
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.itn.admin.itn.leave.mapper.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class LeaveChangeRequestVO {
|
||||
private Long changeRequestId;
|
||||
private Long planId;
|
||||
private String uniqId;
|
||||
private String userName;
|
||||
private LocalDate originalLeaveDate;
|
||||
private LocalDate requestedLeaveDate;
|
||||
private String requestReason;
|
||||
private String requestStatus;
|
||||
private String requestStatusName; // 추가
|
||||
private String approverId;
|
||||
private String rejectionReason;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
|
||||
private LocalDateTime requestDt;
|
||||
private LocalDateTime approvalDt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.itn.admin.itn.leave.mapper.domain;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class LeavePlanVO {
|
||||
private Long planId;
|
||||
private String uniqId;
|
||||
private String userName;
|
||||
private String year;
|
||||
private LocalDate leaveDate;
|
||||
private BigDecimal leaveDays;
|
||||
private String status;
|
||||
private String statusName; // 추가
|
||||
private LocalDateTime requestDt;
|
||||
private String approverId;
|
||||
private LocalDateTime approvalDt;
|
||||
private String rejectReason;
|
||||
private String changeRequestStatus;
|
||||
private String changeRequestStatusName;
|
||||
private String rejectionReason;
|
||||
private String requestedLeaveDate;
|
||||
|
||||
private String requestStatus; // 변경 상태
|
||||
private String requestStatusName; // 변경 상태 코드 name
|
||||
private String changeCount; // 변경 카운트
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.itn.admin.itn.leave.mapper.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class LeaveStatusVO extends LeaveChangeRequestVO{
|
||||
private String year;
|
||||
private BigDecimal totalLeave;
|
||||
private BigDecimal usedLeave;
|
||||
private BigDecimal promotedLeave;
|
||||
private BigDecimal remainingLeave;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.itn.admin.itn.leave.service;
|
||||
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeavePlanVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ItnLeaveService {
|
||||
|
||||
LeaveStatusVO getLeaveStatus(String uniqId, String year);
|
||||
|
||||
List<LeavePlanVO> getLeavePlans(String userId, String year);
|
||||
|
||||
LeavePlanVO getLeavePlanDetail(Long changeRequestId);
|
||||
|
||||
boolean saveLeavePlan(LeavePlanVO leavePlanVO);
|
||||
|
||||
boolean deleteLeavePlan(Long planId);
|
||||
|
||||
List<LeavePlanVO> getAllPendingLeavePlans();
|
||||
|
||||
List<LeaveChangeRequestVO> getAllPendingLeaveChangeRequests();
|
||||
|
||||
boolean approveLeavePlan(Long planId, String approverId);
|
||||
|
||||
boolean rejectLeavePlan(Long planId, String approverId, String rejectReason);
|
||||
|
||||
boolean requestLeaveChange(LeaveChangeRequestVO leaveChangeRequestVO);
|
||||
|
||||
LeaveChangeRequestVO getLeaveChangeRequestDetail(Long changeRequestId);
|
||||
|
||||
boolean approveLeaveChangeRequest(Long changeRequestId, String approverId);
|
||||
|
||||
boolean rejectLeaveChangeRequest(Long changeRequestId, String approverId, String rejectionReason);
|
||||
|
||||
RestResponse getChangeHistoryByPlanId(Long planId);
|
||||
}
|
||||
@ -0,0 +1,248 @@
|
||||
package com.itn.admin.itn.leave.service.impl;
|
||||
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
import com.itn.admin.itn.leave.mapper.ItnLeaveMapper;
|
||||
import com.itn.admin.itn.leave.service.ItnLeaveService;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeavePlanVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO;
|
||||
import com.itn.admin.cmn.util.thymeleafUtils.TCodeUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.itn.admin.cmn.code.common.CommonCodeConstants.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ItnLeaveServiceImpl implements ItnLeaveService {
|
||||
|
||||
private final ItnLeaveMapper itnLeaveMapper;
|
||||
private final TCodeUtils tCodeUtils;
|
||||
|
||||
// 연차 현황 조회
|
||||
@Override
|
||||
public LeaveStatusVO getLeaveStatus(String uniqId, String year) {
|
||||
LeaveStatusVO leaveStatus = itnLeaveMapper.selectLeaveStatusByUserIdAndYear(uniqId, year);
|
||||
if (leaveStatus == null) {
|
||||
leaveStatus = new LeaveStatusVO();
|
||||
leaveStatus.setUniqId(uniqId);
|
||||
leaveStatus.setYear(year);
|
||||
leaveStatus.setTotalLeave(BigDecimal.ZERO);
|
||||
leaveStatus.setUsedLeave(BigDecimal.ZERO);
|
||||
leaveStatus.setPromotedLeave(BigDecimal.ZERO);
|
||||
leaveStatus.setRemainingLeave(BigDecimal.ZERO); // 초기값 설정
|
||||
}
|
||||
return leaveStatus;
|
||||
}
|
||||
|
||||
// 연차 계획 조회 (사용자용)
|
||||
@Override
|
||||
public List<LeavePlanVO> getLeavePlans(String uniqId, String year) {
|
||||
List<LeavePlanVO> leavePlans = itnLeaveMapper.selectLeavePlansByUserIdAndYear(uniqId, year);
|
||||
leavePlans.forEach(plan -> {
|
||||
plan.setStatusName(tCodeUtils.getCodeName("LEAVE_STATUS", plan.getStatus()));
|
||||
plan.setRequestStatusName(tCodeUtils.getCodeName("CHANGE_REQUEST_STATUS", plan.getRequestStatus()));
|
||||
});
|
||||
return leavePlans;
|
||||
}
|
||||
|
||||
// 연차 계획 상세 조회
|
||||
@Override
|
||||
public LeavePlanVO getLeavePlanDetail(Long planId) {
|
||||
LeavePlanVO leavePlan = itnLeaveMapper.selectLeavePlanById(planId);
|
||||
if (leavePlan != null) {
|
||||
leavePlan.setChangeRequestStatusName(tCodeUtils.getCodeName("CHANGE_REQUEST_STATUS", leavePlan.getChangeRequestStatus()));
|
||||
leavePlan.setUserName(tCodeUtils.getUserName(leavePlan.getUniqId()));
|
||||
}
|
||||
return leavePlan;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LeaveChangeRequestVO getLeaveChangeRequestDetail(Long changeRequestId) {
|
||||
LeaveChangeRequestVO leaveChangeRequestVO = itnLeaveMapper.selectItnLeaveChangeRequestById(changeRequestId);
|
||||
if (leaveChangeRequestVO != null) {
|
||||
leaveChangeRequestVO.setUserName(tCodeUtils.getUserName(leaveChangeRequestVO.getUniqId()));
|
||||
}
|
||||
return leaveChangeRequestVO;
|
||||
}
|
||||
|
||||
// 연차 계획 신청/수정
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean saveLeavePlan(LeavePlanVO leavePlanVO) {
|
||||
if (leavePlanVO.getPlanId() == null) {
|
||||
// 신규 신청
|
||||
leavePlanVO.setStatus(LEAVE_STATUS_PENDING); // 초기 상태는 PENDING
|
||||
return itnLeaveMapper.insertLeavePlan(leavePlanVO) > 0;
|
||||
} else {
|
||||
// 수정
|
||||
// TODO: 기존 상태 확인 로직 추가 (예: 승인된 계획은 수정 불가 등)
|
||||
return itnLeaveMapper.updateLeavePlan(leavePlanVO) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 연차 계획 삭제
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean deleteLeavePlan(Long planId) {
|
||||
// TODO: 삭제 권한 및 상태 확인 로직 추가
|
||||
return itnLeaveMapper.deleteLeavePlan(planId) > 0;
|
||||
}
|
||||
|
||||
// 관리자: 승인 대기 연차 계획 목록 조회
|
||||
@Override
|
||||
public List<LeavePlanVO> getAllPendingLeavePlans() {
|
||||
List<LeavePlanVO> leavePlans = itnLeaveMapper.selectAllPendingLeavePlans();
|
||||
leavePlans.forEach(plan -> {
|
||||
// plan.setStatusName(tCodeUtils.getCodeName("LEAVE_STATUS", plan.getStatus()));
|
||||
// plan.setChangeRequestStatusName(tCodeUtils.getCodeName("CHANGE_REQUEST_STATUS", plan.getChangeRequestStatus()));
|
||||
log.info("leavePlans :: [{}]", plan.toString());
|
||||
|
||||
});
|
||||
return leavePlans;
|
||||
}
|
||||
|
||||
// 관리자: 승인 대기 연차 변경 요청 목록 조회
|
||||
@Override
|
||||
public List<LeaveChangeRequestVO> getAllPendingLeaveChangeRequests() {
|
||||
List<LeaveChangeRequestVO> changeRequests = itnLeaveMapper.selectAllPendingLeaveChangeRequests();
|
||||
changeRequests.forEach(request -> {
|
||||
request.setRequestStatusName(tCodeUtils.getCodeName("CHANGE_REQUEST_STATUS", request.getRequestStatus()));
|
||||
});
|
||||
return changeRequests;
|
||||
}
|
||||
|
||||
// 관리자: 연차 계획 승인
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean approveLeavePlan(Long planId, String approverId) {
|
||||
LeavePlanVO leavePlan = itnLeaveMapper.selectLeavePlanById(planId);
|
||||
if (leavePlan == null || !LEAVE_STATUS_PENDING.equals(leavePlan.getStatus())) {
|
||||
return false; // 계획이 없거나 이미 처리됨
|
||||
}
|
||||
|
||||
leavePlan.setStatus(LEAVE_STATUS_APPROVED);
|
||||
leavePlan.setApproverId(approverId);
|
||||
leavePlan.setApprovalDt(LocalDateTime.now());
|
||||
|
||||
// 사용된 연차 업데이트
|
||||
LeaveStatusVO leaveStatus = itnLeaveMapper.selectLeaveStatusByUserIdAndYear(leavePlan.getUniqId(), leavePlan.getYear());
|
||||
if (leaveStatus == null) {
|
||||
// 해당 연도 연차 현황이 없으면 새로 생성
|
||||
leaveStatus = new LeaveStatusVO();
|
||||
leaveStatus.setUniqId(leavePlan.getUniqId());
|
||||
leaveStatus.setYear(leavePlan.getYear());
|
||||
leaveStatus.setTotalLeave(new BigDecimal("0.0")); // 초기값
|
||||
leaveStatus.setUsedLeave(leavePlan.getLeaveDays());
|
||||
leaveStatus.setPromotedLeave(new BigDecimal("0.0")); // 초기값
|
||||
itnLeaveMapper.insertLeaveStatus(leaveStatus);
|
||||
} else {
|
||||
leaveStatus.setUsedLeave(leaveStatus.getUsedLeave().add(leavePlan.getLeaveDays()));
|
||||
itnLeaveMapper.updateLeaveStatus(leaveStatus);
|
||||
}
|
||||
|
||||
return itnLeaveMapper.updateLeavePlan(leavePlan) > 0;
|
||||
}
|
||||
|
||||
// 관리자: 연차 계획 반려
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean rejectLeavePlan(Long planId, String approverId, String rejectReason) {
|
||||
LeavePlanVO leavePlan = itnLeaveMapper.selectLeavePlanById(planId);
|
||||
if (leavePlan == null || !LEAVE_STATUS_PENDING.equals(leavePlan.getStatus())) {
|
||||
return false; // 계획이 없거나 이미 처리됨
|
||||
}
|
||||
|
||||
leavePlan.setStatus(LEAVE_STATUS_REJECTED);
|
||||
leavePlan.setApproverId(approverId);
|
||||
leavePlan.setApprovalDt(LocalDateTime.now());
|
||||
leavePlan.setRejectReason(rejectReason);
|
||||
|
||||
return itnLeaveMapper.updateLeavePlan(leavePlan) > 0;
|
||||
}
|
||||
|
||||
// 연차 변경 요청
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean requestLeaveChange(LeaveChangeRequestVO leaveChangeRequestVO) {
|
||||
// 기존 연차 계획의 변경 요청 상태를 10으로 업데이트
|
||||
// LeavePlanVO originalLeavePlan = itnLeaveMapper.selectLeavePlanById(leaveChangeRequestVO.getPlanId());
|
||||
// if (originalLeavePlan == null) {
|
||||
// return false; // 원본 연차 계획이 없음
|
||||
// }
|
||||
// leaveChangeRequestVO.setUniqId(originalLeavePlan.getUniqId());
|
||||
|
||||
|
||||
// 연차 변경 요청 이력 저장
|
||||
leaveChangeRequestVO.setRequestStatus(LEAVE_CHANGE_REQUEST_STATUS_PENDING);
|
||||
return itnLeaveMapper.insertLeaveChangeRequest(leaveChangeRequestVO) > 0;
|
||||
}
|
||||
|
||||
|
||||
// 관리자: 연차 변경 요청 승인
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean approveLeaveChangeRequest(Long changeRequestId, String approverId) {
|
||||
LeaveChangeRequestVO changeRequest = itnLeaveMapper.selectLeaveChangeRequestById(changeRequestId);
|
||||
if (changeRequest == null || !LEAVE_CHANGE_REQUEST_STATUS_PENDING.equals(changeRequest.getRequestStatus())) {
|
||||
return false; // 변경 요청이 없거나 이미 처리됨
|
||||
}
|
||||
|
||||
// 변경 요청 상태 업데이트
|
||||
changeRequest.setRequestStatus(LEAVE_CHANGE_REQUEST_STATUS_APPROVED);
|
||||
changeRequest.setApproverId(approverId);
|
||||
itnLeaveMapper.updateLeaveChangeRequestStatus(changeRequest);
|
||||
|
||||
// 원본 연차 계획 업데이트 (날짜 변경)
|
||||
LeavePlanVO originalLeavePlan = itnLeaveMapper.selectLeavePlanById(changeRequest.getPlanId());
|
||||
if (originalLeavePlan != null) {
|
||||
originalLeavePlan.setLeaveDate(changeRequest.getRequestedLeaveDate());
|
||||
itnLeaveMapper.updateLeavePlan(originalLeavePlan); // 기존 updateLeavePlan 사용
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 관리자: 연차 변경 요청 반려
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean rejectLeaveChangeRequest(Long changeRequestId, String approverId, String rejectionReason) {
|
||||
LeaveChangeRequestVO changeRequest = itnLeaveMapper.selectLeaveChangeRequestById(changeRequestId);
|
||||
if (changeRequest == null || !LEAVE_CHANGE_REQUEST_STATUS_PENDING.equals(changeRequest.getRequestStatus())) {
|
||||
return false; // 변경 요청이 없거나 이미 처리됨
|
||||
}
|
||||
|
||||
// 변경 요청 상태 업데이트
|
||||
changeRequest.setRequestStatus(LEAVE_CHANGE_REQUEST_STATUS_REJECTED);
|
||||
changeRequest.setApproverId(approverId);
|
||||
changeRequest.setRejectionReason(rejectionReason);
|
||||
changeRequest.setApprovalDt(LocalDateTime.now());
|
||||
itnLeaveMapper.updateLeaveChangeRequestStatus(changeRequest);
|
||||
|
||||
// 원본 연차 계획의 변경 요청 상태 업데이트 (반려 사유 포함)
|
||||
/* LeavePlanVO originalLeavePlan = itnLeaveMapper.selectLeavePlanById(changeRequest.getPlanId());
|
||||
if (originalLeavePlan != null) {
|
||||
originalLeavePlan.setChangeRequestStatus(LEAVE_CHANGE_REQUEST_STATUS_REJECTED);
|
||||
originalLeavePlan.setRejectionReason(rejectionReason);
|
||||
itnLeaveMapper.updateLeavePlanStatusAndReason(originalLeavePlan);
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResponse getChangeHistoryByPlanId(Long planId) {
|
||||
|
||||
List<LeaveChangeRequestVO> leaveChangeRequestVOList = itnLeaveMapper.getChangeHistoryByPlanId(planId);
|
||||
return new RestResponse(HttpStatus.OK, "연차 계획 상세 조회 성공", leaveChangeRequestVOList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.itn.admin.itn.leave.web;
|
||||
|
||||
import com.itn.admin.cmn.config.CustomUserDetails;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO;
|
||||
import com.itn.admin.itn.leave.service.ItnLeaveService;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeavePlanVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import java.time.Year;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequestMapping("/itn/leave")
|
||||
@RequiredArgsConstructor
|
||||
public class ItnLeaveController {
|
||||
|
||||
private final ItnLeaveService itnLeaveService;
|
||||
|
||||
// 내 연차 현황 화면
|
||||
@GetMapping("/status")
|
||||
public String getLeaveStatus(Model model
|
||||
, @AuthenticationPrincipal CustomUserDetails loginUser) {
|
||||
String uniqId = loginUser.getUser().getUniqId(); // 로그인한 사용자의 uniq_id
|
||||
|
||||
Integer year = Year.now().getValue(); // 현재 연도
|
||||
|
||||
LeaveStatusVO leaveStatus = itnLeaveService.getLeaveStatus(uniqId, String.valueOf(year));
|
||||
model.addAttribute("leaveStatus", leaveStatus);
|
||||
model.addAttribute("leavePlans", itnLeaveService.getLeavePlans(uniqId, String.valueOf(year)));
|
||||
return "itn/leave/leave_status";
|
||||
}
|
||||
|
||||
// 연차 사용 계획 신청/변경 화면
|
||||
@GetMapping("/request")
|
||||
public String showLeaveRequestForm(@RequestParam(required = false) Long planId, Model model) {
|
||||
LeavePlanVO leavePlan = new LeavePlanVO();
|
||||
if (planId != null) {
|
||||
leavePlan = itnLeaveService.getLeavePlanDetail(planId);
|
||||
}
|
||||
model.addAttribute("leavePlan", leavePlan);
|
||||
return "itn/leave/leave_request";
|
||||
}
|
||||
|
||||
// 연차 변경 요청 화면
|
||||
@GetMapping("/change-request-form")
|
||||
public String showLeaveChangeRequestForm(@RequestParam Long planId, Model model) {
|
||||
LeavePlanVO leavePlan = itnLeaveService.getLeavePlanDetail(planId);
|
||||
model.addAttribute("leavePlan", leavePlan);
|
||||
return "itn/leave/leave_change_request";
|
||||
}
|
||||
|
||||
// [관리자] 승인 대기 목록 화면
|
||||
@GetMapping("/admin/approvals")
|
||||
public String getApprovalList(Model model) {
|
||||
List<LeaveChangeRequestVO> pendingChangeRequests = itnLeaveService.getAllPendingLeaveChangeRequests();
|
||||
pendingChangeRequests.forEach(t->{
|
||||
System.out.println("t :: "+ t.toString());
|
||||
});
|
||||
model.addAttribute("pendingChangeRequests", pendingChangeRequests);
|
||||
return "itn/leave/leave_approval_list";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
package com.itn.admin.itn.leave.web;
|
||||
|
||||
import com.itn.admin.cmn.config.CustomUserDetails;
|
||||
import com.itn.admin.cmn.msg.RestResponse;
|
||||
import com.itn.admin.itn.leave.service.ItnLeaveService;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO;
|
||||
import com.itn.admin.itn.leave.mapper.domain.LeavePlanVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Year;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/itn/leave")
|
||||
@RequiredArgsConstructor
|
||||
public class ItnLeaveRestController {
|
||||
|
||||
private final ItnLeaveService itnLeaveService;
|
||||
|
||||
|
||||
// 연차 사용 계획 제출 (신규/변경)
|
||||
@PostMapping("/request")
|
||||
public ResponseEntity<RestResponse> submitLeavePlan(@RequestBody LeavePlanVO leavePlanVO
|
||||
, @AuthenticationPrincipal CustomUserDetails loginUser) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String uniqId = loginUser.getUser().getUniqId();
|
||||
leavePlanVO.setUniqId(uniqId);
|
||||
leavePlanVO.setYear(String.valueOf(Year.now().getValue()));
|
||||
|
||||
boolean result = itnLeaveService.saveLeavePlan(leavePlanVO);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획이 성공적으로 저장되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 계획 저장에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
// 연차 계획 삭제
|
||||
@DeleteMapping("/request/{planId}")
|
||||
public ResponseEntity<RestResponse> deleteLeavePlan(@PathVariable Long planId) {
|
||||
boolean result = itnLeaveService.deleteLeavePlan(planId);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획이 성공적으로 삭제되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 계획 삭제에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// [관리자] 연차 계획 승인
|
||||
@PostMapping("/admin/approve")
|
||||
public ResponseEntity<RestResponse> approveLeavePlan(@RequestParam Long planId) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String approverId = authentication.getName(); // 로그인한 관리자 ID
|
||||
boolean result = itnLeaveService.approveLeavePlan(planId, approverId);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획이 승인되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 계획 승인에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
// [관리자] 연차 계획 반려
|
||||
@PostMapping("/admin/reject")
|
||||
public ResponseEntity<RestResponse> rejectLeavePlan(@RequestParam Long planId, @RequestParam String rejectReason) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String approverId = authentication.getName(); // 로그인한 관리자 ID
|
||||
boolean result = itnLeaveService.rejectLeavePlan(planId, approverId, rejectReason);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획이 반려되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 계획 반려에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
// 연차 변경 요청 제출
|
||||
@PostMapping("/change-request")
|
||||
public ResponseEntity<RestResponse> submitLeaveChangeRequest(@RequestBody LeaveChangeRequestVO leaveChangeRequestVO
|
||||
, @AuthenticationPrincipal CustomUserDetails loginUser) {
|
||||
leaveChangeRequestVO.setUniqId(loginUser.getUser().getUniqId());
|
||||
boolean result = itnLeaveService.requestLeaveChange(leaveChangeRequestVO);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 변경 요청이 성공적으로 제출되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 변경 요청 제출에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
// 연차 변경 요청 상세 조회
|
||||
@GetMapping("/change-request/{changeRequestId}")
|
||||
public ResponseEntity<RestResponse> getLeaveChangeRequestDetail(@PathVariable Long changeRequestId) {
|
||||
LeaveChangeRequestVO detail = itnLeaveService.getLeaveChangeRequestDetail(changeRequestId);
|
||||
if (detail != null) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 변경 요청 상세 조회 성공", detail));
|
||||
} else {
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
}
|
||||
|
||||
// [관리자] 연차 변경 요청 승인
|
||||
@PostMapping("/admin/change-request/approve")
|
||||
public ResponseEntity<RestResponse> approveLeaveChangeRequest(@RequestParam Long changeRequestId
|
||||
,@AuthenticationPrincipal CustomUserDetails loginUser) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String approverId = loginUser.getUser().getUniqId(); // 로그인한 관리자 ID
|
||||
boolean result = itnLeaveService.approveLeaveChangeRequest(changeRequestId, approverId);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 변경 요청이 승인되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 변경 요청 승인에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
// [관리자] 연차 변경 요청 반려
|
||||
@PostMapping("/admin/change-request/reject")
|
||||
public ResponseEntity<RestResponse> rejectLeaveChangeRequest(@RequestParam Long changeRequestId, @RequestParam String rejectionReason
|
||||
,@AuthenticationPrincipal CustomUserDetails loginUser) {
|
||||
String approverId = loginUser.getUser().getUniqId(); // 로그인한 관리자 ID
|
||||
boolean result = itnLeaveService.rejectLeaveChangeRequest(changeRequestId, approverId, rejectionReason);
|
||||
if (result) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 변경 요청이 반려되었습니다."));
|
||||
} else {
|
||||
return ResponseEntity.badRequest().body(new RestResponse(HttpStatus.BAD_REQUEST, "연차 변경 요청 반려에 실패했습니다."));
|
||||
}
|
||||
}
|
||||
// [관리자] 연차 계획 상세 조회 (Ajax용)
|
||||
@GetMapping("/admin/change-request-detail/{changeRequestId}")
|
||||
public ResponseEntity<RestResponse> getLeavePlanDetail(@PathVariable Long changeRequestId) {
|
||||
LeaveChangeRequestVO detail = itnLeaveService.getLeaveChangeRequestDetail(changeRequestId);
|
||||
log.info(" + detail :: [{}]", detail.toString());
|
||||
if (detail != null) {
|
||||
return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획 상세 조회 성공", detail));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new RestResponse(HttpStatus.NOT_FOUND, "연차 계획을 찾을 수 없습니다."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// [관리자] 연차 계획 상세 조회 (Ajax용)
|
||||
@GetMapping("/change-history/{planId}")
|
||||
public ResponseEntity<RestResponse> getChangeHistoryByPlanId(@PathVariable Long planId) {
|
||||
log.info(" + planId : [{}]", planId);
|
||||
// log.info(" + detail :: [{}]", detail.toString());
|
||||
// if (detail != null) {
|
||||
// return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획 상세 조회 성공", detail));
|
||||
// } else {
|
||||
// return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
// .body(new RestResponse(HttpStatus.NOT_FOUND, "연차 계획을 찾을 수 없습니다."));
|
||||
// }
|
||||
// return ResponseEntity.ok().body(new RestResponse(HttpStatus.OK, "연차 계획 상세 조회 성공"));
|
||||
return ResponseEntity.ok().body(itnLeaveService.getChangeHistoryByPlanId(planId));
|
||||
}
|
||||
}
|
||||
@ -1,2 +1,3 @@
|
||||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
||||
log4jdbc.dump.sql.addsemicolon=true
|
||||
@ -4,7 +4,8 @@
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
|
||||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss}:%-4relative] %green([%thread]) %highlight(%-5level) %boldWhite([%C.%M:%yellow(%L)]) - %msg%n%ex"/>
|
||||
<!-- 간결화된 로그 패턴 -->
|
||||
<property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss}] %highlight(%-5level) %green([%thread]) - %msg%n%ex"/>
|
||||
|
||||
<property name="LOG_DIR" value="${log.config.path}"/>
|
||||
<property name="ERR_LOG_FILE_NAME" value="err_log"/>
|
||||
@ -41,20 +42,18 @@
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!-- log4jdbc 비활성화 -->
|
||||
<logger name="net.sf.log4jdbc" level="OFF" />
|
||||
<!-- log4jdbc 로거 설정 -->
|
||||
<logger name="jdbc" level="OFF"/>
|
||||
<logger name="jdbc.sqlonly" level="OFF"/>
|
||||
<logger name="jdbc.sqltiming" level="INFO"/>
|
||||
<logger name="jdbc.audit" level="OFF"/>
|
||||
<logger name="jdbc.resultset" level="OFF"/>
|
||||
<logger name="jdbc.resultsettable" level="INFO"/>
|
||||
<logger name="jdbc.connection" level="OFF"/>
|
||||
|
||||
<!-- MyBatis SQL 로그 활성화 -->
|
||||
<logger name="org.mybatis.spring" level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="ROLLING" />
|
||||
</logger>
|
||||
|
||||
<!-- 매퍼 로그 상세 출력 -->
|
||||
<logger name="egovframework.sqlmappers" level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="ROLLING" />
|
||||
</logger>
|
||||
<!-- MyBatis SQL 로그 레벨 조정 -->
|
||||
<logger name="org.mybatis.spring" level="INFO" />
|
||||
<logger name="egovframework.sqlmappers" level="INFO" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ROLLING"/>
|
||||
|
||||
255
src/main/resources/mapper/itn/leave/ItnLeaveMapper.xml
Normal file
255
src/main/resources/mapper/itn/leave/ItnLeaveMapper.xml
Normal file
@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.itn.admin.itn.leave.mapper.ItnLeaveMapper">
|
||||
|
||||
<!-- LeaveStatus 관련 -->
|
||||
<select id="selectLeaveStatusByUserIdAndYear" resultType="com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO">
|
||||
SELECT
|
||||
UNIQ_ID,
|
||||
YEAR,
|
||||
TOTAL_LEAVE,
|
||||
USED_LEAVE,
|
||||
PROMOTED_LEAVE,
|
||||
(TOTAL_LEAVE - USED_LEAVE) AS REMAINING_LEAVE
|
||||
FROM ITN_LEAVE_STATUS
|
||||
WHERE UNIQ_ID = #{uniqId} AND YEAR = #{year}
|
||||
</select>
|
||||
|
||||
<insert id="insertLeaveStatus" parameterType="com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO">
|
||||
INSERT INTO ITN_LEAVE_STATUS (
|
||||
UNIQ_ID,
|
||||
YEAR,
|
||||
TOTAL_LEAVE,
|
||||
USED_LEAVE,
|
||||
PROMOTED_LEAVE
|
||||
) VALUES (
|
||||
#{userId},
|
||||
#{year},
|
||||
#{totalLeave},
|
||||
#{usedLeave},
|
||||
#{promotedLeave}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateLeaveStatus" parameterType="com.itn.admin.itn.leave.mapper.domain.LeaveStatusVO">
|
||||
UPDATE ITN_LEAVE_STATUS
|
||||
SET
|
||||
TOTAL_LEAVE = #{totalLeave},
|
||||
USED_LEAVE = #{usedLeave},
|
||||
PROMOTED_LEAVE = #{promotedLeave}
|
||||
WHERE UNIQ_ID = #{userId} AND YEAR = #{year}
|
||||
</update>
|
||||
|
||||
<!-- LeavePlan 관련 -->
|
||||
<select id="selectLeavePlansByUserIdAndYear" resultType="com.itn.admin.itn.leave.mapper.domain.LeavePlanVO">
|
||||
|
||||
SELECT
|
||||
p.PLAN_ID,
|
||||
p.UNIQ_ID,
|
||||
p.YEAR,
|
||||
p.LEAVE_DATE,
|
||||
p.LEAVE_DAYS,
|
||||
p.STATUS,
|
||||
c.change_request_id,
|
||||
c.original_leave_date,
|
||||
c.requested_leave_date,
|
||||
c.request_reason,
|
||||
c.request_status,
|
||||
c.request_dt,
|
||||
c.rejection_reason,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM itn_leave_change_request sub
|
||||
WHERE sub.plan_id = p.PLAN_ID
|
||||
) AS change_count
|
||||
FROM itn_leave_plan p
|
||||
LEFT JOIN (
|
||||
SELECT c1.*
|
||||
FROM itn_leave_change_request c1
|
||||
INNER JOIN (
|
||||
SELECT plan_id, MAX(request_dt) AS max_request_dt
|
||||
FROM itn_leave_change_request
|
||||
GROUP BY plan_id
|
||||
) c2 ON c1.plan_id = c2.plan_id AND c1.request_dt = c2.max_request_dt
|
||||
) c ON p.PLAN_ID = c.plan_id
|
||||
WHERE p.UNIQ_ID = #{uniqId}
|
||||
AND p.YEAR = #{year}
|
||||
</select>
|
||||
|
||||
<select id="selectLeavePlanById" resultType="com.itn.admin.itn.leave.mapper.domain.LeavePlanVO">
|
||||
SELECT
|
||||
T1.PLAN_ID,
|
||||
T1.UNIQ_ID,
|
||||
T1.YEAR,
|
||||
T1.LEAVE_DATE,
|
||||
T1.LEAVE_DAYS,
|
||||
T1.STATUS
|
||||
FROM ITN_LEAVE_PLAN T1
|
||||
WHERE T1.PLAN_ID = #{planId}
|
||||
</select>
|
||||
|
||||
<insert id="insertLeavePlan" parameterType="com.itn.admin.itn.leave.mapper.domain.LeavePlanVO">
|
||||
INSERT INTO ITN_LEAVE_PLAN (
|
||||
UNIQ_ID,
|
||||
YEAR,
|
||||
LEAVE_DATE,
|
||||
LEAVE_DAYS,
|
||||
STATUS
|
||||
) VALUES (
|
||||
#{userId},
|
||||
#{year},
|
||||
#{leaveDate},
|
||||
#{leaveDays},
|
||||
#{status}
|
||||
)
|
||||
<selectKey keyProperty="planId" resultType="long" order="AFTER">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<update id="updateLeavePlan" parameterType="com.itn.admin.itn.leave.mapper.domain.LeavePlanVO">
|
||||
UPDATE ITN_LEAVE_PLAN
|
||||
SET
|
||||
LEAVE_DATE = #{leaveDate},
|
||||
LEAVE_DAYS = #{leaveDays},
|
||||
STATUS = #{status}
|
||||
WHERE PLAN_ID = #{planId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteLeavePlan" parameterType="long">
|
||||
DELETE FROM ITN_LEAVE_PLAN
|
||||
WHERE PLAN_ID = #{planId}
|
||||
</delete>
|
||||
|
||||
<!-- 관리자용 -->
|
||||
<select id="selectAllPendingLeavePlans" resultType="com.itn.admin.itn.leave.mapper.domain.LeavePlanVO">
|
||||
SELECT
|
||||
T1.PLAN_ID,
|
||||
T1.UNIQ_ID,
|
||||
T1.YEAR,
|
||||
T1.LEAVE_DATE,
|
||||
T1.LEAVE_DAYS,
|
||||
T1.STATUS
|
||||
FROM ITN_LEAVE_PLAN T1
|
||||
WHERE T1.STATUS = '10'
|
||||
ORDER BY T1.REQUEST_DT ASC
|
||||
</select>
|
||||
|
||||
<!-- LeaveChangeRequest 관련 -->
|
||||
<insert id="insertLeaveChangeRequest" parameterType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
INSERT INTO ITN_LEAVE_CHANGE_REQUEST (
|
||||
PLAN_ID,
|
||||
UNIQ_ID,
|
||||
ORIGINAL_LEAVE_DATE,
|
||||
REQUESTED_LEAVE_DATE,
|
||||
REQUEST_REASON,
|
||||
REQUEST_STATUS,
|
||||
REQUEST_DT
|
||||
) VALUES (
|
||||
#{planId},
|
||||
#{uniqId},
|
||||
#{originalLeaveDate},
|
||||
#{requestedLeaveDate},
|
||||
#{requestReason},
|
||||
#{requestStatus},
|
||||
NOW()
|
||||
)
|
||||
<selectKey keyProperty="changeRequestId" resultType="long" order="AFTER">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<select id="selectLeaveChangeRequestById" resultType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
SELECT
|
||||
T1.CHANGE_REQUEST_ID,
|
||||
T1.PLAN_ID,
|
||||
T1.UNIQ_ID,
|
||||
T1.ORIGINAL_LEAVE_DATE,
|
||||
T1.REQUESTED_LEAVE_DATE,
|
||||
T1.REQUEST_REASON,
|
||||
T1.REQUEST_STATUS,
|
||||
(SELECT CODE_NAME FROM COMMON_CODE_DETAIL WHERE CODE_GROUP_ID = 'CHANGE_REQUEST_STATUS' AND CODE_ID = T1.REQUEST_STATUS) AS requestStatusName,
|
||||
T1.APPROVER_ID,
|
||||
T1.REJECTION_REASON,
|
||||
T1.REQUEST_DT,
|
||||
T1.APPROVAL_DT
|
||||
FROM ITN_LEAVE_CHANGE_REQUEST T1
|
||||
WHERE T1.CHANGE_REQUEST_ID = #{changeRequestId}
|
||||
</select>
|
||||
|
||||
<update id="updateLeaveChangeRequestStatus" parameterType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
UPDATE ITN_LEAVE_CHANGE_REQUEST
|
||||
SET
|
||||
REQUEST_STATUS = #{requestStatus},
|
||||
APPROVER_ID = #{approverId},
|
||||
REJECTION_REASON = #{rejectionReason},
|
||||
APPROVAL_DT = NOW()
|
||||
WHERE CHANGE_REQUEST_ID = #{changeRequestId}
|
||||
</update>
|
||||
|
||||
<select id="selectAllPendingLeaveChangeRequests" resultType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
SELECT
|
||||
T1.CHANGE_REQUEST_ID,
|
||||
T1.PLAN_ID,
|
||||
T1.UNIQ_ID,
|
||||
T1.ORIGINAL_LEAVE_DATE,
|
||||
T1.REQUESTED_LEAVE_DATE,
|
||||
T1.REQUEST_REASON,
|
||||
T1.REQUEST_STATUS,
|
||||
(SELECT CODE_NAME FROM COMMON_CODE_DETAIL WHERE CODE_GROUP_ID = 'CHANGE_REQUEST_STATUS' AND CODE_ID = T1.REQUEST_STATUS) AS requestStatusName,
|
||||
T1.APPROVER_ID,
|
||||
T1.REJECTION_REASON,
|
||||
T1.REQUEST_DT,
|
||||
T1.APPROVAL_DT
|
||||
FROM ITN_LEAVE_CHANGE_REQUEST T1
|
||||
WHERE T1.REQUEST_STATUS = '10'
|
||||
ORDER BY T1.REQUEST_DT ASC
|
||||
</select>
|
||||
|
||||
<select id="selectItnLeaveChangeRequestById" resultType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
SELECT
|
||||
T1.CHANGE_REQUEST_ID,
|
||||
T1.PLAN_ID,
|
||||
ilp.YEAR ,
|
||||
ilp.LEAVE_DAYS ,
|
||||
T1.UNIQ_ID,
|
||||
T1.ORIGINAL_LEAVE_DATE,
|
||||
T1.REQUESTED_LEAVE_DATE,
|
||||
T1.REQUEST_REASON,
|
||||
T1.REQUEST_STATUS,
|
||||
(SELECT CODE_NAME FROM COMMON_CODE_DETAIL WHERE CODE_GROUP_ID = 'CHANGE_REQUEST_STATUS' AND CODE_ID = T1.REQUEST_STATUS) AS requestStatusName,
|
||||
T1.APPROVER_ID,
|
||||
T1.REJECTION_REASON,
|
||||
T1.REQUEST_DT,
|
||||
T1.APPROVAL_DT
|
||||
FROM ITN_LEAVE_CHANGE_REQUEST T1
|
||||
left join itn_leave_plan ilp
|
||||
on T1.plan_id = ilp.PLAN_ID
|
||||
WHERE T1.CHANGE_REQUEST_ID = #{changeRequestId}
|
||||
</select>
|
||||
|
||||
<select id="getChangeHistoryByPlanId" resultType="com.itn.admin.itn.leave.mapper.domain.LeaveChangeRequestVO">
|
||||
SELECT
|
||||
T1.CHANGE_REQUEST_ID,
|
||||
T1.PLAN_ID,
|
||||
ilp.YEAR ,
|
||||
ilp.LEAVE_DAYS ,
|
||||
T1.UNIQ_ID,
|
||||
T1.ORIGINAL_LEAVE_DATE,
|
||||
T1.REQUESTED_LEAVE_DATE,
|
||||
T1.REQUEST_REASON,
|
||||
T1.REQUEST_STATUS,
|
||||
(SELECT CODE_NAME FROM COMMON_CODE_DETAIL WHERE CODE_GROUP_ID = 'CHANGE_REQUEST_STATUS' AND CODE_ID = T1.REQUEST_STATUS) AS requestStatusName,
|
||||
T1.APPROVER_ID,
|
||||
T1.REJECTION_REASON,
|
||||
T1.REQUEST_DT,
|
||||
T1.APPROVAL_DT
|
||||
FROM ITN_LEAVE_CHANGE_REQUEST T1
|
||||
left join itn_leave_plan ilp
|
||||
on T1.plan_id = ilp.PLAN_ID
|
||||
WHERE T1.PLAN_ID = #{planId}
|
||||
order by T1.request_dt desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -112,7 +112,7 @@
|
||||
});
|
||||
|
||||
|
||||
function fn_successAlert(title, msg){
|
||||
function fn_successAlert(title="성공", msg){
|
||||
$(document).Toasts('create', {
|
||||
class: 'bg-info',
|
||||
title: title,
|
||||
@ -123,7 +123,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
function fn_failedAlert(title, msg){
|
||||
function fn_failedAlert(title="실패", msg){
|
||||
$(document).Toasts('create', {
|
||||
class: 'bg-danger',
|
||||
title: title,
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" sec:authorize="hasRole('ROLE_ADMIN')">
|
||||
<a th:href="@{/admin/user/list}" class="nav-link">
|
||||
<i class="nav-icon fas fa-user-cog"></i>
|
||||
<p>사용자 관리</p>
|
||||
@ -74,7 +74,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item">
|
||||
<li class="nav-item" sec:authorize="hasRole('ROLE_ADMIN')">
|
||||
<a th:href="@{/code/list}" class="nav-link">
|
||||
<i class="nav-icon fas fa-code"></i>
|
||||
<p>공통코드</p>
|
||||
@ -117,6 +117,36 @@
|
||||
</li>
|
||||
</ul>-->
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link" >
|
||||
<i class="nav-icon fas fa-calendar-alt"></i>
|
||||
<p>
|
||||
연차 관리
|
||||
<i class="right fas fa-angle-left"></i>
|
||||
</p>
|
||||
</a>
|
||||
<ul class="nav nav-treeview">
|
||||
<li class="nav-item" sec:authorize="!hasRole('ROLE_ADMIN')">
|
||||
<a th:href="@{/itn/leave/status}" class="nav-link">
|
||||
<i class="fas fa-calendar-check nav-icon"></i>
|
||||
<p>내 연차 현황</p>
|
||||
</a>
|
||||
</li>
|
||||
<!--<li class="nav-item" sec:authorize="!hasRole('ROLE_ADMIN')">
|
||||
<a th:href="@{/itn/leave/request}" class="nav-link">
|
||||
<i class="fas fa-edit nav-icon"></i>
|
||||
<p>연차 신청</p>
|
||||
</a>
|
||||
</li>-->
|
||||
<li class="nav-item" sec:authorize="hasRole('ROLE_ADMIN')">
|
||||
<a th:href="@{/itn/leave/admin/approvals}" class="nav-link">
|
||||
<i class="fas fa-user-check nav-icon"></i>
|
||||
<p>관리자 승인</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a th:href="@{/dict/list}" class="nav-link">
|
||||
<i class="nav-icon fas fa-book"></i>
|
||||
|
||||
@ -0,0 +1,157 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout}">
|
||||
|
||||
<th:block layout:fragment="title">
|
||||
<title>연차 변경 요청 상세</title>
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="page_title">연차 변경 요청 상세</th:block>
|
||||
<th:block layout:fragment="breadcrumb">연차 변경 요청 상세</th:block>
|
||||
|
||||
<th:block layout:fragment="head">
|
||||
<script src="/plugins/jquery/jquery.min.js"></script>
|
||||
<script src="/plugins/toastr/toastr.min.js"></script>
|
||||
<link rel="stylesheet" href="/plugins/toastr/toastr.min.css">
|
||||
</th:block>
|
||||
|
||||
<body layout:fragment="body">
|
||||
|
||||
<div class="wrapper">
|
||||
<div th:replace="~{fragments/top_nav :: topFragment}"/>
|
||||
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4"
|
||||
th:insert="~{fragments/mainsidebar :: sidebarFragment}">
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">연차 변경 요청 상세</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">연차 변경 요청 상세</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">연차 변경 요청 상세</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="approvalForm">
|
||||
<input type="hidden" id="changeRequestId" th:value="${changeRequest.changeRequestId}">
|
||||
<div class="form-group">
|
||||
<label>신청자</label>
|
||||
<input type="text" class="form-control" th:value="${changeRequest.userId}" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>기존 연차 일자</label>
|
||||
<input type="text" class="form-control" th:value="${changeRequest.originalLeaveDate}" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>요청 변경 일자</label>
|
||||
<input type="text" class="form-control" th:value="${changeRequest.requestedLeaveDate}" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>요청 사유</label>
|
||||
<textarea class="form-control" th:text="${changeRequest.requestReason}" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rejectionReason">반려 사유</label>
|
||||
<textarea class="form-control" id="rejectionReason" name="rejectionReason" rows="3"></textarea>
|
||||
</div>
|
||||
<button type="button" class="btn btn-success" id="approveBtn">승인</button>
|
||||
<button type="button" class="btn btn-danger" id="rejectBtn">반려</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back();">목록으로</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer"
|
||||
th:insert="~{fragments/footer :: footerFragment}">
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
</body>
|
||||
|
||||
<script layout:fragment="script" th:inline="javascript">
|
||||
$(function () {
|
||||
const changeRequestId = $('#changeRequestId').val();
|
||||
|
||||
$('#approveBtn').on('click', function() {
|
||||
if (confirm('정말로 이 변경 요청을 승인하시겠습니까?')) {
|
||||
$.ajax({
|
||||
url: '/itn/leave/admin/change-request/approve',
|
||||
type: 'POST',
|
||||
data: { changeRequestId: changeRequestId },
|
||||
success: function(response) {
|
||||
toastr.success(response.msg);
|
||||
setTimeout(function() { location.href = '/itn/leave/admin/approvals'; }, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
toastr.error(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#rejectBtn').on('click', function() {
|
||||
const rejectionReason = $('#rejectionReason').val();
|
||||
if (!rejectionReason) {
|
||||
toastr.error('반려 사유를 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm('정말로 이 변경 요청을 반려하시겠습니까?')) {
|
||||
$.ajax({
|
||||
url: '/itn/leave/admin/change-request/reject',
|
||||
type: 'POST',
|
||||
data: { changeRequestId: changeRequestId, rejectionReason: rejectionReason },
|
||||
success: function(response) {
|
||||
toastr.success(response.msg);
|
||||
setTimeout(function() { location.href = '/itn/leave/admin/approvals'; }, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
toastr.error(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
||||
270
src/main/resources/templates/itn/leave/leave_approval_list.html
Normal file
270
src/main/resources/templates/itn/leave/leave_approval_list.html
Normal file
@ -0,0 +1,270 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout}">
|
||||
|
||||
<th:block layout:fragment="title">
|
||||
<title>연차 승인 관리</title>
|
||||
</th:block>
|
||||
|
||||
<body layout:fragment="body">
|
||||
|
||||
<div class="wrapper">
|
||||
<div th:replace="~{fragments/top_nav :: topFragment}"/>
|
||||
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4"
|
||||
th:insert="~{fragments/mainsidebar :: sidebarFragment}">
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">연차 승인 관리</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">연차 승인 관리</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header bg-primary">
|
||||
<h3 class="card-title text-white">연차 변경 요청 대기 목록</h3>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-bordered table-hover table-striped mb-0 text-center align-middle">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>신청자</th>
|
||||
<th>기존 연차 일자</th>
|
||||
<th>요청 변경 일자</th>
|
||||
<th>요청 사유</th>
|
||||
<th>요청 일시</th>
|
||||
<th>상태</th>
|
||||
<th>관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="changeRequest : ${pendingChangeRequests}">
|
||||
<td th:text="${@TCodeUtils.getUserName(changeRequest.uniqId)}"></td>
|
||||
<td th:text="${changeRequest.originalLeaveDate}"></td>
|
||||
<td th:text="${changeRequest.requestedLeaveDate}"></td>
|
||||
<td th:text="${changeRequest.requestReason}"></td>
|
||||
<td th:text="${#temporals.format(changeRequest.requestDt, 'yyyy-MM-dd HH:mm')}"></td>
|
||||
<td th:text="${changeRequest.requestStatusName}"></td>
|
||||
<td>
|
||||
<a href="#"
|
||||
th:attr="onclick=|openLeaveChangeRequestDetailModal('${changeRequest.changeRequestId}')|"
|
||||
class="btn btn-info btn-sm">
|
||||
<i class="fas fa-search mr-1"></i> 상세
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(pendingChangeRequests)}">
|
||||
<td colspan="7" class="bg-light text-muted text-center py-3">
|
||||
승인 대기 중인 연차 변경 요청이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- /.card -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer"
|
||||
th:insert="~{fragments/footer :: footerFragment}">
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// 승인 상태 변경 시 반려사유 활성화/비활성화
|
||||
$('#changeRequestApprovalStatus').on('change', function() {
|
||||
const status = $(this).val();
|
||||
const $reason = $('#changeRequestRejectionReason');
|
||||
|
||||
if (status === '30') {
|
||||
$reason.prop('readonly', false);
|
||||
} else {
|
||||
$reason.prop('readonly', true).val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function changeApprove(changeRequestId){
|
||||
|
||||
if (confirm('정말로 이 변경 요청을 승인하시겠습니까?')) {
|
||||
$.ajax({
|
||||
url: '/itn/leave/admin/change-request/approve',
|
||||
type: 'POST',
|
||||
data: { changeRequestId: changeRequestId },
|
||||
success: function(response) {
|
||||
toastr.success(response.msg);
|
||||
setTimeout(function() { location.href = '/itn/leave/admin/approvals'; }, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
toastr.error(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function changeReject(changeRequestId, rejectionReason){
|
||||
|
||||
if (!rejectionReason) {
|
||||
toastr.error('반려 사유를 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm('정말로 이 변경 요청을 반려하시겠습니까?')) {
|
||||
$.ajax({
|
||||
url: '/itn/leave/admin/change-request/reject',
|
||||
type: 'POST',
|
||||
data: { changeRequestId: changeRequestId, rejectionReason: rejectionReason },
|
||||
success: function(response) {
|
||||
toastr.success(response.msg);
|
||||
setTimeout(function() { location.href = '/itn/leave/admin/approvals'; }, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
toastr.error(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.openLeaveChangeRequestDetailModal = function (changeRequestId) {
|
||||
console.log('openLeaveChangeRequestDetailModal : ',changeRequestId);
|
||||
$.ajax({
|
||||
url: `/itn/leave/admin/change-request-detail/${changeRequestId}`,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
const data = response.data;
|
||||
console.log('data : ', data);
|
||||
$('#leaveChangeRequestDetailModal #detailChangeRequestId').val(data.changeRequestId);
|
||||
$('#leaveChangeRequestDetailModal #detailChangeRequestUserId').val(data.userName);
|
||||
$('#leaveChangeRequestDetailModal #detailOriginalLeaveDate').val(data.originalLeaveDate);
|
||||
$('#leaveChangeRequestDetailModal #detailRequestedLeaveDate').val(data.requestedLeaveDate);
|
||||
$('#leaveChangeRequestDetailModal #detailRequestReason').val(data.requestReason);
|
||||
$('#leaveChangeRequestDetailModal #detailChangeRequestRequestDt').val(data.requestDt);
|
||||
$('#leaveChangeRequestDetailModal #changeRequestApprovalStatus').val('20'); // 기본값 설정 : 승인
|
||||
$('#leaveChangeRequestDetailModal #changeRequestRejectionReason').val('');
|
||||
$('#leaveChangeRequestDetailModal').modal('show');
|
||||
},
|
||||
error: function(xhr) {
|
||||
alert("상세 정보를 불러오는 데 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submitChangeRequestApproval() {
|
||||
const changeRequestId = $('#leaveChangeRequestDetailModal #detailChangeRequestId').val(); // 체인지 ID
|
||||
const approvalStatus = $('#leaveChangeRequestDetailModal #changeRequestApprovalStatus').val(); // 승인상태
|
||||
const rejectionReason = $('#leaveChangeRequestDetailModal #changeRequestRejectionReason').val(); // 반려 메세지
|
||||
|
||||
// 승인
|
||||
if(approvalStatus === '20'){
|
||||
changeApprove(changeRequestId)
|
||||
}
|
||||
// 반려
|
||||
else if(approvalStatus === '30')
|
||||
{
|
||||
changeReject(changeRequestId, rejectionReason)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- 연차 변경 요청 상세 모달 -->
|
||||
<div class="modal fade" id="leaveChangeRequestDetailModal" tabindex="-1" role="dialog" aria-labelledby="leaveChangeRequestDetailModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="leaveChangeRequestDetailModalLabel">연차 변경 요청 상세</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="leaveChangeRequestApprovalForm">
|
||||
<input type="hidden" id="detailChangeRequestId" name="changeRequestId">
|
||||
<div class="form-group">
|
||||
<label>신청자</label>
|
||||
<input type="text" class="form-control" id="detailChangeRequestUserId" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>기존 연차 일자</label>
|
||||
<input type="text" class="form-control" id="detailOriginalLeaveDate" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>요청 변경 일자</label>
|
||||
<input type="text" class="form-control" id="detailRequestedLeaveDate" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>요청 사유</label>
|
||||
<textarea class="form-control" id="detailRequestReason" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>요청 일시</label>
|
||||
<input type="text" class="form-control" id="detailChangeRequestRequestDt" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="changeRequestApprovalStatus">승인 상태</label>
|
||||
<select class="form-control" id="changeRequestApprovalStatus" name="changeRequestApprovalStatus">
|
||||
<option value="20">승인</option>
|
||||
<option value="30">반려</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="changeRequestRejectionReason">반려 사유</label>
|
||||
<textarea class="form-control" id="changeRequestRejectionReason" name="changeRequestRejectionReason" rows="3" readonly></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" onclick="submitChangeRequestApproval()">승인/반려</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
143
src/main/resources/templates/itn/leave/leave_change_request.html
Normal file
143
src/main/resources/templates/itn/leave/leave_change_request.html
Normal file
@ -0,0 +1,143 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout}">
|
||||
|
||||
<th:block layout:fragment="title">
|
||||
<title>연차 변경 요청</title>
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="page_title">연차 변경 요청</th:block>
|
||||
<th:block layout:fragment="breadcrumb">연차 변경 요청</th:block>
|
||||
|
||||
<th:block layout:fragment="head">
|
||||
<script src="/plugins/jquery/jquery.min.js"></script>
|
||||
<script src="/plugins/moment/moment.min.js"></script>
|
||||
<script src="/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
|
||||
<link rel="stylesheet" href="/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
|
||||
<script src="/plugins/toastr/toastr.min.js"></script>
|
||||
<link rel="stylesheet" href="/plugins/toastr/toastr.min.css">
|
||||
</th:block>
|
||||
|
||||
<body layout:fragment="body">
|
||||
|
||||
<div class="wrapper">
|
||||
<div th:replace="~{fragments/top_nav :: topFragment}"/>
|
||||
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4"
|
||||
th:insert="~{fragments/mainsidebar :: sidebarFragment}">
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">연차 변경 요청</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">연차 변경 요청</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">연차 변경 요청</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="leaveChangeRequestForm">
|
||||
<input type="hidden" id="planId" name="planId" th:value="${leavePlan.planId}">
|
||||
<div class="form-group">
|
||||
<label for="originalLeaveDate">기존 연차 일자</label>
|
||||
<input type="text" class="form-control" id="originalLeaveDate" th:value="${leavePlan.leaveDate}" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="requestedLeaveDate">변경 요청 일자</label>
|
||||
<div class="input-group date" id="reservationdate" data-target-input="nearest">
|
||||
<input type="text" class="form-control datetimepicker-input" id="requestedLeaveDate" name="requestedLeaveDate" data-target="#reservationdate" required>
|
||||
<div class="input-group-append" data-target="#reservationdate" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="requestReason">변경 요청 사유</label>
|
||||
<textarea class="form-control" id="requestReason" name="requestReason" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">요청 제출</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back();">취소</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer"
|
||||
th:insert="~{fragments/footer :: footerFragment}">
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
</body>
|
||||
|
||||
<script layout:fragment="script" th:inline="javascript">
|
||||
$(function () {
|
||||
//Date picker
|
||||
$('#reservationdate').datetimepicker({
|
||||
format: 'YYYY-MM-DD'
|
||||
});
|
||||
|
||||
$('#leaveChangeRequestForm').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const data = {
|
||||
planId: $('#planId').val(),
|
||||
originalLeaveDate: $('#originalLeaveDate').val(),
|
||||
requestedLeaveDate: $('#requestedLeaveDate').val(),
|
||||
requestReason: $('#requestReason').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '/itn/leave/change-request',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data),
|
||||
success: function (response) {
|
||||
toastr.success(response.msg);
|
||||
setTimeout(function() { window.opener.location.reload(); window.close(); }, 1000);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
toastr.error(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</html>
|
||||
59
src/main/resources/templates/itn/leave/leave_request.html
Normal file
59
src/main/resources/templates/itn/leave/leave_request.html
Normal file
@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout}">
|
||||
|
||||
<th:block layout:fragment="title">
|
||||
<title>연차 신청/변경</title>
|
||||
</th:block>
|
||||
|
||||
<th:block layout:fragment="page_title">연차 신청/변경</th:block>
|
||||
<th:block layout:fragment="breadcrumb">연차 신청/변경</th:block>
|
||||
|
||||
<th:block layout:fragment="head">
|
||||
<script src="/plugins/jquery/jquery.min.js"></script>
|
||||
<script src="/plugins/moment/moment.min.js"></script>
|
||||
<script src="/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
|
||||
<link rel="stylesheet" href="/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
|
||||
<script src="/plugins/toastr/toastr.min.js"></script>
|
||||
<link rel="stylesheet" href="/plugins/toastr/toastr.min.css">
|
||||
</th:block>
|
||||
|
||||
<div layout:fragment="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">연차 신청/변경</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="leaveRequestForm">
|
||||
<input type="hidden" id="planId" th:field="${leavePlan.planId}">
|
||||
<div class="form-group">
|
||||
<label for="leaveDate">연차 일자</label>
|
||||
<div class="input-group date" id="reservationdate" data-target-input="nearest">
|
||||
<input type="text" class="form-control datetimepicker-input" id="leaveDate" name="leaveDate" th:field="${leavePlan.leaveDate}" data-target="#reservationdate" required>
|
||||
<div class="input-group-append" data-target="#reservationdate" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="leaveDays">연차 일수</label>
|
||||
<select class="form-control" id="leaveDays" name="leaveDays" th:field="${leavePlan.leaveDays}" required>
|
||||
<option value="1.0">1.0일</option>
|
||||
<option value="0.5">0.5일 (반차)</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">저장</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back();">취소</button>
|
||||
<button type="button" class="btn btn-danger" id="deleteBtn" th:if="${leavePlan.planId != null}">삭제</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
401
src/main/resources/templates/itn/leave/leave_status.html
Normal file
401
src/main/resources/templates/itn/leave/leave_status.html
Normal file
@ -0,0 +1,401 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout}">
|
||||
|
||||
<th:block layout:fragment="title">
|
||||
<title>내 연차 현황</title>
|
||||
</th:block>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-responsive/css/responsive.bootstrap4.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/plugins/datatables-buttons/css/buttons.bootstrap4.min.css}">
|
||||
|
||||
<style>
|
||||
.badge-status {
|
||||
font-size: 1rem;
|
||||
padding: 0.45em 0.8em;
|
||||
border-radius: 0.5rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
<body layout:fragment="body">
|
||||
|
||||
<div class="wrapper">
|
||||
<div th:replace="~{fragments/top_nav :: topFragment}"/>
|
||||
|
||||
<!-- Main Sidebar Container -->
|
||||
<aside class="main-sidebar sidebar-dark-primary elevation-4"
|
||||
th:insert="~{fragments/mainsidebar :: sidebarFragment}">
|
||||
</aside>
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">내 연차 현황</h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active">내 연차 현황</li>
|
||||
</ol>
|
||||
</div><!-- /.col -->
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- 연차 요약 카드 -->
|
||||
<div class="row text-center mb-4">
|
||||
<div class="col-md-3 col-6">
|
||||
<div class="info-box bg-info">
|
||||
<span class="info-box-icon"><i class="fas fa-calendar-plus"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">발생 연차</span>
|
||||
<span class="info-box-number" th:text="${leaveStatus.totalLeave}">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6">
|
||||
<div class="info-box bg-success">
|
||||
<span class="info-box-icon"><i class="fas fa-check-circle"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">사용 연차</span>
|
||||
<span class="info-box-number" th:text="${leaveStatus.usedLeave}">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6">
|
||||
<div class="info-box bg-warning">
|
||||
<span class="info-box-icon"><i class="fas fa-hourglass-half"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">잔여 연차</span>
|
||||
<span class="info-box-number" th:text="${leaveStatus.remainingLeave}">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-6">
|
||||
<div class="info-box bg-danger">
|
||||
<span class="info-box-icon"><i class="fas fa-exclamation-triangle"></i></span>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">촉진 연차</span>
|
||||
<span class="info-box-number" th:text="${leaveStatus.promotedLeave}">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 사용자 정보 -->
|
||||
<div class="mb-4">
|
||||
<h5 class="mb-3"><i class="fas fa-user text-purple mr-1"></i> 사용자 정보</h5>
|
||||
<table class="table table-bordered table-hover align-middle" style="width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 150px; background-color: #f8f9fa;">사용자 ID</th>
|
||||
<td th:text="${@TCodeUtils.getUserName(leaveStatus.uniqId)}">이호영</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="background-color: #f8f9fa;">귀속 연도</th>
|
||||
<td th:text="${leaveStatus.year}">2025</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 연차 사용 계획 -->
|
||||
<div>
|
||||
<h5>📅 연차 사용 계획</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered text-center" style="table-layout: auto;">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th style="width: 200px;">일자</th>
|
||||
<th style="width: 200px;">일수</th>
|
||||
<th style="width: 200px;">변경 횟수</th>
|
||||
<th style="width: 200px;">요청 상태</th>
|
||||
<th>반려 사유</th>
|
||||
<th style="width: 100px;" class="text-center">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<th:block th:if="${not #lists.isEmpty(leavePlans)}">
|
||||
<tr th:each="plan : ${leavePlans}"
|
||||
th:class="${plan.leaveDate <= T(java.time.LocalDate).now()} ? 'table-secondary text-dark' : ''">
|
||||
<td th:text="${plan.leaveDate}">2025-07-22</td>
|
||||
<td th:text="${plan.leaveDays}">1.0</td>
|
||||
<!-- <td th:text="${plan.changeCount}">2</td>-->
|
||||
<td>
|
||||
<a href="#" class="text-primary font-weight-bold"
|
||||
th:text="${plan.changeCount}"
|
||||
th:onclick="'openChangeHistoryModal(' + ${plan.planId} + ')'"
|
||||
style="cursor: pointer;">
|
||||
</a>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<span th:class="'badge px-3 py-2 fs-6 ' +
|
||||
(${plan.requestStatus} == '20' ? 'badge-secondary' :
|
||||
(${plan.requestStatus} == '30' ? 'badge-warning' :
|
||||
(${plan.requestStatus} == '40' ? 'badge-success' : 'badge-light')))"
|
||||
th:text="${plan.requestStatusName}">
|
||||
</span>
|
||||
<small class="text-muted mt-1"
|
||||
th:if="${plan.requestedLeaveDate != null}"
|
||||
th:text="'요청일: ' + ${plan.requestedLeaveDate}"></small>
|
||||
</td>
|
||||
<td th:text="${plan.rejectionReason}"></td>
|
||||
<td>
|
||||
<a href="#"
|
||||
th:onclick="openLeaveChangeRequestModal([[${plan.planId}]], [[${plan.leaveDate}]])"
|
||||
th:if="${plan.requestStatus != '10'} and ${plan.leaveDate > T(java.time.LocalDate).now()}"
|
||||
class="btn btn-info btn-sm">
|
||||
변경 요청
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</th:block>
|
||||
<th:block th:if="${#lists.isEmpty(leavePlans)}">
|
||||
<tr>
|
||||
<td colspan="6">등록된 연차 계획이 없습니다.</td>
|
||||
</tr>
|
||||
</th:block>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
<!-- Main Footer -->
|
||||
<footer class="main-footer"
|
||||
th:insert="~{fragments/footer :: footerFragment}">
|
||||
</footer>
|
||||
|
||||
<!-- Control Sidebar -->
|
||||
<aside class="control-sidebar control-sidebar-dark">
|
||||
<!-- Control sidebar content goes here -->
|
||||
</aside>
|
||||
<!-- /.control-sidebar -->
|
||||
</div>
|
||||
<!-- ./wrapper -->
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
//Date picker
|
||||
$('#reservationdate').datetimepicker({
|
||||
format: 'YYYY-MM-DD'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function openChangeHistoryModal(planId) {
|
||||
console.log("openChangeHistoryModal for planId: " + planId);
|
||||
|
||||
$.ajax({
|
||||
url: '/itn/leave/change-history/' + planId,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
const historyList = response.data;
|
||||
console.log(historyList);
|
||||
const $body = $('#changeHistoryBody');
|
||||
$body.empty(); // 기존 내용 제거
|
||||
|
||||
if (historyList.length === 0) {
|
||||
$body.append('<tr><td colspan="5">변경 이력이 없습니다.</td></tr>');
|
||||
return;
|
||||
}
|
||||
|
||||
historyList.forEach(item => {
|
||||
const badgeClass = item.requestStatus === '20' ? 'badge-secondary'
|
||||
: item.requestStatus === '30' ? 'badge-warning'
|
||||
: item.requestStatus === '40' ? 'badge-success'
|
||||
: 'badge-light';
|
||||
|
||||
const row = `
|
||||
<tr>
|
||||
<td class="bg-secondary text-white font-monospace rounded px-2 py-1">
|
||||
${item.requestDt}
|
||||
</td>
|
||||
<td>${item.originalLeaveDate}</td>
|
||||
<td>${item.requestedLeaveDate}</td>
|
||||
<td>${item.requestReason}</td>
|
||||
<td>
|
||||
<span class="badge ${badgeClass} px-3 py-2">${item.requestStatusName}</span>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
$body.append(row);
|
||||
});
|
||||
|
||||
$('#changeHistoryModal').modal('show');
|
||||
},
|
||||
error: function() {
|
||||
alert("변경 이력을 불러오는데 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.openLeaveChangeRequestModal = function (planId, originalLeaveDate) {
|
||||
console.log(' openLeaveChangeRequestModal ');
|
||||
$('#leaveChangeRequestModal #planId').val(planId);
|
||||
$('#leaveChangeRequestModal #originalLeaveDate').val(originalLeaveDate);
|
||||
$('#leaveChangeRequestModal #requestedLeaveDate').val('');
|
||||
$('#leaveChangeRequestModal #requestReason').val('');
|
||||
$('#leaveChangeRequestModal').modal('show');
|
||||
}
|
||||
|
||||
function submitLeaveChangeRequest() {
|
||||
const planId = $('#leaveChangeRequestModal #planId').val();
|
||||
const originalLeaveDate = $('#leaveChangeRequestModal #originalLeaveDate').val();
|
||||
const requestedLeaveDate = $('#leaveChangeRequestModal #requestedLeaveDate').val();
|
||||
const requestReason = $('#leaveChangeRequestModal #requestReason').val();
|
||||
|
||||
if (!requestedLeaveDate) {
|
||||
fn_failedAlert("입력 오류", "변경 요청 일자를 입력해주세요.", 1000);
|
||||
// toastr.error("변경 요청 일자를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
if (!requestReason) {
|
||||
fn_failedAlert("입력 오류", "변경 요청 사유를 입력해주세요.", 1000);
|
||||
// toastr.error("변경 요청 사유를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const data = {
|
||||
planId: planId,
|
||||
originalLeaveDate: originalLeaveDate,
|
||||
requestedLeaveDate: requestedLeaveDate,
|
||||
requestReason: requestReason
|
||||
};
|
||||
|
||||
console.log('data: ', data);
|
||||
|
||||
$.ajax({
|
||||
url: '/itn/leave/change-request',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data),
|
||||
success: function (response) {
|
||||
fn_successAlert(response.msg);
|
||||
$('#leaveChangeRequestModal').modal('hide');
|
||||
location.reload();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
const errorResponse = JSON.parse(xhr.responseText);
|
||||
fn_failedAlert(errorResponse.msg);
|
||||
alert(errorResponse.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 연차 변경 요청 모달 -->
|
||||
<div class="modal fade" id="leaveChangeRequestModal" tabindex="-1" role="dialog" aria-labelledby="leaveChangeRequestModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="leaveChangeRequestModalLabel">연차 변경 요청</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="leaveChangeRequestForm">
|
||||
<input type="hidden" id="planId" name="planId">
|
||||
<div class="form-group">
|
||||
<label for="originalLeaveDate">기존 연차 일자</label>
|
||||
<input type="text" class="form-control" id="originalLeaveDate" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="requestedLeaveDate">변경 요청 일자</label>
|
||||
<div class="input-group date" id="reservationdate" data-target-input="nearest">
|
||||
<input type="text" class="form-control datetimepicker-input" id="requestedLeaveDate" name="requestedLeaveDate" data-target="#reservationdate" required>
|
||||
<div class="input-group-append" data-target="#reservationdate" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="requestReason">변경 요청 사유</label>
|
||||
<textarea class="form-control" id="requestReason" name="requestReason" rows="3" required></textarea>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" onclick="submitLeaveChangeRequest()">요청 제출</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 변경 이력 모달 -->
|
||||
<!-- 변경 이력 모달 -->
|
||||
<div class="modal fade" id="changeHistoryModal" tabindex="-1" role="dialog" aria-labelledby="changeHistoryModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="changeHistoryModalLabel">변경 이력</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="닫기">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body px-3 pt-2 pb-0">
|
||||
<div class="table-responsive" style="max-height: 400px; overflow-y: auto;">
|
||||
<table class="table table-sm table-bordered mb-0 text-center align-middle">
|
||||
<thead class="thead-light sticky-top bg-light">
|
||||
<tr class="align-middle">
|
||||
<th style="width: 20%;">변경 일시</th>
|
||||
<th style="width: 15%;">기존 날짜</th>
|
||||
<th style="width: 15%;">요청 날짜</th>
|
||||
<th style="width: 30%;">요청 사유</th>
|
||||
<th style="width: 20%;">처리 상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="changeHistoryBody">
|
||||
<tr>
|
||||
<td class="bg-secondary text-white font-monospace rounded px-2 py-1">
|
||||
2025-07-15 09:32
|
||||
</td>
|
||||
<td>2025-07-22</td>
|
||||
<td>2025-07-24</td>
|
||||
<td>개인 일정 조정</td>
|
||||
<td>
|
||||
<span class="badge badge-secondary px-3 py-2">대기</span>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 추가 row 가능 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-end">
|
||||
<button type="button" class="btn btn-dark btn-sm" data-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user