// 검색 실행 시 지역 파라미터 추가 function executeSearch() { const params = []; // 검증 여부 const verified = document.getElementById('verified').checked; if (verified) params.push('verified=1'); // 학력 const education = document.getElementById('education').value; if (education) params.push(`education=${encodeURIComponent(education)}`); // 수업방식 const teachingMethod = document.getElementById('teaching_method').value; if (teachingMethod) params.push(`teaching_method=${encodeURIComponent(teachingMethod)}`); // 나이 범위 const ageMin = document.getElementById('age_min').value; const ageMax = document.getElementById('age_max').value; if (ageMin || ageMax) { params.push(`age_min=${ageMin}`); params.push(`age_max=${ageMax}`); } // 지역 if (selectedRegions.length > 0) { params.push(`regions=${encodeURIComponent(selectedRegions.join(','))}`); } // 구/군 if (selectedDistricts.length > 0) { params.push(`districts=${encodeURIComponent(selectedDistricts.join(','))}`); } // 경력 const expMin = document.getElementById('exp_min').value; const expMax = document.getElementById('exp_max').value; if (expMin || expMax) { params.push(`exp_min=${expMin}`); params.push(`exp_max=${expMax}`); } // 성별 const gender = document.getElementById('gender').value; if (gender) params.push(`gender=${encodeURIComponent(gender)}`); // 최근 접속 const lastLogin = document.getElementById('last_login').value; if (lastLogin) params.push(`last_login=${encodeURIComponent(lastLogin)}`); // 수업비 const costMin = document.getElementById('cost_min').value; const costMax = document.getElementById('cost_max').value; if (costMin || costMax) { params.push(`cost_min=${costMin}`); params.push(`cost_max=${costMax}`); } // 과목 if (selectedSubjects.length > 0) { params.push(`subjects=${encodeURIComponent(selectedSubjects.join(','))}`); } // 검색어 const searchKeyword = document.getElementById('search_keyword').value; if (searchKeyword) params.push(`search_keyword=${encodeURIComponent(searchKeyword)}`); // URL 생성 및 이동 const baseUrl = g5_bbs_url + '/board.php?bo_table=' + bo_table; const finalUrl = params.length > 0 ? `${baseUrl}&${params.join('&')}` : baseUrl; window.location.href = finalUrl; } // 교습과목 모달 관련 변수 window.selectedSubjects = window.selectedSubjects || []; // 교습과목 모달 열기 function openSubjectModal() { $('#subject-modal').show(); } // 교습과목 모달 닫기 if ($('.close').length) { $('.close').click(function() { $('#subject-modal').hide(); }); } // 모달 외부 클릭시 닫기 if ($(window).length) { $(window).click(function(e) { if ($(e.target).hasClass('modal')) { $('.modal').hide(); } }); } // 체크박스 이벤트 if ($('.subject-checkbox').length) { $('.subject-checkbox').change(function() { if (this.checked) { if (selectedSubjects.length >= 10) { alert('최대 10개까지만 선택할 수 있습니다.'); this.checked = false; return; } selectedSubjects.push(this.value); } else { selectedSubjects = selectedSubjects.filter(subject => subject !== this.value); } updateSubjectDisplay(); }); } // 선택된 항목 표시 업데이트 function updateSubjectDisplay() { $('#selected-count').text(selectedSubjects.length); const container = $('#selected-subjects'); container.empty(); selectedSubjects.forEach(subject => { container.append(` ${subject} × `); }); // 입력 필드에 값 설정 $('#subject-input').val(selectedSubjects.join(',')); } // 선택 항목 제거 if ($(document).length) { $(document).on('click', '.remove-tag', function() { const subject = $(this).data('subject'); selectedSubjects = selectedSubjects.filter(s => s !== subject); updateSubjectDisplay(); $(`input[value="${subject}"]`).prop('checked', false); }); } // 적용하기 버튼 if ($('#apply-subjects').length) { $('#apply-subjects').click(function() { // 검색 모달의 과목 입력란에 선택된 과목들을 설정 $('#stx').val(selectedSubjects.join(', ')); $('#sfl').val('subject'); // 검색 필드를 과목으로 설정 // 선택된 과목들을 selected_subjects 영역에 표시 const selectedSubjectsContainer = $('#selected_subjects'); if (selectedSubjectsContainer.length) selectedSubjectsContainer.empty(); selectedSubjects.forEach(subject => { if (selectedSubjectsContainer.length) { selectedSubjectsContainer.append(`
${subject} ×
`); } }); $('#subject-modal').hide(); }); } // 선택된 과목 제거 함수 function removeSelectedSubject(subject) { // 선택된 과목 배열에서 제거 selectedSubjects = selectedSubjects.filter(s => s !== subject); // 검색 모달의 selected_subjects 영역에서 해당 과목 제거 const selectedSubjectsContainer = $('#selected_subjects'); selectedSubjectsContainer.find(`.selected_subject:contains('${subject}')`).remove(); // 모달 내의 체크박스 해제 $(`input[value="${subject}"]`).prop('checked', false); // 모달 내의 선택된 과목 수 업데이트 $('#selected-count').text(selectedSubjects.length); // 모달 내의 선택된 과목 표시 업데이트 updateSubjectDisplay(); }