129 lines
5.2 KiB
HTML
129 lines
5.2 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="tabFragment">
|
|
<div class="tab-content household-visit" data-tab-value="tab4">
|
|
<div class="content-inner">
|
|
<section class="table-group">
|
|
<div class="table-tit-group">
|
|
<h3></h3>
|
|
<div class="component-btns bottom-btn-group">
|
|
<div class="btns-row align-right">
|
|
<button type="button" class="btn small btn-secondary" onclick="goDeleteVisitInfo();">
|
|
<span class=" btn-txt">삭제</span>
|
|
</button>
|
|
<button type="button" class="btn small btn-primary" onclick="showVisitInfoModal();">
|
|
<span class="btn-txt">추가</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<table id="household-visit">
|
|
<thead>
|
|
<tr>
|
|
<th>선택</th>
|
|
<th>방문일</th>
|
|
<th>관리분야</th>
|
|
<th>내용</th>
|
|
<th>최종 수정자</th>
|
|
<th>답례품 전달</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<script th:inline="javascript">
|
|
// 임가방문정보 조회
|
|
const getVisitInfo = () => {
|
|
const f = document.reqForm;
|
|
|
|
ajaxUtil._ajaxMethod(
|
|
'/api/household/visitInfos',
|
|
{
|
|
householdSeq: f.householdSeq.value,
|
|
recordMonth: f.recordMonth.value
|
|
},
|
|
(response) => { // 성공
|
|
console.log("임가 방문정보 조회 : ", response);
|
|
const tbody = $('.tab-content.household-visit tbody');
|
|
|
|
tbody.empty();
|
|
|
|
if(response.length === 0) {
|
|
tbody.append(`<tr><td colspan="6" style="text-align: center;">등록이 필요합니다.</td></tr>`);
|
|
return;
|
|
}
|
|
|
|
let tmpl = '';
|
|
$(response).each((idx, item) => {
|
|
tmpl +=
|
|
`
|
|
<tr>
|
|
<td>
|
|
<div class="component-input">
|
|
<label class="checkbox-inner">
|
|
<input type="checkbox" id="removeIds_${item.id}" name="removeIds" value="${item.id}">
|
|
</label>
|
|
</div>
|
|
</td>
|
|
<td>${ifNullHyphen(item.visitDate)}</td> <!-- 방문일 -->
|
|
<td>${ifNullHyphen(managementType[item.managementType])}</td> <!-- 관리분야 -->
|
|
<td class="underline"><a href="javascript:void(0);" onclick="showVisitInfoModal(${item.id});">${ifNullHyphen(item.content)}</a></td> <!-- 내용 -->
|
|
<td>
|
|
${item.updatedBy}<br>
|
|
(${item.updatedAt})
|
|
</td><!-- 최종 수정자 -->
|
|
<td>${item.isGiftSent ? "전달 완료" : "미전달"}</td> <!-- 답례품 전달 -->
|
|
</tr>
|
|
`;
|
|
});
|
|
|
|
tbody.append(tmpl);
|
|
},
|
|
function (code, rstData) { // 실패
|
|
console.log("error : ", code);
|
|
},
|
|
'get',
|
|
'json'
|
|
);
|
|
}
|
|
|
|
// 임가방문정보 삭제
|
|
const goDeleteVisitInfo = () => {
|
|
const infoIds = $('input[name=removeIds]:checked');
|
|
if(infoIds.length <= 0) {
|
|
alert("임가방문정보를 선택해주세요.");
|
|
return
|
|
}
|
|
|
|
if(confirm("선택하신 내용을 삭제하시겠습니까? 삭제한 항목은 복구할 수 없습니다.")) {
|
|
const f = document.reqForm;
|
|
let dataOj = $(f).serializeObject();
|
|
|
|
console.log("dataOj", dataOj);
|
|
|
|
ajaxUtil._ajaxMethod(
|
|
'/api/visitInfo/remove',
|
|
JSON.stringify(dataOj),
|
|
(response) => { // 성공
|
|
alert("방문정보가 삭제되었습니다.");
|
|
getVisitInfo(0);
|
|
},
|
|
function (code, rstData) {
|
|
if(code == 422) alert(rstData.responseText);
|
|
},
|
|
'delete',
|
|
'json',
|
|
{ handle422Type: 'alert' }
|
|
);
|
|
}
|
|
}
|
|
</script>
|
|
</div>
|
|
</html> |