// noinspection JSUnusedGlobalSymbols window.addEventListener('error', (event) => { alert(`오류가 발생했어요!\n메시지: ${event.message}\n위치: ${event.filename}:${event.lineno}`); }); function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } let lastFocusedElement = null; document.addEventListener('DOMContentLoaded', () => { // 1. 감시할 대상 요소 const targetNode = document.getElementById('explode'); // 2. 대상 요소가 DOM에 존재할 때만 옵저버 실행 if (targetNode) { const observer = new MutationObserver(async (mutations) => { for (const mutation of mutations) { // style 속성이 변경되었을 때 (display: block/none 등) if (mutation.type === 'attributes' && mutation.attributeName === 'style') { const $explode = $('#explode'); // 화면에 보이는 상태가 되었는지 확인 if ($explode.is(':visible')) { lastFocusedElement = document.activeElement; await sleep(1000); // 1. 포커스 할 타겟 요소 동적 탐색 let $focusTarget = $explode.find('button').first(); // 우선순위 1: button if ($focusTarget.length === 0) { // 우선순위 2: 다른 포커스 가능한 요소 (input, a, select 등) $focusTarget = $explode.find('input, a[href], select, textarea, [tabindex]:not([tabindex="-1"])').first(); } if ($focusTarget.length === 0) { // 우선순위 3: 포커스할 하위 요소가 아예 없으면 팝업 창 자체에 강제 포커스 $explode.attr('tabindex', '-1'); $focusTarget = $explode; } // 2. 타겟에 최초 포커스 $focusTarget.focus(); } else { // 닫혔을 때: 찌꺼기 이벤트 지우기 (메모리 누수 방지) $explode.off('keydown'); } } } }); // 3. 옵저버 감시 시작 (속성(attributes) 변화만 감시) observer.observe(targetNode, { attributes: true }); } }); //자리수 채우기 Number.prototype.fill = function (fix) { let len = String(this).length; if (len >= fix) { return this; } let spec = '0000'; while (fix > String(spec).length) { spec += '0000'; } return spec.substring(0, (fix - len)) + this; }; Date.prototype.date = function (fmt) { if (!this.valueOf()) return ''; if (!fmt) fmt = 'yyyy-MM-dd HH:mm:ss'; let weekName = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일']; let d = this; return fmt.replace(/(yyyy|yy|MM|dd|E|HH|hh|mm|ss|a\/p)/gi, function ($1) { switch ($1) { case 'yyyy': return d.getFullYear(); case 'yy': return (d.getFullYear() % 1000).fill(2); case 'MM': return (d.getMonth() + 1).fill(2); case 'dd': return d.getDate().fill(2); case 'E': return weekName[d.getDay()]; case 'HH': return d.getHours().fill(2); case 'hh': return ((d = d.getHours() % 12) ? d : 12).fill(2); case 'mm': return d.getMinutes().fill(2); case 'ss': return d.getSeconds().fill(2); case 'a/p': return d.getHours() < 12 ? '오전' : '오후'; default: return $1; } }); }; function changeDate(dt) { if (!dt) return ''; try { return dt.date(); } catch (e) { return dt; } } $(function () { // placeholder 지원 안하는 브라우저는 js로 처리 $('input, textarea').placeholder(); $('.numonly').on('keypress', function (e) { let key = window.event ? window.event.keyCode : e.which; if (!(key > 47 && key < 58) && !(key > 95 && key < 106) && !(key === 8 || key === 9 || key === 37 || key === 39 || key === 46)) { e.preventDefault; } }).on('keyup', function () { $(this).val($(this).val().replace(/[^0-9]/g, '')); }); wtypeCheck(true); }); //각 영역 변경 function change(id) { $('div.body-container').hide(); $('#' + id).show(); $('html,body').scrollTop(0); stepOn(id); changeFooter(); } function stepOn(id) { let no = 0; switch (id) { case 'notice' : no = 0; break; case 'company' : $('#noticeAgreementYn').attr('checked', true); no = 1; break; case 'agreement': no = 1; break; case 'sub-notice-agreement' : no = 1; break; case 'question' : no = 1; break; case 'residence': no = 1; break; case 'private' : $('#noticeAgreementYn').attr('checked', true); $('#agreementYn').attr('checked', true); no = 2; break; case 'confirm' : no = 3; break; case 'apply' : no = 3; break; case 'result' : no = 4; break; } for (let i = 0; i <= 4; i++) { if (i > no) $('.step li').eq(i).removeClass('on'); else if (i === no) $('.step li').eq(i).addClass('on'); } } function changeFooter() { if ($(window).height() > $('body').height() + 60) { $('#footer').css({ 'position': 'fixed', 'bottom': 0, 'margin-top': 0 }); } else { $('#footer').css({ 'position': 'relative', 'margin-top': '50px' }); } } //쿠키저장 function setCookie(name, value, expireMinute) { let todayDate = new Date(); todayDate.setTime(todayDate.getTime() + (expireMinute * 60 * 1000)); document.cookie = name + '=' + escape(value) + '; path=/; expires=' + todayDate.toGMTString() + ';'; } //쿠키값읽어오기 function getCookie(name) { let arg = name + '='; let alen = arg.length; let clen = document.cookie.length; let i = 0; while (i < clen) { let j = i + alen; if (document.cookie.substring(i, j) === arg) return getCookieVal(j); i = document.cookie.indexOf(' ', i) + 1; if (i === 0) break; } return null; } //쿠키값읽어오기 function getCookieVal(offset) { let endstr = document.cookie.indexOf(';', offset); if (endstr === -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } //쿠키삭제 // noinspection JSUnusedGlobalSymbols function deleteCookie(name) { let expireDate = new Date(); expireDate.setDate(expireDate.getDate() - 1); if ('' !== getCookie(name)) { document.cookie = name + '=' + ';expires=' + expireDate.toGMTString() + ';path=/'; } } // noinspection JSUnusedGlobalSymbols function closePopupToday() { if ($('#popupAlwaysYn').is(':checked')) { let minute = 24 * 60; setCookie('POPUP', 'Y', minute); showPopup('N'); } } function showPopup(yn) { if (yn === 'N') $('#popupAlways').hide(); else $('#popupAlways').show(); } let isMobile = false; function wtypeCheck(flag) { let filter = 'win16|win32|win64|mac|macintel'; isMobile = false; if (navigator.platform) { isMobile = filter.indexOf(navigator.platform.toLowerCase()) < 0; } if (flag) { // 처음부터 감춰 두고 권장 브라우저가 아닐 때만 보이는 안내(data-browser-check)는 showBrowserGuide 가 맡는다 — 여기서는 옛 꼴 안내만 const legacyGuide = $('.browser-guide').not('[data-browser-check]'); if (isMobile) { $('.wtype-pc').hide(); $('.wtype-mobile').show(); legacyGuide.hide(); } else { $('.wtype-pc').show(); $('.wtype-mobile').hide(); let browser = getBrowserType(); if (!(browser === 'IE11' || browser === 'Chrome' || browser === 'Safari')) { legacyGuide.show(); } else legacyGuide.hide(); } } } /* * 권장 브라우저인가 — 안내 문구 «Chrome · Edge · Safari 최신»(범주 10-29). 오래된 브라우저에서도 이 함수는 돌아야 하므로 ES5 로만 쓴다. * 크롬 엔진 브라우저(웨일 · 삼성 인터넷 · 앱 안 브라우저 등)는 크롬과 같게, iOS 는 모든 브라우저가 Safari 엔진이라 Safari 와 같게 본다. * «최신» 은 판 번호 대신 기능으로 본다 — structuredClone(Chrome · Edge 98, Safari 15.4 — 2022년 3월부터)이 없으면 오래된 판 */ function isRecommendedBrowser() { var ua = navigator.userAgent; if (typeof window.structuredClone !== 'function') return false; if (/iPhone|iPad|iPod/.test(ua) || (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1)) return true; // Firefox · IE · 크롬 엔진 이전의 Edge(UA 에 Chrome 도 들어 있다) if (/Firefox\/|Trident\/|MSIE |Edge\/\d/.test(ua)) return false; if (/Chrome\/\d/.test(ua)) return true; return /Safari\//.test(ua) && /Version\/\d/.test(ua); } /* * 메인의 «※ Chrome · Edge · Safari 최신 브라우저를 …» 안내(.browser-guide[data-browser-check], 처음엔 hidden) — 권장 브라우저가 아닐 때만 보인다. * 안내 바로 뒤에서 부른다(DOM 준비를 기다리면 그사이 잠깐 보였다 사라진다) */ function showBrowserGuide() { var guides = document.querySelectorAll('.browser-guide[data-browser-check]'); var hide = isRecommendedBrowser(); for (var i = 0; i < guides.length; i++) guides[i].hidden = hide; } function getBrowserType() { let _ua = navigator.userAgent; //IE 11,10,9,8 let trident = _ua.match(/Trident\/(\d.\d)/i); if (trident !== null) { if (trident[1] === '7.0') return 'IE' + 11; if (trident[1] === '6.0') return 'IE' + 10; if (trident[1] === '5.0') return 'IE' + 9; if (trident[1] === '4.0') return 'IE' + 8; } //IE 7... if (navigator.appName === 'Microsoft Internet Explorer') return 'IE' + 7; //other let agt = _ua.toLowerCase(); if (agt.indexOf('chrome') !== -1) return 'Chrome'; if (agt.indexOf('opera') !== -1) return 'Opera'; if (agt.indexOf('staroffice') !== -1) return 'Star Office'; if (agt.indexOf('webtv') !== -1) return 'WebTV'; if (agt.indexOf('beonex') !== -1) return 'Beonex'; if (agt.indexOf('chimera') !== -1) return 'Chimera'; if (agt.indexOf('netpositive') !== -1) return 'NetPositive'; if (agt.indexOf('phoenix') !== -1) return 'Phoenix'; if (agt.indexOf('firefox') !== -1) return 'Firefox'; if (agt.indexOf('safari') !== -1) return 'Safari'; if (agt.indexOf('skipstone') !== -1) return 'SkipStone'; if (agt.indexOf('netscape') !== -1) return 'Netscape'; if (agt.indexOf('mozilla/5.0') !== -1) return 'Mozilla'; } function applyLink() { wtypeCheck(false); } // 본인인증 호출 function privateCall() { let windowW = 430; let windowH = 590; // 지금 브라우저 창의 가운데 — 모니터가 여럿이거나 1920 보다 넓으면 화면 기준 계산이 아래 · 옆으로 밀렸다 (QA-191) // 새 창 바깥은 테두리 · 주소 줄만큼 커서(웨일 실측 +16 · +87) 그 반을 뺀다 let left = Math.round(window.screenX + (window.outerWidth - windowW - 16) / 2); let top = Math.round(window.screenY + (window.outerHeight - windowH - 87) / 2); window.open( '', 'auth_popup', `width=${windowW},height=${windowH},scrollbar=yes,left=${left},top=${top},screenX=${left},screenY=${top}`, ); let form = document.privateForm; form.target = 'auth_popup'; form.submit(); } function btnColorChange(obj, id) { if (obj.checked) { $('#' + id + ' .bk').addClass('activationColor'); } else { $('#' + id + ' .bk').removeClass('activationColor'); } } function businessNumberView(n) { if (!n) return ''; // 숫자만 남기기 const onlyNum = String(n).replace(/[^0-9]/g, ''); // 10자리가 아니면 하이픈 없이 숫자만 반환 if (onlyNum.length !== 10) return onlyNum; // 정규식으로 그룹을 나눠서 하이픈 추가 return onlyNum.replace(/(\d{3})(\d{2})(\d{5})/, '$1-$2-$3'); } //번호 출력 - 4자리 단위 데시 구분 function mobileView(n) { let reg = /(^[+-]?\d+)(\d{4})/; let len = n.length; let i = 0; while (reg.test(n)) { if ((i > 0 && (len <= 10))) { reg = /(^[+-]?\d+)(\d{3})/; } n = n.replace(reg, '$1' + '-' + '$2'); i++; } return n; } function birthdayView(n) { let reg = /(\d{4})(\d{2})(\d{2})/; n = n.replace(reg, '$1-$2-$3'); return n; } function moneyView(money) { return money.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + '원'; } function dateView(date) { return `${date.substring(0, 4)}년 ${date.substring(4, 6)}월 ${date.substring(6, 8)}일`; } function dateTimeView(dt) { return `${dt.substring(0, 4)}년 ${dt.substring(4, 6)}월 ${dt.substring(6, 8)}일 ${dt.substring(8, 10)}:${dt.substring(10, 12)}`; } function goWaitConfirm() { location.href = '/'; } function goLanding() { location.href = '/landing/index.do'; } function copyToClipboard() { let copyText = $('#cyberAccountNo'); copyText.select(); document.execCommand('Copy'); $('#cyber_account_no').focus(); } function multiDeposit(type) { $('.js-depositSite').addClass('blind'); if (type) { const types = type.split(';'); for (let i = 0; i < types.length; i++) { const type = types[i]; const typeItems = type.split('-'); if ($.isArray(typeItems) && typeItems.length > 0) { let groupName = typeItems[0].replace(/\s/gi, ''); if (MULTI_GROUP_NAME) { groupName = MULTI_GROUP_NAME[groupName] ? MULTI_GROUP_NAME[groupName] : groupName; } if ($('#' + groupName)) { $('#deposit' + groupName).removeClass('blind'); } } } } } function showYn(yn) { return yn === 'Y' ? '예' : yn === 'N' ? '아니오' : yn.includes(';') ? yn.replaceAll(';', ', ') : yn; } // otherAreaName 이 없으면 N 을 '기타'로 보여 준다 function showResidentialAreaName(yn, residentialAreaName, otherAreaName) { if (residentialAreaName) { return yn === 'Y' ? residentialAreaName : (otherAreaName || '기타'); } else { return yn === 'Y' ? '예' : yn === 'N' ? '아니오' : yn; } } // 법인 신청이면 법인 정보를 이름표 붙은 줄(법인명 · 대표자 · 개업연월일 · 사업자등록번호)로 주소 줄 위에 두고, // 주소 줄은 «사업장 소재지», 이름 줄은 «담당자» 로 부른다. 다시 조회하면 앞서 넣은 줄을 지우고 새로 넣는다 (QA-150) function showCompanyResultRows(info) { const addressRow = $('#result-address').closest('dl'); addressRow.siblings('.company-result-row').remove(); if (!info.companyYn || 'Y' !== info.companyYn.toUpperCase()) { $('#result-name').siblings('dt').text('이름'); addressRow.children('dt').text('주소'); return; } $('#result-name').siblings('dt').text('담당자'); addressRow.children('dt').text('사업장 소재지'); const companyDate = String(info.companyDate || '').replace(/^(\d{4})(\d{2})(\d{2})$/, '$1-$2-$3'); const rows = [ ['법인명', info.companyName], ['대표자', info.companyCeo], ['개업연월일', companyDate], ['사업자등록번호', businessNumberView(info.businessNumber)], ]; for (const [title, value] of rows) { addressRow.before( $('
') .append($('
').text(title)) .append($('
').text(value || '')), ); } } let showApplyInfoAfter; let TYPE_RESULT_SEPARATOR = '-'; // 다른 구분자를 사용해야할 경우 청약 폴더에 common.js 생성, apply.html, applyInfo.html에 common.js 추가하고 정의한다. function showApplyResultInfo(info) { let resultAddress; if (info['addressDetail']) { resultAddress = '(' + info['zipcode'] + ')
' + info['address'] + ' ' + info['addressDetail']; } else { resultAddress = info['address']; } showCompanyResultRows(info); // 청약신청정보 $('#result-seq').html(info['seq']); // 타입과 신청유형을 분리해야할 경우 사용 if ($('#custom-result-type').length > 0) { let infoTypes = info['type'].split(';'); let atype = []; // 주택형 let itype = []; // 신청유형 for (let t = 0; t < infoTypes.length; t++) { let infoType = infoTypes[t]; let applyTypes = infoType.split(TYPE_RESULT_SEPARATOR); let applyType = applyTypes.shift(); atype.push(applyType); if (applyTypes && applyTypes.length > 0) { itype.push(applyTypes.join(TYPE_RESULT_SEPARATOR)); } } $('#result-type').html(atype.join($('#typeNewLineYn').val() === 'Y' ? '
' : ', ')); $('#custom-result-type').html(itype.join($('#typeNewLineYn').val() === 'Y' ? '
' : ', ')); console.log('itype', itype, itype.length); if (itype.length < 1) { $('#custom-result-type').parents('dl').addClass('blind'); } else { $('#custom-result-type').parents('dl').removeClass('blind'); } } else { $('#result-type').html(info['type'].replace(/;/g, $('#typeNewLineYn').val() === 'Y' ? '
' : ', ')); } $('#result-name').html(info['name']); $('#result-mobile').html(mobileView(info['mobile'])); $('#result-birthday').html(birthdayView(info['birthday'])); $('#result-gender').html(info['gender'] === '0' ? '여' : '남'); $('#result-address').html(resultAddress); $('#result-refund').html(`${info.refundBank} / ${info.refundBankAccountHolder} / ${info.refundBankAccountNumber}`); for (let i = 1; i <= 5; i++) { const checkValue = info['check' + i]; if (checkValue) { if (i === 1) { $('#result-check' + i).html(showResidentialAreaName(checkValue, $('#residentialAreaName').val(), $('#otherAreaName').val())); } else { $('#result-check' + i).html(checkValue); } $('#result-custom-check' + i).text(showYn(checkValue)).parents('dl').removeClass('blind'); } else { $('#result-check' + i).parents('dl').addClass('blind'); $('#result-custom-check' + i).parents('dl').addClass('blind'); } } // 결과 출력 후 작업이 필요할 경우 (대치 등) if (typeof showApplyInfoAfter === 'function') showApplyInfoAfter(); /*// custom check1 let check1 = info['check1']; if (check1) { $('#result-check1').html(showResidentialAreaName(check1, $('#residentialAreaName').val(), $('#otherAreaName').val())); $('#result-custom-check1').text(showYn(check1)).parents('dl').removeClass('blind'); } else { $('#result-check1').parents('dl').addClass('blind'); $('#result-custom-check1').parents('dl').addClass('blind'); } // custom check2 let check2 = info['check2']; if (check2) { $('#result-check2').html(check2); $('#result-custom-check2').text(showYn(check2)).parents('dl').removeClass('blind'); } else { $('#result-check2').parents('dl').addClass('blind'); $('#result-custom-check2').parents('dl').addClass('blind'); } // custom check3 let check3 = info['check3']; if (check3) { $('#result-check3').html(check3); $('#result-custom-check3').text(showYn(check3)).parents('dl').removeClass('blind'); } else { $('#result-check3').parents('dl').addClass('blind'); $('#result-custom-check3').parents('dl').addClass('blind'); } // custom check4 let check4 = info['check4']; if (check4) { $('#result-check4').html(check4); $('#result-custom-check4').text(showYn(check4)).parents('dl').removeClass('blind'); } else { $('#result-check4').parents('dl').addClass('blind'); $('#result-custom-check4').parents('dl').addClass('blind'); } // custom check5 let check5 = info['check5']; if (check5) { $('#result-check5').html(check5); $('#result-custom-check5').text(showYn(check5)).parents('dl').removeClass('blind'); } else { $('#result-check5').parents('dl').addClass('blind'); $('#result-custom-check5').parents('dl').addClass('blind'); }*/ } // 휴대폰번호 체크 function regExpMobile(str) { const regExp = /^(01[016789]{1})-?[0-9]{3,4}-?[0-9]{4}$/; return regExp.test(str); } function isEmail(text) { const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return pattern.test(text); } function changeRequestNo(request_no) { $('#request_no').val(request_no); } // loading function loading(type) { if (type === 'S' || type === true || type !== false || type === undefined) { $('#loading').show(); } else { $('#loading').hide(); } } let isCompanyApply = false; function changeCompany(toggle) { isCompanyApply = toggle; if (toggle) { $('.company-show').show(); $('.company-hide').hide(); } else { $('.company-show').hide(); $('.company-hide').show(); } if ($('#questionAgreementYn').val() === 'Y') { change('question'); } else { change('agreement'); } } function validBusinessNumber(number) { // 1. 입력값에서 숫자만 추출 (하이픈 등 제거) const rawNumber = number.toString().replace(/[^0-9]/g, ''); // 2. 사업자번호 길이는 무조건 10자리여야 함 if (rawNumber.length !== 10) { return; } // 3. 각 자리에 곱할 가중치 배열 (국세청 공식 알고리즘) const weights = [1, 3, 7, 1, 3, 7, 1, 3, 5]; let sum = 0; // 4. 1~9번째 자리까지 가중치를 곱해서 합산 for (let i = 0; i < 9; i++) { sum += parseInt(rawNumber.charAt(i), 10) * weights[i]; } // 5. 9번째 자리 숫자에 5를 곱한 뒤 10으로 나눈 몫을 합산 sum += Math.floor((parseInt(rawNumber.charAt(8), 10) * 5) / 10); // 6. 합산한 값을 10으로 나눈 나머지를 구하고, 10에서 그 나머지를 뺌 // (단, 나머지가 0일 경우 10이 되므로 다시 10으로 나눈 나머지를 취함) const checkDigit = (10 - (sum % 10)) % 10; // 7. 계산된 검증 번호와 실제 10번째 자리 숫자가 같으면 유효한 번호 return checkDigit === parseInt(rawNumber.charAt(9), 10); } let checkCompanyCompleted = false; async function checkCompany() { if (checkCompanyCompleted) { alert('사업자 확인이 이미 완료됐습니다.'); return; } checkCompanyCompleted = false; let company = getCompany(false); if (!company) return; const { companyName, companyCeo, companyDate, businessNumber } = company; // 국세청 진위확인(번호 · 법인명 · 대표자 · 개업연월일)과 이미 신청된 번호인지를 함께 본다 (QA-149) if (!confirm('입력한 법인 정보를 국세청 사업자등록 정보와 맞춰 보고, 이미 신청된 사업자등록번호인지 확인합니다.\n확인이 끝나면 법인 정보를 고칠 수 없습니다.\n계속 진행하시겠습니까?')) { return; } const payload = { businesses: [ { b_no: businessNumber, start_dt: companyDate, p_nm: companyCeo, b_nm: companyName, }, ], // 사업자 확인 결과를 이 본인인증에 묶는다 — 서버가 청약 토큰의 본인인증 고유키를 결과 토큰에 담는다(본인확인 D6-corp) ticket: $('#ticket').val(), }; const response = await submit({ url: '/api/check/company', payload, completeMessage: '사업자 확인이 완료됐습니다.', errorAlert: false, }); // 공공 API 오류 · 결과 없음 — 사업자 확인이 안 됐으니 법인 신청을 열지 않는다(범주 10-15 «필수», 서버도 결과 토큰 없이 저장을 막는다) if (502 === response.status || 501 === response.status) { alert('사업자 확인이 안 돼 법인 신청을 진행할 수 없습니다. 잠시 뒤 다시 시도해 주세요.\n(' + response.data.message + ')'); return; } if (200 === response.status) { // 사업자 확인 결과 토큰 — 법인 계좌인증 · 법인 신청에 싣는다(apply.js gCompanyCertToken, 본인확인 D6-corp) gCompanyCertToken = response.data.companyCertToken; checkCompanyCompleted = true; setCheckCompanyButton(true); $('#companyName').attr('disabled', true); $('#companyCeo').attr('disabled', true); $('#companyDate').attr('disabled', true); $('#businessNumber').attr('disabled', true); $('#refundBankAccountHolder').text(companyName); } else { handleApiError( { response }, undefined, { [response.status]: response.data.message, }, ); } } /** [사업자 확인] 단추 — 끝나면 «확인 완료» 로 흐리게 잠그고, 처음 상태로 되돌리면 다시 연다 (QA-149) */ function setCheckCompanyButton(done) { const button = $('#checkCompanyBtn'); button.prop('disabled', done).toggleClass('activationColor', false === done).toggleClass('done', done); button.find('.label').text(done ? '확인 완료' : '사업자 확인'); } function getCompany(check = true) { const company = { companyName: null, companyCeo: null, companyDate: null, businessNumber: null, companyYn: 'N', }; if (!isUseCompanyApply || !isCompanyApply) { return company; } if (!$('#companyName').val()) { alert('법인명을 입력해 주세요.'); $('#companyName').focus(); return; } if (!$('#companyCeo').val()) { alert('대표자를 입력해 주세요.'); $('#companyCeo').focus(); return; } if (!$('#companyDate').val()) { alert('개업연월일을 입력해 주세요.'); $('#companyDate').focus(); return; } if (!$('#businessNumber').val()) { alert('사업자등록번호를 입력해 주세요.'); $('#businessNumber').focus(); return; } if (!validBusinessNumber($('#businessNumber').val())) { alert('사업자등록번호 양식에 맞게 작성해주세요.'); $('#businessNumber').focus(); return; } if (check && isUseCompanyApply && isCompanyApply && !checkCompanyCompleted) { alert('사업자 확인이 완료되지 않았습니다.\n사업자등록번호 옆 «사업자 확인» 을 눌러 주세요.'); $('#businessNumber').focus(); return; } company.companyName = $('#companyName').val(); company.companyCeo = $('#companyCeo').val(); company.companyDate = $('#companyDate').val(); company.businessNumber = $('#businessNumber').val(); company.companyYn = 'Y'; return company; } /** * 신청서 이어 쓰기(QA-240) — 유효시간이 지난 저장분은 어느 화면을 열든 지운다. * 신청 화면만 지우면 창을 닫고 다시 안 오거나 신청 기간이 끝난 뒤엔 개인정보가 브라우저에 그대로 남는다. */ // 여기서 지운 키 — 신청 화면(apply-resume.js)이 «유효시간이 지나 지웠다» 고 한 번 알린다(QA-240) const gApplyResumeSweptKeys = []; (function sweepExpiredApplyResume() { try { Object.keys(localStorage).filter(key => key.startsWith('apply-resume:')).forEach(function (key) { const saved = JSON.parse(localStorage.getItem(key)); if (null == saved || 'number' !== typeof saved['exp'] || saved['exp'] <= Date.now()) { localStorage.removeItem(key); gApplyResumeSweptKeys.push(key); } }); } catch (e) { // 저장소를 못 쓰면(사생활 모드 등) 지울 것도 없다 } }());