워커 수정
This commit is contained in:
@@ -7,7 +7,7 @@ var sortable = null; // Sortable 인스턴스
|
||||
|
||||
$(function () {
|
||||
|
||||
trade_type_onchange();
|
||||
// trade_type_onchange();
|
||||
|
||||
if (isDefined(window.rcpt_hscp_nm)) {
|
||||
$(".spc").hide();
|
||||
@@ -846,32 +846,67 @@ function savePropertyImageOrder() {
|
||||
});
|
||||
}
|
||||
|
||||
function trade_type_onchange() {
|
||||
var trade_type = $('#trade_type').val();
|
||||
if (trade_type == 'B2' || trade_type == 'B3') {
|
||||
// 월세...
|
||||
$('#div_trade_type_price_monthly').show();
|
||||
} else {
|
||||
$('#div_trade_type_price_monthly').hide();
|
||||
}
|
||||
function editPriceInfo() {
|
||||
// 1. 이미 내가 풀어서 '도장'이 찍힌 요소가 있는지 확인 (이미 수정 모드인지 체크)
|
||||
const $manuallyOpened = $('#rcptFrm').find('[data-was-disabled="true"]');
|
||||
|
||||
if ($manuallyOpened.length > 0) {
|
||||
// --- [다시 잠그기 모드] ---
|
||||
$manuallyOpened.prop("disabled", true).removeAttr("data-was-disabled");
|
||||
console.log("임시로 풀었던 필드들을 다시 잠갔습니다.");
|
||||
} else {
|
||||
// --- [잠금 풀기 모드] ---
|
||||
// 2. 풀 대상들을 모읍니다. (기존 로직 포함)
|
||||
let targets = [
|
||||
"#trade_type",
|
||||
"#rcpt_product_info2",
|
||||
"#rcpt_product_info3",
|
||||
".display-price-input" // 클래스 대상 추가
|
||||
];
|
||||
|
||||
var rcpt_product = $('#rcpt_product').val();
|
||||
var trade_type = $('#trade_type').val();
|
||||
|
||||
if (trade_type == "A1") {
|
||||
if (['A01', 'A02', 'A03', 'B01', 'B02', 'B03'].includes(rcpt_product)) {
|
||||
targets.push("#rcpt_product_info4", "#rcpt_product_info5", "#rcpt_product_info6");
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 대상들 중에서 '현재 잠겨있는 것만' 골라서 도장 찍고 풀기
|
||||
const $targetElements = $(targets.join(', '));
|
||||
const $toOpen = $targetElements.filter(':disabled');
|
||||
|
||||
$toOpen.attr('data-was-disabled', 'true').prop('disabled', false);
|
||||
|
||||
console.log($toOpen.length + "개의 필드를 수정 가능하게 풀었습니다.");
|
||||
if($toOpen.length > 0) $toOpen.first().focus();
|
||||
}
|
||||
}
|
||||
|
||||
// 가격수정 btn
|
||||
function editPriceInfo() {
|
||||
var rcpt_product = $('#rcpt_product').val();
|
||||
var trade_type = $('#trade_type').val();
|
||||
// 수정 버튼 클릭 시 정보 수정 가능하도록
|
||||
function editInfo() {
|
||||
const $form = $('#rcptFrm');
|
||||
|
||||
// 1. 이미 내가 풀어서 '도장(data-was-disabled)'이 찍힌 요소가 있는지 확인
|
||||
const $manuallyOpened = $form.find('[data-was-disabled="true"]');
|
||||
|
||||
$("#trade_type").prop("disabled", false);
|
||||
if ($manuallyOpened.length > 0) {
|
||||
// [다시 잠그기]
|
||||
// 도장이 찍힌 놈들만 다시 잠그고 도장을 지웁니다.
|
||||
$manuallyOpened.prop('disabled', true).removeAttr('data-was-disabled');
|
||||
console.log("임시로 풀었던 요소들을 다시 잠갔습니다.");
|
||||
} else {
|
||||
// [잠금 풀기]
|
||||
// 현재 disabled 상태인 요소들만 찾아서 도장을 찍고 풀어줍니다.
|
||||
const $toOpen = $form.find('input:disabled, select:disabled');
|
||||
|
||||
$("#rcpt_product_info2").prop("disabled", false);
|
||||
$("#rcpt_product_info3").prop("disabled", false);
|
||||
|
||||
if (trade_type == "A1") {
|
||||
if (rcpt_product == 'A01' || rcpt_product == 'A02' || rcpt_product == 'A03' || rcpt_product == 'B01' || rcpt_product == 'B02' || rcpt_product == 'B03') {
|
||||
$("#rcpt_product_info4").prop("disabled", false);
|
||||
$("#rcpt_product_info5").prop("disabled", false);
|
||||
if ($toOpen.length > 0) {
|
||||
$toOpen.attr('data-was-disabled', 'true').prop('disabled', false);
|
||||
$toOpen.first().focus();
|
||||
console.log("잠겨있던 요소들을 수정 가능하게 풀었습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 가격수정 저장
|
||||
@@ -897,23 +932,50 @@ function modifyPriceInfo(btn) {
|
||||
cancelButtonColor: "#d33",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Display input에서 수정된 값 읽기
|
||||
var dealAmount = $("#displayDealAmount").val() || 0;
|
||||
var warrantyAmount = $("#displayWarrantyAmount").val() || 0;
|
||||
var leaseAmount = $("#displayLeaseAmount").val() || 0;
|
||||
var preSaleAmount = $("#displayPresaleAmount").val() || 0;
|
||||
var premiumAmount = $("#displayPremiumAmount").val() || 0;
|
||||
var preSaleOptionAmount = $("#displayOptionAmount").val() || 0;
|
||||
|
||||
// Hidden input에 값 동기화
|
||||
$("#dealAmount").val(dealAmount);
|
||||
$("#warrantyAmount").val(warrantyAmount);
|
||||
$("#leaseAmount").val(leaseAmount);
|
||||
$("#preSaleAmount").val(preSaleAmount);
|
||||
$("#premiumAmount").val(premiumAmount);
|
||||
$("#preSaleOptionAmount").val(preSaleOptionAmount);
|
||||
|
||||
var params = {
|
||||
'rcpt_sq': window.rcpt_sq,
|
||||
'rcpt_key': $("#rcpt_key").val(),
|
||||
'rcpt_no': $("#rcpt_atclno").val(),
|
||||
'rcpt_sq': $("#rcptFrm [name=rcpt_sq]").val() || $("input[name=rcpt_sq]").val(),
|
||||
'rcpt_key': $("#rcptFrm [name=rcpt_key]").val(),
|
||||
'rcpt_atclno': $("#rcptFrm [name=rcpt_atclno]").val(),
|
||||
'trade_type': tradeType,
|
||||
'rcpt_product_info2': $("#rcpt_product_info2").val(),
|
||||
'rcpt_product_info3': $("#rcpt_product_info3").val(),
|
||||
'rcpt_product_info4': $("#rcpt_product_info4").val(),
|
||||
'rcpt_product_info5': $("#rcpt_product_info5").val(),
|
||||
'rcpt_product_info6': $("#rcpt_product_info6").val(),
|
||||
'dealAmount': dealAmount,
|
||||
'warrantyAmount': warrantyAmount,
|
||||
'leaseAmount': leaseAmount,
|
||||
'preSaleAmount': preSaleAmount,
|
||||
'premiumAmount': premiumAmount,
|
||||
'preSaleOptionAmount': preSaleOptionAmount,
|
||||
'rcpt_ptp_no': $("#rcpt_ptp_no").val(),
|
||||
'agent_tel': $("#agent_tel").val(),
|
||||
'rcpt_hscp_no': $(btn).data('hscp_no'),
|
||||
'rcpt_ptp_no': $(btn).data('ptp_no'),
|
||||
};
|
||||
|
||||
console.log( params );
|
||||
// callAjax("/article/receipt/modifyPriceInfo", params, fn_result);
|
||||
callAjax("/article/receipt/modifyPriceInfo", params, fn_result);
|
||||
|
||||
// 저장 완료 후 display input 다시 비활성화
|
||||
$(".display-price-input").prop("disabled", true);
|
||||
$(".btn-edit").show();
|
||||
$(".btn-save").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -931,7 +993,7 @@ function fn_save_tel() {
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
var params = {
|
||||
'rcpt_sq': window.rcpt_sq,
|
||||
'rcpt_sq': $("#rcptFrm [name=rcpt_sq]").val() || $("input[name=rcpt_sq]").val(),
|
||||
'agent_tel': $("#agent_tel").val(),
|
||||
};
|
||||
|
||||
@@ -2161,6 +2223,97 @@ function loadExistingImages(imgType, imgSubType) {
|
||||
});
|
||||
}
|
||||
|
||||
// 단지 목록 가져오기
|
||||
function loadComplexList() {
|
||||
console.log('[loadComplexList] 단지 목록 로드 시작');
|
||||
|
||||
var legalDivisionNumber = $('input[name="rcpt_dong"]').val() ?? '';
|
||||
console.log('[loadComplexList] legalDivisionNumber:', legalDivisionNumber);
|
||||
var realEstateType = $('input[name="rcpt_product"]').val() ?? '';
|
||||
|
||||
// 값이 없을때
|
||||
if ( legalDivisionNumber == '' ) return;
|
||||
|
||||
let sendData = {
|
||||
legalDivisionNumber: legalDivisionNumber,
|
||||
};
|
||||
|
||||
if (realEstateType) {
|
||||
sendData.realEstateType = realEstateType;
|
||||
}
|
||||
|
||||
console.log('[loadComplexList] 요청 데이터:', sendData);
|
||||
|
||||
$.ajax({
|
||||
url: '/common/getComplexList',
|
||||
method: 'GET',
|
||||
data : sendData,
|
||||
success: function(result) {
|
||||
console.log('[loadComplexList] 응답:', result);
|
||||
|
||||
if (result.code === 'success' && result.data) {
|
||||
var options = '<option value="">단지 선택</option>';
|
||||
|
||||
result.data.forEach(function(complex) {
|
||||
options += '<option value="' + complex.complexNumber + '">' + complex.name + '</option>';
|
||||
});
|
||||
|
||||
$('#rcpt_hscp_nm').html(options);
|
||||
|
||||
// 현재 선택된 단지가 있으면 선택
|
||||
var currentHscpNo = $('input[name="rcpt_hscp_no"]').val();
|
||||
if (currentHscpNo) {
|
||||
$('#rcpt_hscp_nm').val(currentHscpNo);
|
||||
// 평형 정보도 로드
|
||||
// loadPyeongInfo(currentHscpNo);
|
||||
}
|
||||
|
||||
console.log('[loadComplexList] 단지 목록 로드 완료, 개수:', result.data.length);
|
||||
} else {
|
||||
console.warn('[loadComplexList] 단지 목록 응답이 올바르지 않습니다:', result);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('[loadComplexList] 단지 목록 요청 실패:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadPyeongInfo() {
|
||||
|
||||
var currentHscpNo = $('input[name="rcpt_hscp_no"]').val();
|
||||
var currentPtpNo = $('input[name="rcpt_ptp_no"]').val();
|
||||
var realEstateType = $('input[name="rcpt_product"]').val() ?? '';
|
||||
console.log('[loadPyeongInfo] 평형 정보 로드 시작, hscpNo:', currentHscpNo);
|
||||
$.ajax({
|
||||
url: '/common/getPyeongInfo',
|
||||
method: 'GET',
|
||||
data: { complexNumber: currentHscpNo, realEstateType: realEstateType },
|
||||
success: function(result) {
|
||||
console.log('[loadPyeongInfo] 응답:', result);
|
||||
if (result.code === 'success' && result.data) {
|
||||
var options = '<option value="">평형 선택</option>';
|
||||
result.data.forEach(function(pyeong) {
|
||||
|
||||
options += '<option value="' + pyeong.pyeongTypeNumber + '">' + pyeong.pyeongTypeName + '</option>';
|
||||
});
|
||||
|
||||
$('#rcpt_ptp_nm').html(options);
|
||||
if (currentPtpNo) {
|
||||
$('#rcpt_ptp_nm').val(currentPtpNo);
|
||||
}
|
||||
console.log('[loadPyeongInfo] 평형 정보 로드 완료, 개수:', result.data.length);
|
||||
} else {
|
||||
console.warn('[loadPyeongInfo] 평형 정보 응답이 올바르지 않습니다:', result);
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
console.error('[loadPyeongInfo] 평형 정보 요청 실패:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 파일업로드 모달 오픈
|
||||
function viewFilePop(imgType, imgSubType) {
|
||||
console.log('[viewFilePop] 호출:', imgType, imgSubType);
|
||||
@@ -2178,6 +2331,8 @@ function viewFilePop(imgType, imgSubType) {
|
||||
$("#uploadModal").modal("show");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 모달 닫힘 이벤트 처리
|
||||
$(document).ready(function() {
|
||||
// 중복 등록 방지를 위해 기존 핸들러 제거 후 재등록
|
||||
@@ -2232,4 +2387,18 @@ $(document).ready(function() {
|
||||
} else {
|
||||
console.warn('[PageLoad] rsrv_sq가 없어서 이미지를 불러올 수 없습니다.');
|
||||
}
|
||||
|
||||
// ========== 단지 목록 불러오기 ==========
|
||||
// 페이지 로드 시 단지 목록을 가져와서 select 박스 채우기
|
||||
loadComplexList();
|
||||
// 평형 목록 불러 오기
|
||||
loadPyeongInfo();
|
||||
|
||||
$(document).on('change', '#rcpt_hscp_nm', function() {
|
||||
const selectedHscpNo = $(this).val();
|
||||
console.log('[ComplexSelect] 단지 선택 변경, hscp_no:', selectedHscpNo);
|
||||
$('input[name="rcpt_hscp_no"]').val(selectedHscpNo);
|
||||
loadPyeongInfo();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user