422 lines
19 KiB
HTML
422 lines
19 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">
|
|
<div class="content-inner">
|
|
<!-- 테이블 영역 -->
|
|
<table class="type-form">
|
|
<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>임가번호<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" id="regionSubCode" required>
|
|
<option value="">전체</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="regionDetailCode" id="regionDetailCode" required>
|
|
<option value="">전체</option>
|
|
</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" id="industryLargeCode">
|
|
<option value="">전체</option>
|
|
</select>
|
|
</div>
|
|
</td>
|
|
<th>업종 중분류1</th>
|
|
<td>
|
|
<div class="component-select">
|
|
<select class="select-list" name="industryMiddleCode" id="industryMiddleCode">
|
|
<option value="">전체</option>>
|
|
</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>
|
|
|
|
<th>유지 여부</th>
|
|
<td class="radio-group" colspan="3">
|
|
<div class="d-flex">
|
|
<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>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>구분</th>
|
|
<td class="radio-group">
|
|
<div class="component-input">
|
|
<label class="radio-inner">
|
|
<input type="radio" id="usageType_MOBILE" name="usageType" value="MOBILE" 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="usageType_PAPER" name="usageType" value="PAPER">
|
|
<span class="radio-item">
|
|
<span class="radio-txt">지류</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
</td>
|
|
|
|
<th>전·겸업</th>
|
|
<td class="radio-group" colspan="3">
|
|
<div class="d-flex">
|
|
<div class="component-input">
|
|
<label class="radio-inner">
|
|
<input type="radio" id="EmploymentType_FULLTIME" name="employmentType" value="FULLTIME" checked>
|
|
<span class="radio-item">
|
|
<span class="radio-txt">1. 임업전업</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<div class="component-input">
|
|
<label class="radio-inner">
|
|
<input type="radio" id="EmploymentType_MAIN" name="employmentType" value="MAIN">
|
|
<span class="radio-item">
|
|
<span class="radio-txt">2. 임업주업</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<div class="component-input">
|
|
<label class="radio-inner">
|
|
<input type="radio" id="EmploymentType_PART" name="employmentType" value="PART">
|
|
<span class="radio-item">
|
|
<span class="radio-txt">3. 임업부업</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
</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">
|
|
const regionList = [[${regionSubList}]];
|
|
const industryLargeList = [[${industryLargeList}]];
|
|
|
|
$(document).ready(function () {
|
|
// 지역, 세부지역 셀렉트박스 세팅
|
|
setSelectBoxUiCode({
|
|
codeList: regionList,
|
|
parentSelector: '#regionSubCode',
|
|
childSelector: '#regionDetailCode'
|
|
});
|
|
|
|
// 업종 대분류, 중분류 셀렉트박스 세팅
|
|
setSelectBoxUiCode({
|
|
codeList: industryLargeList,
|
|
parentSelector: '#industryLargeCode',
|
|
childSelector: '#industryMiddleCode',
|
|
});
|
|
});
|
|
</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> |