Merge branch 'susu' into dev
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
<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">
|
||||
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
|
||||
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
<section class="filter-wrap">
|
||||
<div class="form-area">
|
||||
<input type="hidden" name="page" th:field="*{reqVO.page}"/>
|
||||
<input type="hidden" name="researcherSeq" id="researcherSeq" th:value="${researcherSeq}">
|
||||
<input type="hidden" name="regionMainCode" th:value="${regionMainCode}">
|
||||
@@ -89,54 +89,55 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn" onclick="resetSearchForm()">
|
||||
<span class="btn-txt">초기화</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" th:onclick="|searchHouseholdList(0,${regionMainCode})|">
|
||||
<span class="btn-txt">검색</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="input-label" style="font-size: 16px;">
|
||||
총 <span id="mappingHouseholdTotalElements"></span>건
|
||||
</p>
|
||||
<table id="householdTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>임가번호</th>
|
||||
<th>경영주명</th>
|
||||
<th>휴대폰번호</th>
|
||||
<th>실사</th>
|
||||
<th>지역</th>
|
||||
<th>세부지역</th>
|
||||
<th>조사원</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="mappingHousehold-list"></tbody>
|
||||
</table>
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="row paging"></div>
|
||||
|
||||
<!-- 등록 버튼 -->
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn" onclick="resetSearchForm()">
|
||||
<span class="btn-txt">초기화</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" th:onclick="|searchHouseholdList(0,${regionMainCode})|">
|
||||
<span class="btn-txt">검색</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p class="input-label" style="font-size: 16px;">
|
||||
총 <span id="mappingHouseholdTotalElements"></span>건
|
||||
</p>
|
||||
<table id="householdTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>선택</th>
|
||||
<th>임가번호</th>
|
||||
<th>경영주명</th>
|
||||
<th>휴대폰번호</th>
|
||||
<th>실사</th>
|
||||
<th>지역</th>
|
||||
<th>세부지역</th>
|
||||
<th>조사원</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="mappingHousehold-list"></tbody>
|
||||
</table>
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="row paging"></div>
|
||||
|
||||
<!-- 등록 버튼 -->
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<button class="modal-close"></button>
|
||||
</div>
|
||||
<button class="modal-close"></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-id="${ct.seq}">
|
||||
<td class="underline"><a href="">${ct.householdNum}</a></td>
|
||||
<td><a href="#">${ct.householdNum}</a></td>
|
||||
<td>${ct.ownerName || '-'}</td>
|
||||
<td>${ct.phone || '-'}</td>
|
||||
<td>${ct.regionMainCodeName || '-'}</td>
|
||||
@@ -271,7 +271,7 @@
|
||||
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="underline"><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||
<td><a href="#" onclick="showHouseholdModal2(${ct.id});">${ct.householdNum}</a></td>
|
||||
<td>${ct.ownerName}</td>
|
||||
<td>${ct.visitDate}</td>
|
||||
<td>${ct.managementType}</td>
|
||||
|
||||
@@ -15,71 +15,75 @@
|
||||
<section>
|
||||
<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>
|
||||
<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">
|
||||
<table class="type-form confirm" >
|
||||
<tbody id="household-visit-detail">
|
||||
<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>
|
||||
</div>
|
||||
</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>
|
||||
</td>
|
||||
<th>관리분야</th>
|
||||
<td>
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select id="managementType" name="managementType" class="select-list" required>
|
||||
<option value="">선택하세요</option>
|
||||
</select>
|
||||
</div>
|
||||
</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="updateHouseholdVisit()">
|
||||
<span class="btn-txt">수정</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</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="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="updateHouseholdVisit()">
|
||||
<span class="btn-txt">수정</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
@@ -97,8 +101,22 @@
|
||||
});
|
||||
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
document.querySelector(".modal02").ui.open();
|
||||
//initFlatpickr();
|
||||
const modal = document.querySelector(".modal02");
|
||||
modal.ui.open();
|
||||
const $el = document.querySelector('.component-datepicker');
|
||||
const datepicker = etUI.components.DatepickerComp();
|
||||
datepicker.core.init($el, {
|
||||
dateSelectCallback: function (selectedDate) {
|
||||
console.log('선택된 날짜:', selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
datepickerInstance = datepicker.getDatepickerInstance();
|
||||
|
||||
// 초기 상태 오늘 날짜로
|
||||
if (datepickerInstance) {
|
||||
datepickerInstance.setDate(new Date(), { render: true });
|
||||
}
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/researcher/visitHousehold/'+seq,
|
||||
@@ -123,13 +141,15 @@
|
||||
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 (datepickerInstance && data.visitDate) {
|
||||
|
||||
console.log(data.visitDate);
|
||||
console.log(new Date(data.visitDate));
|
||||
|
||||
datepickerInstance.setDate(new Date(data.visitDate), { render: true });
|
||||
}
|
||||
|
||||
if (data.managementType) {
|
||||
f.managementType.value= data.managementType;
|
||||
}
|
||||
@@ -161,27 +181,48 @@
|
||||
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 값 동기화
|
||||
},
|
||||
});
|
||||
// Flatpickr 초기화
|
||||
try {
|
||||
visitDatePicker = flatpickr(input, {
|
||||
dateFormat: 'Y-m-d',
|
||||
defaultDate: currentVal || null,
|
||||
enableTime: false,
|
||||
clickOpens: true,
|
||||
onReady: function () {
|
||||
console.log('Flatpickr 초기화 완료');
|
||||
},
|
||||
onChange: function (selectedDates, dateStr, instance) {
|
||||
console.log('날짜 선택됨:', dateStr);
|
||||
input.value = dateStr; // 입력 필드 동기화
|
||||
},
|
||||
onOpen: function () {
|
||||
console.log('Flatpickr 캘린더 열림');
|
||||
},
|
||||
onClose: function () {
|
||||
console.log('Flatpickr 캘린더 닫힘');
|
||||
}
|
||||
});
|
||||
|
||||
// 입력 필드 클릭 이벤트 추가 (보조)
|
||||
input.addEventListener('click', () => {
|
||||
console.log('visitDate 입력 필드 클릭됨');
|
||||
if (visitDatePicker) {
|
||||
visitDatePicker.open(); // 수동으로 캘린더 열기
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Flatpickr 초기화 실패:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const updateHouseholdVisit = () => {
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
tbody.append(
|
||||
`
|
||||
<tr data-id="${ct.id}">
|
||||
<td class="underline"><a href="javascript:goDetail(${ct.seq})">${ct.name || '-'}</a></td>
|
||||
<td><a href="javascript:goDetail(${ct.seq})">${ct.name || '-'}</a></td>
|
||||
<td>${ct.phone || '-'}</td>
|
||||
<td>${ct.regionMainCodeName || '-'}</td>
|
||||
<td>${ct.householdCount || '-'}</td>
|
||||
|
||||
Reference in New Issue
Block a user