Merge branch 'daily' into dev

This commit is contained in:
김현주
2025-06-16 18:21:22 +09:00
49 changed files with 1239 additions and 656 deletions

View File

@@ -0,0 +1,149 @@
package app.module.front.usecase.daily.calendar.adapters.persistence;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
import app.module.front.usecase.daily.calendar.ports.application.domain.CalendarChildren;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@Repository
@RequiredArgsConstructor
public class RecordCalendarDao implements RecordCalendarPortOut {
private final RecordCalendarMapper recordCalendarMapper;
@Override
public List<RecordCalendar> operate(RecordCalendarCmd command) {
List<DailyRecordCalendarDto> calendarList = this.getCalendarList(command);
List<DailyRecordStatusDto> statusList = this.getDailyRecordStatus(command);
String pathFormat = "/record/%s/%s/%s";
List<RecordCalendar> refineList = new ArrayList<>();
for (DailyRecordCalendarDto calendar : calendarList) {
RecordCalendar refine = new RecordCalendar();
refine.setNo(calendar.getGroupNo());
refine.setStart(calendar.getStartDay());
refine.setEnd(calendar.getEndDay());
DailyRecordStatusDto findStatus = statusList.stream()
.filter(f -> Objects.equals(calendar.getDailyId(), f.getDailyId()))
.findFirst().orElse(null);
if (findStatus == null) {
refine.setChildren(new ArrayList<>());
} else {
List<CalendarChildren> childList = new ArrayList<>();
if (DailyTargetStatus.TARGET.equals(findStatus.getIncomeStatus())) {
childList.add(new CalendarChildren(
"INCOME",
"수입",
findStatus.getIncomeCount(),
String.format(pathFormat, "income", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
if (DailyTargetStatus.TARGET.equals(findStatus.getWorkStatus())) {
childList.add(new CalendarChildren(
"WORK",
"임업노동 투입 내역",
findStatus.getWorkCount(),
String.format(pathFormat, "work", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
if (DailyTargetStatus.TARGET.equals(findStatus.getExpenseStatus())) {
childList.add(new CalendarChildren(
"EXPENSE",
"지출",
findStatus.getExpenseCount(),
String.format(pathFormat, "expense", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
if (DailyTargetStatus.TARGET.equals(findStatus.getPowerStatus())) {
childList.add(new CalendarChildren(
"POWER",
"동력 사용시간",
findStatus.getPowerCount(),
String.format(pathFormat, "power", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
if (DailyTargetStatus.TARGET.equals(findStatus.getForestryStatus())) {
childList.add(new CalendarChildren(
"FORESTRY",
"자가임업 생산물 중 자가소비량",
findStatus.getForestryCount(),
String.format(pathFormat, "forestry", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
if (DailyTargetStatus.TARGET.equals(findStatus.getFarmingStatus())) {
childList.add(new CalendarChildren(
"FARMING",
"자가농업 생산물 중 자가소비량",
findStatus.getFarmingCount(),
String.format(pathFormat, "farming", command.getSearchMonth(), findStatus.getDayGroupNo())));
}
// TODO /info/monthly
childList.add(new CalendarChildren(
"MONTHLY",
"임산물 현황 등록",
0,
String.format("/info/monthly/month/%s", command.getSearchMonth())));
childList.add(new CalendarChildren(
"BANK",
"은행 자동이체 내역 등록",
0,
"/info/bank"));
refine.setChildren(childList);
}
refineList.add(refine);
}
return refineList;
}
/**
* 특정월의 일 그룹 조회
*
* @param command
* @return
*/
private List<DailyRecordCalendarDto> getCalendarList(RecordCalendarCmd command) {
List<DailyRecordCalendarDto> calendarList = recordCalendarMapper.getCalendarByDailyRecord(command);
List<DailyRecordCalendarDto> refineList = new ArrayList<>();
for (DailyRecordCalendarDto record : calendarList) {
record.setStartDate(command.getSearchMonth() + String.format("%02d", record.getStartDay()));
if ((command.getLastDay() == 28 || command.getLastDay() == 30) && record.getStartDay() == command.getLastDay()) {
record.setEndDay(command.getLastDay());
refineList.add(record);
} else if (record.getStartDay() <= command.getLastDay() && record.getEndDay() <= command.getLastDay()) {
refineList.add(record);
}
}
return refineList;
}
/**
* 특정월의 일계부 등록 상태 조회
*
* @param command
* @return
*/
private List<DailyRecordStatusDto> getDailyRecordStatus(RecordCalendarCmd command) {
List<DailyRecordStatusDto> statusList = recordCalendarMapper.getDailyRecordStatus(command);
if (statusList == null || statusList.isEmpty()) {
return Collections.emptyList();
}
return statusList;
}
}

View File

@@ -0,0 +1,27 @@
package app.module.front.usecase.daily.calendar.adapters.persistence;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface RecordCalendarMapper {
/**
* 특정월의 일 그룹 조회
*
* @param cmd 검색 조건
* @return 일(DAY) 그룹 목록
*/
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarCmd cmd);
/**
* 특정일의 일계부 등록 상태 조회
*
* @param cmd 검색 조건
* @return 일계부 등록 현황 목록
*/
List<DailyRecordStatusDto> getDailyRecordStatus(RecordCalendarCmd cmd);
}

View File

@@ -0,0 +1,29 @@
package app.module.front.usecase.daily.calendar.adapters.persistence.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DailyRecordCalendarDto {
/**
* 일 그룹 번호
*/
private Integer groupNo;
/**
* 시작일
*/
private Integer startDay;
/**
* 종료일
*/
private Integer endDay;
/**
* 시작일(yyyy-MM-dd)
*/
private String startDate;
/**
* 일계부 항목 일련번호
*/
private Long dailyId;
}

View File

@@ -0,0 +1,81 @@
package app.module.front.usecase.daily.calendar.adapters.persistence.model;
import app.module.front.usecase.daily.record.web.model.DailyStatus;
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
import lombok.Data;
import lombok.ToString;
import java.time.LocalDate;
@Data
@ToString
public class DailyRecordStatusDto {
/**
* 일계부 일련번호
*/
private Long dailyId;
/**
* 특정일의 그룹 번호
*/
private Integer dayGroupNo;
/**
* 시작일
*/
private LocalDate startDate;
/**
* 종료일
*/
private LocalDate endDate;
/**
* 특정일 입력 상태
*/
private DailyStatus allStatus;
/**
* 수입 입력 상태
*/
private DailyTargetStatus incomeStatus;
/**
* 임업노동 입력 상태
*/
private DailyTargetStatus workStatus;
/**
* 지출 입력 상태
*/
private DailyTargetStatus expenseStatus;
/**
* 동력 사용시간 입력 상태
*/
private DailyTargetStatus powerStatus;
/**
* 자가임업 입력 상태
*/
private DailyTargetStatus forestryStatus;
/**
* 자가농업 입력 상태
*/
private DailyTargetStatus farmingStatus;
/**
* 수입 입력 개수
*/
private Integer incomeCount;
/**
* 임업노동 입력 개수
*/
private Integer workCount;
/**
* 지출 입력 개수
*/
private Integer expenseCount;
/**
* 동력 사용시간 입력 개수
*/
private Integer powerCount;
/**
* 자가임업 입력 개수
*/
private Integer forestryCount;
/**
* 자가농업 입력 개수
*/
private Integer farmingCount;
}

View File

@@ -0,0 +1,38 @@
package app.module.front.usecase.daily.calendar.adapters.web;
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortIn;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/calendar")
public class RecordCalendarController {
private final RecordCalendarPortIn recordCalendarPortIn;
@GetMapping(path = "/{searchMonth}")
public ResponseEntity<?> list(@PathVariable("searchMonth") String searchMonth) {
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO(searchMonth);
log.debug("reqVO: {}", reqVO);
List<RecordCalendar> calendarList = recordCalendarPortIn.operate(new RecordCalendarCmd(
reqVO.getSearchMonth(),
reqVO.getHouseholdSeq(),
reqVO.getSearchDate().withDayOfMonth(reqVO.getSearchDate().lengthOfMonth()).getDayOfMonth()
));
return ResponseEntity.status(HttpStatus.OK).body(calendarList);
}
}

View File

@@ -0,0 +1,28 @@
package app.module.front.usecase.daily.calendar.adapters.web;
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
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.RequestMapping;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/calendar")
public class RecordCalendarUIController {
@GetMapping(path = "")
public String index(Model model) {
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
log.debug("reqVO: {}", reqVO);
model.addAttribute("reqVO", reqVO);
// TODO : 현재 날짜로부터 3일 이전 날짜에 등록하지 않은 날이 있을 경우
return "record/calendar";
}
}

View File

@@ -0,0 +1,48 @@
package app.module.front.usecase.daily.calendar.adapters.web.model;
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
import lombok.Data;
import lombok.ToString;
import org.apache.tika.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@Data
@ToString
public class RecordCalendarUIReqVO extends DailyUIReqVO {
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendarUIReqVO.class);
public RecordCalendarUIReqVO() {
setSearchMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM")));
}
public RecordCalendarUIReqVO(String searchMonth) {
setSearchMonth(searchMonth);
}
/**
* 검색 일(yyyy-MM-dd)
*/
private LocalDate searchDate;
public void setSearchMonth(String searchMonth) {
if (!StringUtils.isBlank(searchMonth) && searchMonth.length() == 7) {
searchMonth = searchMonth + "-01";
} else {
searchMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
}
try {
LocalDate formatDate = LocalDate.parse(searchMonth);
setSearchDate(formatDate);
super.setSearchMonth(formatDate.format(DateTimeFormatter.ofPattern("yyyyMM")));
} catch (Exception e) {
LOGGER.warn("[DateParse] target={}", searchMonth, e);
}
}
}

View File

@@ -1,44 +0,0 @@
package app.module.front.usecase.daily.calendar.persistence;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
import app.module.front.usecase.daily.record.persistence.model.UpdateDailyRecordStatusCmd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface RecordCalendarMapper {
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
int getStartDayByDailyGroupNo(@Param("groupNo") Integer groupNo);
/**
* 일계부 등록 여부
* @param householdSeq
* @param recordMonth
* @param dayGroupNo
* @return
*/
Long getDailyRecordExistCount(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
/**
* 일계부 등록(생성)
* @param command
* @return
*/
Long createDailyRecord(CreateDailyRecordReqVO command);
/**
* 일계부 상태 수정
* @param command
* @return
*/
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
}

View File

@@ -1,14 +0,0 @@
package app.module.front.usecase.daily.calendar.persistence.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DailyRecordCalendarDto {
private String groupNo;
private Integer startDay;
private Integer endDay;
private String startDate;
private String dailyId;
}

View File

@@ -1,29 +0,0 @@
package app.module.front.usecase.daily.calendar.persistence.model;
import lombok.Data;
import lombok.ToString;
import java.time.LocalDate;
@Data
@ToString
public class DailyRecordStatusDto {
/**
* 일계부 일련번호
*/
private Long dailyId;
private LocalDate startDate;
private LocalDate endDate;
/**
* 특정일 입력 상태 TODO enum
*/
private String allStatus;
/**
* 수입 입력 상태 TODO enum
*/
private String incomeStatus;
/**
* 수입 입력 개수
*/
private Integer incomeCount;
}

View File

@@ -0,0 +1,10 @@
package app.module.front.usecase.daily.calendar.ports;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import java.util.List;
public interface RecordCalendarPortIn {
List<RecordCalendar> operate(RecordCalendarCmd command);
}

View File

@@ -0,0 +1,12 @@
package app.module.front.usecase.daily.calendar.ports;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import java.util.List;
public interface RecordCalendarPortOut {
List<RecordCalendar> operate(RecordCalendarCmd command);
}

View File

@@ -0,0 +1,21 @@
package app.module.front.usecase.daily.calendar.ports.application;
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortIn;
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class RecordCalendarService implements RecordCalendarPortIn {
private final RecordCalendarPortOut portOut;
@Override
public List<RecordCalendar> operate(RecordCalendarCmd command) {
return portOut.operate(command);
}
}

View File

@@ -0,0 +1,13 @@
package app.module.front.usecase.daily.calendar.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class CalendarChildren {
private String code;
private String codeLabel;
private Integer total;
private String path;
}

View File

@@ -0,0 +1,18 @@
package app.module.front.usecase.daily.calendar.ports.application.domain;
import lombok.Data;
import lombok.ToString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@Data
@ToString
public class RecordCalendar {
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendar.class);
private Integer no;
private Integer start;
private Integer end;
private List<CalendarChildren> children;
}

View File

@@ -0,0 +1,32 @@
package app.module.front.usecase.daily.calendar.ports.application.domain;
import app.module.front.usecase.daily.record.web.model.DailyCmd;
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
import lombok.*;
import org.apache.tika.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
@Getter
@Setter
@AllArgsConstructor
public class RecordCalendarCmd {
/**
* 검색 월(yyyyMM)
*/
private String searchMonth;
/**
* 임가 일련번호
*/
private Long householdSeq;
/**
* 특정월의 마지막 일
*/
private int lastDay;
}

View File

@@ -1,16 +0,0 @@
package app.module.front.usecase.daily.calendar.service;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
import java.util.List;
public interface RecordCalendarService {
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO);
}

View File

@@ -1,54 +0,0 @@
package app.module.front.usecase.daily.calendar.service;
import app.module.front.usecase.daily.calendar.persistence.RecordCalendarMapper;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
import app.module.front.usecase.daily.record.persistence.DailyRecordMapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@Service
@RequiredArgsConstructor
public class RecordCalendarServiceImpl implements RecordCalendarService {
private final RecordCalendarMapper recordCalendarMapper;
@Override
public List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO) {
int lastDay = reqVO.getSearchDate().withDayOfMonth(reqVO.getSearchDate().lengthOfMonth()).getDayOfMonth();
List<DailyRecordCalendarDto> list = recordCalendarMapper.getCalendarByDailyRecord(reqVO);
List<DailyRecordCalendarDto> refineList = new ArrayList<DailyRecordCalendarDto>();
for (DailyRecordCalendarDto record : list) {
record.setStartDate(reqVO.getSearchMonth() + String.format("%02d", record.getStartDay()));
if ((lastDay == 28 || lastDay == 30) && record.getStartDay() == lastDay) {
record.setEndDay(lastDay);
refineList.add(record);
} else if (record.getStartDay() <= lastDay && record.getEndDay() <= lastDay) {
refineList.add(record);
}
}
return refineList;
}
@Override
public DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO) {
return recordCalendarMapper.getDailyRecordStatus(reqVO);
}
@Override
public int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO) {
return recordCalendarMapper.getStartDayByDailyGroupNo(reqVO.getGroupNo());
}
}

View File

@@ -1,66 +0,0 @@
package app.module.front.usecase.daily.calendar.web;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/calendar")
public class RecordCalendarController {
private final RecordCalendarService recordCalendarService;
@GetMapping(path = "")
public String index(Model model, @RequestParam(value = "searchDay", required = false) String searchDay) {
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO(searchDay, getAccessId());
log.debug("reqVO: {}", reqVO);
model.addAttribute("reqVO", reqVO);
model.addAttribute("calendarList", recordCalendarService.getCalendarByDailyRecord(reqVO));
return "record/calendar";
}
@PostMapping(path = "/{searchMonth}/{groupNo}")
public String detail(Model model
, @PathVariable(required = true) String searchMonth
, @PathVariable(required = true) String groupNo) {
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
reqVO.setSearchMonth(searchMonth);
reqVO.setGroupNo(Integer.parseInt(groupNo));
reqVO.setHouseholdSeq(getAccessId());
log.debug("reqVO: {}", reqVO);
DailyRecordStatusDto detail = recordCalendarService.getDailyRecordStatus(reqVO);
if (detail == null) {
int startDay = recordCalendarService.getStartDayByDailyGroupNo(reqVO);
reqVO.setSearchDay(reqVO.getSearchMonth() + String.format("%02d", startDay));
}
//uiCodeListPortIn.connect("code.pageable.rows");
model.addAttribute("reqVO", reqVO);
model.addAttribute("detail", detail);
return "record/calendar-wrap";
}
// TODO : 로그인 SEQ
private Long getAccessId() {
return 2L;
}
}

View File

@@ -1,73 +0,0 @@
package app.module.front.usecase.daily.calendar.web.model;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.tika.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Date;
import java.util.Locale;
@Data
@ToString
public class RecordCalendarUIReqVO {
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendarUIReqVO.class);
public RecordCalendarUIReqVO() {
}
public RecordCalendarUIReqVO(String searchDay, Long accessId) {
if (StringUtils.isBlank(searchDay) || searchDay.length() != 8) {
searchDay = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
}
try {
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
SimpleDateFormat monthSdf = new SimpleDateFormat("yyyyMM", Locale.KOREAN);
Date formatDate = beforeSdf.parse(searchDay);
setSearchDate(LocalDate.parse(afterSdf.format(formatDate)));
setSearchMonth(monthSdf.format(formatDate));
setSearchDay(beforeSdf.format(formatDate));
} catch (Exception e) {
LOGGER.warn("[DateParse] target={}", searchDay, e);
}
setHouseholdSeq(accessId);
}
/**
* 검색 일(yyyyMMdd)
*/
private String searchDay;
/**
* 검색 월(yyyyMM)
*/
private String searchMonth;
private Integer groupNo;
/**
* 검색 일(yyyy-MM-dd)
*/
private LocalDate searchDate;
/**
* 임가회원 일련번호
*/
private Long householdSeq;
}

View File

@@ -16,7 +16,6 @@ public class CreateDailyExpenseCmd extends FrontAuditCommand {
private String inputType;
private Boolean credit;
private String incomeMarkCode;
private String categoryCode;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -11,8 +11,6 @@ public class DailyExpenseDto {
// TODO : SELF, OCR
private String inputType;
private Boolean credit;
private String categoryCode;
private String categoryLabel;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -41,11 +41,9 @@ public class DailyExpenseServiceImpl implements DailyExpenseService {
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));
}
@@ -54,14 +52,15 @@ public class DailyExpenseServiceImpl implements DailyExpenseService {
/**
* 코드명 조회
* @param code 코드
*
* @param codeId 코드
* @param codeList 공통 코드 목록
* @return
* @return 코드명
*/
private String getCodeLabel(String code, List<UICodeElement> codeList) {
private String getCodeLabel(String codeId, List<UICodeElement> codeList) {
String returnValue = null;
for (UICodeElement codeSetup : codeList) {
if (codeSetup.getCodeValue().equalsIgnoreCase(code)) {
if (codeSetup.getId().equalsIgnoreCase(codeId)) {
returnValue = codeSetup.getCodeText();
break;
}
@@ -78,7 +77,6 @@ public class DailyExpenseServiceImpl implements DailyExpenseService {
formVO.getInputType(),
formVO.getCredit(),
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),
formVO.getQuantity(),

View File

@@ -82,7 +82,6 @@ public class DailyExpenseUIController {
}
}
model.addAttribute("recordExpense", uiCodeListPortIn.connect("code.record.expense"));
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));

View File

@@ -26,14 +26,10 @@ public class CreateDailyExpenseReqVO extends DailyUIReqVO {
* 외상판매 여부
*/
private Boolean credit;
/**
* 지출의 종류 코드
*/
@NotBlank(message = "지출 종류를 선택해 주세요.")
private String categoryCode;
/**
* 지출의 종류 직접입력
*/
@NotBlank(message = "지출 종류를 입력해 주세요.")
private String categorySelf;
/**
* 용도

View File

@@ -20,18 +20,6 @@ public class CreateDailyExpenseValidator implements Validator {
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",

View File

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

View File

@@ -15,8 +15,6 @@ public class DailyIncomeDto {
private Boolean credit;
private String cropCode;
private String cropLabel;
private String categoryCode;
private String categoryLabel;
private String categorySelf;
private String sourcePurpose;
private Integer quantity;

View File

@@ -41,12 +41,10 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
private List<DailyIncomeDto> getRefineIncomeList(DailyIncomeUIReqVO reqVO) {
List<DailyIncomeDto> list = dailyIncomeMapper.getDailyIncomeList(reqVO);
List<UICodeElement> recordIncome = uiCodeListPortIn.connect("code.record.income");
List<UICodeElement> recordCrop = uiCodeListPortIn.connect("code.record.crop");
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
for (DailyIncomeDto dto : list) {
dto.setCategoryLabel(this.getCodeLabel(dto.getCategoryCode(), recordIncome));
dto.setCropLabel(this.getCodeLabel(dto.getCropCode(), recordCrop));
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
}
@@ -56,14 +54,15 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
/**
* 코드명 조회
* @param code 코드
*
* @param codeId 코드
* @param codeList 공통 코드 목록
* @return
* @return 코드명
*/
private String getCodeLabel(String code, List<UICodeElement> codeList) {
private String getCodeLabel(String codeId, List<UICodeElement> codeList) {
String returnValue = null;
for (UICodeElement codeSetup : codeList) {
if (codeSetup.getCodeValue().equalsIgnoreCase(code)) {
if (codeSetup.getId().equalsIgnoreCase(codeId)) {
returnValue = codeSetup.getCodeText();
break;
}
@@ -81,7 +80,6 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
formVO.getCredit(),
formVO.getCropCode(),
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
formVO.getCategoryCode(),
formVO.getCategorySelf(),
formVO.getSourcePurpose(),
formVO.getQuantity(),

View File

@@ -80,7 +80,6 @@ public class DailyIncomeUIController {
}
}
model.addAttribute("recordIncome", uiCodeListPortIn.connect("code.record.income"));
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));

View File

@@ -30,14 +30,10 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
* 재배형태 코드
*/
private String cropCode;
/**
* 수입의 종류 코드
*/
@NotBlank(message = "수입 종류를 선택해 주세요.")
private String categoryCode;
/**
* 수입의 종류 직접입력
*/
@NotBlank(message = "수입 종류를 입력해 주세요.")
private String categorySelf;
/**
* 수입원

View File

@@ -23,18 +23,6 @@ public class CreateDailyIncomeValidator implements Validator {
public void validate(Object target, Errors errors) {
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) 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",

View File

@@ -1,7 +1,6 @@
package app.module.front.usecase.daily.record.web;
import app.module.core.config.application.exception.NoMatchingURIException;
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
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.CreateDailyRecordReqVO;
@@ -23,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RequestMapping(path = "/api/record/daily")
public class DailyRecordController {
private final RecordCalendarService recordCalendarService;
private final DailyRecordService dailyRecordService;
private final CreateDailyRecordValidator createDailyRecordValidator;

View File

@@ -1,7 +1,6 @@
package app.module.front.usecase.daily.record.web;
import app.module.core.config.application.exception.NoMatchingURIException;
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
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.CreateDailyRecordReqVO;
@@ -22,7 +21,6 @@ import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RequestMapping(path = "/record/daily")
public class DailyRecordUIController {
private final RecordCalendarService recordCalendarService;
private final DailyRecordService dailyRecordService;
private final CreateDailyRecordValidator createDailyRecordValidator;

View File

@@ -0,0 +1,22 @@
package app.module.front.usecase.daily.record.web.model;
import app.module.front.config.application.util.AuthUtil;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class DailyCmd {
/**
* 검색 월(yyyyMM)
*/
private String searchMonth;
/**
* 검색 그룸번호
*/
private Integer groupNo;
/**
* 임가 일련번호
*/
private Long householdSeq;
}

View File

@@ -5,7 +5,7 @@
<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.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"/>
@@ -29,13 +29,13 @@
<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
daily_record_seq, input_type, is_credit, income_mark_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}
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
@@ -46,7 +46,6 @@
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}

View File

@@ -5,7 +5,7 @@
<select id="getDailyIncomeList"
resultType="app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.crop_code, ds.category_code, ds.category_self, ds.source_purpose
, ds.crop_code, ds.category_self, ds.source_purpose
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
from daily_income ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
@@ -29,13 +29,13 @@
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_code, category_self, source_purpose
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{dailyRecordSeq}
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categoryCode}, #{categorySelf}, #{sourcePurpose}
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
@@ -47,7 +47,6 @@
, is_credit = #{credit}
, expense_mark_code = #{expenseMarkCode}
, crop_code = #{cropCode}
, category_code = #{categoryCode}
, category_self = #{categorySelf}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}

View File

@@ -1,9 +1,9 @@
<?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.calendar.persistence.RecordCalendarMapper">
<mapper namespace="app.module.front.usecase.daily.calendar.adapters.persistence.RecordCalendarMapper">
<select id="getCalendarByDailyRecord"
resultType="app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto">
resultType="app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto">
select ddg.group_no, ddg.start_day, ddg.end_day
, dr.id as daily_id
from daily_day_group ddg
@@ -17,45 +17,26 @@
</select>
<select id="getDailyRecordStatus"
resultType="app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto">
resultType="app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto">
select dr.id as daily_id
, dr.start_date, dr.end_date
, dr.day_group_no, dr.start_date, dr.end_date
, dr.all_status
, dr.income_status
, (select count(*) from daily_income di where di.daily_record_seq = dr.id and di.is_deleted = false) as income_count
, dr.work_status
, dr.expense_status
, dr.power_status
, dr.forestry_status
, dr.farming_status
, (select count(*) from daily_income di where di.daily_record_seq = dr.id and di.is_deleted = false) as income_count
, (select count(*) from daily_work dw where dw.daily_record_seq = dr.id and dw.is_deleted = false) as work_count
, (select count(*) from daily_expense de where de.daily_record_seq = dr.id and de.is_deleted = false) as expense_count
, (select count(*) from daily_power dp where dp.daily_record_seq = dr.id and dp.is_deleted = false) as power_count
, (select count(*) from daily_forestry df1 where df1.daily_record_seq = dr.id and df1.is_deleted = false) as forestry_count
, (select count(*) from daily_farming df2 where df2.daily_record_seq = dr.id and df2.is_deleted = false) as farming_count
from daily_record dr
where dr.is_deleted = false
and dr.household_seq = #{householdSeq}
and dr.record_month = #{searchMonth}
and dr.day_group_no = #{groupNo}
</select>
<select id="getStartDayByDailyGroupNo"
resultType="int">
select ddg.start_day
from daily_day_group ddg
where ddg.is_deleted = false
and ddg.group_no = #{groupNo}
</select>
<select id="getDailyRecordExistCount"
resultType="int">
/* 일계부 데이터 존재 여부 getDailyRecordExistCount */
select count(*) as exist
from daily_record dr
where dr.household_seq = 2
and dr.is_deleted = false
and dr.record_month = '2025-06'
and dr.day_group_no = 3
</select>
<sql id="InnerJoinByDailyRecord">
/* TODO */
inner join daily_record dr on
dr.id = ds.daily_record_seq
and dr.is_deleted = false
and dr.recordMonth = #{recordMonth} and dr.day_group_no = #{dayGroupNo}
and dr.household_seq = #{householdSeq}
</sql>
</mapper>

View File

@@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 21.5006L12 5.67773" stroke="#868E96" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4 11.7383L12 3.73828L20 11.7383" stroke="#868E96" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 345 B

View File

@@ -1,6 +1,6 @@
etUI.utils.ready(function () {
console.log('document ready');
etUI.initUI();
// etUI.initUI();
// [공통] 헤더 스크롤 관련 기능
etUI.pages.headerScroll = function () {
@@ -253,6 +253,66 @@ etUI.utils.ready(function () {
}
};
// [공통] top 버튼
etUI.pages.scrollTop = function () {
const floatingEl = document.querySelector('.floating-area');
const hasFooter = document.querySelector('.footer');
const isFixedBtn = document.querySelector('.component-btns.fixed');
let isVisible = false;
if (!floatingEl) return;
// 초기 숨김 상태 설정
gsap.set(floatingEl, {
opacity: 0,
// scale: 0,
pointerEvents: 'none'
});
etUI.hooks.useEventListener(window, 'scroll', () => {
const scrollY = window.scrollY;
// bottom 위치 설정
if (hasFooter) {
floatingEl.style.bottom = '72px';
} else if (isFixedBtn) {
floatingEl.style.bottom = '112px';
} else {
floatingEl.style.bottom = '';
}
if (scrollY <= 0 && isVisible) {
// 스크롤 맨 위: 숨기기
isVisible = false;
gsap.to(floatingEl, {
duration: 0.4,
opacity: 0,
// scale: 0,
pointerEvents: 'none',
ease: 'power4.out'
});
} else if (scrollY > 0 && !isVisible) {
// 스크롤 내림: 보이기
isVisible = true;
gsap.to(floatingEl, {
duration: 0.4,
opacity: 1,
scale: 1,
pointerEvents: 'auto',
ease: 'power4.out'
});
}
});
// 클릭 시 top으로 부드럽게 이동
etUI.hooks.useEventListener(floatingEl, 'click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
};
document.fonts.ready.then(() => {
etUI.pages.initSwitchStyleToggle();
etUI.pages.initPriceInputComma();
@@ -262,5 +322,6 @@ etUI.utils.ready(function () {
etUI.pages.activeAppbarOnPath();
etUI.pages.headerScroll();
etUI.pages.tabButtonToggle();
etUI.pages.scrollTop();
});
});
});

File diff suppressed because one or more lines are too long

View File

@@ -6003,9 +6003,7 @@ button.swiper-pagination-bullet {
font-weight: 600;
}
.component-select.bottom-sheet .select-options {
display: -webkit-box;
display: -webkit-flex;
display: flex;
display: none;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
@@ -7762,6 +7760,27 @@ button.swiper-pagination-bullet {
padding-bottom: 0.8rem;
}
.floating-area {
opacity: 0;
position: fixed;
bottom: 7.4rem;
right: 1.6rem;
}
.floating-area .btn-top {
display: block;
width: 4.8rem;
height: 4.8rem;
border-radius: 50%;
background-image: url("../images/common/ico_btn_top.svg");
background-color: #ffffff;
background-size: 2.4rem 2.4rem;
background-repeat: no-repeat;
background-position: center;
border: 0.1rem solid #E9ECEF;
box-shadow: 0px 3px 8px 0px rgba(0, 0, 0, 0.1);
z-index: 2;
}
.detail-wrap {
margin-top: 3.2rem;
}

View File

@@ -30,7 +30,7 @@
<link rel="shortcut icon" type="image/x-icon" href="pathImages/" />
<link th:href="@{/static/assets/styles/style.css}" type="text/css" rel="stylesheet" />
<script th:src="@{/static/assets/scripts/common.ui.plugin.js}"></script>
<script th:src="@{/static/assets/scripts/common.ui.js}"></script>
<script th:src="@{/static/assets/scripts/common.ui.js}" data-init></script>
<script th:src="@{/static/assets/scripts/common.js}"></script>
<script th:src="@{/static/library/jquery/jquery-3.7.1.min.js}"></script>
@@ -212,6 +212,11 @@
<div id="btn-gotop">
<a class="gotop"><span class="hide-txt">화면 제일위로 이동</span></a>
</div>
<div class="floating-area">
<button class="btn-top">
<span class="hide-txt">상단으로 이동</span>
</button>
</div>
</th:block>
</body>

View File

@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<div>
<div>
reqVO: [[${reqVO}]]
</div>
<div>
<th:block th:if="${not #strings.isEmpty(detail)}">
[[${#temporals.format(detail.startDate, 'yyyy년 MM월 dd일')}]] ~ [[${#temporals.format(detail.endDate, 'yyyy년 MM월 dd일')}]]<br/>
수입 : [[${detail.incomeStatus}]], [[${detail.incomeCount}]]
<span th:onclick="formControl.incomeDetail([[${reqVO.searchDay}]])">수정</span>
<br/>
<br/><br/>
detail: [[${detail}]]
</th:block>
<th:block th:if="${#strings.isEmpty(detail)}">
<th:block th:with="searchDate=${#temporals.createDate(reqVO.searchDay, 'yyyyMMdd')}">
[[${#temporals.format(searchDate, 'yyyy년 MM월 dd일')}]]
</th:block>
<br/>
<input type="button" value="등록" th:onclick="formControl.recordCreate([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
</th:block>
</div>
</div>
</html>

View File

@@ -4,34 +4,435 @@
<div layout:fragment="content" th:classappend="acco-wrap">
<main id="content" role="main">
<h2>calendar</h2>
<div>
reqVO: [[${reqVO}]]
</div>
<div>
<th:block th:each="calendar, calendarStatus : ${calendarList}">
<th:block th:if="${not #strings.isEmpty(calendar.dailyId)}">
<span th:onclick="formControl.getDetail([[${reqVO.searchMonth}]], [[${calendar.groupNo}]])">
No=[[${calendar.groupNo}]], Start=[[${calendar.startDay}]], End=[[${calendar.endDay}]], StartDate=[[${calendar.startDate}]], Id=[[${calendar.dailyId}]]<br/>
</span>
</th:block>
<th:block th:if="${#strings.isEmpty(calendar.dailyId)}">
<span th:onclick="formControl.getDetail([[${reqVO.searchMonth}]], [[${calendar.groupNo}]])">
No=[[${calendar.groupNo}]], Start=[[${calendar.startDay}]], End=[[${calendar.endDay}]], StartDate=[[${calendar.startDate}]]<br/>
</span>
</th:block>
</th:block>
</div>
<!-- alert-box 클래스 리스트트
fail : 실패(빨강)
warning : 경고(노랑)
success : 성공(초록)
info : 인포(파랑)
-->
<!-- TODO -->
<!--<article class="alert-box warning">
<p class="tit"><strong>홍길동</strong>님,</p>
<span class="txt">
일계부를 등록하지 않은 날짜가 있습니다. <br>
정확한 조사를 위해 꾸준히 입력해 주세요.
</span>
</article>-->
<hr/>
<!-- 캘린더 -->
<section class="main-calendar">
<div class="datepicker-loading"><i class="ico-spinner" aria-hidden="true"></i></div>
<button type="button" class="btn-week-month month"><span>월</span> <span>주</span></button>
<div class="component-datepicker kri" data-props-type="inline" data-init="false"></div>
<script th:inline="javascript">
class DatepickerComponent {
$datepicker
$datepickerLoading
$btnWeekMonth
$btnPrevMonth
$btnNextMonth
$btnPrevWeek
$btnNextWeek
datepickerInstance
datepickerCompInstance
weekStart = 0 // 주 시작일 (0: 일요일, 1: 월요일 등)
weekPaging = 0
maxWeekPaging = 0
serverData = new Map()
isLoading = false
currentMonth
currentList = []
mode = 'month'
_changeDateCallback = () => {}
_changeMonthCallback = () => {}
<div id="selectedDay">
constructor (changeDateCallback, changeMonthCallback) {
this._changeDateCallback = changeDateCallback || this._changeDateCallback
this._changeMonthCallback = changeMonthCallback || this._changeMonthCallback
this.$datepicker = document.querySelector('.component-datepicker.kri')
this.$datepickerLoading = document.querySelector('.datepicker-loading')
this.$btnWeekMonth = document.querySelector('.btn-week-month')
this.datepickerCompInstance = etUI.components.DatepickerComp()
this.datepickerCompInstance.core.init(this.$datepicker, {
maxView: 0,
beforeShowDay: this.beforeShowDay.bind(this)
})
this.datepickerInstance = this.datepickerCompInstance.getDatepickerInstance()
this.cloneButtons();
this.$btnPrevMonth = document.querySelector('.datepicker-controls .prev-btn:not(.week-prev-btn)')
this.$btnNextMonth = document.querySelector('.datepicker-controls .next-btn:not(.week-next-btn)')
this.$btnPrevWeek = document.querySelector('.datepicker-controls .week-prev-btn')
this.$btnNextWeek = document.querySelector('.datepicker-controls .week-next-btn')
this.$btnPrevWeek.style.display = 'none'
this.$btnNextWeek.style.display = 'none'
this.addEvents()
// 초기 데이터 로딩
const today = new Date()
this.loadMonthData(today);
}
addEvents () {
this._changeDateCallbackDebounced = etUI.utils.debounce(function(currentList, datePair, date, viewDate) {
this._changeDateCallback.apply(this, [currentList, datePair, date, viewDate]);
}, 200);
this.$datepicker.addEventListener('changeDate', ({ detail }) => {
const data = this.serverData.get(this.currentMonth)
this.currentList = etUI.utils.getServerDataChildren(data, detail.viewDate.getDate())
this._changeDateCallbackDebounced(this.currentList, etUI.utils.getDatePair(detail.date), detail.date, detail.viewDate)
})
this.$datepicker.addEventListener('changeMonth', async ({ detail }) => {
const date = new Date(detail.viewDate)
const monthKey = this.getMonthKey(date)
this.setupMonth(date);
if (!this.isLoading) {
await this.loadMonthData(date)
this.setupMonth(date);
}
this._changeMonthCallback.apply(this, [monthKey, date])
})
this.$btnPrevWeek.addEventListener('click', () => {
console.log('prev week')
this.weekPagingPrev()
this.weekPagination('prev')
})
this.$btnNextWeek.addEventListener('click', () => {
console.log('next week')
this.weekPagingNext()
this.weekPagination('next')
})
this.$btnWeekMonth.addEventListener('click', () => {
if(this.mode === 'month'){
this.mode = 'week'
this.$datepicker.classList.remove('month')
this.$datepicker.classList.add('week')
this.$btnWeekMonth.classList.remove('month')
this.$btnWeekMonth.classList.add('week')
this.$btnPrevMonth.style.display = 'none'
this.$btnNextMonth.style.display = 'none'
this.$btnPrevWeek.style.display = 'block'
this.$btnNextWeek.style.display = 'block'
this.setFirstDateDay(this.datepickerInstance.getDate())
this.datepickerInstance.setOptions({
...this.datepickerCompInstance.core.props,
weekStart: this.weekStart,
})
this.loadMonthData(this.datepickerInstance.getDate())
this.weekPaging = 0;
this.weekPagination()
}else{
this.mode = 'month'
this.$datepicker.classList.remove('week')
this.$datepicker.classList.add('month')
this.$btnWeekMonth.classList.remove('week')
this.$btnWeekMonth.classList.add('month')
this.$btnPrevMonth.style.display = 'block'
this.$btnNextMonth.style.display = 'block'
this.$btnPrevWeek.style.display = 'none'
this.$btnNextWeek.style.display = 'none'
this.setFirstDateDay(this.datepickerInstance.getDate())
this.datepickerInstance.setOptions({
...this.datepickerCompInstance.core.props,
weekStart: this.weekStart,
})
this.loadMonthData(this.datepickerInstance.getDate())
const allCells = Array.from(this.$datepicker.querySelectorAll('.datepicker-cell'));
allCells.forEach((cell, idx) => {
cell.classList.remove('hide')
});
}
})
}
weekPagingPrev() {
// 현재 주가 1주차(weekPaging = 0)라면 이전 달로 이동
if (this.weekPaging <= 0) {
this.moveToPreviousMonth();
return;
}
// 이전 주로 이동
this.weekPaging -= 1;
setTimeout(() => {
document.querySelector('.datepicker-cell:not(.hide)').click();
}, 80)
// 주 페이지네이션 적용
this.weekPagination('prev');
}
/**
* 다음 주로 이동
* 1일부터 시작하는 주 단위 기준 (1~7일=1주, 8~14일=2주...)
*/
weekPagingNext() {
const currentDate = this.datepickerInstance.getDate();
const lastDayOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).getDate();
// 현재 달의 최대 주차 계산 (1일 기준)
this.maxWeekPaging = Math.ceil(lastDayOfMonth / 7);
// 마지막 주차를 넘어가면 다음 달로 이동
if (this.weekPaging >= this.maxWeekPaging - 1) {
this.moveToNextMonth();
return;
}
// 다음 주로 이동
this.weekPaging += 1;
setTimeout(() => {
document.querySelector('.datepicker-cell:not(.hide)').click();
}, 80)
// 주 페이지네이션 적용
this.weekPagination('next');
}
moveToPreviousMonth() {
console.log('===========moveToPreviousMonth')
const currentDate = this.datepickerInstance.getDate();
// 이전 달의 마지막 날 구하기
const lastDayOfPrevMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).getDate();
// 이전 달의 마지막 주차 계산 (1일 기준)
const lastWeekOfPrevMonth = Math.ceil(lastDayOfPrevMonth / 7) - 1;
// 이전 달 마지막 주의 첫 번째 날 계산 (1일 기준 주차)
const firstDayOfLastWeek = (lastWeekOfPrevMonth * 7) + 1;
// 이전 달의 해당 주 첫 날로 이동
const targetDate = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, firstDayOfLastWeek);
console.log('targetDate===================', targetDate)
// this.$btnPrevMonth.click()
this.datepickerInstance.setDate(targetDate);
this.weekPaging = lastWeekOfPrevMonth;
console.log('this.weekPaging', this.weekPaging)
this.weekPagination('prev');
setTimeout(() => {
document.querySelector('.datepicker-cell:not(.hide)').click();
}, 80)
}
moveToNextMonth() {
console.log('===========moveToNextMonth')
const currentDate = this.datepickerInstance.getDate();
// 다음 달 1일로 이동 (첫 주의 첫 번째 날)
const nextMonthFirstDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1);
// 다음 달로 이동
// this.$btnNextMonth.click()
this.datepickerInstance.setDate(nextMonthFirstDay);
this.weekPaging = 0;
this.weekPagination('next');
}
setFirstDateDay(date) {
const firstDate = new Date(date.getFullYear(), date.getMonth(), 1);
this.weekStart = firstDate.getDay();
}
weekPagination(direction) {
if (this.mode !== 'week') return;
const allCells = Array.from(this.$datepicker.querySelectorAll('.datepicker-cell'));
const thisMonthCells = allCells.filter(cell => !cell.classList.contains('prev') && !cell.classList.contains('next'));
// 현재 페이지의 첫 번째 셀 인덱스
const startIndex = this.weekPaging * 7;
// 현재 페이지의 마지막 셀 인덱스
const endIndex = startIndex + 7;
// 모든 셀 숨기기
allCells.forEach(cell => cell.classList.add('hide'));
// 현재 페이지의 셀만 보이기
thisMonthCells.slice(startIndex, endIndex).forEach(cell => cell.classList.remove('hide'));
}
cloneButtons(){
const prevBtn = document.querySelector('.prev-btn');
if (prevBtn) {
// 요소 복제 (깊은 복사로 모든 속성과 이벤트 리스너 포함)
const clonedPrevBtn = prevBtn.cloneNode(true);
// 복제된 요소에 고유한 식별자 추가 (선택사항)
clonedPrevBtn.classList.add('week-prev-btn');
// 원본 요소 다음에 복제된 요소 삽입
prevBtn.insertAdjacentElement('afterend', clonedPrevBtn);
}
const nextBtn = document.querySelector('.next-btn');
if (nextBtn) {
// 요소 복제 (깊은 복사로 모든 속성과 이벤트 리스너 포함)
const clonedNextBtn = nextBtn.cloneNode(true);
// 복제된 요소에 고유한 식별자 추가 (선택사항)
clonedNextBtn.classList.add('week-next-btn');
// 원본 요소 다음에 복제된 요소 삽입
nextBtn.insertAdjacentElement('afterend', clonedNextBtn);
}
}
setupMonth(date){
this.currentMonth = this.getMonthKey(date)
const allCells = Array.from(this.$datepicker.querySelectorAll('.datepicker-cell'));
const thisMonthCells = Array.from(this.$datepicker.querySelectorAll('.datepicker-cell:not(.prev):not(.next)'));
// 먼저 모든 클래스 초기화
allCells.forEach(cell => {
cell.classList.remove('selected', 'registered', 'group-start', 'group-end', 'single');
});
const data = this.serverData.get(this.currentMonth)
thisMonthCells.forEach((cell, i) => {
if (cell.classList.contains('disabled') || !cell.dataset.date) return;
const cellDate = new Date(Number(cell.dataset.date));
cellDate.setHours(0, 0, 0, 0);
if(data){
const registered = etUI.utils.checkServerDataChildren(data, cellDate.getDate()) ? 'registered' : '';
cell.classList.add(...etUI.utils.findNumberPosition(cellDate, registered).split(' '))
}else{
cell.classList.add(etUI.utils.findNumberPosition(cellDate))
}
})
}
beforeShowDay (date) {
const today = new Date()
const availToday = etUI.utils.getShowAvailDate(today)
if(availToday < date) {
return {
classes: 'disabled',
}
}
}
async loadMonthData (date) {
if (this.isLoading) return
this.loadingStart()
try {
const monthKey = this.getMonthKey(date)
if(!this.serverData.get(monthKey)){
const data = await this.getData(monthKey)
this.serverData.set(monthKey, data)
}
} catch (error) {
console.error('Failed to load calendar data:', error)
} finally {
const today = new Date()
if (
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear()) {
this.datepickerInstance.setDate(today)
setTimeout(() => {
document.querySelector('.focused').click()
})
} else {
date.setDate(1)
this.datepickerInstance.setDate(date)
setTimeout(() => {
document.querySelector('.focused').click()
})
}
this.datepickerInstance.refresh()
this.loadingEnd()
this.$datepicker.classList.remove('loading')
this.setupMonth(today);
}
}
getMonthKey (date) {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`
}
loadingStart () {
this.isLoading = true
this.$datepicker.classList.add('loading')
this.$datepickerLoading.style.display = 'block'
}
loadingEnd () {
this.isLoading = false
this.$datepicker.classList.remove('loading')
this.$datepickerLoading.style.display = 'none'
}
async getData (month) {
await new Promise(resolve => setTimeout(resolve, 50))
const data = await fetch(`/api/record/calendar/${month}`)
return await data.json()
}
}
new DatepickerComponent(function(list, currentDate, viewDate){
console.log('changeDateCallback', list, currentDate, viewDate);
formControl.setDetail(list, currentDate, viewDate);
}, function(monthKey, currentDate){
console.log('changeMonthCallback', monthKey, currentDate);
});
</script>
</section>
<section class="daily-report-area bg-gray bg-lround">
<div class="inner" id="selectedDay">
<!--/* jsRender */-->
</div>
</section>
</div>
</main>
</div>
<section layout:fragment="script">
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
@@ -44,32 +445,89 @@
};
let formControl = {
getDetail(searchMonth, groupNo) {
console.log('searchMonth=', searchMonth, 'groupNo=', groupNo);
setDetail(list, currentDate, viewDate) {
const todoList = list.filter(f => !(f.code === 'MONTHLY' || f.code === 'BANK'));
const etcList = list.filter(f => f.code === 'MONTHLY' || f.code === 'BANK');
console.log(todoList)
console.log(etcList)
ajaxUtil._ajaxAsync(
ENV.httpUrl.list.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo),
{},
function(rstHtml, status) {
$('#selectedDay').html(rstHtml);
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);
},
'html'
);
let tmpl = $.templates('#dailyNoneTmpl');
let html = '';
if (todoList === undefined || todoList.length === 0) {
html = tmpl.render({
date: currentDate,
etcList: etcList,
});
} else {
tmpl = $.templates('#dailyListTmpl');
html = tmpl.render({
date: currentDate,
list: todoList,
etcList: etcList,
});
}
console.log(html)
$('#selectedDay').html(html);
},
incomeDetail(selectedDay) {
// TODO
alert('TODO : ' + selectedDay);
},
recordCreate(searchMonth, groupNo) {
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo);
},
};
</script>
<script id="dailyNoneTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
<div class="component-btns btn-add">
<button type="button" onclick="alert('TODO');">
<p class="txt">일계부 등록하기</p>
</button>
</div>
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="dailyListTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
<ul class="btn-column-list">
{{for list tmpl="#basicRowTmpl" /}}
</ul>
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="titleTmpl" type="text/x-jsrender">
{{if date.start == date.end}}
<p class="date">{{:date.start}}</p>
{{else}}
<p class="date">{{:date.start}} ~ {{:date.end}}</p>
{{/if}}
</script>
<script id="basicRowTmpl" type="text/x-jsrender">
<li>
<a href="{{:path}}">
<p class="label">{{:codeLabel}}</p>
{{if total != null && total != 0}}
<p class="value"><em>총 <b>{{:total}}</b>건</em></p>
{{else}}
<p class="value">없음</p>
{{/if}}
</a>
</li>
</script>
<script id="etcRowTmpl" type="text/x-jsrender">
<div class="regist-btn-area">
{{for etcList}}
<a href="{{:path}}" class="btn{{if total != null && total != 0}} complete{{/if}}">
<p>{{:codeLabel}}</p>
{{if total != null && total != 0}}
<span>등록완료</span>
{{else}}
<span>미등록</span>
{{/if}}
</a>
{{/for}}
</div>
</script>
</section>
</html>

View File

@@ -54,43 +54,14 @@
<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 class="component-input">
<div class="input-label">
<label for="categorySelf" class="label-txt">
지출의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</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 class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="지출의 종류를 입력해 주세요">
</div>
</div>
<div class="component-input">
@@ -143,9 +114,9 @@
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.codeValue}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.codeValue eq detail.unitCode ? 'current' : ''}"
th:selected="${uiCode.id eq detail.unitCode ? 'current' : ''}"
></li>
</ul>
</div>

View File

@@ -63,7 +63,7 @@
<div class="list-item"
th:each="item, itemStatus : ${expenseList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categoryLabel}]] [[${item.categorySelf}]]</p>
<p class="item-name">[[${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>
@@ -150,8 +150,8 @@
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}]],
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
@@ -209,6 +209,17 @@
// });
},
_bindModelUI() {
etUI.initUI();
const $select2 = document.querySelector('#unitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="unitCode"]').val(dataValue)
}
});
let $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
@@ -239,47 +250,9 @@
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) {
@@ -290,12 +263,6 @@
);
},
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() {

View File

@@ -72,7 +72,7 @@
<ul class="">
<li class="option"
th:each="uiCode : ${recordCrop}"
th:data-value="${uiCode.codeValue}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"></li>
</ul>
</div>
@@ -84,43 +84,14 @@
<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 class="component-input">
<div class="input-label">
<label for="categorySelf" class="label-txt">
수입의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</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 : ${recordIncome}"
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 class="input-field">
<input type="text" id="categorySelf" name="categorySelf" th:value="${detail.categorySelf}" maxlength="30" placeholder="수입의 종류를 입력해 주세요">
</div>
</div>
<div class="component-input">
@@ -173,9 +144,9 @@
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.codeValue}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.codeValue eq detail.unitCode ? 'current' : ''}"
th:selected="${uiCode.id eq detail.unitCode ? 'current' : ''}"
></li>
</ul>
</div>

View File

@@ -62,7 +62,7 @@
<div class="list-item"
th:each="item, itemStatus : ${incomeList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categoryLabel}]] [[${item.categorySelf}]]</p>
<p class="item-name">[[${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>
@@ -153,8 +153,8 @@
remove: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
@@ -209,7 +209,27 @@
// });
},
_bindModelUI() {
let $formWrap = $(bind.form.selector).find('form');
etUI.initUI();
const $select1 = document.querySelector('#cropCode');
const selectboxInstance1 = new etUI.components.SelectBox();
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="cropCode"]').val(dataValue)
}
});
const $select2 = document.querySelector('#unitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="unitCode"]').val(dataValue)
}
});
const $formWrap = $(bind.form.selector).find('form');
$formWrap.on('keyup', 'input[name="price"]', function() {
// TODO : UI disabled
if ($(this).val() === '') {
@@ -239,48 +259,9 @@
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('#cropCode'));
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) {
@@ -291,13 +272,6 @@
);
},
createVaild() {
const f = document.reqModalForm;
// TODO : setter
f.categoryCode.value = document.querySelector('#categoryCode').value !== undefined ? document.querySelector('#categoryCode').value : '';
f.cropCode.value = document.querySelector('#cropCode').value !== undefined ? document.querySelector('#cropCode').value : '';
f.unitCode.value = document.querySelector('#unitCode').value !== undefined ? document.querySelector('#unitCode').value : '';
formControl.create();
},
create() {