<?php
	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';

	$MENU_ACTV = '33';
?>
<? include("../include/inc_top.php") ?>
<? include("../include/inc_header.php") ?>
<script type="text/javascript" src="/common/smarteditor/js/HuskyEZCreator.js" charset="utf-8"></script>


<main class="">
	<section>
		<div class="sub--top--visual cscenter">
			<div class="contents--inner">
				<h2>고객 센터</h2>
				<p>이차조아에 대해 궁금하신 점이 있다면 무엇이든 물어보세요.</p>
			</div>
		</div>
	</section>
	<?php include_once($_SERVER['DOCUMENT_ROOT']."/include/inc_nav.php");?>
	<form id="frmBbs" name="frmBbs" method="post" action="board_proc.php" enctype="multipart/form-data">
	<input type="hidden" name="cd_board" id="cd_board" value="04"/>
	<input type="hidden" name="mode" id="mode" value="AddQna"/>
	<input type="hidden" name="url" id="url" value="/"/>
	<input type="hidden" name="nm_etc3" id="nm_etc3" value=""/>
	<input type="hidden" name="nm_etc2" id="nm_etc2" value=""/>

	<input type="hidden" name="nm_etc1" id="nm_etc1" value="일반문의">

	<?php
	/*
	<span class="check_wrap"><input type="radio" name="nm_etc1" id="nm_etc1" value="일반문의"><i></i><label for="nm_etc1">일반문의</label></span>
	<span class="check_wrap"><input type="radio" name="nm_etc1" id="nm_etc1" value="회원문의"><i></i><label for="ask2">회원문의</label></span>
	<span class="check_wrap"><input type="radio" name="nm_etc1" id="nm_etc1" value="딜러가입문의"><i></i><label for="ask3">딜러가입문의</label></span>
	<span class="check_wrap"><input type="radio" name="nm_etc1" id="nm_etc1" value="불만접수"><i></i><label for="ask3">불만접수</label></span>
	*/
	?>

	<section>
		<div class="qna--wrapper">
			<div class="qna--inner">
				<div class="form--wrapper d-flex align-items-center justify-content-between">
					<div>
						<label for="nm_name">이름</label>
						<input type="text" class="form-control" style="width:250px;" name="nm_name" id="nm_name" />
					</div>
					<div>
						<label for="">연락처</label>
						<div class="d-flex align-items-center">
							<select name="nm_hp1" class="form-control" id="nm_hp1" style="width:110px;"></select>
							<label for="" class="ml10 mr10">-</label>
							<input type="text" class="form-control" style="width:110px;" id="nm_hp2" name="nm_hp2" maxlength="4" />
							<label for="" class="ml10 mr10">-</label>
							<input type="text" class="form-control" style="width:110px;" id="nm_hp3" name="nm_hp3" maxlength="4"/>
						</div>
					</div>
					<div>
						<label for="">이메일</label>
						<div class="d-flex align-items-center">
							<input type="text" class="form-control" style="width:120px;" name="nm_email1" id="nm_email1" />

							<label for="" class="ml10 mr10">@</label>
							<input type="text" class="form-control" style="width:120px;" name="nm_email2" id="nm_email2" />
							<label for="" class="ml10 mr10"></label>
							<select name="nm_email3" id="nm_email3" class="form-control" style="width:200px"></select>
						</div>
					</div>
				</div>

				<div class="form--wrapper mt40">
					<label for="">제목</label>
					<input type="text" rows="5" class="form-control" name="nm_title" id="nm_title">
				</div>

				<div class="form--wrapper mt40">
					<label for="">문의 사항</label>
					<textarea rows="5" class="form-control" name="nm_content" id="nm_content"></textarea>
				</div>
				<div class="agree--wrapper mt35 d-flex justify-content-end">
					<input type="checkbox" id="ds_agree2" name="ds_agree2" class="ty2" hidden>
					<label for="ds_agree2">개인정보 수집 및 이용 동의 (필수)</label>
					<button type="button" class="info--btn btn" data-bs-toggle="modal" data-bs-target="#exampleModal6"></button>
				</div>

				<div class="btn--wrappers">
					<button type="button" class="btn btn-primary" id="btn_write">문의 하기</button>
				</div>
			</div>

		</div>
	</section>
	</form>


</main>



<!-- 거래 완료 -->
<div class="modal fade type2" id="exampleModal6" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
	<div class="modal-dialog  modal-dialog-centered" style="max-width:800px;">
		<div class="modal-content">
			<div class="modal-header">
				<h1 class="modal-title" id="exampleModalLabel">개인정보 수집 및 이용 동의</h1>
				<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
			</div>
			<div class="modal-body modal--body pt0">
				<div class="date--text">
					수집하는 개인정보의 항목, 개인정보의 수집 및 이용 목적, 개인 정보의 보유 및 이용 기간을 안내 드리오니 자세히 읽은 후 동의하여 주시기 바랍니다.<br/>
					<br/>
					- 수집 및 이용 목적<br/>
					- 상담 접수 및 처리<br/>
					- 처리 내역 보관 용도<br/>
					- 중복 상담 확인<br/>
					<br/>
					항목<br/>
					(필수) 이름, 이메일, 연락처<br/>
					<br/>
					보관 기간<br/>
					수집·이용 동의일로부터 12개월 (단, 요청시 삭제)<br/>
					<br/>
					귀하는 위 개인정보 수집 및 이용을 거부할 수 있으나, 동의를 거부하실 경우 상담을 받으실 수 없습니다.<br/>
					<br/>
					귀하의 상담 내용은 원활한 상담을 위하여 보관되며, 홈페이지에 게시된 개인정보처리방침에 따라 처리됩니다.
				</div>
			</div>
			<!--<div class="modal-footer d-flex justify-content-center ty2 ty--2">
				<button type="button" class="btn btn-primary" style="max-width:100px;">확인</button>
			</div>-->
		</div>
	</div>
</div>



<script>
  $(".faq--wrap li").on("click",function(){
    $(this).toggleClass("actv");
  });
</script>

<!--
<tr>
	<th>첨부파일</th>
	<td>
		<div class="filebox">
			<label for="nm_file">찾아보기</label>
			<input class="upload-name" value="">
			<input type="file" name="nm_file" id="nm_file" class="upload-hidden">
		</div>
	</td>
</tr> -->

<script language="javascript" type="text/javascript">
	var cd_board = "<?=$cd_board?>";

	function fnList(param){
		location.replace("./bbs_list.php?cd_board="+param);
	}

	$(document).ready(function() {
		setCodeSelect("listPhone","nm_hp1","","","<?=$nm_hp1?>","선택","");
		setCodeSelect("listEmail","nm_email3","","","","직접입력","");

        $("#nm_email3").on("change", function(){
            if($(this).val() == ""){
				// $("#nm_email2").show();
                $("#nm_email2").val("");
            }else{
				// $("#nm_email2").hide();
				$("#nm_email2").val($(this).val());
            }
        });

		$("#btn_write").bind("click",function(){
			var custom_opts = {
				title : '',
				btn_close_show : false,
			}

            var fieldlist = [["nm_name","이름"],["nm_hp1","연락처"],["nm_hp2","연락처"],["nm_hp3","연락처"],["nm_email1","이메일"],["nm_email2","이메일"],["nm_title","제목"],["nm_content","문의사항"]]
			//,["nm_etc2","연락처"]
			// ["nm_etc1","문의유형"],[

			// oEditors.getById["nm_content"].exec("UPDATE_CONTENTS_FIELD", []);

			if (!fnCheckForm(fieldlist)){
				return false;
			}

			$("#nm_etc2").val($("#nm_hp1").val()+"-"+$("#nm_hp2").val()+"-"+$("#nm_hp3").val());
			$("#nm_etc3").val($("#nm_email1").val()+"@"+$("#nm_email2").val());

			if(!document.getElementById("ds_agree2").checked){
				custom_opts.title = "[필수] 개인정보 수집이용 에 동의해 주세요.";
				custom_modal_alert(custom_opts);
				return false;
			}

			custom_opts.title = '문의 하시겠습니까?';
			custom_modal_confirm(custom_opts, function(confirm) {
				if(confirm) {
					$("#btn_write").hide();
					var data = $("#frmBbs").serialize();
					$.ajax({
						url : 'board_proc.php',
						type: 'POST',
						dataType : 'json',
						data: data,
						success: function(res) {
							custom_modal_confirm_close();

							$("#btn_write").show();

							//세션 종료시 로그인 페이지로 이동
							if(res.CODE != "0000") {
								custom_opts.title = res.MSG;

								if(res.CODE == "4444") {
									window.location.href = res.DATAS.URL;
								}
								custom_modal_alert(custom_opts);
								return false;
							}

							custom_opts.title = '등록이 완료되었습니다.';
							custom_opts.event_esc_key = false;

							custom_modal_alert(custom_opts, function() {
								link("/");
							});
						},
						error:function(request,status,error){
							$("#btn_write").show();

							custom_modal_confirm_close();

							alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
						}
					});

				}else {
					$("#btn_write").show();
					return false;
				}
			});
			// var c = confirm("처리하시겠습니까?");
			// if(c){
			// 	$("#frmBbs").submit();
			// }else{
			// 	return false;
			// }

		});
	});

</script>
<script type="text/javascript">
//  var oEditors = [];
// 	 nhn.husky.EZCreator.createInIFrame({
// 	oAppRef: oEditors,
// 	elPlaceHolder: "nm_content",
// 	sSkinURI: "/common/smarteditor/SmartEditor2Skin.html",
// 	htParams : {
// 		bUseToolbar : true,
// 		bUseVerticalResizer : true,
// 		bUseModeChanger : true,
// 		fOnBeforeUnload : function(){}
// 	}, //boolean
// 	fOnAppLoad : function(){},
// 	fCreator: "createSEditor2"
//
//  });
// function pasteHTML(fcode,objKey){
// 	var sHTML = '<span style="color:#FF0000;"><img src="'+fcode+'"></span>';
// 	oEditors.getById[objKey].exec("PASTE_HTML", [sHTML]);
// }
//
// function delHTML(source){
// 	oEditors.getById[source].exec("SET_CONTENTS", [""]);
// }
// function copyHTML(source,dest) {
// 	var sHTML = getHTML(source);
// 	oEditors.getById[dest].exec("PASTE_HTML", [sHTML]);
// }
// function getHTML(source){
// 	return oEditors.getById[source].getIR();
// }
</script>
<script language="javascript">
<!--

// function sel_1(sltObj)
// {
//     document.getElementById("nm_email2").value = sltObj;
// 	if (sltObj == "")
// 	{
// 		document.getElementById("nm_email2").readOnly = false;
// 	}else{
// 		document.getElementById("nm_email2").readOnly = true;
// 	}
//
// }
//-->
</script>

<? include("../include/inc_footer.php"); ?>
