[FO] 지출 CRUD, 수지출의 부호 추가 및 유효성체크

This commit is contained in:
김현주
2025-06-12 18:26:36 +09:00
parent 595c8a5e72
commit 31684352e1
24 changed files with 1388 additions and 28 deletions

View File

@@ -0,0 +1,49 @@
package app.module.front.usecase.daily.expense.persistence;
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DailyExpenseMapper {
/**
* 일계부 지출 목록 조회
*
* @param reqVO 검색 조건
* @return 수입 목록
*/
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
/**
* 일계부 지출 데이터 존재 여부
*
* @param reqVO 검색 조건
* @return 중복 개수
*/
Integer getRecordExistCount(DailyExpenseUIReqVO reqVO);
/**
* 일계부 지출 등록
*
* @param command 등록 데이터
*/
void createDailyExpense(CreateDailyExpenseCmd command);
/**
* 일계부 지출 수정
*
* @param command 수정 데이터
*/
void updateDailyExpense(CreateDailyExpenseCmd command);
/**
* 일계부 지출 삭제
*
* @param command 삭제 데이터
*/
void removeDailyExpense(RemoveDailyExpenseCmd command);
}

View File

@@ -0,0 +1,26 @@
package app.module.front.usecase.daily.expense.persistence.model;
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@AllArgsConstructor
@ToString
public class CreateDailyExpenseCmd extends FrontAuditCommand {
private Long id;
private Long dailyRecordSeq;
private String inputType;
private Boolean credit;
private String incomeMarkCode;
private String categoryCode;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;
private String unitCode;
private Integer price;
private Integer estimatedValue;
}

View File

@@ -0,0 +1,31 @@
package app.module.front.usecase.daily.expense.persistence.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DailyExpenseDto {
private Long id;
private Long dailyRecordSeq;
// TODO : SELF, OCR
private String inputType;
private Boolean credit;
private String categoryCode;
private String categoryLabel;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;
private String unitCode;
private String unitLabel;
private Integer price;
private Integer estimatedValue;
/**
* 수정 가능 여부
* @return true=가능, false=불가능(등록 상태)
*/
public boolean isUpdated() {
return this.id != null && this.id != 0L;
}
}

View File

@@ -0,0 +1,18 @@
package app.module.front.usecase.daily.expense.persistence.model;
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@AllArgsConstructor
@ToString
public class RemoveDailyExpenseCmd extends FrontAuditCommand {
private String searchMonth;
private Integer groupNo;
private Long id;
private Long dailyRecordSeq;
}

View File

@@ -0,0 +1,40 @@
package app.module.front.usecase.daily.expense.service;
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
import java.util.List;
public interface DailyExpenseService {
/**
* 일계부 수입 목록 조회
*
* @param reqVO 검색 조건
* @return
*/
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
/**
* 일계부 수입 조회
*
* @param reqVO 검색 조건
* @return
*/
DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO);
/**
* 일계부 수입 등록
*
* @param formVO 입력 데이터
*/
void create(CreateDailyExpenseReqVO formVO);
/**
* 일계부 수입 삭제
*
* @param formVO 삭제 검색 조건
*/
void remove(RemoveDailyExpenseReqVO formVO);
}

View File

@@ -0,0 +1,124 @@
package app.module.front.usecase.daily.expense.service;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
import app.module.front.config.application.util.AuditUtil;
import app.module.front.usecase.daily.expense.persistence.DailyExpenseMapper;
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor
public class DailyExpenseServiceImpl implements DailyExpenseService {
private final UICodeListPortIn uiCodeListPortIn;
private final DailyExpenseMapper DailyExpenseMapper;
@Override
public List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO) {
return this.getRefineIncomeList(reqVO);
}
@Override
public DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO) {
List<DailyExpenseDto> list = this.getRefineIncomeList(reqVO);
if (list.isEmpty()) {
return null;
}
return list.get(0);
}
private List<DailyExpenseDto> getRefineIncomeList(DailyExpenseUIReqVO reqVO) {
List<DailyExpenseDto> list = DailyExpenseMapper.getDailyExpenseList(reqVO);
List<UICodeElement> recordIncome = uiCodeListPortIn.connect("code.record.expense");
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
for (DailyExpenseDto dto : list) {
dto.setCategoryLabel(this.getCodeLabel(dto.getCategoryCode(), recordIncome));
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
}
return list;
}
/**
* 코드명 조회
* @param code 코드
* @param codeList 공통 코드 목록
* @return
*/
private String getCodeLabel(String code, List<UICodeElement> codeList) {
String returnValue = null;
for (UICodeElement codeSetup : codeList) {
if (codeSetup.getCodeValue().equalsIgnoreCase(code)) {
returnValue = codeSetup.getCodeText();
break;
}
}
return returnValue;
}
@Override
public void create(CreateDailyExpenseReqVO formVO) {
CreateDailyExpenseCmd command = AuditUtil.create(
new CreateDailyExpenseCmd(
formVO.getId(),
formVO.getDailyRecordSeq(),
formVO.getInputType(),
formVO.getCredit(),
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),
formVO.getQuantity(),
formVO.getUnitCode(),
formVO.getPrice(),
formVO.getEstimatedValue()));
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
existReqVO.setId(formVO.getId());
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
if (existCount == 0) {
DailyExpenseMapper.createDailyExpense(command);
log.debug("[CreateDailyExpense] record={}", command);
} else {
DailyExpenseMapper.updateDailyExpense(command);
log.debug("[UpdateDailyExpense] record={}", command);
}
}
@Override
public void remove(RemoveDailyExpenseReqVO formVO) {
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
RemoveDailyExpenseCmd command = AuditUtil.delete(
new RemoveDailyExpenseCmd(
formVO.getSearchMonth(),
formVO.getGroupNo(),
id,
formVO.getDailyRecordSeq()));
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
existReqVO.setId(id);
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
if (existCount != 0) {
DailyExpenseMapper.removeDailyExpense(command);
log.debug("[RemoveDailyExpense] record={}", command);
}
}
}

View File

@@ -0,0 +1,135 @@
package app.module.front.usecase.daily.expense.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.util.CoreUtil;
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
import app.module.front.usecase.daily.expense.web.validator.CreateDailyExpenseValidator;
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
import app.module.front.usecase.daily.record.service.DailyRecordService;
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/expense")
public class DailyExpenseController {
private final CoreUtil coreUtil;
private final DailyRecordService dailyRecordService;
private final DailyExpenseService DailyExpenseService;
private final CreateDailyExpenseValidator createDailyExpenseValidator;
/**
* 일계부 지출 등록 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param id 수입 일련번호
* @param formVO 입력 데이터
* @param bindingResult BindingResult
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
ResponseEntity<?> create(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @PathVariable("id") String id
, @Valid @RequestBody CreateDailyExpenseReqVO formVO, BindingResult bindingResult) {
createDailyExpenseValidator.validate(formVO, bindingResult);
if (bindingResult.hasErrors()) {
return coreUtil.getErrorInfo(bindingResult);
}
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
formVO.setSearchMonth(searchMonth);
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
DailyExpenseService.create(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 지출 삭제 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param formVO 입력 데이터
* @param bindingResult BindingResult
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/remove")
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyExpenseReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
DailyExpenseService.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 지출 전체 삭제 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/reset")
ResponseEntity<?> removeAll(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
RemoveDailyExpenseReqVO formVO = new RemoveDailyExpenseReqVO();
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
DailyExpenseService.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 유효성 체크 및 데이터 조회
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
if (dailyRecord == null || dailyRecord.getId() == null) {
throw new NoRecordDataException();
}
return dailyRecord;
}
}

View File

@@ -0,0 +1,113 @@
package app.module.front.usecase.daily.expense.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
import app.module.front.usecase.daily.record.service.DailyRecordService;
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.thymeleaf.util.StringUtils;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/expense")
public class DailyExpenseUIController {
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordService dailyRecordService;
private final DailyExpenseService DailyExpenseService;
/**
* 일계부 지출 목록 화면
*
* @param model Model
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
@GetMapping(path = "/{searchMonth}/{groupNo}")
public String index(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
List<DailyExpenseDto> expenseList = DailyExpenseService.getDailyExpenseList(reqVO);
model.addAttribute("reqVO", reqVO);
model.addAttribute("dailyRecord", dailyRecord);
model.addAttribute("expenseList", expenseList);
return "record/expense/index";
}
/**
* 일계부 지출 등록 화면
*
* @param model Model
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param id 수입 일련번호
* @return
*/
@GetMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
public String formBySelf(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @PathVariable("id") String id) {
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
if (StringUtils.isEmpty(id)) {
reqVO.setId(0L);
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
DailyExpenseDto detail = new DailyExpenseDto();
if (reqVO.getId() != 0L) {
detail = DailyExpenseService.getDailyExpense(reqVO);
if (detail == null || !detail.isUpdated()) {
throw new NoRecordDataException();
}
}
model.addAttribute("recordExpense", uiCodeListPortIn.connect("code.record.expense"));
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
model.addAttribute("reqVO", reqVO);
model.addAttribute("detail", detail);
return "record/expense/form";
}
/**
* 일계부 유효성 체크 및 데이터 조회
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
if (dailyRecord == null || dailyRecord.getId() == null) {
throw new NoRecordDataException();
}
return dailyRecord;
}
}

View File

@@ -0,0 +1,59 @@
package app.module.front.usecase.daily.expense.web.model;
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
public class CreateDailyExpenseReqVO extends DailyUIReqVO {
/**
* 수입 일련번호
*/
private Long id;
/**
* 일계부 일련번호
*/
private Long dailyRecordSeq;
/**
* 등록 유형(SELF, OCR)
*/
private String inputType;
/**
* 외상판매 여부
*/
private Boolean credit;
/**
* 지출의 종류 코드
*/
@NotBlank(message = "지출 종류를 선택해 주세요.")
private String categoryCode;
/**
* 지출의 종류 직접입력
*/
private String categorySelf;
/**
* 용도
*/
@NotBlank(message = "용도를 입력해 주세요.")
private String sourcePurpose;
/**
* 수량
*/
private Integer quantity;
/**
* 단위 코드
*/
private String unitCode;
/**
* 현금
*/
private Integer price;
/**
* 현물평가액
*/
private Integer estimatedValue;
}

View File

@@ -0,0 +1,29 @@
package app.module.front.usecase.daily.expense.web.model;
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.tika.utils.StringUtils;
@Getter
@Setter
@ToString(callSuper = true)
public class DailyExpenseUIReqVO extends DailyUIReqVO {
public DailyExpenseUIReqVO(String month, String no) {
setSearchMonth(month);
if (!StringUtils.isBlank(no)) {
setGroupNo(Integer.parseInt(no));
}
}
public DailyExpenseUIReqVO(String month, Integer no) {
setSearchMonth(month);
setGroupNo(no);
}
/**
* 수입 일련번호
*/
private Long id;
}

View File

@@ -0,0 +1,22 @@
package app.module.front.usecase.daily.expense.web.model;
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
public class RemoveDailyExpenseReqVO extends DailyUIReqVO {
/**
* 수입 일련번호
*/
@NotBlank(message = "{valid.common.required}")
private String id;
/**
* 일계부 일련번호
*/
private Long dailyRecordSeq;
}

View File

@@ -0,0 +1,44 @@
package app.module.front.usecase.daily.expense.web.validator;
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
import lombok.RequiredArgsConstructor;
import org.apache.tika.utils.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
@RequiredArgsConstructor
public class CreateDailyExpenseValidator implements Validator {
@Override
public boolean supports(Class<?> clazz) {
return CreateDailyExpenseReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
CreateDailyExpenseReqVO vo = (CreateDailyExpenseReqVO) target;
if (StringUtils.isBlank(vo.getCategoryCode())) {
errors.rejectValue(
"categoryCode", "valid.common.required",
"지출 종류를 선택해 주세요.");
}
if ("SELF".equals(vo.getCategoryCode()) && StringUtils.isBlank(vo.getCategorySelf())) {
errors.rejectValue(
"categorySelf", "valid.common.required",
"지출 종류를 입력해 주세요.");
}
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
errors.rejectValue(
"price", "valid.common.required",
"현금 또는 현물평가액을 입력 해주세요.");
errors.rejectValue(
"estimatedValue", "valid.common.required",
"현금 또는 현물평가액을 입력 해주세요.");
}
}
}

View File

@@ -17,6 +17,7 @@ public class CreateDailyIncomeCmd extends FrontAuditCommand {
private String inputType;
private Boolean credit;
private String cropCode;
private String expenseMarkCode;
private String categoryCode;
private String categorySelf;
private String sourcePurpose;

View File

@@ -80,6 +80,7 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
formVO.getInputType(),
formVO.getCredit(),
formVO.getCropCode(),
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),

View File

@@ -13,9 +13,9 @@ public enum DailyTargetStatus {
* 등록 없음
*/
NONE,
/**
* 등록 완료
*/
DONE,
// /**
// * 등록 완료
// */
// DONE,
;
}

View File

@@ -0,0 +1,71 @@
<?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="app.module.front.usecase.daily.expense.persistence.DailyExpenseMapper">
<select id="getDailyExpenseList"
resultType="app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.category_code, ds.category_self, ds.source_purpose
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
from daily_expense ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = ${id}
</if>
order by
ds.id desc
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_expense ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = ${id}
</if>
</select>
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
insert into daily_expense (
daily_record_seq, input_type, is_credit, income_mark_code, category_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<update id="updateDailyExpense">
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
, is_credit = #{credit}
, income_mark_code = #{incomeMarkCode}
, category_code = #{categoryCode}
, category_self = #{categorySelf}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}
, unit_code = #{unitCode}
, price = #{price}
, estimated_value = #{estimatedValue}
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
and id = #{id}
</update>
<update id="removeDailyExpense">
update daily_expense set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
<if test="id != null and id != ''">
and id = #{id}
</if>
</update>
</mapper>

View File

@@ -29,13 +29,13 @@
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, is_credit, crop_code, category_code, category_self, source_purpose
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}
, #{inputType}, #{credit}, #{cropCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
@@ -45,6 +45,7 @@
<update id="updateDailyIncome">
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
, is_credit = #{credit}
, expense_mark_code = #{expenseMarkCode}
, crop_code = #{cropCode}
, category_code = #{categoryCode}
, category_self = #{categorySelf}

View File

@@ -56,6 +56,8 @@ krip.daily.todayNone = function(month, groupNo, target, checked) {
{},
function (rstData, status) {
console.log('rstData', rstData)
$('.component-btns').find('.btn-primary').attr('disabled', !checked);
},
);
};

View File

@@ -32,6 +32,7 @@
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">수입</span>
<!-- TODO : DONE 유지여부 판단하기 -->
<input type="checkbox" name="incomeStatus" value="TARGET" data-target="income"
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TARGET') or #strings.equals(dailyRecord.incomeStatus, 'DONE')}">
<span class="switch-item">

View File

@@ -0,0 +1,205 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<th:block>
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<div>
reqVO: [[${reqVO}]]
</div>
<div>
detail: [[${dailyRecord}]]
</div>
</th:block>
<div class="modal-content-inner">
<div class="component-btns type-tab"
th:if="${not detail.updated}">
<div class="btns-row">
<button type="button" class="btn active">수기 등록</button>
<!--/* TODO : 2차 오픈 */-->
<!--<button type="button" class="btn">영수증 등록</button>-->
</div>
</div>
<p class="form-desc">필지출력</p>
<form name="reqModalForm">
<input type="hidden" name="inputType" th:value="${#strings.defaultString(detail.inputType, 'SELF')}">
<input type="hidden" name="id" th:value="${detail.id}">
<section class="form-group">
<div class="segment-label">
<p class="label-txt">
외상 또는 카드 구입 여부
</p>
</div>
<div class="component-segment">
<div class="component-radio">
<label class="radio-inner">
<input type="radio" name="credit" value="true" th:checked="${detail.credit}">
<span class="radio-item">
<span class="radio-txt">예</span>
</span>
</label>
</div>
<div class="component-radio">
<label class="radio-inner">
<input type="radio" name="credit" value="false" th:checked="not ${detail.credit}">
<span class="radio-item">
<span class="radio-txt">아니오</span>
</span>
</label>
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="select-group">
<div class="select-label">
<p class="label-txt">
지출의 종류
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
</div>
<div id="categoryCode" class="component-select bottom-sheet" data-props-default="지출 종류를 선택해 주세요" data-props-type="bottomSheet">
<input type="hidden1" name="categoryCode" th:value="${detail.categoryCode}" data-type="select">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>지출의 종류</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option"
th:each="uiCode : ${recordExpense}"
th:data-value="${uiCode.codeValue}"
th:text="${uiCode.codeText}"></li>
<li class="option" data-value="SELF">직접 입력</li>
</ul>
</div>
</div>
</div>
<div class="component-input input-invalid" data-option="직접 입력">
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="지출의 종류를 입력해 주세요">
</div>
<ul class="input-info">
<li>지출 종류를 입력해 주세요.</li>
</ul>
</div>
</div>
<div class="component-input">
<div class="input-label">
<label for="sourcePurpose" class="label-txt">
용도
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="sourcePurpose" name="sourcePurpose" th:value="${detail.sourcePurpose}" maxlength="30" placeholder="용도를 입력해 주세요">
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="quantity" class="label-txt">
수량
</label>
</div>
<div class="input-field">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="quantity" name="quantity" th:value="${detail.quantity}" maxlength="10" placeholder="수량을 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 2, 2.5</li>
</ul>
</div>
<div class="select-group">
<div class="select-label">
<p class="label-txt">
단위
</p>
</div>
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
<input type="hidden1" name="unitCode" th:value="${detail.unitCode}">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>단위</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.codeValue}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.codeValue eq detail.unitCode ? 'current' : ''}"
></li>
</ul>
</div>
</div>
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="price" class="label-txt">
현금
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-price">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price" th:value="${detail.price}" maxlength="10" placeholder="금액을 입력해 주세요">
<span class="input-field-txt">원</span>
</div>
<ul class="guide-info">
<li>예 : 30000</li>
</ul>
</div>
<div class="component-input">
<div class="input-label">
<label for="estimatedValue" class="label-txt">
현물평가액
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-price">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" th:value="${detail.estimatedValue}" maxlength="10" placeholder="금액을 입력해 주세요">
<span class="input-field-txt">원</span>
</div>
<ul class="guide-info">
<li>예 : 30000</li>
</ul>
</div>
</section>
</form>
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.createVaild();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</th:block>
</html>

View File

@@ -0,0 +1,368 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="acco-wrap">
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<div>
reqVO: [[${reqVO}]]
</div>
<div>
dailyRecord: [[${dailyRecord}]]
</div>
</th:block>
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3>
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
</th:block>
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
</th:block>
<strong>지출 내역 [[${#lists.isEmpty(expenseList) ? 0 : #lists.size(expenseList)}]]건 등록</strong> <br>
되었습니다.
</h3>
<p>지출 내역을 등록해 주세요.</p>
</hgroup>
<form name="reqForm">
<input type="hidden" name="todayNone" value="N">
</form>
<!--/* 신규 등록 */-->
<th:block th:if="${#lists.isEmpty(expenseList)}">
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
th:disabled="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE')}">
<i class=" ico-small" aria-hidden="true"
th:classappend="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
<span class="btn-txt">추가 등록</span>
</button>
<div class="component-input align-center">
<label class="checkbox-inner" id="todayNone">
<input type="checkbox" name="todayNone"
th:checked="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE')}">
<span class="checkbox-item">
<span class="checkbox-txt">금일 등록내용 없음</span>
</span>
</label>
</div>
</th:block>
<!--/* 목록 */-->
<th:block th:unless="${#lists.isEmpty(expenseList)}">
<section class="regist-item-area">
<p class="total">
<span>총 <strong>[[${#lists.size(expenseList)}]]</strong>건</span>
<button type="button" class="btn-reset" onclick="formControl.resetConfirm()">
<i class="ico-reset ico-small" aria-hidden="true"></i>
<span>초기화</span>
</button>
</p>
<div class="item-list">
<div class="list-item"
th:each="item, itemStatus : ${expenseList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categoryLabel}]] [[${item.categorySelf}]]</p>
<div class="btn-group">
<button type="button" class="delete" th:onclick="formControl.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" th:onclick="formControl.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
</div>
</div>
<ul class="detail-list">
<li th:if="${item.credit != null}">
<p>외상 또는 카드 구입 여부</p>
<span th:text="${item.credit ? '예' : '아니오'}">아니오</span>
</li>
<li th:if="${not #strings.isEmpty(item.sourcePurpose)}">
<p>용도</p>
<span th:text="${item.sourcePurpose}">소비자</span>
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.price)}">
<p>현금 </p>
<span th:text="|${#numbers.formatInteger(item.price, 1, 'COMMA')}원|">302,000원</span>
</li>
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
<p>현물평가액</p>
<span th:text="|${#numbers.formatInteger(item.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</ul>
</div>
</div>
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
<i class="ico-add ico-small" aria-hidden="true"></i>
<span class="btn-txt">추가 등록</span>
</button>
</section>
</th:block>
</div>
</main>
<!-- 하단 고정 버튼 -->
<div class="component-btns fixed">
<div class="btns-row">
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
<span class="btn-txt">이전 단계로 이동</span>
</button>
<button type="button" class="btn btn-l btn-primary"
th:disabled="${not #strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE') and #lists.isEmpty(expenseList)}">
<span class="btn-txt">다음 단계로 이동</span>
</button>
</div>
</div>
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal acco-wrap modal01" data-props-dimm-click="true">
<div class="modal-dimm"></div>
<div class="modal-frame">
<div class="modal-container">
<div class="modal-header">
<h3 class="modal-tit">지출 등록</h3>
</div>
<div class="modal-content">
<!--/* form */-->
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</div>
<!-- //모달 팝업 -->
</div>
<section layout:fragment="script">
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
$(function() {
formControl.init();
});
let ENV = {
httpUrl: {
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
create: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
remove: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
submitted: false,
};
let bind = {
form: {
selectorId: '.button-modal01',
selector: '.modal01',
},
selectbox: null,
}
let formControl = {
init() {
formControl._bindUI();
//formControl.createModal();
// TODO 등록된 건수가 0일 경우 버튼 비활성화
},
_bindUI() {
etUI.locales.ko = {
dialog: {
positive: '예',
negative: '아니오',
},
};
let $noneWrap = $('#todayNone');
$noneWrap.on('click', 'input[name="todayNone"]', function() {
let checked = $(this).is(':checked');
let $btn = $('.button-modal01');
$btn.attr('disabled', checked);
if (checked) {
$btn.find('i').addClass('ico-add-disabled');
$btn.find('i').removeClass('ico-add');
document.reqForm.todayNone.value = 'Y';
} else {
$btn.find('i').addClass('ico-add');
$btn.find('i').removeClass('ico-add-disabled');
document.reqForm.todayNone.value = 'N';
}
krip.daily.todayNone(ENV.month, ENV.groupNo, 'EXPENSE', checked);
});
let $formWrap = $(bind.form.selectorId);
$formWrap.on('click', function() {
formControl.createModal();
});
// const $btnModal01 = document.querySelector(".button-modal01");
// $btnModal01.addEventListener("click", function() {
// const modal01 = document.querySelector(".modal01").ui;
// modal01.open();
// });
},
_bindModelUI() {
let $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
$formWrap.find('input[name="estimatedValue"]').attr('disabled', false);
} else {
$formWrap.find('input[name="estimatedValue"]').val('').attr('disabled', true);
}
});
$formWrap.on('keyup', 'input[name="estimatedValue"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
$formWrap.find('input[name="price"]').attr('disabled', false);
} else {
$formWrap.find('input[name="price"]').val('').attr('disabled', true);
}
});
},
createModal(id) {
if (id === undefined) {
id = 0;
}
ajaxUtil._ajaxAsyncMethod(
ENV.httpUrl.form.replace('{id}', id),
{},
function(rstHtml, status) {
$('.modal01').find('.modal-content').html(rstHtml);
// TODO
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'));
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'));
/*
etUI.components.SelectBox().core.init(document.querySelector('#categoryCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
// TODO : console.log ?
console.log(1111)
}
});
etUI.components.SelectBox().core.init(document.querySelector('#unitCode'), {
onChange: function() {
console.log('sssssssssss')
},
selectItemCallback: function() {
console.log(3333)
}
});
*/
/*document.querySelector('#selectUnit').addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
const selectbox2 = document.querySelector('.component-select');
selectbox2.addEventListener('select:onChange', (e) => {
console.log(e.detail);
console.log(e.detail.value);
});
*/
//document.queerySelector('#unitSelect')
const modal01 = document.querySelector(".modal01").ui;
modal01.open();
formControl._bindModelUI();
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);
},
'get',
'html'
);
},
createVaild() {
const f = document.reqModalForm;
// TODO : setter
f.categoryCode.value = document.querySelector('#categoryCode').value !== undefined ? document.querySelector('#categoryCode').value : '';
f.unitCode.value = document.querySelector('#unitCode').value !== undefined ? document.querySelector('#unitCode').value : '';
formControl.create();
},
create() {
const f = document.reqModalForm;
const obj = $(f).serializeObject();
console.log(obj)
ajaxUtil._ajaxAsync(
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
obj,
function (rstData, status) {
console.log('rstData', rstData)
location.reload();
/*
if (f.todayNone.value === 'Y') {
krip.daily.goToMain();
} else {
krip.daily.goToNext($('input:checked').eq(0).data('target'), ENV.month, ENV.groupNo);
}
*/
},
);
},
removeConfirm(id) {
etUI.dialog.alert({
title: "삭제 안내",
message: "등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
type: "confirm",
dialogType: "confirm",
callback: function () {
formControl.remove(id);
},
});
},
remove(id) {
console.log('remove', id)
ajaxUtil._ajaxAsync(
ENV.httpUrl.remove,
{ 'id': id },
function (rstData, status) {
location.reload();
},
);
},
resetConfirm() {
etUI.dialog.alert({
title: "초기화 안내",
message: "등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
type: "confirm",
dialogType: "confirm",
callback: function () {
formControl.reset();
},
});
},
reset() {
ajaxUtil._ajaxAsync(
ENV.httpUrl.reset,
{},
function (rstData, status) {
location.reload();
},
);
},
};
</script>
</section>
</html>

View File

@@ -116,7 +116,7 @@
</div>
<div class="component-input input-invalid" data-option="직접 입력">
<div class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" placeholder="수입의 종류를 입력해 주세요">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="수입의 종류를 입력해 주세요">
</div>
<ul class="input-info">
<li>수입 종류를 입력해 주세요.</li>
@@ -131,7 +131,7 @@
</label>
</div>
<div class="input-field">
<input type="text" id="sourcePurpose" name="sourcePurpose" th:value="${detail.sourcePurpose}" maxlength="50" placeholder="수입원을 입력해 주세요">
<input type="text" id="sourcePurpose" name="sourcePurpose" th:value="${detail.sourcePurpose}" maxlength="30" placeholder="수입원을 입력해 주세요">
</div>
</div>
</section>

View File

@@ -32,14 +32,16 @@
</form>
<!--/* 신규 등록 */-->
<th:block th:if="${#lists.isEmpty(incomeList)}">
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
<i class="ico-add ico-small" aria-hidden="true"></i>
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
th:disabled="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
<i class=" ico-small" aria-hidden="true"
th:classappend="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
<span class="btn-txt">추가 등록</span>
</button>
<div class="component-input align-center">
<label class="checkbox-inner" id="todayNone">
<input type="checkbox" name="todayNone">
<input type="checkbox" name="todayNone"
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
<span class="checkbox-item">
<span class="checkbox-txt">금일 등록내용 없음</span>
</span>
@@ -81,7 +83,7 @@
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${item.quantity}${item.unitLabel}|">500g</span>
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.price)}">
<p>현금 </p>
@@ -109,8 +111,8 @@
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
<span class="btn-txt">이전 단계로 이동</span>
</button>
<!-- 비활성화 스타일/ 버튼 속성 disable 추가-->
<button type="button" class="btn btn-l btn-primary">
<button type="button" class="btn btn-l btn-primary"
th:disabled="${not #strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE') and #lists.isEmpty(incomeList)}">
<span class="btn-txt">다음 단계로 이동</span>
</button>
</div>
@@ -145,11 +147,11 @@
let ENV = {
httpUrl: {
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
create: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
remove: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
@@ -159,10 +161,7 @@
let bind = {
form: {
selectorId: '.button-modal01',
selector: null,
// scheduleMSeq: null,
// scheduleDSeq: null,
// reserveSeq: null,
selector: '.modal01',
},
selectbox: null,
}
@@ -181,7 +180,7 @@
};
let $noneWrap = $('#todayNone');
$noneWrap.on('click', 'input[name="todayNone"]', function() {
$noneWrap.on('click', 'input[name="todayNone"]', function () {
let checked = $(this).is(':checked');
let $btn = $('.button-modal01');
$btn.attr('disabled', checked);
@@ -209,13 +208,31 @@
// modal01.open();
// });
},
_bindModelUI() {
let $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
$formWrap.find('input[name="estimatedValue"]').attr('disabled', false);
} else {
$formWrap.find('input[name="estimatedValue"]').val('').attr('disabled', true);
}
});
$formWrap.on('keyup', 'input[name="estimatedValue"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
$formWrap.find('input[name="price"]').attr('disabled', false);
} else {
$formWrap.find('input[name="price"]').val('').attr('disabled', true);
}
});
},
createModal(id) {
if (id === undefined) {
id = 0;
}
//
ajaxUtil._ajaxAsyncMethod(
ENV.httpUrl.form.replace('{id}', id),
{},
@@ -264,6 +281,7 @@
const modal01 = document.querySelector(".modal01").ui;
modal01.open();
formControl._bindModelUI();
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);