임산물현황 완료일거에요.

This commit is contained in:
주우성
2025-06-16 14:07:05 +09:00
parent 3ac0e7b0dd
commit c9085a6e91
14 changed files with 433 additions and 86 deletions

View File

@@ -0,0 +1,26 @@
package app.module.core.usecase.product.removeMonthForestProducts.adapters.persistence;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.product.removeMonthForestProducts.adapters.persistence.model.RemoveMonthForestProductsParam;
import app.module.core.usecase.product.removeMonthForestProducts.ports.RemoveMonthForestProductsPortOut;
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Repository
@RequiredArgsConstructor
class RemoveMonthForestProductsDao implements RemoveMonthForestProductsPortOut {
private final RemoveMonthForestProductsMapper mapper;
@Override
public void operate(RemoveMonthForestProductsCmd command) {
String loginUser = CommonUtil.getLoginUsername();;
LocalDateTime now = LocalDateTime.now();
mapper.deleteForestProducts(
new RemoveMonthForestProductsParam(command.getId(), command.getHouseholdSeq(), now, loginUser, now, loginUser));
}
}

View File

@@ -0,0 +1,9 @@
package app.module.core.usecase.product.removeMonthForestProducts.adapters.persistence;
import app.module.core.usecase.product.removeMonthForestProducts.adapters.persistence.model.RemoveMonthForestProductsParam;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemoveMonthForestProductsMapper {
void deleteForestProducts(RemoveMonthForestProductsParam param);
}

View File

@@ -0,0 +1,20 @@
package app.module.core.usecase.product.removeMonthForestProducts.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.Set;
@Getter
@Setter
@AllArgsConstructor
public class RemoveMonthForestProductsParam {
private Long id;
private Long householdSeq;
private LocalDateTime updatedAt;
private String updatedBy;
private LocalDateTime deletedAt;
private String deletedBy;
}

View File

@@ -0,0 +1,7 @@
package app.module.core.usecase.product.removeMonthForestProducts.ports;
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
public interface RemoveMonthForestProductsPortIn {
void operate(RemoveMonthForestProductsCmd command);
}

View File

@@ -0,0 +1,7 @@
package app.module.core.usecase.product.removeMonthForestProducts.ports;
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
public interface RemoveMonthForestProductsPortOut {
void operate(RemoveMonthForestProductsCmd command);
}

View File

@@ -0,0 +1,19 @@
package app.module.core.usecase.product.removeMonthForestProducts.ports.application;
import app.module.core.usecase.product.removeMonthForestProducts.ports.RemoveMonthForestProductsPortIn;
import app.module.core.usecase.product.removeMonthForestProducts.ports.RemoveMonthForestProductsPortOut;
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class RemoveMonthForestProductsService implements RemoveMonthForestProductsPortIn {
private final RemoveMonthForestProductsPortOut portOut;
@Override
public void operate(RemoveMonthForestProductsCmd command) {
portOut.operate(command);
}
}

View File

@@ -0,0 +1,17 @@
package app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Set;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class RemoveMonthForestProductsCmd {
private Long id;
private Long householdSeq;
}

View File

@@ -0,0 +1,16 @@
<?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.core.usecase.product.removeMonthForestProducts.adapters.persistence.RemoveMonthForestProductsMapper">
<update id="deleteForestProducts">
/* deleteForestProducts : 게시물 삭제 */
UPDATE forest_product
SET <include refid="common.fields.DeleteBaseSet" />
WHERE
household_seq = #{householdSeq}
AND monthly_input_status_id = #{id}
</update>
</mapper>

View File

@@ -9,6 +9,8 @@ import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMont
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
import app.module.core.usecase.product.createForestProduct.ports.CreateForestProductPortIn;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
import app.module.core.usecase.product.removeMonthForestProducts.ports.RemoveMonthForestProductsPortIn;
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
import app.module.front.config.application.response.ApiResponse;
import app.module.front.config.application.util.AuthUtil;
import app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model.CreateMonthlyProductReqVO;
@@ -29,6 +31,8 @@ class CreateMonthlyController {
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
private final CreateForestProductPortIn createForestProductPortIn;
private final UpdateMonthlyInputStatusPortIn updateMonthlyInputStatusPortIn;
private final RemoveMonthForestProductsPortIn removeMonthForestProductsPortIn;
private final CoreUtil coreUtil;
@PostMapping(path = "/api/front/info/monthly/create")
@@ -41,50 +45,57 @@ class CreateMonthlyController {
new GetMonthlyInputStatusCmd(
reqVO.getId(), AuthUtil.getUserSeq())).orElse(null);
if(!reqVO.getStatus() && reqVO.getProductList()!=null && !reqVO.getProductList().isEmpty()){ // 등록없음 처리가 아님.
for(CreateMonthlyProductReqVO item : reqVO.getProductList()){
createForestProductPortIn.operate(new CreateForestProductCmd(
AuthUtil.getUserSeq(),
item.getStreetNum(),
item.getLandType(),
item.getTown(),
item.getAvailableArea(),
item.getCropName(),
null,
item.getLandArea(),
if(currentMonthlyInfo!=null) {
//TODO 트렌젝션 고려
removeMonthForestProductsPortIn.operate(new RemoveMonthForestProductsCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
if (!reqVO.getStatus() && reqVO.getProductList() != null && !reqVO.getProductList().isEmpty()) { // 등록없음 처리가 아님.
for (CreateMonthlyProductReqVO item : reqVO.getProductList()) {
createForestProductPortIn.operate(new CreateForestProductCmd(
AuthUtil.getUserSeq(),
item.getStreetNum(),
item.getLandType(),
item.getTown(),
item.getAvailableArea(),
item.getCropName(),
null,
item.getLandArea(),
currentMonthlyInfo.getMonth(),
item.getMainYield(),
item.getMainYieldUnitCode(),
item.getMainSaleAmount(),
item.getMainSaleUnitCode(),
item.getSubYield(),
item.getSubYieldUnitCode(),
item.getSubSaleAmount(),
item.getSubSaleUnitCode(),
currentMonthlyInfo.getId()
));
}
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
currentMonthlyInfo.getId(),
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
item.getMainYield(),
item.getMainYieldUnitCode(),
item.getMainSaleAmount(),
item.getMainSaleUnitCode(),
item.getSubYield(),
item.getSubYieldUnitCode(),
item.getSubSaleAmount(),
item.getSubSaleUnitCode(),
currentMonthlyInfo.getId()
MonthStatus.REGISTERED,
currentMonthlyInfo.getBankAutoTransferInputStatus(),
currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
} else {
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
currentMonthlyInfo.getId(),
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
MonthStatus.NOTHING,
currentMonthlyInfo.getBankAutoTransferInputStatus(),
currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
}
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
currentMonthlyInfo.getId(),
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
MonthStatus.REGISTERED,
currentMonthlyInfo.getBankAutoTransferInputStatus(),
currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
return ResponseEntity.ok(ApiResponse.success(null));
} else {
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
currentMonthlyInfo.getId(),
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
MonthStatus.NOTHING,
currentMonthlyInfo.getBankAutoTransferInputStatus(),
currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
return ResponseEntity.ok(ApiResponse.failure(null));
}
return ResponseEntity.ok(ApiResponse.success(null));
}
}

View File

@@ -26,6 +26,9 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
@Controller
@RequiredArgsConstructor
@@ -50,7 +53,7 @@ class CreateMonthlyUIController {
new GetPrevMonthlyInputStatusCmd(
id, AuthUtil.getUserSeq())).orElse(null);
//현재 달 입력 상태 취득
//이번달 달 입력 상태 취득
GetMonthlyInputStatus currentMonthlyInfo =
getMonthlyInputStatusPortIn.operate(
new GetMonthlyInputStatusCmd(
@@ -75,6 +78,11 @@ class CreateMonthlyUIController {
currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
}
//수정 가능 여부 판단
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth());
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
LocalDate today = LocalDate.now();
boolean editable = !today.isAfter(maxMonth);
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
@@ -87,6 +95,7 @@ class CreateMonthlyUIController {
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
model.addAttribute("MonthStatus", MonthStatus.class);
model.addAttribute("editable", editable);
return "info/monthly/{id}";
}

View File

@@ -55,7 +55,6 @@ var ajaxUtil = {
},
});
}
},
_alertId : function (alertId, afterEvent) {
ajaxUtil._alertMethod({

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" 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>
이번달의 <br>
<strong>은행 자동이체 내역 입력 현황</strong>을
확인하세요.
</h3>
</hgroup>
<ul class="product-col-list">
<li>
<a href="">
<p class="list-tit">수입</p>
<span class="tag">미등록</span>
</a>
</li>
<li class="complete">
<a href="">
<p class="list-tit">지출</p>
<span class="tag">등록완료</span>
</a>
</li>
</ul>
</div>
</main>
</div>
<section layout:fragment="script">
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
},
module:{
confirmPopup : null
},
submitted: false,
};
let formControl = {
init(){
}
}
</script>
</section>
</html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" 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>
이번달의 <br>
<strong>은행 자동이체 내역 입력 현황</strong>을
확인하세요.
</h3>
</hgroup>
<ul class="product-col-list">
<li>
<a href="">
<p class="list-tit">수입</p>
<span class="tag">미등록</span>
</a>
</li>
<li class="complete">
<a href="">
<p class="list-tit">지출</p>
<span class="tag">등록완료</span>
</a>
</li>
</ul>
</div>
</main>
</div>
<section layout:fragment="script">
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
},
module:{
confirmPopup : null
},
submitted: false,
};
let formControl = {
init(){
}
}
</script>
</section>
</html>

View File

@@ -16,7 +16,7 @@
<section class="regist-item-area">
<p class="total" style="display: none" id="listHeader"><!-- th:style="${currentList.totalElements == 0 ? 'display:none':''}"-->
<span>총 <strong id="listCount">0</strong>건</span>
<button type="button" class="btn-reset" onclick="formControl.clearAllItems()">
<button type="button" class="btn-reset" onclick="formControl.clearAllItems()" id="clearAllItems">
<i class="ico-reset ico-small" aria-hidden="true"></i>
<span>초기화</span>
</button>
@@ -30,12 +30,12 @@
<span class="btn-txt">추가 등록</span>
</button>
<button type="button" class="btn btn-m btn-link btn-full" th:style="${pastMonthlyInfo != null && currentList.totalElements == 0 ? '':'display:none'}" id="callPastInfoBtn">
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn"> <!-- th:style="${pastMonthlyInfo != null && currentList.totalElements == 0 ? '':'display:none'}"-->
<span class="btn-txt">이전 정보 불러오기</span>
</button>
<div class="component-input align-center" th:style="${currentList.totalElements == 0 ? '':'display:none'}" id="forestProductStatusDiv">
<div class="component-input align-center" id="forestProductStatusDiv"> <!-- th:style="${currentList.totalElements == 0 ? '':'display:none'}"-->
<label class="checkbox-inner">
<input type="checkbox" id="forestProductStatus" name="forestProductStatus" th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
<span class="checkbox-item">
@@ -428,9 +428,12 @@
purposeList: /*[[${purposeList}]]*/ [],
unitList: /*[[${unitList}]]*/ [],
// productList: /*[[${currentList.content}]]*/ [],
productList: [],
productList: /*[[${currentList.content}]]*/[],
pastProductList : /*[[${pastList.content}]]*/ [],
id: /*[[${currentMonthlyInfo.id}]]*/''
id: /*[[${currentMonthlyInfo.id}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.forestProductStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.forestProductStatus}]]*/'',
editable : /*[[${editable}]]*/,
},
elementRefs: {
noDataCheckbox: document.getElementById("forestProductStatus"),
@@ -447,13 +450,126 @@
init() {
this.cacheElements();
this.bindDecimalLimit();
this.setting();
ajaxUtil._alert('select 초기화/지정 방법?\n 6월의 카운트와 추가등록의 카운터의 차이?\n 신규 작성 이후 재진입시의 로직?\n 일단 저장데이터 뿌리는것은 막아둠',null);
// this.updateLayout();
this.loadingLayout();
// this.checkUsePastData();
// ajaxUtil._alert('select 초기화/지정 방법?\n 6월의 카운트와 추가등록의 카운터의 차이?\n 신규 작성 이후 재진입시의 로직?\n 일단 저장데이터 뿌리는것은 막아둠',null);
},
checkUsePastData(){
etUI.dialog.alert({
title: "이전 정보 불러오기",
message: "이번달 정보를 아직 입력하지 않으셨네요.\n지난달 정보를 불러와 수정하여 등록하시겠어요?\n\n‘예’ 를 선택하시면 지난달 정보를 불러오고\n‘아니오’를 선택하시면 신규 등록이 가능합니다.\n계속 진행하시겠습니까?",
type: "confirm",
dialogType: "confirm",
positiveText:"예",
negativeText:"아니오",
callback: function () {
ENV.data.productList = JSON.parse(JSON.stringify(ENV.data.pastProductList));
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
formControl.updateLayout();
},
});
},
//모달창
cacheElements() {
ENV.module.modalPopup = document.querySelector(".addPopup").ui;
},
// 스크립트 단순화/고도화 필요.
loadingLayout(){
//아이템 추가 버튼
const addItemBtn = document.getElementById("addItemBtn");
const icon = addItemBtn.querySelector("i");
//이전 데이터 취득 버튼
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
//데이터 없음 버튼
const forestProductStatus = document.getElementById("forestProductStatus");
//등록 완료 버튼
const next = document.getElementById('complateBtn');
const clearAllItems = document.getElementById('clearAllItems');
if(ENV.data.pastProductList.length == 0) {
callPastInfoBtn.disabled = true;
}
if(ENV.data.editable) {
if (ENV.data.currentStatus == "NONE") {
if(ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastProductList.length > 0){
this.checkUsePastData();
}
} else if (ENV.data.currentStatus == "NOTHING") {
addItemBtn.disabled = true;
icon.classList.toggle("ico-add", false);
icon.classList.toggle("ico-add-disabled", true);
callPastInfoBtn.disabled = true;
forestProductStatus.checked = true;
next.disabled = true;
} else if (ENV.data.currentStatus == "REGISTERED") {
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
this.updateLayout();
} else {
}
}
} else {
if (ENV.data.currentStatus == "REGISTERED") {
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data,false));
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
count.textContent = total;
}
}
addItemBtn.disabled = true;
icon.classList.toggle("ico-add", false);
icon.classList.toggle("ico-add-disabled", true);
callPastInfoBtn.disabled = true;
forestProductStatus.disabled = true;
next.disabled = true;
next.style.display="none";
clearAllItems.style.display = "none";
}
},
updateLayout() {
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
const btn = document.getElementById("addItemBtn");
const icon = btn.querySelector("i");
const status = document.getElementById('forestProductStatusDiv');
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
const next = document.getElementById('complateBtn');
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
status.style.display = total > 0 ? 'none' : '';
callPastInfoBtn.style.display = total > 0 ? 'none' : '';
count.textContent = total;
btn.disabled = isChecked;
icon.classList.toggle("ico-add", !isChecked);
icon.classList.toggle("ico-add-disabled", isChecked);
if(isChecked) {
next.disabled = !isChecked;
} else {
next.disabled = total <= 0;
}
},
//숫자입력
bindDecimalLimit() {
document.addEventListener("DOMContentLoaded", () => {
@@ -471,9 +587,9 @@
},
setting(){
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data));
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
}
this.updateListHeader();
this.updateLayout();
},
pastMonthlyDataPopup(){
//pastProductList 출력하면도미.
@@ -488,14 +604,19 @@
},
//등록없음 버튼
handleNoDataToggle() {
this.updateListHeader();
if(!ENV.data.editable && ENV.data.currentStatus == "NOTHING") {
ENV.elementRefs.noDataCheckbox.checked = true;
return;
}
this.updateLayout();
},
// 등록폼 추가
openAddForm() {
const modalContent = document.querySelector('.modal-content');
setTimeout(() => { modalContent.scrollTop = 0; }, 0);
//초기화 안됨
['landTypeSelect', 'mainYieldUnitCodeSelect', 'mainSaleUnitCodeSelect', 'subYieldUnitCodeSelect', 'subSaleUnitCodeSelect']
.forEach(id => etUI.components.SelectBox().core.init(document.getElementById(id)));
@@ -544,7 +665,7 @@
else ENV.data.productList.push(product);
ENV.module.modalPopup.close();
setTimeout(() => productRenderer.addItem(product), 300);
setTimeout(() => productRenderer.addItem(product,true), 300);
},
// 선택 아이템 수정 (폼 노출)
editItemById(id) {
@@ -573,7 +694,7 @@
ENV.data.productList = ENV.data.productList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove();
this.updateListHeader();
this.updateLayout();
},
// 전체 초기화
clearAllItems() {
@@ -583,34 +704,7 @@
// this.updateListHeader();
},
// 아이템 겟수 처리 아이템에 따른 레이아웃 정리
updateListHeader() {
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
const btn = document.getElementById("addItemBtn");
const icon = btn.querySelector("i");
const status = document.getElementById('forestProductStatusDiv');
const next = document.getElementById('complateBtn');
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
status.style.display = total > 0 ? 'none' : '';
count.textContent = total;
btn.disabled = isChecked;
icon.classList.toggle("ico-add", !isChecked);
icon.classList.toggle("ico-add-disabled", isChecked);
if(isChecked) {
next.disabled = !isChecked;
} else {
next.disabled = total <= 0;
}
},
// 지목 코드
getPurposeLabel(code) {
const found = ENV.data.purposeList.find(i => i.id === code);
@@ -651,7 +745,7 @@
const productRenderer = {
//화면에 아이템 추가
addItem(product) {
addItem(product, isEdit) {
const listBody = document.getElementById('listBody');
const form = document.getElementById('forestForm');
form.reset();
@@ -689,23 +783,30 @@
tag6 = `<li><p>부생산물 판매량</p><span>${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode)}</span></li>`;
}
let buttonGroupHtml = '';
if (isEdit) {
buttonGroupHtml = `
<div class="btn-group">
<button type="button" class="delete" onclick="formControl.deleteItemById(${product.id})"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" onclick="formControl.editItemById(${product.id})"><span class="hide-txt">수정</span></button>
</div>
`;
}
const div = document.createElement('div');
div.className = 'list-item';
div.dataset.id = product.id;
div.innerHTML = `
<div class="item-tit-group">
<p class="item-name">${product.cropName} ${tag1}</p>
<div class="btn-group">
<button type="button" class="delete" onclick="formControl.deleteItemById(${product.id})"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" onclick="formControl.editItemById(${product.id})"><span class="hide-txt">수정</span></button>
</div>
${buttonGroupHtml}
</div>
<ul class="detail-list">${tag2}${tag3}${tag4}${tag5}${tag6}</ul>
`;
const existing = listBody.querySelector(`[data-id="${product.id}"]`);
existing ? listBody.replaceChild(div, existing) : listBody.appendChild(div);
formControl.updateListHeader();
formControl.updateLayout();
}
};