YYYY-MM -> YYYYMM 변경관련 오류 수정 및 스크립트 리스너 변경

This commit is contained in:
주우성
2025-06-16 20:40:04 +09:00
parent 59e80d87a4
commit 0eb7d3fa8f
3 changed files with 17 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
package app.module.front.usecase.info.bankUI.getBankInputUI.adapters.web;
import app.module.core.config.application.enums.MonthStatus;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.front.config.application.util.AuthUtil;
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
@@ -55,7 +56,9 @@ class GetBankInputUIController {
id, AuthUtil.getUserSeq())).orElse(null);
//수정 가능 여부 판단
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
LocalDate today = LocalDate.now();
boolean editable = !today.isAfter(maxMonth);
@@ -68,6 +71,7 @@ class GetBankInputUIController {
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
model.addAttribute("MonthStatus", MonthStatus.class);
model.addAttribute("editable", editable);

View File

@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.NoSuchElementException;
@Controller
@@ -104,7 +105,8 @@ class CreateMonthlyUIController {
}
//수정 가능 여부 판단
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
LocalDate today = LocalDate.now();
boolean editable = !today.isAfter(maxMonth);

View File

@@ -44,9 +44,7 @@
<label class="checkbox-inner">
<input type="checkbox" id="forestProductStatus" name="forestProductStatus"
th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
<span class="checkbox-item">
<span class="checkbox-txt">이번달 등록내용 없음</span>
</span>
<span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>
</label>
</div>
@@ -592,16 +590,14 @@
},
//숫자입력
bindDecimalLimit() {
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".limitDecimalLength").forEach(input => {
input.addEventListener("input", () => {
let val = input.value.replace(/[^0-9.]/g, '');
const parts = val.split('.');
if (parts.length > 2) val = parts[0] + '.' + parts.slice(1).join('');
if (parts[1]) parts[1] = parts[1].slice(0, 2);
if (val.length > 10) val = val.slice(0, 10);
input.value = parts.join('.');
});
document.querySelectorAll(".limitDecimalLength").forEach(input => {
input.addEventListener("input", () => {
let val = input.value.replace(/[^0-9.]/g, '');
const parts = val.split('.');
if (parts.length > 2) val = parts[0] + '.' + parts.slice(1).join('');
if (parts[1]) parts[1] = parts[1].slice(0, 2);
if (val.length > 10) val = val.slice(0, 10);
input.value = parts.join('.');
});
});
},