[BO] 임가현황 작업 중 - url 변경

This commit is contained in:
kangsunlee
2025-06-23 13:59:07 +09:00
parent 1aeb87642a
commit 1a753eb5c1
26 changed files with 377 additions and 42 deletions

View File

@@ -0,0 +1,353 @@
<!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">
<div class="content-inner">
<!-- 테이블 영역 -->
<table class="type-form">
<tbody>
<tr>
<th>임가번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="d-flex">
<div class="input-field">
<input type="number" name="householdNum" id="householdNum"
placeholder=""
oninput="numberMaxLengthChk(this, 5);">
</div>
<button type="button" class="btn" onclick="checkHouseholdNum();">
<span class="btn-txt">중복확인</span>
</button>
</div>
</div>
</div>
</td>
<th>경영주명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="ownerName" name="ownerName" placeholder="" maxlength="10">
</div>
</div>
</td>
<th>연령(만 나이)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="number" id="ownerAge" name="ownerAge" placeholder=""
oninput="numberMaxLengthChk(this, 3);">
</div>
</div>
</td>
</tr>
<tr>
<th>가구 연락처</th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="tel1">
<option value="" disabled hidden>선택해주세요.</option>
<option value="02">02</option>
<option value="031" selected>031</option>
<option value="032">032</option>
<option value="033">033</option>
<option value="041">041</option>
<option value="042">042</option>
<option value="043">043</option>
<option value="044">044</option>
<option value="051">051</option>
<option value="052">052</option>
<option value="053">053</option>
<option value="054">054</option>
<option value="055">055</option>
<option value="061">061</option>
<option value="062">062</option>
<option value="063">063</option>
<option value="064">064</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="tel2" name="tel2" placeholder=""
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="tel3" name="tel3" placeholder=""
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
</div>
</td>
<th>휴대폰 번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="phone1" required>
<option value="" disabled hidden>선택해주세요.</option>
<option value="010" selected>010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" name="phone2" id="phone2" placeholder=""
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" name="phone3" id="phone3" placeholder=""
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionMainCode" required>
<option value="">전체</option>
<option th:each="item : ${regionMainList}"
th:value="${item.id}"
th:text="${item.codeText}">
</select>
</div>
</td>
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionSubCode" required>
<option value="">전체</option>
<option th:each="item : ${regionSubList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</td>
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionDetailCode" required>
<option value="">전체</option>
<option th:each="item : ${regionDetailList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</td>
</tr>
<tr>
<th>전체 주소<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" name="address" id="address" placeholder="">
</div>
</div>
</td>
</tr>
<tr>
<th>업종 대분류</th>
<td>
<div class="component-select">
<select class="select-list" name="industryLargeCode">
<option value="">전체</option>
<option th:each="item : ${industryLargeList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</td>
<th>업종 중분류1</th>
<td>
<div class="component-select">
<select class="select-list" name="industryMiddleCode">
<option value="">전체</option>
<option th:each="item : ${industryMiddleList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</td>
<th>업종 중분류2</th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="industrySubMiddle" name="industrySubMiddle" placeholder="" maxlength="20">
</div>
</div>
</td>
</tr>
<tr>
<th>세부품목</th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="industryDetail" name="industryDetail" placeholder="" maxlength="20">
</div>
</div>
</td>
</tr>
<tr>
<th>담당 조사원</th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="input-field">
<input type="text" name="researcherName" id="researcherName" placeholder="">
</div>
</div>
<button type="button" class="btn" onclick="showResearcherModal();">
<span class="btn-txt">검색</span>
</button>
</div>
</td>
</tr>
<tr>
<th>유지 여부</th>
<td class="radio-group">
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isPanel_Y" name="isPanel" value="true" checked>
<span class="radio-item">
<span class="radio-txt">유지</span>
</span>
</label>
</div>
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isPanel_N" name="isPanel" value="false">
<span class="radio-item">
<span class="radio-txt">탈락</span>
</span>
</label>
</div>
</td>
</tr>
<tr>
<th>비고</th>
<td colspan="5">
<div class="component-input">
<div class="input-textarea-field">
<textarea id="memo" name="memo" class="textarea" placeholder=""></textarea>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="location.href='/households'">
<span class="btn-txt">취소</span>
</button>
<button type="button" class="btn btn-primary" onclick="createHousehold();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</form>
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// 임가번호 중복확인 변수
let checkDuplicate = false;
// 임가번호 중복확인
const checkHouseholdNum = () => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/households/check',
{ householdNum : f.householdNum.value },
function(response) { // 성공
const message = response.isDuplicated
? "입력하신 번호는 중복입니다. 다른 임가번호를 입력해주세요."
: "사용 가능합니다.";
alert(message);
// 중복이 아니어야 (false여야) 사용 가능
checkDuplicate = !response.isDuplicated;
},
function (code, rstData) { // 실패
console.log("error : ", code);
if(code == 400) alert("임가번호를 입력해주세요.");
},
'get',
'json'
);
}
</script>
<script>
// 임가등록
const createHousehold = () => {
if(!checkDuplicate) {
alert("임가번호 중복확인을 해주세요.");
return;
}
const f = document.reqForm;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/households/create',
JSON.stringify(dataOj),
function(response) { // 성공
alert("등록이 완료되었습니다.");
location.href = '/households';
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
},
'post',
'json',
{ handle422Type: 'alert' }
);
}
</script>
<script>
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
const getSelectedResearcher = (data, closeModal) => {
document.getElementById('researcherName').value = `${data.name}`;
const form = document.reqForm;
let input = form.querySelector('input[name="researcherSeq"]');
if (!input) {
input = document.createElement('input');
input.type = 'hidden';
input.name = 'researcherSeq';
form.appendChild(input);
}
// adminSeq 값 세팅
input.value = data.adminSeq;
closeModal();
}
</script>
<script>
// 휴대폰번호 길이 체크
const numberMaxLengthChk = (el, number) => {
el.value = el.value.slice(0, number);
}
</script>
</section>
</html>

View File

@@ -0,0 +1,481 @@
<!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" th:action="@{/households}"
th:object="${reqVO}">
<input name="page" th:field="*{page}" type="hidden"/>
<input name="size" th:field="*{size}" type="hidden"/>
<input name="userRole" th:value="${userRole}" type="hidden"/>
<input name="userRegionMainCode" th:value="${userRegionMainCode}" type="hidden"/>
<div class="content-inner">
<!-- 필터 영역 -->
<section class="filter-wrap">
<div class="form-area">
<!-- 연/월 -->
<div class="input-group">
<div class="input-label">
<p class="label-txt">
연/월
</p>
</div>
<div class="component-select">
<select class="select-list" name="recordMonth" th:field="*{recordMonth}" required>
<option th:each="month : ${monthList}"
th:value="${month.value}"
th:text="${month.label}"
th:selected="${month.value == currentMonth}">
</option>
</select>
</div>
</div>
<!-- 경영주 -->
<div class="input-group">
<div class="input-label">
<p class="label-txt">
경영주
</p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="ownerField" th:field="*{ownerField}">
<option value="">전체</option>
<option value="name">이름</option>
<option value="phone">전화번호</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="temp_input_0001" name="ownerValue" th:field="*{ownerValue}" placeholder="이름 입력">
</div>
</div>
</div>
</div>
<div class="input-group">
<div class="d-flex">
<div class="component-select">
<div class="input-label">
<p class="label-txt">
실사
</p>
</div>
<select class="select-list" name="regionMainCode" th:field="*{regionMainCode}">
<option value="">전체</option>
<option th:each="item : ${regionMainList}"
th:value="${item.id}"
th:text="${item.codeText}">
</select>
</div>
<div class="component-select">
<div class="input-label">
<p class="label-txt">
지역
</p>
</div>
<select class="select-list" name="regionSubCode" th:field="*{regionSubCode}">
<option value="">전체</option>
<option th:each="item : ${regionSubList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
<div class="component-select">
<div class="input-label">
<p class="label-txt">
세부지역
</p>
</div>
<select class="select-list" name="regionDetailCode" th:field="*{regionDetailCode}">
<option value="">전체</option>
<option th:each="item : ${regionDetailList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</div>
</div>
<div class="input-group">
<div class="d-flex">
<div class="component-select">
<div class="input-label">
<p class="label-txt">
업종 대분류
</p>
</div>
<select class="select-list" name="industryLargeCode" th:field="*{industryLargeCode}">
<option value="">전체</option>
<option th:each="item : ${industryLargeList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
<div class="component-select">
<div class="input-label">
<p class="label-txt">
업종 중분류
</p>
</div>
<select class="select-list" name="industryMiddleCode" th:field="*{industryMiddleCode}">
<option value="">전체</option>
<option th:each="item : ${industryMiddleList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}">
</select>
</div>
</div>
</div>
<div class="input-group">
<div class="component-select">
<div class="input-label">
<p class="label-txt">
일계부 현황
</p>
</div>
<select class="select-list" 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>
</div>
</div>
<!-- TODO : 2차 오픈 -->
<!-- <div class="input-group">-->
<!-- <div class="d-flex">-->
<!-- <div class="component-select">-->
<!-- <div class="input-label">-->
<!-- <p class="label-txt">-->
<!-- 당일 1차 방문-->
<!-- </p>-->
<!-- </div>-->
<!-- <select class="select-list" name="isFirstVisited" th:field="*{isFirstVisited}">-->
<!-- <option value="">전체</option>-->
<!-- <option value="true">방문</option>-->
<!-- <option value="false">미방문</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- <div class="component-select">-->
<!-- <div class="input-label">-->
<!-- <p class="label-txt">-->
<!-- 당월 2차 방문-->
<!-- </p>-->
<!-- </div>-->
<!-- <select class="select-list" name="isSecondVisited" th:field="*{isSecondVisited}">-->
<!-- <option value="">전체</option>-->
<!-- <option value="true">방문</option>-->
<!-- <option value="false">미방문</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- <div class="component-select">-->
<!-- <div class="input-label">-->
<!-- <p class="label-txt">-->
<!-- 답례품 방문-->
<!-- </p>-->
<!-- </div>-->
<!-- <select class="select-list" name="isGiftSent" th:field="*{isGiftSent}">-->
<!-- <option value="">전체</option>-->
<!-- <option value="true">전달</option>-->
<!-- <option value="false">미전달</option>-->
<!-- </select>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="input-group">
<div class="input-label">
<p class="label-txt">
조사원
</p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="researcherField" th:field="*{researcherField}">
<option value="">전체</option>
<option value="name">이름</option>
<option value="phone">전화번호</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="temp_input_0002" name="researcherValue" placeholder="이름 입력" th:field="*{researcherValue}">
</div>
</div>
</div>
</div>
<div class="input-group">
<div class="input-label">
<p class="label-txt">
패널 유지 여부
</p>
</div>
<div class="component-select">
<select class="select-list" name="isPanel" th:field="*{isPanel}">
<option value="">전체</option>
<option value="true">유지</option>
<option value="false">탈락</option>
</select>
</div>
</div>
</div>
<!-- 버튼 그룹 -->
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn" onclick="location.href = location.pathname">
<span class="btn-txt">초기화</span>
</button>
<button type="submit" class="btn btn-primary">
<span class="btn-txt">검색</span>
</button>
</div>
</div>
</section>
<section>
<p class="input-label" style="font-size: 16px;">총 <span id="totalElements">0</span>건</p>
<!-- 테이블 영역 -->
<table>
<thead>
<tr>
<th>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="checkedAll" name="checkedAll">
</label>
</div>
</th>
<th>임가번호</th>
<th>이름</th>
<th>전화번호</th>
<th>실사</th>
<th>지역</th>
<th>세부지역</th>
<th>업종(대분류)</th>
<th>업종(중분류)</th>
<th>당월 일계부 현황</th>
<!-- TODO : 2차 오픈 -->
<!-- <th>당월 1차 임가방문</th>-->
<!-- <th>당월 2차 임가방문</th>-->
<!-- <th>답례품 전달</th>-->
<th class="hide-role-researcher">조사원</th>
<th class="hide-role-researcher">조사원 휴대전화</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</section>
<!-- 페이지네이션 -->
<div class="row paging"></div>
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
<!-- 관리자만 노출 -->
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}"
onclick="location.href='/households/create'">
<span class="btn-txt">임가 등록</span>
</button>
<!-- 관리자, 지방실사만 노출 -->
<button type="button" class="btn" th:if="${userRole != 'ROLE_RESEARCHER'}" onclick="showResearcherModal();">
<span class="btn-txt">조사원 매핑</span>
</button>
</div>
</div>
</div>
</form>
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// 임가 목록 조회
const getHouseholds = (pageNo) => {
const f = document.reqForm;
f.page.value = pageNo;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/households',
dataOj,
function(response) { // 성공
console.log("response", response);
$('#totalElements').text(response.totalElements);
const tbody = $('#listTBody');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr>
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="chkBox_${ct.householdSeq}" name="chkBox" value="${ct.householdSeq}">
</label>
</div>
</td>
<td class="underline"><a href="/households/${ct.householdSeq}?recordMonth=${f.recordMonth.value}">${ct.householdNum}</a></td><!-- 임가번호 -->
<td class="underline"><a href="/households/${ct.householdSeq}?recordMonth=${f.recordMonth.value}">${ct.householdName}</a></td><!-- 경영주 이름 -->
<td>${ct.householdPhone}</td><!-- 경영주 번호 -->
<td>${ct.regionMainName}</td><!-- 실사 -->
<td>${ct.regionSubName}</td><!-- 지역 -->
<td>${ct.regionDetailName}</td><!-- 세부지역 -->
<td>${ifNullHyphen(ct.industryLargeName)}</td><!-- 업종 대분류 -->
<td>${ifNullHyphen(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
<td>${ct.progressPercent}%</td><!-- 임가 진행 상황 -->
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherName)}</td> <!-- 조사원이름 -->
<td class="hide-role-researcher">${ifNullHyphen(ct.researcherPhone)}</td> <!-- 조사원번호 -->
</tr>
`
);
});
<!-- TODO : 2차 오픈 -->
// `
// <tr>
// <td>
// <div class="component-input">
// <label class="checkbox-inner">
// <input type="checkbox" id="chkBox_${ct.householdSeq}" name="chkBox" value="${ct.householdSeq}">
// </label>
// </div>
// </td>
// <td class="underline"><a href="/households/${ct.householdSeq}?recordMonth=${f.recordMonth.value}">${ct.householdNum}</a></td><!-- 임가번호 -->
// <td class="underline"><a href="/households/${ct.householdSeq}?recordMonth=${f.recordMonth.value}">${ct.householdName}</a></td><!-- 경영주 이름 -->
// <td>${ct.householdPhone}</td><!-- 경영주 번호 -->
// <td>${ct.regionMainName}</td><!-- 실사 -->
// <td>${ct.regionSubName}</td><!-- 지역 -->
// <td>${ct.regionDetailName}</td><!-- 세부지역 -->
// <td>${ifNullHyphen(ct.industryLargeName)}</td><!-- 업종 대분류 -->
// <td>${ifNullHyphen(ct.industryMiddleName)}</td><!-- 업종 중분류1 -->
// <td>${ct.progressPercent}%</td><!-- 임가 진행 상황 -->
// <td>${ifNullHyphen(ct.firstVisitDate)}</td><!-- 1차방문날짜 -->
// <td>${ifNullHyphen(ct.secondVisitDate)}</td><!-- 2차방문날짜 -->
// <td>${ct.isGiftSent ? "전달" : "미전달"}</td> <!-- 답례품 -->
// <td class="hide-role-researcher">${ifNullHyphen(ct.researcherName)}</td> <!-- 조사원이름 -->
// <td class="hide-role-researcher">${ifNullHyphen(ct.researcherPhone)}</td> <!-- 조사원번호 -->
// </tr>
// `
// 현재 로그인한 유저의 역할
const isResearcher = f.userRole.value === 'ROLE_RESEARCHER';
const colspanLength = isResearcher ? 13 : 15;
// 조사원일 경우 조사원이름, 번호 칼럼 hide
$('.hide-role-researcher').toggle(!isResearcher);
// nodata 처리
if (!$(response.content).length) {
tbody.append(`
<tr>
<td colspan="${colspanLength}" 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();
}));
},
function (code, rstData) { // 실패
console.log("error : ", code);
},
'get',
'json'
);
}
// 최초 리스트 로드
getHouseholds(document.reqForm.page.value);
</script>
<script th:inline="javascript">
const goSearch = () => {
const f = document.reqForm;
f.method = 'GET';
f.submit();
}
</script>
<script>
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
const getSelectedResearcher = (data, closeModal) => {
const checked = document.querySelectorAll('input[name="chkBox"]:checked');
const householdSeqs = Array.from(checked).map(el => el.value);
if(checked.length == 0) {
alert("임가를 선택해주세요.");
return;
}
ajaxUtil._ajaxMethod(
'/api/household/researcherMapping/create',
JSON.stringify({
adminSeq: data.adminSeq,
householdSeqs: householdSeqs
}),
() => { // 성공
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>
// 체크박스 전체 선택
document.getElementById('checkedAll').addEventListener('change', function () {
const isChecked = this.checked;
const checkboxes = document.querySelectorAll('input[name="chkBox"]');
checkboxes.forEach(cb => {
cb.checked = isChecked;
});
});
</script>
<script th:inline="javascript" th:if="${alertMessage != null}">
alert([[${alertMessage}]]);
</script>
</section>
</html>

View File

@@ -0,0 +1,159 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<div class="layer-wrap" th:fragment="modalFragment">
<form autocomplete="off" method="get" name="reqVisitForm">
<input name="page" value="0" type="hidden"/>
<input name="size" value="10" type="hidden">
<div class="component-modal mypage-wrap modal01 modal-visit-info" data-props-dimm-click="true" data-state="close">
<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">
<table class="type-form">
<tbody>
<tr>
<th>방문일</th>
<td>
<div class="component-datepicker">
<div class="component-input">
<div class="input-field">
<input type="text" class="datepicker-btn-trigger" name="visitDate" id="visitDate" aria-label="시작일"
placeholder="시작일을 입력해주세요" />
<span class="input-field-btn datepicker-state">
<span class="hide-txt">달력</span>
<i class="ico-calendar ico-normal" aria-hidden="true"></i>
</span>
</div>
</div>
</div>
</td>
<th>관리분야<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="managementType" required>
<option value="" disabled hidden selected>선택</option>
<option value="">선택</option>
<option value="VISIT">방문조사</option>
<option value="CALL">전화상담</option>
<option value="ETC">기타</option>
</select>
</div>
</td>
</tr>
<tr>
<th>내용<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td colspan="5">
<div class="component-input">
<div class="input-textarea-field">
<textarea id="textarea_note" class="textarea" name="content" placeholder=""></textarea>
</div>
</div>
</td>
</tr>
<tr>
<th>답례품 전달</th>
<td class="radio-group">
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isGiftSent_Y" name="isGiftSent" value="true">
<span class="radio-item">
<span class="radio-txt">전달</span>
</span>
</label>
</div>
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isGiftSent_N" name="isGiftSent" value="false" checked>
<span class="radio-item">
<span class="radio-txt">미전달</span>
</span>
</label>
</div>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-primary" onclick="">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</form>
<script th:inline="javascript">
const resetForm = () => {
const form = document.forms['reqVisitForm'];
if (!form) return;
const today = new Date().toISOString().slice(0, 10);
form.visitDate.value = today;
form.managementType.value = '';
form.content.value = '';
document.getElementById('isGiftSent_N').checked = true;
}
</script>
<script th:inline="javascript">
const showVisitInfoModal = (id) => {
document.querySelector(".modal-visit-info").ui.open();
resetForm();
if(id != null) {
ajaxUtil._ajaxMethod(
'/api/visitInfo/' + id,
{},
(response) => {
console.log("임가방문정보 상세 응답값 : ", response);
setFormData(response);
},
function (code, rstData) {
console.log("error : ", code);
},
'get',
'json'
);
}
}
const setFormData = (data) => {
const form = document.forms['reqVisitForm'];
if (!form) return;
// 폼에 값 세팅
form.visitDate.value = data.visitDate || '';
form.managementType.value = data.managementType || '';
form.content.value = data.content || '';
// 라디오 버튼 처리
document.getElementById('isGiftSent_Y').checked = data.isGiftSent === true;
document.getElementById('isGiftSent_N').checked = data.isGiftSent === false;
}
</script>
</div>
</html>

View File

@@ -0,0 +1,346 @@
<!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">
<input type="hidden" name="householdSeq" th:value="${householdInfo.householdSeq}">
<div class="content-inner">
<!-- 테이블 영역 -->
<table class="type-form">
<tbody>
<tr>
<th>임가번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="d-flex">
<div class="input-field">
<input type="number" name="householdNum" id="householdNum" placeholder=""
th:value="*{householdInfo.householdNum}" readonly>
</div>
<button type="button" class="btn" disabled>
<span class="btn-txt">중복확인</span>
</button>
</div>
</div>
</div>
</td>
<th>경영주명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="ownerName" name="ownerName" placeholder=""
maxlength="10"
th:value="*{householdInfo.householdName}">
</div>
</div>
</td>
<th>연령(만 나이)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="number" id="ownerAge" name="ownerAge" placeholder=""
th:value="*{householdInfo.householdAge}"
oninput="numberMaxLengthChk(this, 3);">
</div>
</div>
</td>
</tr>
<tr>
<th>가구 연락처</th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="tel1">
<option value="" disabled hidden>선택해주세요.</option>
<option value="02" th:selected="${householdInfo.householdTel1 == '02'}">02</option>
<option value="031" th:selected="${householdInfo.householdTel1 == '031'}">031</option>
<option value="032" th:selected="${householdInfo.householdTel1 == '032'}">032</option>
<option value="033" th:selected="${householdInfo.householdTel1 == '033'}">033</option>
<option value="041" th:selected="${householdInfo.householdTel1 == '041'}">041</option>
<option value="042" th:selected="${householdInfo.householdTel1 == '042'}">042</option>
<option value="043" th:selected="${householdInfo.householdTel1 == '043'}">043</option>
<option value="044" th:selected="${householdInfo.householdTel1 == '044'}">044</option>
<option value="051" th:selected="${householdInfo.householdTel1 == '051'}">051</option>
<option value="052" th:selected="${householdInfo.householdTel1 == '052'}">052</option>
<option value="053" th:selected="${householdInfo.householdTel1 == '053'}">053</option>
<option value="054" th:selected="${householdInfo.householdTel1 == '054'}">054</option>
<option value="055" th:selected="${householdInfo.householdTel1 == '055'}">055</option>
<option value="061" th:selected="${householdInfo.householdTel1 == '061'}">061</option>
<option value="062" th:selected="${householdInfo.householdTel1 == '062'}">062</option>
<option value="063" th:selected="${householdInfo.householdTel1 == '063'}">063</option>
<option value="064" th:selected="${householdInfo.householdTel1 == '064'}">064</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="tel2" name="tel2" placeholder=""
th:value="*{householdInfo.householdTel2}"
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="tel3" name="tel3" placeholder=""
th:value="*{householdInfo.householdTel3}"
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
</div>
</td>
<th>휴대폰 번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" name="phone1" required>
<option value="" disabled hidden>선택해주세요.</option>
<option value="010" th:selected="${householdInfo.householdPhone1 == '010'}">010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" name="phone2" id="phone2" placeholder=""
th:value="*{householdInfo.householdPhone2}"
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" name="phone3" id="phone3" placeholder=""
th:value="*{householdInfo.householdPhone3}"
oninput="numberMaxLengthChk(this, 4);">
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionMainCode" required>
<option value="">전체</option>
<option th:each="item : ${regionMainList}"
th:value="${item.id}"
th:text="${item.codeText}"
th:selected="${item.id == householdInfo.regionMainCode}">
</option>
</select>
</div>
</td>
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionSubCode" required>
<option value="">전체</option>
<option th:each="item : ${regionSubList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}"
th:selected="${item.id == householdInfo.regionSubCode}">
</select>
</div>
</td>
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-select">
<select class="select-list" name="regionDetailCode" required>
<option value="">전체</option>
<option th:each="item : ${regionDetailList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}"
th:selected="${item.id == householdInfo.regionDetailCode}">
</select>
</div>
</td>
</tr>
<tr>
<th>전체 주소<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" name="address" id="address" placeholder=""
th:value="*{householdInfo.address}">
</div>
</div>
</td>
</tr>
<tr>
<th>업종 대분류</th>
<td>
<div class="component-select">
<select class="select-list" name="industryLargeCode">
<option value="">전체</option>
<option th:each="item : ${industryLargeList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}"
th:selected="${item.id == householdInfo.industryLargeCode}">
</select>
</div>
</td>
<th>업종 중분류1</th>
<td>
<div class="component-select">
<select class="select-list" name="industryMiddleCode">
<option value="">전체</option>
<option th:each="item : ${industryMiddleList}"
th:value="${item.id}"
th:text="${item.codeValue + '. ' + item.codeText}"
th:selected="${item.id == householdInfo.industryMiddleCode}">
</select>
</div>
</td>
<th>업종 중분류2</th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="industrySubMiddle" name="industrySubMiddle"
placeholder="" maxlength="20"
th:value="${householdInfo.industrySubMiddle}">
</div>
</div>
</td>
</tr>
<tr>
<th>세부품목</th>
<td>
<div class="component-input">
<div class="input-field">
<input type="text" id="industryDetail" name="industryDetail"
placeholder="" maxlength="20"
th:value="${householdInfo.industryDetail}">
</div>
</div>
</td>
</tr>
<tr>
<th>담당 조사원</th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="input-field">
<input type="text" name="researcherName" id="researcherName"
placeholder=""
th:value="${householdInfo.researcherName}">
<input type="hidden" name="researcherSeq" id="researcherSeq"
th:value="${householdInfo.researcherSeq}">
</div>
</div>
<button type="button" class="btn" onclick="showResearcherModal();">
<span class="btn-txt">검색</span>
</button>
</div>
</td>
</tr>
<tr>
<th>유지 여부</th>
<td class="radio-group">
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isPanel_Y" name="isPanel" value="true"
th:checked="${householdInfo.isPanel == true}">
<span class="radio-item">
<span class="radio-txt">유지</span>
</span>
</label>
</div>
<div class="component-input">
<label class="radio-inner">
<input type="radio" id="isPanel_N" name="isPanel" value="false"
th:checked="${householdInfo.isPanel == false}">
<span class="radio-item">
<span class="radio-txt">탈락</span>
</span>
</label>
</div>
</td>
</tr>
<tr>
<th>비고</th>
<td colspan="5">
<div class="component-input">
<div class="input-textarea-field">
<textarea id="memo" name="memo" class="textarea"
placeholder=""
th:value="${householdInfo.memo}"></textarea>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="location.href='/households'">
<span class="btn-txt">취소</span>
</button>
<button type="button" class="btn btn-primary" onclick="updateHousehold();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</form>
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
</section>
<section layout:fragment="script">
<script th:inline="javascript">
// 임가 수정
const updateHousehold= () => {
const f = document.reqForm;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/api/households/update',
JSON.stringify(dataOj),
function(response) { // 성공
alert("등록이 완료되었습니다.");
location.href = '/households';
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
},
'put',
'json',
{ handle422Type: 'alert' }
);
}
</script>
<script>
// 조사원 매핑 팝업의 선택된 조사원 가져오기.
const getSelectedResearcher = (data, closeModal) => {
document.getElementById('researcherName').value = `${data.name}`;
const form = document.reqForm;
let input = form.querySelector('input[name="researcherSeq"]');
if (!input) {
input = document.createElement('input');
input.type = 'hidden';
input.name = 'researcherSeq';
form.appendChild(input);
}
// adminSeq 값 세팅
input.value = data.adminSeq;
closeModal();
}
</script>
<script>
// 휴대폰번호 길이 체크
const numberMaxLengthChk = (el, number) => {
el.value = el.value.slice(0, number);
}
</script>
</section>
</html>

File diff suppressed because it is too large Load Diff