Merge branch 'susu' into dev
This commit is contained in:
@@ -148,8 +148,31 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="visitHouseholdDetail">
|
||||
select
|
||||
rhv.id,
|
||||
rhv.household_seq,
|
||||
rhv.visit_date,
|
||||
rhv.content,
|
||||
rhv.management_type,
|
||||
rhv.is_gift_sent as is_gift_sent_flag,
|
||||
rhv.created_at
|
||||
from household_visit rhv
|
||||
where rhv.is_deleted = false and rhv.id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="updateVisitHousehold">
|
||||
update household_visit
|
||||
set visit_date = #{visitDate},
|
||||
content = #{content},
|
||||
management_type = #{managementType},
|
||||
is_gift_sent = #{isGiftSent},
|
||||
<include refid="common.fields.UpdateBaseSet" />
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="visitHouseholdDelete">
|
||||
update researcher_household_visit
|
||||
update household_visit
|
||||
set is_deleted = true,
|
||||
deleted_at = NOW(),
|
||||
deleted_by = #{deletedBy}
|
||||
|
||||
@@ -7,27 +7,28 @@
|
||||
<form
|
||||
method="post"
|
||||
th:action="@{/settings/admins/create}"
|
||||
th:object="${bindingVO}">
|
||||
th:object="${bindingVO}"
|
||||
name="adminCreateForm">
|
||||
|
||||
<table class="type-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="d-flex">
|
||||
<div class="component-input">
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="roleIds"
|
||||
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||
th:field="*{roleIds}"
|
||||
<select class="select-list" id="roleId"
|
||||
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
|
||||
th:field="*{roleId}"
|
||||
onchange="onRoleChange(this);">
|
||||
<option value="">선택</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
||||
th:if="${#fields.hasErrors('roleIds')}">
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
|
||||
th:if="${#fields.hasErrors('roleId')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,13 +41,18 @@
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="id"
|
||||
name="id"
|
||||
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||
th:field="*{id}"/>
|
||||
<button type="button" class="btn btn-primary" onclick="adminIdCheckDuplicate();">
|
||||
<span class="btn-txt">중복확인</span>
|
||||
</button>
|
||||
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
||||
th:if="${#fields.hasErrors('id')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
@@ -61,11 +67,51 @@
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${bindingVO.roleId == 'ROLE_LOCAL_INSPECTOR'} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="name" type="text" name="name"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
th:field="*{name}"/>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('name')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
010-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone1" name="phone1" type="number" maxlength="4" th:field="*{phone1}"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone2" name="phone2" type="number" maxlength="4" th:field="*{phone2}"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone1')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
@@ -118,7 +164,7 @@
|
||||
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
||||
<span class="btn-txt">목록으로 이동</span>
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" onclick="createAdmin();">
|
||||
<span class="btn-txt">저장</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -137,14 +183,71 @@
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
const roleSelect = document.getElementById('roleIds');
|
||||
const roleSelect = document.getElementById('roleId');
|
||||
onRoleChange(roleSelect);
|
||||
|
||||
});
|
||||
const onRoleChange = (el) => {
|
||||
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
|
||||
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
|
||||
const idResearcher = !selectedValues.length || selectedValues.includes('ROLE_RESEARCHER');
|
||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
let checkDuplicate = false;
|
||||
|
||||
const adminIdCheckDuplicate = () => {
|
||||
const f = document.adminCreateForm;
|
||||
if (!f.id.value) {
|
||||
alert("아이디를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/idCheck',
|
||||
{ id : f.id.value },
|
||||
function(response) { // 성공
|
||||
const message = response > 0
|
||||
? "이미 사용하고 있는 아이디 입니다. 아이디를 입력해주세요."
|
||||
: "사용 가능한 아이디입니다.";
|
||||
alert(message);
|
||||
checkDuplicate = response <= 0;
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
if(code == 400) alert("아이디를 입력해주세요.");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
const createAdmin = () => {
|
||||
if (!checkDuplicate) {
|
||||
alert("아이디 중복 확인을 해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const f = document.adminCreateForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/settings/admin/create',
|
||||
JSON.stringify(dataOj),
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 200 ){
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
},
|
||||
'post',
|
||||
'json'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -17,14 +17,26 @@
|
||||
<div class="form-area">
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt"><label for="searchField">검색필드</label></p>
|
||||
<p class="label-txt">권한</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||
th:value="${role.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt"><label for="searchField">정보</label></p>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchField" th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option selected value="">전체</option>
|
||||
<option value="id">ID</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="name">이름</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
@@ -38,13 +50,25 @@
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">권한</p>
|
||||
<p class="label-txt">실사</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchRole" th:field="*{searchRole}">
|
||||
<select class="select-list" id="searchArea" th:field="*{searchArea}">
|
||||
<option selected value="">전체</option>
|
||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||
th:value="${role.id}"></option>
|
||||
<option th:each="region : ${regionMainCode}" th:text="${region.codeText}"
|
||||
th:value="${region.id}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">계정사용여부</p>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="searchDisabled" th:field="*{searchDisabled}">
|
||||
<option selected value="">전체</option>
|
||||
<option value="false">사용</option>
|
||||
<option value="true">미사용</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,11 +147,11 @@
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
<!-- <script th:inline="javascript">
|
||||
// 목록 정렬 표기 및 갱신 기능 적용
|
||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||
[[${listOutput.pageable.sort.toString()}]]);
|
||||
</script>
|
||||
</script>-->
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
@@ -146,6 +170,8 @@
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchRole.value = '';
|
||||
f.searchArea.value = '';
|
||||
f.searchDisabled.value = '';
|
||||
}
|
||||
|
||||
// 수정페이지 이동
|
||||
|
||||
@@ -57,6 +57,47 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="name" type="text" name="name"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
th:field="*{name}"/>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('name')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
010-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone1" name="phone1" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(3, 7) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone2" name="phone2" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(7, 11) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
@@ -137,12 +178,7 @@
|
||||
<th:block layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
function gotoList() {
|
||||
if (document.prevAdminParamForm) {
|
||||
const f = document.prevAdminParamForm;
|
||||
f.submit();
|
||||
} else {
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
@@ -156,12 +192,26 @@
|
||||
if (roleSelect) {
|
||||
onRoleChange(roleSelect);
|
||||
}
|
||||
|
||||
$('form').on('submit', function() {
|
||||
const phone1 = $('#phone1').val();
|
||||
const phone2 = $('#phone2').val();
|
||||
if (phone1 && phone2) {
|
||||
$('#phone').val('010' + phone1 + phone2);
|
||||
} else {
|
||||
$('#phone').val('');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
const onRoleChange = (el) => {
|
||||
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
|
||||
const idResearcher = el.value === 'ROLE_RESEARCHER' || !el.value;
|
||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
};
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHouseholdList',
|
||||
'/api/researcher/visitHousehold/list',
|
||||
dataObj,
|
||||
function (response) {
|
||||
$('#household-visit-totalElements').text(response.totalElements);
|
||||
@@ -268,10 +268,10 @@
|
||||
<tr data-id="${ct.id}">
|
||||
<td>
|
||||
<label>
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.seq});">${ct.householdNum}</a></td>
|
||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||
<td>${ct.ownerName}</td>
|
||||
<td>${ct.visitDate}</td>
|
||||
<td>${ct.managementType}</td>
|
||||
|
||||
@@ -13,56 +13,63 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<section>
|
||||
<table class="type-form confirm" th:object="${researcherDto}" >
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>방문일</th>
|
||||
<td>
|
||||
<span th:text="*{id}"></span>
|
||||
</td>
|
||||
<th>관리분야</th>
|
||||
<td>
|
||||
<span th:text="*{name}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</th>
|
||||
<td>
|
||||
<span th:text="*{regionMainCodeName}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>답례품 전달</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="radio_status_keep" name="survey_status">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="radio_status_drop" name="survey_status">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<form autocomplete="off" method="get" name="householdVisitReqForm" >
|
||||
<input type="hidden" name="id" id="id" />
|
||||
<table class="type-form confirm" >
|
||||
<tbody id="household-visit-detail">
|
||||
<tr>
|
||||
<th>방문일</th>
|
||||
<td>
|
||||
<input id="visitDate" class="flatpickr" name="visitDate" type="text" placeholder="방문일을 선택하세요"/>
|
||||
</td>
|
||||
<th>관리분야</th>
|
||||
<td>
|
||||
<select id="managementType" name="managementType">
|
||||
<option value="">선택하세요</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-textarea-field">
|
||||
<textarea id="content" name="content" class="textarea" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>답례품 전달</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_y" name="isGiftSent">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="is_gift_sent_n" name="isGiftSent">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">미전달</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 등록 버튼 -->
|
||||
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="registerHouseholds()">
|
||||
<span class="btn-txt">등록</span>
|
||||
<button type="button" class="btn btn-primary" onclick="updateHouseholdVisit()">
|
||||
<span class="btn-txt">수정</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close" onclick="closeModal()"></button>
|
||||
@@ -70,17 +77,131 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
let visitDatePicker;
|
||||
|
||||
<script th:inline="javascript">
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
console.log(seq);
|
||||
document.querySelector(".modal02").ui.open();
|
||||
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||
console.log("날짜 변경됨:", e.target.value);
|
||||
});
|
||||
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
document.querySelector(".modal02").ui.open();
|
||||
initFlatpickr();
|
||||
|
||||
};
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold/'+seq,
|
||||
null,
|
||||
function (response) {
|
||||
const managementTypeList =response.managementTypeList;
|
||||
if (managementTypeList.length > 0) {
|
||||
// select 박스에 managementTypeList 옵션 추가
|
||||
populateManagementType(managementTypeList);
|
||||
}
|
||||
const data = response.researchersHouseholdVisitDto;
|
||||
setFormData(data);
|
||||
},
|
||||
function (code, rstData) {
|
||||
},
|
||||
'get',
|
||||
'json',
|
||||
null
|
||||
);
|
||||
};
|
||||
|
||||
const setFormData = (data) => {
|
||||
// 폼 필드에 데이터 세팅
|
||||
const f = document.householdVisitReqForm;
|
||||
if (data.visitDate) {
|
||||
const visitDate = data.visitDate.substring(0, 10); // 'YYYY-MM-DD' 형식
|
||||
if (visitDatePicker) {
|
||||
f.visitDate.value = visitDate; // 입력 필드 먼저 설정
|
||||
visitDatePicker.setDate(visitDate); // Flatpickr 동기화
|
||||
}
|
||||
}
|
||||
if (data.managementType) {
|
||||
f.managementType.value= data.managementType;
|
||||
}
|
||||
f.content.value = data.content;
|
||||
f.id.value = data.id;
|
||||
const isGift = data.isGiftSentFlag;
|
||||
if (isGift === "t") {
|
||||
document.getElementById('is_gift_sent_y').checked = true;
|
||||
} else if (isGift === "f") {
|
||||
document.getElementById('is_gift_sent_n').checked = true;
|
||||
}
|
||||
};
|
||||
|
||||
const populateManagementType = (managementTypeList) => {
|
||||
const select = document.getElementById('managementType');
|
||||
select.innerHTML = '<option value="">선택하세요</option>'; // 초기화
|
||||
managementTypeList.forEach(item => {
|
||||
const option = document.createElement('option');
|
||||
option.value = item.id;
|
||||
option.textContent = item.codeText;
|
||||
select.appendChild(option);
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
const initFlatpickr = () => {
|
||||
// 기존 Flatpickr 인스턴스 제거
|
||||
if (visitDatePicker) {
|
||||
visitDatePicker.destroy();
|
||||
visitDatePicker = null;
|
||||
}
|
||||
|
||||
// 1. input 요소가 실제로 존재하는지 확인
|
||||
const input = document.getElementById('visitDate');
|
||||
if (!input) {
|
||||
console.warn('#visitDate input not found!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. input에 값이 있으면 flatpickr와 동기화
|
||||
const currentVal = input.value;
|
||||
|
||||
// 3. flatpickr 초기화
|
||||
visitDatePicker = flatpickr(input, {
|
||||
dateFormat: 'Y-m-d',
|
||||
defaultDate: currentVal || null, // 현재 값으로 초기 선택 날짜 설정
|
||||
enableTime: false,
|
||||
clickOpens: true,
|
||||
onChange: function (selectedDates, dateStr, instance) {
|
||||
console.log('날짜 선택됨:', dateStr);
|
||||
input.value = dateStr; // 수동으로 input 값 동기화
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const updateHouseholdVisit = () => {
|
||||
const form = document.forms['householdVisitReqForm'];
|
||||
const formData = new FormData(form);
|
||||
const data = Object.fromEntries(formData);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold',
|
||||
JSON.stringify(data),
|
||||
function (response) {
|
||||
alert('수정 완료되었습니다.');
|
||||
closeModal();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.error('Error updating data:', code, rstData);
|
||||
alert('수정에 실패했습니다.');
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{'Content-Type': 'application/json'}
|
||||
);
|
||||
};
|
||||
const closeModal = () => {
|
||||
document.querySelector(".modal02").ui.close();
|
||||
if (visitDatePicker) {
|
||||
visitDatePicker.destroy();
|
||||
visitDatePicker = null;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
</div>
|
||||
</html>
|
||||
Reference in New Issue
Block a user