[ 'name' => '고객 예약 신청 확인', 'subject' => '[상담예약] 예약 신청이 접수되었습니다', 'content' => "안녕하세요 {customer_name}님,\n\n상담 예약 신청이 정상적으로 접수되었습니다.\n\n예약 정보:\n- 날짜: {reservation_date}\n- 시간: {reservation_time}\n- 상담비: {payment_amount}원\n\n입금 계좌: {account_info}\n\n입금 확인 후 예약이 확정됩니다.\n\n감사합니다." ], 'consultant_confirmed_customer' => [ 'name' => '고객 예약 확정 알림', 'subject' => '[상담예약] 예약이 확정되었습니다', 'content' => "안녕하세요 {customer_name}님,\n\n입금이 확인되어 예약이 확정되었습니다.\n\n예약 정보:\n- 날짜: {reservation_date}\n- 시간: {reservation_time}\n\n상담 당일 시간에 맞춰 방문해주시기 바랍니다.\n\n감사합니다." ], 'consultant_cancelled_customer' => [ 'name' => '고객 예약 취소 알림', 'subject' => '[상담예약] 예약이 취소되었습니다', 'content' => "안녕하세요 {customer_name}님,\n\n예약이 취소되었습니다.\n\n취소된 예약 정보:\n- 날짜: {reservation_date}\n- 시간: {reservation_time}\n\n취소 사유: {cancel_reason}\n\n문의사항이 있으시면 연락주시기 바랍니다.\n\n감사합니다." ] ]; // 현재 템플릿 조회 $templates = []; // 💡 [수정] 현재 탭의 타입에 맞는 템플릿만 조회합니다. if (is_consultant_installed()) { // 💡 [수정] 타입에 따라 테이블 분기 $table_name = ($current_type === 'sms') ? 'consultant_sms_templates' : 'consultant_mail_templates'; // 테이블 존재 여부 확인 (설치 초기 단계 고려) $table_check = sql_query("SHOW TABLES LIKE '{$table_name}'", false); if (sql_num_rows($table_check) > 0) { $sql = "SELECT * FROM {$table_name} WHERE template_type = '".sql_real_escape_string($current_type)."' ORDER BY template_key"; $result = sql_query($sql, false); if ($result) { while ($row = sql_fetch_array($result)) { $templates[$row['template_key']] = $row; } } } } // 기본 템플릿과 병합 foreach ($default_templates as $key => $default) { if (!isset($templates[$key])) { $templates[$key] = [ 'template_key' => $key, 'template_name' => $default['name'], 'template_subject' => $default['subject'], 'template_content' => $default['content'] ]; } } $current_template_key = $_GET['template'] ?? array_key_first($templates); include_once(G5_ADMIN_PATH . '/admin.head.php'); ?>