초기소스
This commit is contained in:
340
src/main/webapp/WEB-INF/views/comm/crm/Header.jsp
Normal file
340
src/main/webapp/WEB-INF/views/comm/crm/Header.jsp
Normal file
@@ -0,0 +1,340 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.cdnurl')" var="cdnurl"/>
|
||||
<script>
|
||||
// 현재 창의 이름을 'crmWin'로 설정
|
||||
window.onload = function() {
|
||||
if (!window.name) {
|
||||
window.name = 'crmWin';
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function (){
|
||||
// 전화와 왔을 경우
|
||||
if (window.parent !== window) {
|
||||
var sopmalCd = parent.document.ValidForm.sopmalCd.value;
|
||||
// console.log('header > sopmalCd (쇼핑몰 이름, 로고 get) : ' + sopmalCd);
|
||||
// fn_select_sopmal_name(sopmalCd);
|
||||
}
|
||||
/*
|
||||
* crm버튼 선택 이벤트
|
||||
*/
|
||||
$(document).on('click', '#btnCrm', function() {
|
||||
const td = $(this).closest('td');
|
||||
|
||||
const mbrInnb = $(td).find('.mbrInnb').val();
|
||||
const mbrDvCd = $(td).find('.mbrDvCd').val();
|
||||
|
||||
fn_move_crm_cnslt(mbrInnb, mbrDvCd);
|
||||
});
|
||||
|
||||
$("#srchKyword").on('keydown', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
fn_select_crm_mbr_popup(1);
|
||||
}
|
||||
});
|
||||
$("#mainSrchKyword").on('keydown', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
fn_select_crm_mbr_popup(1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 전화 쇼피몽 이름 창 닫기
|
||||
const fn_sopmal_bar_close = function() {
|
||||
$('#callSopmalNm').hide();
|
||||
}
|
||||
|
||||
// 쇼핑몰 이름 조회
|
||||
const fn_select_sopmal_name = function (sopmalCd) {
|
||||
const url = '<c:url value="/crm/main/selectSopmalNm"/>';
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: {
|
||||
sopmalCd : sopmalCd
|
||||
},
|
||||
success: function (data) {
|
||||
let result = JSON.parse(data.resBody.result);
|
||||
//콜 들어올 시 회색 바 노출
|
||||
let message = result.sopmalNm + ' 전화';
|
||||
$('#sopmalNm').text(message);
|
||||
$('#callSopmalNm').show();
|
||||
//해당 브랜드 로고 header로고에 등록
|
||||
if(!fn_is_empty(result.topFilCours)){
|
||||
const cdnurl = '${cdnurl}';
|
||||
const logoImgSrc = cdnurl + result.topFilCours + '/' + result.topSysFilNm;
|
||||
$("#crmMainLogo").attr("src",logoImgSrc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// window.addEventListener('message', function(event) {
|
||||
// if(event.data.functionName == 'recordKeyLoad') {
|
||||
// fn_sopmal_bar_close()
|
||||
// }
|
||||
// }, false);
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************
|
||||
* CRM 회원 검색 조회
|
||||
*******************************************************/
|
||||
const fn_select_crm_mbr_popup = function () {
|
||||
const url = '<c:url value="/crm/main/selectCrmMbrSrchForm"/>';
|
||||
// 전화와 왔을 경우
|
||||
if (window.parent !== window) {
|
||||
var sopmalCd = parent.document.ValidForm.sopmalCd.value;
|
||||
$("#mainSopmalCd").val(sopmalCd);
|
||||
$("#ctiAt").val("Y");
|
||||
}
|
||||
let data = $('#mainMbrSrchFrom').serialize();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: data,
|
||||
success: function (data) {
|
||||
$('#crmSearchPopup').remove();
|
||||
$('#popupDiv').html(data);
|
||||
$('#crmSearchPopup').modal();
|
||||
// $("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
// 하나면 바로 이동
|
||||
// 여러개명 팝업 호출
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* CRM 회원 검색 조회
|
||||
*******************************************************/
|
||||
const fn_select_crm_mbr_list = function (pageIndex, pageUnit, srchKywordDv, srchKyword) {
|
||||
if (srchKywordDv !== undefined && srchKywordDv !== '') {
|
||||
$('#popSrchKywordDv').val(srchKywordDv);
|
||||
}
|
||||
if (srchKyword !== undefined && srchKyword !== '') {
|
||||
$('#popSrchKyword').val(srchKyword);
|
||||
}
|
||||
|
||||
let dataStr;
|
||||
if (!pageIndex) {
|
||||
$('#mbrPopPageIndex').val(1);
|
||||
} else {
|
||||
$('#mbrPopPageIndex').val(pageIndex);
|
||||
}
|
||||
|
||||
if (!pageUnit) {
|
||||
dataStr = $('#mbrSrchForm').serialize();
|
||||
} else {
|
||||
if ($('#pageUnit').length) {
|
||||
$('#pageUnit').val(pageUnit);
|
||||
dataStr = $('#mbrSrchForm').serialize();
|
||||
} else {
|
||||
dataStr = $('#mbrSrchForm').serialize() + '&pageUnit=' + pageUnit;
|
||||
}
|
||||
}
|
||||
$('#pageIndex').val(pageIndex);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<c:url value="/crm/main/selectCrmMbrSrch"/>",
|
||||
data: dataStr,
|
||||
success: function (resultHtml) {
|
||||
$('#mbrPageDiv').html(resultHtml);
|
||||
let bool;
|
||||
if(fn_is_empty($("#popSrchKyword"))){
|
||||
bool = isValidPhoneNumber($("#mainSrchKyword").val().replaceAll('-',''));
|
||||
}else{
|
||||
bool = isValidPhoneNumber($("#popSrchKyword").val().replaceAll('-',''));
|
||||
}
|
||||
if (fn_return_parents_totcnt().totalRecordCount == 0 && $("#headerSrch").val() === 'phone' && bool) {//검색조건이 휴대폰번호이고 비회원이면 비회원으로 crm 넘어감
|
||||
fn_move_crm_cnslt('', '', $("#mainSrchKyword").val());
|
||||
} else if (fn_return_parents_totcnt().totalRecordCount == 1) {//회원 1명
|
||||
fn_move_crm_cnslt(fn_return_parents_totcnt().mbrInnb, fn_return_parents_totcnt().mbrDvCd);
|
||||
} else { //회원 다수
|
||||
$(".mbtlnb").each(function () {
|
||||
let mbtlnb = fn_format_mbtlnb($(this).text().trim());
|
||||
mbtlnb = mbtlnb.replace(/(\d{3})-(\d{4})-(\d{4})/, "$1-****-$3");
|
||||
$(this).text(mbtlnb);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//휴대폰번호 숫자만 허용
|
||||
function isValidPhoneNumber(phoneNumber) {
|
||||
// 한국 전화번호 형식: 010-1234-5678, 02-123-4567 등
|
||||
const phoneRegex = /^[0-9]+$/;
|
||||
return phoneRegex.test(phoneNumber);
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* 회원 목록 총 개수 반환
|
||||
*******************************************************/
|
||||
const fn_return_parents_totcnt = function () {
|
||||
let totCnt = $('#totCnt').val();
|
||||
|
||||
let mbrInnb = null;
|
||||
let mbrDvCd = null;
|
||||
|
||||
if (totCnt === '1') {
|
||||
mbrInnb = $('input[name="oneMbrInnb"]').val();
|
||||
mbrDvCd = $('input[name="oneMbrDvCD"]').val();
|
||||
}
|
||||
|
||||
const data = {
|
||||
totalRecordCount: totCnt,
|
||||
mbrInnb: mbrInnb,
|
||||
mbrDvCd: mbrDvCd
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
</script>
|
||||
<header class="header">
|
||||
<div class="header__top">
|
||||
<div class="header-left">
|
||||
<div class="header__logo">
|
||||
<%
|
||||
if(request.getCookies() != null){
|
||||
for(Cookie cookie : request.getCookies()){
|
||||
if("authSopmalCd".equals(cookie.getName())){
|
||||
request.setAttribute("cookieAuthSopmalCd", cookie.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
<c:if test="${not empty crmMenuList.menuList}">
|
||||
<c:forEach var = "crmTopMenuList" items = "${crmMenuList.menuList}" varStatus="status">
|
||||
<c:if test = "${crmTopMenuList.expsrLcDvCd eq '01' && crmTopMenuList.sortOrdr eq '1'}">
|
||||
<a href="<c:out value="${crmTopMenuList.url}"/>" style="background:#eeeeee;margin-right: 18px;">
|
||||
<c:choose>
|
||||
<c:when test = "${not empty siteList && not empty cookieAuthSopmalCd}">
|
||||
<c:forEach var="site" items="${siteList}">
|
||||
<c:if test = "${cookieAuthSopmalCd eq site.sopmalCd}">
|
||||
<img src="<c:out value="${cdnurl}${site.topFilCours}/${site.topSysFilNm}"/>" alt="<c:out value="${site.sopmalNm}"/>">
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<img src="/crm/images/logo_white.png" alt="GC ONE 관리자" id="crmMainLogo">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<span class="header__logo-title"><c:out value="${crmTopMenuList.menuNm}"/></span>
|
||||
</a>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="header-searchBar">
|
||||
<form id="mainMbrSrchFrom">
|
||||
<div class="header-searchBar__inner">
|
||||
<div class="header-searchBar__select">
|
||||
<select name="srchKywordDv" title="검색어 구분" id = "headerSrch">
|
||||
<option value="phone" selected>휴대전화</option>
|
||||
<option value="name">이름</option>
|
||||
<option value="id">아이디</option>
|
||||
<option value="email">이메일</option>
|
||||
</select>
|
||||
</div>
|
||||
<input class="header-searchBar__input" id ="mainSrchKyword" type="text" name="srchKyword" title="검색어 입력" placeholder="검색어를 입력하세요" value="<c:out value="${ mainVO.phone }"/>">
|
||||
<input type="hidden" name="sopmalCd" id="mainSopmalCd" value="<c:out value="${ mainVO.sopmalCd }"/>"/>
|
||||
<input type="hidden" name="ctiAt" id="ctiAt"/>
|
||||
<button class="header-searchBar__btn" type="button" id="srchBtn" onclick="fn_select_crm_mbr_popup(); return false;"><span class="visually-hidden">검색</span></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<ul class="header-crmLink">
|
||||
<c:if test="${not empty crmMenuList.menuList}">
|
||||
<c:forEach var="crmTopMenuList" items="${crmMenuList.menuList}" varStatus="status">
|
||||
<c:if test="${crmTopMenuList.expsrLcDvCd eq '01' && crmTopMenuList.sortOrdr ne '1'}">
|
||||
<c:choose>
|
||||
<c:when test = "${fn:contains(crmTopMenuList.url,'/sopmal/mbr/selectJoinGuidance')}"><%--회원등록은 사용자 url로 이동--%>
|
||||
<li><a onclick="fn_move_sopmal_bbs_list('','','<c:out value="${crmTopMenuList.url}"/>')" target="_blank" style="cursor:pointer"><c:out value="${crmTopMenuList.menuNm}"/></a></li>
|
||||
</c:when>
|
||||
<c:when test = "${fn:contains(crmTopMenuList.url,'/crm/ordr/selectMngrOrdrRegistForm')}"><%--주문등록--%>
|
||||
<li><a onclick="fn_move_mngr_ordr_regist_form('${cnsltVO.mbrInnb}','${cnsltVO.mbrDvCd}','${cnsltVO.mbtlnb}')" target="_blank" style="cursor:pointer"><c:out value="${crmTopMenuList.menuNm}"/></a></li>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<li><a href="<c:out value="${crmTopMenuList.url}"/>" target="_blank"><c:out value="${crmTopMenuList.menuNm}"/></a></li>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<div class="header-right__linkContainer">
|
||||
<a class="btn outline xsm" href="/mngr/main" title="관리자 바로가기" target="adminWin">
|
||||
<i class="icon icon_headerLaptop"></i>
|
||||
관리자 바로가기
|
||||
</a>
|
||||
</div>
|
||||
<div class="header-right__user-info">
|
||||
<c:out value="${userNm}"/>님
|
||||
<div class="userInfo-float">
|
||||
<div class="userInfo-float__top">
|
||||
<i class="icon icon_user-info-big"></i>
|
||||
<div class="userInfo-float__info">
|
||||
<p class="userInfo-float__info-row">
|
||||
${userNm}
|
||||
</p>
|
||||
<p class="userInfo-float__info-row">
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="userInfo-float__bottom">
|
||||
<a href="/mngr/setup/mngr/selectMngrInfoInqireForm" class="btn outline sm">정보수정</a>
|
||||
<a href="/logout" class="btn dark sm">로그아웃</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="header-right__logout" onclick="location.href='/logout'">
|
||||
<i class="icon icon_logout-white"></i>
|
||||
로그아웃
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id = 'popupDiv'></div>
|
||||
|
||||
<!-- crm 전화 쇼핑몰 이름 -->
|
||||
<div id="callSopmalNm" style="
|
||||
width:100%; height:35px;
|
||||
background-color:#ccc;
|
||||
position:absolute; top:0px;
|
||||
/* display: flex; */
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-right: 10px;
|
||||
display: none;
|
||||
">
|
||||
<span id="sopmalNm" style="
|
||||
display: inline-block; /* 인라인 블록으로 변경 */
|
||||
line-height: 35px; /* 세로 중앙 정렬 */
|
||||
width: calc(100% - 100px); /* 버튼 공간을 고려한 너비 */
|
||||
text-align: center; /* 텍스트 중앙 정렬 */
|
||||
"></span>
|
||||
|
||||
<button onclick="fn_sopmal_bar_close();" style="
|
||||
position: absolute; /* 절대 위치로 설정 */
|
||||
right: 10px; /* 오른쪽 끝에서 약간 떨어짐 */
|
||||
line-height: 35px; /* 세로 중앙 정렬 */
|
||||
">닫기</button>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
</html>
|
||||
Reference in New Issue
Block a user