245 lines
10 KiB
HTML
245 lines
10 KiB
HTML
<!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="reqResearcherForm">
|
|
<input name="page" value="0" type="hidden"/>
|
|
<input name="size" value="10" type="hidden">
|
|
|
|
<div class="component-modal mypage-wrap modal01" 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">
|
|
<section class="filter-wrap">
|
|
<div class="form-area">
|
|
<!-- 조사원 -->
|
|
<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="searchField" required>
|
|
<option value="" disabled hidden>선택해주세요.</option>
|
|
<option value="" selected>전체</option>
|
|
<option value="name">이름</option>
|
|
<option value="phone">전화번호</option>
|
|
</select>
|
|
</div>
|
|
<div class="component-input">
|
|
<div class="input-field">
|
|
<input type="text" id="searchField" name="searchValue" 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" id="regionMainCodeSelect" required>
|
|
<!-- ajax 호출 -->
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 버튼 그룹 -->
|
|
<div class="component-btns">
|
|
<div class="btns-row">
|
|
<button type="button" class="btn" onclick="goReset();">
|
|
<span class="btn-txt">초기화</span>
|
|
</button>
|
|
<button type="button" class="btn btn-primary" onclick="getResearchers(0);">
|
|
<span class="btn-txt">검색</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<p class="input-label" style="font-size: 16px;">총 <span id="researcherTotal">0</span>건</p>
|
|
<!-- 테이블 영역 -->
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
|
|
</th>
|
|
<th>조사원명</th>
|
|
<th>전화번호</th>
|
|
<th>실사</th>
|
|
<th>담당임가 수</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="researcherListTbody">
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- 페이지네이션 -->
|
|
<div class="row modal-paging"></div>
|
|
|
|
<div class="component-btns bottom-btn-group">
|
|
<div class="btns-row align-right">
|
|
<button type="button" class="btn btn-primary" onclick="setResearcher();">
|
|
<span class="btn-txt">등록</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
<button class="modal-close"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<script th:inline="javascript">
|
|
let researcherList = [];
|
|
|
|
const showResearcherModal = () => {
|
|
document.querySelector(".modal01").ui.open();
|
|
|
|
// 실사 공통코드 가져오기
|
|
ajaxUtil._ajaxMethod(
|
|
'/api/regionMainCodes',
|
|
{},
|
|
(response) => {
|
|
const select = document.getElementById('regionMainCodeSelect');
|
|
select.innerHTML = '<option value="" selected>전체</option>';
|
|
response.forEach(item => {
|
|
const option = document.createElement('option');
|
|
option.value = item.id;
|
|
option.textContent = item.codeText;
|
|
select.appendChild(option);
|
|
});
|
|
},
|
|
function (code, rstData) {
|
|
console.log("error : ", code);
|
|
},
|
|
'get',
|
|
'json'
|
|
);
|
|
|
|
getResearchers(document.reqResearcherForm.page.value);
|
|
}
|
|
|
|
// 조사원 리스트 가져오기
|
|
const getResearchers = (pageNo) => {
|
|
const f = document.reqResearcherForm;
|
|
f.page.value = pageNo;
|
|
|
|
let dataOj = $(f).serializeObject();
|
|
|
|
ajaxUtil._ajaxMethod(
|
|
'/api/popupResearchers',
|
|
dataOj,
|
|
function (response) {
|
|
$('#researcherTotal').text(response.totalElements);
|
|
|
|
researcherList = response.content;
|
|
|
|
// List 구성하기
|
|
const tbody = $('#researcherListTbody');
|
|
tbody.empty();
|
|
|
|
$(response.content).each((idx, ct) => {
|
|
tbody.append(
|
|
`
|
|
<tr>
|
|
<td>
|
|
<div class="component-input">
|
|
<label class="radio-inner">
|
|
<input type="radio" id="temp_radio_000${ct.adminSeq}" name="adminSeq" value="${ct.adminSeq}">
|
|
</label>
|
|
</div>
|
|
</td>
|
|
<td>${ct.name}</td>
|
|
<td>${ifNullHyphen(ct.phone)}</td>
|
|
<td>${ct.regionMainName}</td>
|
|
<td>${ct.householdCount}</td>
|
|
</tr>
|
|
`
|
|
);
|
|
});
|
|
|
|
if (!$(response.content).length) {
|
|
tbody.append(`
|
|
<tr>
|
|
<td colspan="5" class="text-center text-muted">조사원이 존재하지 않습니다.</td>
|
|
</tr>
|
|
`);
|
|
}
|
|
|
|
// Pagination 구성하기
|
|
const paging = $('.modal-paging');
|
|
paging.empty();
|
|
paging.append(
|
|
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
|
|
(movePageNo) => {
|
|
f.page.value = movePageNo;
|
|
getResearchers();
|
|
}));
|
|
|
|
},
|
|
function (code, rstData) {
|
|
|
|
},
|
|
'get',
|
|
'json',
|
|
null
|
|
);
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
const setResearcher = () => {
|
|
const selectedAdminSeq = $('input[name="adminSeq"]:checked').val();
|
|
|
|
if (!selectedAdminSeq) {
|
|
alert("조사원을 선택해주세요.");
|
|
return;
|
|
}
|
|
|
|
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
|
|
|
console.log("선택된 조사원 : ", selectedResearcher);
|
|
|
|
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
|
getSelectedResearcher(selectedResearcher, () => {
|
|
document.querySelector(".modal01").ui.close();
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
const goReset = () => {
|
|
const f = document.reqResearcherForm;
|
|
|
|
f.searchField.value = "";
|
|
f.searchValue.value = "";
|
|
f.regionMainCode.value = "";
|
|
|
|
getResearchers(0);
|
|
}
|
|
</script>
|
|
</div>
|
|
</html> |