임산물현황 추가 팝업까지 + 값체크.
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||
import app.module.core.usecase.product.getForestProduct.ports.GetForestProductPortIn;
|
||||
import app.module.core.usecase.product.getForestProducts.ports.GetForestProductsPortIn;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortIn;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
|
||||
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model.CreateMonthlyReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class CreateMonthlyUIController {
|
||||
|
||||
|
||||
private final GetPrevMonthlyInputStatusPortIn portIn;
|
||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||
private final GetMonthlyForestProductsPortIn getMonthlyForestProductsPortIn;
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/info/monthly/create/{id}")
|
||||
String operate(Model model,
|
||||
@PathVariable Long id,
|
||||
@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
|
||||
// 전달 입력 상태 취득 , 데이터가 없을 경우 null
|
||||
// 이전달 입력상태:NONE일 경우도 null
|
||||
|
||||
GetPrevMonthlyInputStatus pastMonthlyInfo =
|
||||
portIn.operate(
|
||||
new GetPrevMonthlyInputStatusCmd(
|
||||
id, AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
//현재 달 입력 상태 취득
|
||||
GetMonthlyInputStatus currentMonthlyInfo =
|
||||
getMonthlyInputStatusPortIn.operate(
|
||||
new GetMonthlyInputStatusCmd(
|
||||
id, AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
|
||||
// 전달 입력 리스트 취득
|
||||
Page<GetMonthlyForestProducts> pastList = Page.empty();
|
||||
if (pastMonthlyInfo != null) {
|
||||
pastList = getMonthlyForestProductsPortIn.operate(
|
||||
pageable,
|
||||
new GetMonthlyForestProductsCmd(
|
||||
pastMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
}
|
||||
|
||||
// 이번달 입력 리스트 취득
|
||||
Page<GetMonthlyForestProducts> currentList = Page.empty();
|
||||
if (currentMonthlyInfo != null) {
|
||||
currentList = getMonthlyForestProductsPortIn.operate(
|
||||
pageable,
|
||||
new GetMonthlyForestProductsCmd(
|
||||
currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
||||
model.addAttribute("pastList", pastList);
|
||||
model.addAttribute("currentList", currentList);
|
||||
|
||||
|
||||
model.addAttribute("purposeList", uiCodeListPortIn.connect("code.purpose"));
|
||||
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
||||
|
||||
model.addAttribute("MonthStatus", MonthStatus.class);
|
||||
|
||||
return "info/monthly/{id}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CreateMonthlyReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
package app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn;
|
||||
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
|
||||
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web.model.GetMontylyssReqVO;
|
||||
import app.module.front.usecase.info.monthly.getMonthlysUI.adapters.web.model.GetMonthlyssReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -23,7 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetMontylysUIController {
|
||||
class GetMonthlysUIController {
|
||||
|
||||
|
||||
private final GetMonthlyInputStatussPortIn portIn;
|
||||
@@ -32,7 +26,7 @@ class GetMontylysUIController {
|
||||
@GetMapping(path = "/info/monthly")
|
||||
String operate(Model model,
|
||||
@PageableDefault(sort = "month", direction = Sort.Direction.DESC, page = 0, size = 13) Pageable pageable,
|
||||
GetMontylyssReqVO reqVO) {
|
||||
GetMonthlyssReqVO reqVO) {
|
||||
|
||||
Page<GetMonthlyInputStatuss> list =
|
||||
portIn.operate(
|
||||
@@ -9,7 +9,7 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetMontylyssReqVO {
|
||||
public class GetMonthlyssReqVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
@@ -20,8 +20,9 @@ uri.front.info.user.password=\uBE44\uBC00\uBC88\uD638 \uD655\uC778
|
||||
uri.front.info.notice=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.{{pathVar}}=\uACF5\uC9C0\uC0AC\uD56D
|
||||
uri.front.info.notice.path=/info/notice
|
||||
uri.front.info.monthly=\uC6D4\uBCC4 \uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.monthly=\uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.monthly.path=/info/monthly
|
||||
uri.front.info.monthly.create.{{pathVar}}=\uC784\uC0B0\uBB3C \uD604\uD669
|
||||
uri.front.info.bank=\uC740\uD589 \uC790\uB3D9\uC774\uCCB4 \uB0B4\uC5ED
|
||||
uri.front.info.bank.path=/info/bank
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ let kri = {
|
||||
};
|
||||
kri.menu = new Object;
|
||||
kri.logger = new Object();
|
||||
|
||||
kri.form = new Object();
|
||||
/* kri.menu */
|
||||
/**
|
||||
* 스크립트로 페이지 이동
|
||||
@@ -74,3 +74,65 @@ kri.logger.warn = function(message){
|
||||
};
|
||||
|
||||
|
||||
kri.form.error = function(errorList){
|
||||
let isResetDone = false;
|
||||
|
||||
$(errorList).each((idx, oj) => {
|
||||
const target = $('[name="' + oj.field + '"]');
|
||||
let infoBox = null;
|
||||
if (!isResetDone) {
|
||||
const formElement = target.closest('form');
|
||||
if (formElement.length > 0) {
|
||||
$(formElement).find('.component-input').removeClass('input-invalid');
|
||||
$(formElement).find('.input-flex-group').removeClass('invalid');
|
||||
$(formElement).find('.select-group').removeClass('select-invalid');
|
||||
$(formElement).find('.input-info').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
isResetDone = true;
|
||||
}
|
||||
|
||||
if (target.length > 0) {
|
||||
|
||||
const component = target.closest('.component-input');
|
||||
if(component){
|
||||
component.addClass('input-invalid');
|
||||
//연결된 구조 일 경우 상위에 변경
|
||||
if(target.closest('.input-flex-group').length > 0){
|
||||
infoBox = target.closest('.input-flex-group').find('.input-info');
|
||||
} else {
|
||||
infoBox = component.find('.input-info');
|
||||
}
|
||||
|
||||
if (infoBox.length === 0) {
|
||||
if(target.closest('.input-flex-group').length > 0){
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(target.closest('.input-flex-group'));
|
||||
target.closest('.input-flex-group').addClass('invalid');
|
||||
} else {
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||
}
|
||||
}
|
||||
infoBox.html('<li>' + oj.message + '</li>');
|
||||
}
|
||||
}
|
||||
|
||||
if (target.data('type') === 'select') {
|
||||
|
||||
const component = target.closest('.select-group');
|
||||
if (component) {
|
||||
component.addClass('select-invalid');
|
||||
|
||||
infoBox = component.find('.input-info');
|
||||
if (infoBox.length === 0) {
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||
}
|
||||
|
||||
infoBox.html('<li>' + oj.message + '</li>');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<ul class="product-col-list">
|
||||
|
||||
<li th:each="item : ${list.content}" th:classappend="${item.forestProductStatus != MonthStatus.NONE} ? ' complete'">
|
||||
<a href="">
|
||||
<a th:href="@{/info/monthly/create/{id}(id=${item.id})}">
|
||||
<p class="list-tit" th:text="${item.koreanMonth}"></p>
|
||||
<span class="tag" th:text="${item.forestProductStatus.desc}"></span>
|
||||
</a>
|
||||
@@ -27,8 +27,7 @@
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.notice.path}]]*/'detailUrl',
|
||||
notice: /*[[#{uri.front.info.notice.path}]]*/'noticeUrl'
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
|
||||
},
|
||||
module:{
|
||||
confirmPopup : null
|
||||
|
||||
581
front/src/main/resources/templates/info/monthly/{id}.html
Normal file
581
front/src/main/resources/templates/info/monthly/{id}.html
Normal file
@@ -0,0 +1,581 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<hgroup class="tit-group">
|
||||
<h3>
|
||||
[[${currentMonthlyInfo.koreanMonth}]]의 <br>
|
||||
<strong>임산물 현황 <span>[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다.
|
||||
</h3>
|
||||
<p>임산물 현황을 등록해 주세요.</p>
|
||||
</hgroup>
|
||||
|
||||
<section class="regist-item-area">
|
||||
<p class="total" th:style="${currentList.totalElements == 0 ? 'display:none':''}">
|
||||
<span>총 <strong>1</strong>건</span>
|
||||
<button type="button" class="btn-reset">
|
||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||
<span>초기화</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="item-list" th:style="${currentList.totalElements == 0 ? 'display:none':''}" id="listBody">
|
||||
<div class="list-item">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">송이<span>400평</span> </p>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="delete"><span class="hide-txt">삭제</span></button>
|
||||
<button type="button" class="edit"><span class="hide-txt">수정</span></button>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li><span>서화면 서화리 161-1</span></li>
|
||||
<li><p>지목</p><span>임야</span></li>
|
||||
<li><p>가능면적</p><span>600평</span></li>
|
||||
<li><p>주생산물 수확량 / 판매량</p><span>35kg / 10kg</span></li>
|
||||
<li><p>부생산물 수확량 / 판매량</p><span>7kg / 2kg</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-m btn-secondary btn-full" style="margin-bottom:1.2rem" id="addItemBtn" onclick="formControl.addOpen()">
|
||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||
<span class="btn-txt">추가 등록</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-m btn-link btn-full" th:if="${pastMonthlyInfo != null && currentList.totalElements == 0}" id="callPastInfoBtn">
|
||||
<span class="btn-txt">이전 정보 불러오기</span>
|
||||
</button>
|
||||
|
||||
|
||||
<div class="component-input align-center" th:if="${currentList.totalElements == 0}" id="forestProductStatusDiv">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="forestProductStatus" name="forestProductStatus" th:value="${MonthStatus.NOTHING}" onchange="formControl.handleCheckboxChange()">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">이번달 등록내용 없음</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<ul class="info-bullet-list">
|
||||
<li>
|
||||
임업과 관련하여 재배 및 채취된 모든 임산물(목재 포함)을 기록해주세요.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 하단 고정 버튼 -->
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<!-- 비활성화 스타일/ 버튼 속성 disable 추가-->
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||
<span class="btn-txt">등록 완료</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 모달 팝업 -->
|
||||
<div class="layer-wrap">
|
||||
<div class="component-modal mypage-wrap addPopup" 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">
|
||||
<div class="modal-content-inner">
|
||||
|
||||
<form id="forestForm">
|
||||
<article class="alert-box full green">
|
||||
<ul>
|
||||
<li>임업과 관련하여 재배 및 채취된 모든 임산물(목재 포함)을 기록해주세요.</li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<p class="form-desc">필수입력</p>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 읍면동 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="town" class="label-txt">
|
||||
읍면동
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="town" placeholder="읍면동을 입력해 주세요" name="town" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지번 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="streetNum" class="label-txt">
|
||||
지번
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="streetNum" placeholder="지번을 입력해 주세요" name="streetNum" maxlength="10">
|
||||
</div>
|
||||
</div>
|
||||
<!-- 지목 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
지목
|
||||
</p>
|
||||
</div>
|
||||
<div id="landTypeSelect" class="component-select bottom-sheet" data-props-default="지목을 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" id="landType" name="landType" 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="">
|
||||
<th:block th:each="item : ${purposeList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 가능 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="availableArea" class="label-txt">
|
||||
가능 면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="availableArea" placeholder="가능 면적을 입력해 주세요" name="availableArea" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 재배 작물명 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="cropName" class="label-txt">
|
||||
재배 작물명
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="cropName" placeholder="재배 작물명을 입력해 주세요" name="cropName" maxlength="10">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 수확</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 면적 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="landArea" class="label-txt">
|
||||
면적<span>(평)</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="landArea" placeholder="작업 면적을 입력해 주세요" name="landArea" class="limitDecimalLength">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 180, 6</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainYield" class="label-txt">
|
||||
주생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainYield" placeholder="수확량을 입력해 주세요" name="mainYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainYieldUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainYieldUnitCode" id="mainYieldUnitCode" 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="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 주생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="mainSaleAmount" class="label-txt">
|
||||
주생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="mainSaleAmount" placeholder="판매량을 입력해 주세요" name="mainSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="mainSaleUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="mainSaleUnitCode" id="mainSaleUnitCode" 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="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 수확량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subYield" class="label-txt">
|
||||
부생산물 수확량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subYield" placeholder="수확량을 입력해 주세요" name="subYield" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subYieldUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subYieldUnitCode" id="subYieldUnitCode" 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="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<!-- 부생산물 판매량 -->
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="subSaleAmount" class="label-txt">
|
||||
부생산물 판매량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" id="subSaleAmount" placeholder="판매량을 입력해 주세요" name="subSaleAmount" class="limitDecimalLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 단위 -->
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div id="subSaleUnitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="subSaleUnitCode" id="subSaleUnitCode" 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="">
|
||||
<th:block th:each="item : ${unitList}">
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.addData()">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //모달 팝업 -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
|
||||
},
|
||||
module:{
|
||||
addPopup : null
|
||||
},
|
||||
data: {
|
||||
addProducts: []
|
||||
},
|
||||
target:{
|
||||
nothingCheck : document.getElementById("forestProductStatus"),
|
||||
addBtn:{
|
||||
button: null,
|
||||
icon : null
|
||||
}
|
||||
},
|
||||
submitted: false,
|
||||
};
|
||||
let formControl = {
|
||||
init(){
|
||||
this._bindUI();
|
||||
this._listener();
|
||||
},
|
||||
_bindUI(){
|
||||
ENV.module.addPopup = document.querySelector(".addPopup").ui;
|
||||
// ENV.target.addBtn.button = document.getElementById("addItemBtn");
|
||||
// ENV.target.addBtn.icon = button.querySelector("i");
|
||||
|
||||
},
|
||||
_listener(){
|
||||
//소수점
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const inputs = document.querySelectorAll(".limitDecimalLength");
|
||||
|
||||
inputs.forEach(input => {
|
||||
input.addEventListener("input", () => {
|
||||
let val = input.value;
|
||||
|
||||
val = val.replace(/[^0-9.]/g, '');
|
||||
const parts = val.split('.');
|
||||
if (parts.length > 2) {
|
||||
val = parts[0] + '.' + parts.slice(1).join('');
|
||||
}
|
||||
if (parts.length === 2) {
|
||||
parts[1] = parts[1].slice(0, 2);
|
||||
val = parts[0] + '.' + parts[1];
|
||||
}
|
||||
if (val.length > 10) {
|
||||
val = val.slice(0, 10);
|
||||
}
|
||||
|
||||
input.value = val;
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
checkNextBtn(){
|
||||
|
||||
},
|
||||
// button
|
||||
//TODO 하나로 바꿔야함
|
||||
handleCheckboxChange(){
|
||||
const isChecked = document.getElementById("forestProductStatus").checked;
|
||||
this.addButtonOnOff(!isChecked);
|
||||
},
|
||||
addButtonOnOff(isEnabled){
|
||||
const button = document.getElementById("addItemBtn");
|
||||
const icon = button.querySelector("i");
|
||||
|
||||
if (isEnabled) {
|
||||
button.disabled = false;
|
||||
icon.classList.remove("ico-add-disabled");
|
||||
icon.classList.add("ico-add");
|
||||
} else {
|
||||
button.disabled = true;
|
||||
icon.classList.remove("ico-add");
|
||||
icon.classList.add("ico-add-disabled");
|
||||
}
|
||||
},
|
||||
// button
|
||||
addOpen(){
|
||||
ENV.module.addPopup.open();
|
||||
},
|
||||
addData(){
|
||||
const form = document.getElementById('forestForm');
|
||||
|
||||
const landTypeSelect = document.getElementById('ndTypeSelect');
|
||||
const mainYieldUnitCodeSelect = document.getElementById('mainYieldUnitCodeSelect');
|
||||
const mainSaleUnitCodeSelect = document.getElementById('mainSaleUnitCodeSelect');
|
||||
const subYieldUnitCodeSelect = document.getElementById('subYieldUnitCodeSelect');
|
||||
const subSaleUnitCodeSelect = document.getElementById('subSaleUnitCodeSelect');
|
||||
|
||||
if (landTypeSelect && landTypeSelect.value) {
|
||||
form.landType.value = landTypeSelect.value;
|
||||
}
|
||||
if (mainYieldUnitCodeSelect && mainYieldUnitCodeSelect.value) {
|
||||
form.mainYieldUnitCode.value = mainYieldUnitCodeSelect.value;
|
||||
}
|
||||
if (mainSaleUnitCodeSelect && mainSaleUnitCodeSelect.value) {
|
||||
form.mainSaleUnitCode.value = mainSaleUnitCodeSelect.value;
|
||||
}
|
||||
if (subYieldUnitCodeSelect && subYieldUnitCodeSelect.value) {
|
||||
form.subYieldUnitCode.value = subYieldUnitCodeSelect.value;
|
||||
}
|
||||
if (subSaleUnitCodeSelect && subSaleUnitCodeSelect.value) {
|
||||
form.subSaleUnitCode.value = subSaleUnitCodeSelect.value;
|
||||
}
|
||||
|
||||
const errorData = [];
|
||||
|
||||
if(!form.cropName.value) {
|
||||
const data = {field:'cropName', message: '재배 작물명을 입력해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.mainYield.value && !form.mainYieldUnitCode.value) {
|
||||
const data = {field:'mainYieldUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.mainSaleAmount.value && !form.mainSaleUnitCode.value) {
|
||||
const data = {field:'mainSaleUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
|
||||
if(form.subYield.value && !form.subYieldUnitCode.value) {
|
||||
const data = {field:'subYieldUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
if(form.subSaleAmount.value && !form.subSaleUnitCode.value) {
|
||||
const data = {field:'subSaleUnitCode', message: '단위를 선택해주세요.'}
|
||||
errorData.push(data);
|
||||
}
|
||||
kri.form.error(errorData)
|
||||
|
||||
if(errorData.length > 0) {
|
||||
const formData = new FormData(form);
|
||||
|
||||
const data = {};
|
||||
formData.forEach((value, key) => {
|
||||
data[key] = value;
|
||||
});
|
||||
ENV.data.addProducts.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${regionMainList}">
|
||||
<li class="option" th:data-value="${item.codeValue}" th:text="${item.codeText}">option1</li>
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}">option1</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -187,7 +187,7 @@
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<th:block th:each="item : ${regionSubList}">
|
||||
<li class="option" th:data-value="${item.codeValue}" th:text="${item.codeText}" >option1</li>
|
||||
<li class="option" th:data-value="${item.id}" th:text="${item.codeText}" >option1</li>
|
||||
</th:block>
|
||||
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user