Files
korea-research/admin/src/main/resources/templates/households/{seq}.html
2025-07-16 11:48:14 +09:00

419 lines
18 KiB
HTML

<!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">
<form autocomplete="off" method="get" name="reqForm" onsubmit="return false;">
<input type="hidden" name="householdSeq" th:value="${seq}">
<div class="content-inner">
<section>
<table class="type-form confirm">
<colgroup>
<col width="8%" />
<col width="25.3%" />
<col width="8%" />
<col width="25.3%" />
<col width="8%" />
<col width="25.3%" />
</colgroup>
<tbody>
<tr>
<th>임가번호</th>
<td>
<span th:text="${householdInfo.householdNum}">16750</span>
</td>
<th>경영주</th>
<td>
<span th:text="${householdInfo.householdName}">홍길동</span>
</td>
<th>연령</th>
<td>
<span th:text="${householdInfo.householdAge}">75</span>
</td>
</tr>
<tr>
<th>가구 연락처</th>
<td>
<span
th:text="${householdInfo.householdTel != null && householdInfo.householdTel != '' ? householdInfo.householdTel : '-'}">031-0000-0000</span>
</td>
<th>휴대폰 번호</th>
<td>
<span th:text="${householdInfo.householdPhone}">010-0000-0000</span>
</td>
</tr>
<tr>
<th>실사</th>
<td>
<span th:text="${householdInfo.regionMainName}">서울</span>
</td>
<th>지역</th>
<td>
<span th:text="${householdInfo.regionSubName}">31.경기도</span>
</td>
<th>세부 지역</th>
<td>
<span th:text="${householdInfo.regionDetailName}">9.경기</span>
</td>
</tr>
<tr>
<th>전체 주소</th>
<td>
<span th:text="${householdInfo.address}">경기도 성남시 분당구 산성대로 OOOO</span>
</td>
</tr>
<tr>
<th>업종 대분류</th>
<td>
<span
th:text="${householdInfo.industryLargeName != null && householdInfo.industryLargeName != '' ? householdInfo.industryLargeName : '-'}">40. 수실류재배업</span>
</td>
<th>업종 중분류1</th>
<td>
<span
th:text="${householdInfo.industryMiddleName != null && householdInfo.industryMiddleName != '' ? householdInfo.industryMiddleName : '-'}">42. 대추재배업</span>
</td>
<th>업종 중분류2</th>
<td>
<span
th:text="${householdInfo.industrySubMiddleName != null && householdInfo.industrySubMiddleName != '' ? householdInfo.industrySubMiddleName : '-'}">52_1. 조경수</span>
</td>
</tr>
<tr>
<th>규모/세부품목</th>
<td>
<span
th:text="${householdInfo.industryDetailName != null && householdInfo.industryDetailName != '' ? householdInfo.industryDetailName : '-'}">52_1_1. 조경수</span>
</td>
</tr>
<tr>
<th>담당 조사원</th>
<td>
<span
th:text="${householdInfo.researcherName != null && householdInfo.researcherName != '' ? householdInfo.researcherName : '-'}">김조사</span>
</td>
<th>담당조사원 연락처</th>
<td>
<span
th:text="${householdInfo.researcherPhone != null && householdInfo.researcherPhone != '' ? householdInfo.researcherPhone : '-'}">010-0000-0000</span>
</td>
<th>유지여부</th>
<td class="radio-group">
<span th:text="${householdInfo.isPanel ? '1. 유지' : '2. 탈락'}">1.유지</span>
</td>
</tr>
<tr>
<th>비고</th>
<td class="radio-group">
<span th:text="${householdInfo.memo != null && householdInfo.memo != '' ? householdInfo.memo : '-'}">-</span>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group" th:if="${userRole == 'ROLE_ADMIN'}">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="showResearcherModal();">
<span class="btn-txt">조사원 매핑</span>
</button>
<button type="button" class="btn btn-primary" onclick="goUpdateForm();">
<span class="btn-txt">수정</span>
</button>
</div>
</div>
</section>
<section>
<div class="component-tab" data-active="none">
<div class="tab-head">
<button type="button" class="tab-label select-tab" data-tab-type="daily-record" data-tab-value="tab1">일계부 등록 현황</button>
<button type="button" class="tab-label select-tab" data-tab-type="forest-product" data-tab-value="tab2">임산물 현황</button>
<button type="button" class="tab-label select-tab" data-tab-type="bank-auto-transfer" data-tab-value="tab3">은행자동이체 내역</button>
<button type="button" class="tab-label select-tab" data-tab-type="household-visit" data-tab-value="tab4">임가방문정보</button>
<div class="component-select select-date">
<select class="select-list" name="recordMonth" required onchange="onRecordMonthChange();">
<option th:each="m : ${monthList}"
th:value="${m.value}"
th:text="${m.label}"
th:selected="${m.value == recordMonth}">2025년 5월</option>
</select>
</div>
</div>
<div class="tab-body">
<!-- 일계부 등록 현황 탭 -->
<th:block th:replace="households/tab/daily-record :: tabFragment"/>
<!-- 임산물 현황 탭 -->
<th:block th:replace="households/tab/forest-product :: tabFragment"/>
<!-- 은행자동이체내역 탭 -->
<th:block th:replace="households/tab/bank-auto-transfer :: tabFragment"/>
<!-- 임가방문정보 탭 -->
<th:block th:replace="households/tab/household-visit :: tabFragment"/>
</div>
</div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<div class="btns-col-1">
<button type="button" class="btn" onclick="location.href='/households'">
<span class="btn-txt">목록</span>
</button>
</div>
</div>
</div>
</section>
</div>
</form>
<!-- 일계부 모달 -->
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
<th:block th:replace="households/modal/modal-daily-work :: modalFragment"/>
<th:block th:replace="households/modal/modal-daily-expense :: modalFragment"/>
<th:block th:replace="households/modal/modal-daily-power :: modalFragment"/>
<th:block th:replace="households/modal/modal-daily-forestry :: modalFragment"/>
<th:block th:replace="households/modal/modal-daily-farming :: modalFragment"/>
<!-- 조사원 매핑 모달 -->
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
<!-- 임가방문정보 모달 -->
<th:block th:replace="households/modal/modal-visit-info :: modalFragment"/>
<!-- 임산물현황등록 모달 -->
<th:block th:replace="households/modal/modal-forest-product :: modalFragment"/>
<!-- 은행자동이체(수입) 모달 -->
<th:block th:replace="households/modal/modal-bank-auto-transfer-income :: modalFragment"/>
<!-- 은행자동이체(지출) 모달 -->
<th:block th:replace="households/modal/modal-bank-auto-transfer-expense :: modalFragment"/>
</section>
<section layout:fragment="script">
<script>
// 일계부 완료상태
const statusInfoMap = {
DONE: {
label: '작성완료',
className: 'green'
},
INCOMPLETE: {
label: '미완료',
className: 'light-green'
},
EMPTY: {
label: '미작성',
className: 'border'
},
WAITING: {
label: '대기',
className: 'gray'
}
};
const managementType = {
VISIT: "방문조사",
CALL: "전화상담",
ETC: "기타"
};
</script>
<script>
const tabStorageName = 'tabActive';
const monthStorageName = 'recordMonth';
let tabActive = 'tab1';
let tabMonth = document.reqForm.recordMonth.value;
window.onpageshow = function (event) {
if (event.persisted || (window.performance && window.performance.navigation.type == 1)) {
if (('sessionStorage' in window) && window['sessionStorage'] !== null) {
if (sessionStorage.getItem(tabStorageName)) {
tabActive = sessionStorage.getItem(tabStorageName);
}
if (sessionStorage.getItem(monthStorageName)) {
tabMonth = sessionStorage.getItem(monthStorageName);
document.reqForm.recordMonth.value = tabMonth;
}
}
} else if (event.persisted || (window.performance && window.performance.navigation.type == 2)) {
sessionStorage.removeItem(tabStorageName);
sessionStorage.removeItem(monthStorageName);
}
}
$(document).ready(() => {
$('._excelDownload button').hide();
setTimeout(function () {
let $tab = $('.component-tab button[data-tab-value="' + tabActive + '"]');
getTabData($tab.data('tabType'), $tab.data('tabValue'));
}, 500);
});
$('.select-tab').on('click', function () {
getTabData(this.dataset.tabType, this.dataset.tabValue);
});
</script>
<script>
// 날짜선택
const onRecordMonthChange = () => {
const selectedTab = document.querySelector('.tab-label[aria-selected="true"]');
if (!selectedTab) return;
getTabData(selectedTab.dataset.tabType, selectedTab.dataset.tabValue);
}
const getTabData = (tabType, tabValue) => {
switch (tabType) {
case 'daily-record': // 일계부 등록 현황
getDailyRecords();
break;
case 'forest-product': // 임산물 현황
getForestProductsStatus();
break;
case 'bank-auto-transfer': // 은행자동이체내역
getBankAutoTransfer();
break;
case 'household-visit': // 임가방문정보
getVisitInfo();
break;
}
sessionStorage.setItem(tabStorageName, tabValue);
sessionStorage.setItem(monthStorageName, document.reqForm.recordMonth.value);
document.querySelector('.component-tab').ui.setValue(tabValue);
$('._excelDownload button').hide();
$('._excelDownload button[data-tab-value="' + tabValue + '"]').show();
}
</script>
<script>
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
const getSelectedResearcher = (data, closeModal) => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/household/researcherMapping/create',
JSON.stringify({
adminSeq: data.adminSeq,
householdSeqs: [Number(f.householdSeq.value)]
}),
() => { // 성공
alert("등록이 완료되었습니다.");
closeModal();
// 새로고침이 버벅거려서 일단 setTimeout 처리..
setTimeout(() => {
location.reload();
}, 200);
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
},
'post',
'json',
{ handle422Type: 'alert' }
);
}
</script>
<script>
// 수정 폼으로 가기
const goUpdateForm = () => {
const f = document.reqForm;
location.href = '/households/update/' + f.householdSeq.value;
}
</script>
<script>
// 일계부 등록 현황 nodata 처리
const noDataDaily = (target, status, length) => {
const noDataText = status === 'TARGET' ? '등록이 필요합니다.' : '등록없음';
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
}
// 임산물 현황 noData 처리
const noDataMonthly = (target, status, length) => {
const noDataText = status === 'NOTHING' ? '등록없음' : '등록이 필요합니다.';
$(target).append(`<tr><td colspan="${length}" style="text-align: center;">${noDataText}</td></tr>`);
}
// 단위 선택 (직접입력 선택시 input 활성화)
const selectedUnit = (el) => {
const tr = el.closest('tr');
const unitArea = tr.querySelector('.unit-self-input');
const unitInput = tr.querySelector('.unit-self-input input');
if (el.value.indexOf('.self') !== -1) {
unitInput.disabled = false;
unitArea.classList.remove('input-disabled');
} else {
unitInput.disabled = true;
unitInput.value = '';
unitArea.classList.add('input-disabled');
}
}
// 금액 1개 입력시 다른 금액 input disable
const priceDisabled = (el, disableEl) => {
const wrap = disableEl.closest('td');
const disableArea = wrap.querySelector('.component-input');
const disableInput = wrap.querySelector('input');
if (el.value === '') {
disableInput.disabled = false;
disableArea.classList.remove('input-disabled');
} else {
disableInput.disabled = true;
disableInput.value = '';
disableArea.classList.add('input-disabled');
}
}
const priceDisabledReset = (el, disableEl) => {
let wrap = null;
if (el.value === '') {
wrap = el.closest('td');
wrap.querySelector('input').disabled = false;
wrap.querySelector('.component-input').classList.remove('input-disabled');
}
if (disableEl.value === '') {
wrap = disableEl.closest('td');
wrap.querySelector('input').disabled = false;
wrap.querySelector('.component-input').classList.remove('input-disabled');
}
}
// 직접입력 선택시 input 활성화
const selectedSelf = (el) => {
const tr = el.closest('tr');
const unitArea = tr.querySelector('.self-input');
const unitInput = tr.querySelector('.self-input input');
if (el.value?.endsWith('.self')) {
unitInput.disabled = false;
unitArea.classList.remove('input-disabled');
} else {
unitInput.disabled = true;
unitInput.value = '';
unitArea.classList.add('input-disabled');
}
}
</script>
</section>
</html>