[BO] 임가현황 리스트, 상세 작업 중 (1)

This commit is contained in:
kangsunlee
2025-06-12 20:05:27 +09:00
parent 3d79c5349e
commit 265311034a
25 changed files with 850 additions and 32 deletions

View File

@@ -3,7 +3,244 @@
layout:decorate="~{layout/layout}">
<section layout:fragment="content">
<h1>/household/households</h1>
<form autocomplete="off" method="get" name="reqForm" th:action="@{/household/households}"
th:object="${reqVO}">
<input name="page" th:field="*{page}" type="hidden"/>
<input name="size" th:field="*{size}" type="hidden"/>
<div>
<label>입력월</label>
<select name="recordMonth" th:field="*{recordMonth}">
<option th:each="month : ${monthList}"
th:value="${month.value}"
th:text="${month.label}"
th:selected="${month.value == currentMonth}">
</option>
</select>
<label>경영주</label>
<select name="ownerField" th:field="*{ownerField}">
<option value="">전체</option>
<option value="name">이름</option>
<option value="phone">전화번호</option>
</select>
<input type="text" name="ownerValue" placeholder="" th:field="*{ownerValue}">
<label>실사</label>
<select name="regionMainCode" th:field="*{regionMainCode}">
<option value="">전체</option>
<option th:each="item : ${regionMainList}"
th:value="${item.id}"
th:text="${item.codeText}">
</select>
<label>지역</label>
<select name="regionSubCode" th:field="*{regionSubCode}">
<option value="">전체</option>
<option th:each="item : ${regionSubList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
<label>세부지역</label>
<select name="regionDetailCode" th:field="*{regionDetailCode}">
<option value="">전체</option>
<option th:each="item : ${regionDetailList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
<label>업종 대분류</label>
<select name="industryLargeCode" th:field="*{industryLargeCode}">
<option value="">전체</option>
<option th:each="item : ${industryLargeList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
<label>업종 중분류</label>
<select name="industryMiddleCode" th:field="*{industryMiddleCode}">
<option value="">전체</option>
<option th:each="item : ${industryMiddleList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
<label>일계부 현황</label>
<select name="progressType" th:field="*{progressType}">
<option value="">전체</option>
<option value="PROGRESS_25">25% 미만</option>
<option value="PROGRESS_50">25~50% 미만</option>
<option value="PROGRESS_75">50~75% 미만</option>
<option value="PROGRESS_75_UP">75% 이상</option>
<option value="PROGRESS_100">100% 완료</option>
</select>
<label>당월 1차 방문</label>
<select name="isFirstVisited" th:field="*{isFirstVisited}">
<option value="">전체</option>
<option value="true">방문</option>
<option value="false">미방문</option>
</select>
<label>당월 2차 방문</label>
<select name="isSecondVisited" th:field="*{isSecondVisited}">
<option value="">전체</option>
<option value="true">방문</option>
<option value="false">미방문</option>
</select>
<label>답례품 전달</label>
<select name="isGiftSent" th:field="*{isGiftSent}">
<option value="">전체</option>
<option value="true">전달</option>
<option value="false">미전달</option>
</select>
<label>조사원</label>
<select name="researcherField" th:field="*{researcherField}">
<option value="">전체</option>
<option value="name">이름</option>
<option value="phone">전화번호</option>
</select>
<input type="text" name="researcherValue" placeholder="" th:field="*{researcherValue}">
<label>패널 유지 여부</label>
<select name="isPanel" th:field="*{isPanel}">
<option value="">전체</option>
<option value="true">유지</option>
<option value="false">비유지</option>
</select>
<div>
<button type="reset" onclick="location.href = location.pathname">초기화</button>
<button type="submit">검색</button>
</div>
</div>
<p>총 <span id="totalElements">100</span>건</p>
<table border="1" style="width: 100%; ">
<thead>
<tr>
<th style="width: 40px;"><input type="checkbox"></th>
<th style="width: 80px;">임가번호</th>
<th style="width: 80px;">경영주명</th>
<th style="width: 120px;">휴대전화</th>
<th style="width: 60px;">실사</th>
<th style="width: 100px;">지역</th>
<th style="width: 100px;">세부지역</th>
<th style="width: 120px;">업종 대분류</th>
<th style="width: 120px;">업종 중분류</th>
<th style="width: 120px;">당월 일계부 현황</th>
<th style="width: 100px;">1차 방문일</th>
<th style="width: 100px;">2차 방문일</th>
<th style="width: 100px;">답례품 전달</th>
<th style="width: 80px;">조사원</th>
<th style="width: 120px;">조사원 휴대전화</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</form>
<div class="row paging"></div>
<div>
<!-- <button>엑셀 다운로드</button>-->
<!-- <button>임가 등록</button>-->
<!-- <button>조사원 매핑</button>-->
</div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// TODO : ajax 공통화 작업 후 수정해야
const getHouseholds = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
$.ajax({
method: 'GET',
url: '/api/household/households',
data: dataOj,
success(response) {
console.log("response", response);
$('#totalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#listTBody');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr>
<td><input type="checkbox"></td>
<td><a href="/household/households/${ct.householdSeq}">${ct.householdNum}</a></td> <!-- 임가번호 -->
<td>${ct.householdName}</td> <!-- 경영주 이름 -->
<td>${ct.householdPhone}</td> <!-- 경영주 번호 -->
<td>${ct.regionMainName}</td> <!-- 실사 -->
<td>${ct.regionSubName}</td> <!-- 지역 -->
<td>${ct.regionDetailName}</td> <!-- 세부지역 -->
<td>${isEmpty(ct.industryLargeName)}</td> <!-- 업종 대분류 -->
<td>${isEmpty(ct.industryMiddleName)}</td> <!-- 업종 중분류1 -->
<td>${ct.progressPercent}%</td> <!-- 임가 진행 상황 -->
<td>${isEmpty(ct.firstVisitDate)}</td> <!-- 1차방문날짜 -->
<td>${isEmpty(ct.secondVisitDate)}</td> <!-- 2차방문날짜 -->
<td>${ct.isGiftSent ? "전달" : "미전달"}</td> <!-- 답례품 -->
<td>${isEmpty(ct.researcherName)}</td> <!-- 조사원이름 -->
<td>${isEmpty(ct.researcherPhone)}</td> <!-- 조사원번호 -->
</tr>
`
);
});
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="15" class="text-center text-muted">게시물이 존재하지 않습니다.</td>
</tr>
`);
}
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
}));
}
})
}
// 최초 리스트 로드
getHouseholds(document.reqForm.page.value);
</script>
<script th:inline="javascript">
const goSearch = () => {
const f = document.reqForm;
f.method = 'GET';
f.submit();
}
</script>
<script>
function isEmpty(value, fallback = '-') {
return value !== null && value !== undefined && value !== '' ? value : fallback;
}
</script>
</section>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<section layout:fragment="content">
<h1>/household/households/{seq}</h1>
</section>
</html>