258 lines
13 KiB
PHP
258 lines
13 KiB
PHP
<?php
|
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
|
|
|
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css">', 0);
|
|
add_javascript('<script src="'.$board_skin_url.'/order_form.js"></script>', 10);
|
|
|
|
// 💡 [추가] 답변 글 1개 제한 기능 (true: 여러개 허용, false: 1개만 허용)
|
|
$order_eclem_allow_multiple_proposals = false;
|
|
|
|
// 💡 [수정] 대리점의 답변 작성(견적 제안) 기능을 비활성화 -> Level 9, 10은 허용
|
|
if ($w == 'r') {
|
|
if (!($member['mb_level'] == 9 || $member['mb_level'] == 10)) {
|
|
alert('견적 제안 기능은 전문가(Level 9) 또는 관리자(Level 10)만 이용 가능합니다.');
|
|
exit;
|
|
}
|
|
|
|
// 💡 [추가] 답변 글 1개 제한 로직
|
|
if (!$order_eclem_allow_multiple_proposals) {
|
|
$sql_check = "SELECT wr_id FROM {$write_table} WHERE wr_parent = '{$wr_id}' AND mb_id = '{$member['mb_id']}'";
|
|
$row_check = sql_fetch($sql_check);
|
|
if ($row_check['wr_id']) {
|
|
alert('이미 이 요청에 대한 견적 제안을 작성하셨습니다. 기존 제안을 수정해주세요.');
|
|
// 기존 답변 수정 페이지로 이동
|
|
goto_url(G5_HTTP_BBS_URL.'/write.php?w=u&bo_table='.$bo_table.'&wr_id='.$row_check['wr_id']);
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
|
|
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/xeicon@2.3.3/xeicon.min.css">
|
|
|
|
<!-- for mobile -->
|
|
<!--<div class="rb_bbs_wrap rb_bbs_write_wrap">-->
|
|
<section id="bo_w">
|
|
|
|
<!-- 전문가 상담 및 예약 버튼 (상단 오른쪽) -->
|
|
<div class="expert-consultation-header" style="position: relative; margin-bottom: 20px;">
|
|
<div style="text-align: right; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;">
|
|
<!-- <button type="button" class="btn btn-primary expert-consultation-btn" onclick="openReservationPopup()">
|
|
<i class="fa fa-user-md"></i> 상담예약
|
|
</button>-->
|
|
<button type="button" class="btn btn-success reservation-btn" onclick="openExpertVisitPopup(<?php /*echo $wr_id; */?>)">
|
|
<i class="fa fa-calendar"></i> 전문가 방문 예약
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 게시물 작성/수정 시작 { -->
|
|
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>"
|
|
onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data"
|
|
autocomplete="off" style="width:<?php echo $width; ?>">
|
|
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
|
|
<input type="hidden" name="w" value="<?php echo $w ?>">
|
|
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
|
|
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
|
|
<input type="hidden" name="sca" value="<?php echo $sca ?>">
|
|
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
|
|
<input type="hidden" name="stx" value="<?php echo $stx ?>">
|
|
<input type="hidden" name="spt" value="<?php echo $spt ?>">
|
|
<input type="hidden" name="sst" value="<?php echo $sst ?>">
|
|
<input type="hidden" name="sod" value="<?php echo $sod ?>">
|
|
<input type="hidden" name="page" value="<?php echo $page ?>">
|
|
<input type="hidden" name="wr_content" value="견적상세내용">
|
|
|
|
<?php
|
|
// 💡 [수정] 대리점의 답변 작성 로직 제거
|
|
if ($w == 'u') { // 수정
|
|
?>
|
|
<input type="hidden" name="wr_subject" value="<?php echo $write['wr_subject']; ?>">
|
|
<input type="hidden" name="wr_1" value="<?php echo $write['wr_1']; ?>">
|
|
<?php
|
|
} else { // 새글쓰기
|
|
$name = $member['mb_name'];
|
|
?>
|
|
<input type="hidden" name="wr_subject" value="<?php echo $name; ?>님의 견적 요청입니다.">
|
|
<input type="hidden" name="wr_1" value="견적신청중">
|
|
<input type="hidden" name="company_name" value="<?php echo $name; ?>">
|
|
<?php
|
|
}
|
|
?>
|
|
<div class="content-input-form" style="background-color: #fff;">
|
|
<?php if (!$is_member) { ?>
|
|
<div class="input-wrap">
|
|
<?php if ($is_name) { ?>
|
|
<div class="input-box required">
|
|
<label for="wr_name" class="input-title">이름</label>
|
|
<div class="input-content"><input type="text" name="wr_name"
|
|
value="<?php echo $name; ?>" id="wr_name"
|
|
required class="" placeholder="이름을 입력해주세요.">
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if ($is_password) { ?>
|
|
<div class="input-box <?php echo $password_required; ?>">
|
|
<label for="wr_password" class="input-title">패스워드</label>
|
|
<div class="input-content"><input type="password" name="wr_password"
|
|
id="wr_password" <?php echo $password_required; ?>
|
|
class="" placeholder="비밀번호"
|
|
autocomplete="new-password"></div>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if ($is_email) { ?>
|
|
<div class="input-box">
|
|
<label for="wr_email" class="input-title">이메일</label>
|
|
<div class="input-content"><input type="text" name="wr_email"
|
|
value="<?php echo $email; ?>" id="wr_email"
|
|
class="email " placeholder="이메일"></div>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if ($is_homepage) { ?>
|
|
<div class="input-box">
|
|
<label for="wr_homepage" class="input-title">연락처</label>
|
|
<div class="input-content"><input type="text" name="wr_homepage"
|
|
value="<?php echo $homepage; ?>"
|
|
id="wr_homepage" class="" placeholder="연락처">
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<?php if ($is_homepage) { ?>
|
|
<div class="input-box">
|
|
<label for="wr_homepage" class="input-title">주소</label>
|
|
<div class="input-content"><input type="text" name="wr_homepage"
|
|
value="<?php echo $homepage; ?>"
|
|
id="wr_homepage" class="" placeholder="연락처">
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
<?php } ?>
|
|
<div class="input-wrap">
|
|
<!-- <label for="wr_content" class="sound_only">내용<strong>필수</strong></label> -->
|
|
<div class="wr_content <?php echo $is_dhtml_editor ? $config['cf_editor'] : ''; ?>">
|
|
|
|
<?php if ($write_min || $write_max) { ?>
|
|
<!-- 최소/최대 글자 수 사용 시 -->
|
|
<!-- <p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p> -->
|
|
<?php } ?>
|
|
<!-- <?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?> -->
|
|
<?php if ($write_min || $write_max) { ?>
|
|
<!-- 최소/최대 글자 수 사용 시 -->
|
|
<div id="char_count_wrap"><span id="char_count"></span>글자</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if (($w == 'u' && isset($member['mb_level']) && $member['mb_level'] == 2)) {
|
|
// 레벨2 회원은 수정 불가, 얼럿창 띄우고 뒤로가기
|
|
echo "<script>
|
|
alert('신청내역 수정이 불가능합니다.\\n기존 신청을 삭제 후, 새로 신청해 주세요.');
|
|
history.back();
|
|
</script>";
|
|
exit;
|
|
} else if ($w == '' || ($w == 'u' && empty($write['wr_reply']))) { // 💡 [수정] URL 대신 서버 파일 경로를 사용합니다.
|
|
include($board_skin_path . '/order.php');
|
|
}
|
|
// 💡 [수정] 답변 글(견적 제안) 작성 로직 활성화 (Level 9, 10)
|
|
else if (($w == 'r' || ($w == 'u' && !empty($write['wr_reply']))) && ($member['mb_level'] == 9 || $member['mb_level'] == 10)) {
|
|
include($board_skin_path . '/order2.php');
|
|
}
|
|
?>
|
|
<?php if ($is_use_captcha) { //자동등록방지 ?>
|
|
<div class="input-wrap">
|
|
<?php echo $captcha_html ?>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
|
|
<div class="btn-confirm input-wrap">
|
|
<button type="submit" id="btn_submit" accesskey="s" class="btn-submit">
|
|
작성완료
|
|
</button>
|
|
<a href="<?php echo get_pretty_url($bo_table); ?>"
|
|
class="btn-cancel">취소</a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
<!--</div>-->
|
|
<!-- 💡 [수정] 컴포넌트화된 팝업 로더를 절대 경로로 포함합니다. -->
|
|
<?php //include_once(G5_ADMIN_PATH . '/consultant_manage/components/_consultant_popups.php'); ?>
|
|
<?php include_once(G5_ADMIN_PATH . '/order_manage/components/_expert_visit_popups.php'); ?>
|
|
|
|
|
|
<script>
|
|
// PHP 변수를 JavaScript로 전달
|
|
var gallery_general_config = {
|
|
write_min: <?php echo (int)$write_min; ?>,
|
|
write_max: <?php echo (int)$write_max; ?>
|
|
};
|
|
|
|
<?php if ($write_min || $write_max) { ?>
|
|
// 글자수 제한
|
|
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
|
|
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
|
|
<?php } ?>
|
|
|
|
// 💡 [수정] window 객체에 할당하여 전역 스코프 보장
|
|
window.fwrite_submit = function(f) {
|
|
console.log("fwrite_submit 호출됨"); // 디버깅용 로그
|
|
|
|
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
|
|
|
|
var subject = "";
|
|
var content = "";
|
|
$.ajax({
|
|
url: g5_bbs_url + "/ajax.filter.php",
|
|
type: "POST",
|
|
data: {
|
|
"subject": f.wr_subject.value,
|
|
"content": f.wr_content.value
|
|
},
|
|
dataType: "json",
|
|
async: false,
|
|
cache: false,
|
|
success: function (data, textStatus) {
|
|
subject = data.subject;
|
|
content = data.content;
|
|
}
|
|
});
|
|
|
|
if (subject) {
|
|
alert("제목에 금지단어('" + subject + "')가 포함되어있습니다");
|
|
f.wr_subject.focus();
|
|
return false;
|
|
}
|
|
|
|
if (content) {
|
|
alert("내용에 금지단어('" + content + "')가 포함되어있습니다");
|
|
if (typeof (ed_wr_content) != "undefined")
|
|
ed_wr_content.returnFalse();
|
|
else
|
|
f.wr_content.focus();
|
|
return false;
|
|
}
|
|
|
|
if (document.getElementById("char_count")) {
|
|
if (char_min > 0 || char_max > 0) {
|
|
var cnt = parseInt(check_byte("wr_content", "char_count"));
|
|
if (char_min > 0 && char_min > cnt) {
|
|
alert("내용은 " + char_min + "글자 이상 쓰셔야 합니다.");
|
|
return false;
|
|
}
|
|
if (char_max > 0 && char_max < cnt) {
|
|
alert("내용은 " + char_max + "글자 이하로 쓰셔야 합니다.");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
<?php echo $captcha_js; // 캡차 사용시 자바스크립트에서 입력된 캡차를 검사함 ?>
|
|
|
|
document.getElementById("btn_submit").disabled = "disabled";
|
|
|
|
return true;
|
|
}
|
|
</script>
|
|
<!-- } 게시물 작성/수정 끝 -->
|