9439 lines
318 KiB
Plaintext
9439 lines
318 KiB
Plaintext
|
|
|
|
<script type="text/javascript" src="/bower_components/jquery/js/jquery.min.js"></script>
|
|
|
|
<script type="text/javascript" src="/bower_components/jquery-ui/js/jquery-ui.min.js"></script>
|
|
<script type="text/javascript" src="/bower_components/popper.js/js/popper.min.js"></script>
|
|
<script type="text/javascript" src="/bower_components/bootstrap/js/bootstrap.min.js"></script>
|
|
|
|
<script src="/pages/waves/js/waves.min.js"></script>
|
|
|
|
<script type="text/javascript" src="/bower_components/jquery-slimscroll/js/jquery.slimscroll.js"></script>
|
|
<script src="/js/pcoded.min.js"></script>
|
|
<script src="/js/vertical/vertical-layout.min.js"></script>
|
|
|
|
<script type="text/javascript" src="/js/script.min.js"></script>
|
|
|
|
|
|
<script src="/pages/widget/amchart/amcharts.js"></script>
|
|
<script src="/pages/widget/amchart/gauge.js"></script>
|
|
<script src="/pages/widget/amchart/serial.js"></script>
|
|
<script src="/pages/widget/amchart/light.js"></script>
|
|
<script src="/pages/widget/amchart/pie.min.js"></script>
|
|
<script src="/pages/widget/amchart/ammap.min.js"></script>
|
|
<script src="/pages/widget/amchart/usaLow.js"></script>
|
|
|
|
|
|
<script src="/pages/chart/float/jquery.flot.js"></script>
|
|
<script src="/pages/chart/float/jquery.flot.categories.js"></script>
|
|
<script src="/pages/chart/float/curvedLines.js"></script>
|
|
<script src="/pages/chart/float/jquery.flot.tooltip.min.js"></script>
|
|
|
|
<script src="/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
|
|
<script src="/bower_components/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
|
|
<script src="/pages/data-table/js/jszip.min.js"></script>
|
|
<script src="/pages/data-table/js/pdfmake.min.js"></script>
|
|
<script src="/pages/data-table/js/vfs_fonts.js"></script>
|
|
<script src="/bower_components/datatables.net-buttons/js/buttons.print.min.js"></script>
|
|
<script src="/bower_components/datatables.net-buttons/js/buttons.html5.min.js"></script>
|
|
<script src="/bower_components/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
|
|
<script src="/bower_components/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
|
|
<script src="/bower_components/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>
|
|
|
|
<script type="text/javascript" src="https://cdn.iamport.kr/js/iamport.payment-1.1.5.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/admindek/bower_components/jquery-slimscroll/js/jquery.slimscroll.js"></script>
|
|
|
|
<script type="text/javascript" src="/admindek/bower_components/modernizr/js/modernizr.js"></script>
|
|
<script type="text/javascript" src="/admindek/bower_components/modernizr/js/css-scrollbars.js"></script>
|
|
|
|
<script src="/admindek/bower_components/jquery.steps/js/jquery.steps.js" type="text/javascript"></script>
|
|
|
|
|
|
|
|
<script src="/admindek/bower_components/jquery-validation/js/jquery.validate.js" type="text/javascript"></script>
|
|
<script src="/admindek/js/jquery.mask.min.js" type="text/javascript"></script>
|
|
|
|
|
|
<script type="text/javascript" src="/admindek/bower_components/jquery-bar-rating/js/jquery.barrating.js"></script>
|
|
<script type="text/javascript" src="/admindek/js/rating.js"></script>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/admin/upload') {%>
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<script src="/admindek/js/underscore-min.js" type="text/javascript"></script>
|
|
<script src="/admindek/bower_components/moment/js/moment.min.js" type="text/javascript"></script>
|
|
<script src="/admindek/bower_components/moment/locale/ko.js" type="text/javascript"></script>
|
|
<script type="text/javascript" src="/admindek/pages/form-validation/validate.js"></script>
|
|
|
|
<!--
|
|
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
|
|
-->
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
|
|
|
|
<script src="https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="/json-browse/jquery.json-browse.js"></script>
|
|
|
|
|
|
<script src="/admindek/pages/file-upload/dropzone-amd-module.min.js" type="text/javascript"></script>
|
|
|
|
|
|
<script type="text/javascript" src="/admindek/js/bootstrap-growl.min.js"></script>
|
|
|
|
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.js"></script>
|
|
<script src="/admindek/js/summernote/summernote-ko-KR.js"></script>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
var webSocket;
|
|
var firstTime = true;
|
|
|
|
function connectWsChat()
|
|
{
|
|
try
|
|
{
|
|
window.WebSocket = window.WebSocket || window.MozWebSocket;
|
|
var host = '<%= infos.appInfo.wsUrl %>';
|
|
webSocket = new WebSocket( host );
|
|
webSocket.onopen = function()
|
|
{
|
|
//console.log('wss open!!!')
|
|
sendWsChat(JSON.stringify({cmd: 'loc', data: '<%= infos.rawLoc %>'}))
|
|
|
|
<% if (infos.appInfo.type === 'chachachak' && infos.loc.startsWith('/depot')) {%>
|
|
|
|
sendWsChat(JSON.stringify({cmd: 'select', target: 'locCount', loc: '<%= infos.rawLoc %>'}))
|
|
<%} %>
|
|
}
|
|
webSocket.onmessage = function( msg )
|
|
{
|
|
console.log('wss onmessage, msg=', msg)
|
|
var parsedMsg = JSON.parse(msg.data)
|
|
switch (parsedMsg.rpl) {
|
|
case 'locCount':
|
|
notify('이 화면을 보고 있는 사람의 수 : ' + parsedMsg.data , 'inverse');
|
|
break;
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
webSocket.onclose = function()
|
|
{
|
|
console.log('wss onclose')
|
|
}
|
|
}
|
|
catch( exception )
|
|
{
|
|
console.log('wss exception', exception)
|
|
}
|
|
}
|
|
function isConnectedWsChat() {
|
|
if( webSocket && webSocket.readyState==1 ) {
|
|
return true;
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
|
|
function sendWsChat (msg) {
|
|
|
|
if( isConnectedWsChat() ) {
|
|
try{
|
|
webSocket.send( msg );
|
|
} catch( exception ){
|
|
console.log('wss sendWsChat() exception', exception)
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
Date.prototype.format = function(f) {
|
|
if (!this.valueOf()) return " ";
|
|
|
|
var weekName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
|
|
var d = this;
|
|
var h = null;
|
|
|
|
return f.replace(/(yyyy|yy|MM|dd|E|hh|mm|ss|a\/p)/gi, function($1) {
|
|
switch ($1) {
|
|
case "yyyy": return d.getFullYear();
|
|
case "yy": return (d.getFullYear() % 1000).zf(2);
|
|
case "MM": return (d.getMonth() + 1).zf(2);
|
|
case "dd": return d.getDate().zf(2);
|
|
case "E": return weekName[d.getDay()];
|
|
case "HH": return d.getHours().zf(2);
|
|
case "hh": return ((h = d.getHours() % 12) ? h : 12).zf(2);
|
|
case "mm": return d.getMinutes().zf(2);
|
|
case "ss": return d.getSeconds().zf(2);
|
|
case "a/p": return d.getHours() < 12 ? "오전" : "오후";
|
|
default: return $1;
|
|
}
|
|
});
|
|
};
|
|
|
|
String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;};
|
|
String.prototype.zf = function(len){return "0".string(len - this.length) + this;};
|
|
Number.prototype.zf = function(len){return this.toString().zf(len);};
|
|
|
|
var entityMap = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"',
|
|
"'": ''',
|
|
'/': '/',
|
|
'`': '`',
|
|
'=': '='
|
|
};
|
|
|
|
function escapeHtml(string) {
|
|
return String(string).replace(/[&<>"'`=\/]/g, function(s) {
|
|
return entityMap[s];
|
|
});
|
|
}
|
|
|
|
|
|
function getFormattedNow () {
|
|
// return new Date().format("yyyy년 MM월 dd일 a/p hh시 mm분 ss초")
|
|
return new Date().format("yyyy년 MM월 dd일 a/p hh시 mm분")
|
|
}
|
|
|
|
|
|
var previewSubscriptionItem = {
|
|
title: '정기배송 상품 샘플 200g',
|
|
flags: 'new,hot',
|
|
detail: '아빠콩에서 가장 추천하는 매월의 추천 원두로 믹스한 블랜드를 200g 보내 드립니다. 혼자서 드시는 분에게 적당한 분량입니다.',
|
|
image: '/images/beans256.jpg',
|
|
amount: 8500
|
|
}
|
|
|
|
|
|
<% if (infos.loc === '/admin/subscription/edit') {%>
|
|
<% if (hero !== null) {%>
|
|
<%-'previewSubscriptionItem = ' + JSON.stringify(hero)%>
|
|
<%} %>
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type, message, created, name
|
|
function makeSupportItemTag (hero) {
|
|
|
|
var tag = ''
|
|
|
|
switch (hero.type) {
|
|
case 'send':
|
|
tag += '<div class="row m-b-20 send-chat">'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">' + hero.message + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>' + moment.utc(hero.created).locale("ko").fromNow() + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col-auto p-l-0">'
|
|
<% if (infos.userInfo.profile.photo_url != '') { %>
|
|
tag += ' <img src="<%=infos.userInfo.profile.photo_url%>" alt="user image" class="img-radius img-40">' + hero.name
|
|
<% } else { %>
|
|
tag += ' ' + hero.name
|
|
<% } %>
|
|
// tag += ' <img src="/images/avatar-3.jpg" alt="user image" class="img-radius img-40">' + hero.name
|
|
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
break;
|
|
|
|
case 'received':
|
|
tag += '<div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
tag += ' <img src="/images/avatar-2.jpg" alt="user image" class="img-radius img-40">' + hero.name
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">' + hero.message + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>' + moment.utc(hero.created).locale("ko").fromNow() + '</p>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
break;
|
|
case 'system':
|
|
tag += '<div class="col-sm-12">'
|
|
tag += ' <div class="alert alert-info">'
|
|
tag += ' <strong>' + hero.message + '</strong>'
|
|
tag += ' <code>' + moment.utc(hero.created).locale("ko").fromNow() + '</code>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
tag += '<div>' + hero.message + ' from ' + hero.name + ' at ' + moment.utc(hero.created).locale("ko").fromNow() + '</div>'
|
|
}
|
|
return tag
|
|
}
|
|
|
|
|
|
function makeProfileTag (displayText, cat, hero) {
|
|
var tag = ''
|
|
|
|
tag += '<a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/select\', {target: \'pid\', hero: \'' + hero + '\', cat: \'' + cat + '\'})">' + displayText + '</a>'
|
|
return tag
|
|
}
|
|
|
|
function makeCommentItemTag (hero) {
|
|
var tag = ''
|
|
|
|
var tmpWidth = $( '#widthTag' ).width();
|
|
|
|
if (tmpWidth < 400) {
|
|
|
|
tag += ' ' + makeProfileTag(hero.nick, 'comment', hero.serial) + ''
|
|
tag += ' <div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">' + hero.comment + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>' + moment(hero.created).locale("ko").fromNow() + '</p>'
|
|
tag += ' </div>'
|
|
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
|
|
|
|
} else {
|
|
tag += ' <div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
// tag += ' <img src="/images/avatar-2.jpg" alt="user image" class="img-radius img-40">'
|
|
tag += ' ' + makeProfileTag(hero.nick, 'comment', hero.serial) + ''
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">' + hero.comment + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>' + moment(hero.created).locale("ko").fromNow() + '</p>'
|
|
tag += ' </div>'
|
|
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.appInfo.type === 'linkcare') {%>
|
|
var commentListId = 'commentList_' + hero.tid
|
|
var currentDomain = elderInfo.eid
|
|
<%} else {%>
|
|
var commentListId = 'commentList'
|
|
var currentDomain = getParams['cid']
|
|
<%} %>
|
|
|
|
var currentLikeInfo = null
|
|
for (var i = 0; i < likeInfos.length; i++) {
|
|
if (likeInfos[i].cid == hero.cid) {
|
|
currentLikeInfo = likeInfos[i]
|
|
}
|
|
}
|
|
// console.log('makeCommentItemTag(), hero=', hero)
|
|
// console.log('makeCommentItemTag(), likeInfos=', likeInfos)
|
|
// console.log('makeCommentItemTag(), currentLikeInfo=', currentLikeInfo)
|
|
|
|
if (hero.myFlag === false) {
|
|
/*
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:comment\', tag: \'like\', hero: \'' + hero.cid + '\', domain: \'' + currentDomain + '\', commentListId: \'' + commentListId + '\'});" title="좋아요" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : '') : '') + ' waves-effect waves-light">'
|
|
tag += ' <i class="fa fa-thumbs-up"></i>' + numberAbout(hero.like_count)
|
|
tag += ' </button>'
|
|
*/
|
|
if (tmpWidth < 400) {
|
|
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:comment\', tag: \'like\', hero: \'' + hero.cid + '\', domain: \'' + currentDomain + '\', commentListId: \'' + commentListId + '\'});" title="좋아요" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : '') : '') + ' waves-effect waves-light" style="padding:0px">'
|
|
tag += ' <i class="fa fa-thumbs-up"></i>' + numberAbout(hero.like_count)
|
|
tag += ' </button>'
|
|
} else {
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:comment\', tag: \'like\', hero: \'' + hero.cid + '\', domain: \'' + currentDomain + '\', commentListId: \'' + commentListId + '\'});" title="좋아요" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : '') : '') + ' waves-effect waves-light">'
|
|
tag += ' <i class="fa fa-thumbs-up"></i>' + numberAbout(hero.like_count)
|
|
tag += ' </button>'
|
|
}
|
|
|
|
|
|
<% if (infos.appInfo.type === 'chachachak') {%>
|
|
|
|
if (tmpWidth < 400) {
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:comment\', tag: \'dislike\', hero: \'' + hero.cid + '\', domain: \'' + currentDomain + '\', commentListId: \'' + commentListId + '\'});" title="반대" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'dislike' ? 'btn-danger' : '') : '') + ' waves-effect waves-light" style="padding:0px">'
|
|
tag += ' <i class="fa fa-thumbs-down"></i>' + numberAbout(hero.dislike_count)
|
|
tag += ' </button>'
|
|
} else {
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:comment\', tag: \'dislike\', hero: \'' + hero.cid + '\', domain: \'' + currentDomain + '\', commentListId: \'' + commentListId + '\'});" title="반대" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'dislike' ? 'btn-danger' : '') : '') + ' waves-effect waves-light">'
|
|
tag += ' <i class="fa fa-thumbs-down"></i>' + numberAbout(hero.dislike_count)
|
|
tag += ' </button>'
|
|
}
|
|
|
|
|
|
|
|
<%} %>
|
|
} else {
|
|
|
|
if (tmpWidth < 400) {
|
|
tag += ' <button type="button" onclick="alert(\'내가 단 댓글입니다.\')" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : '') : '') + ' waves-effect waves-light" style="padding:0px">'
|
|
tag += ' <i class="fa fa-thumbs-up"></i>' + numberAbout(hero.like_count)
|
|
tag += ' </button>'
|
|
|
|
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/delete\', {target: \'comment\', hero: \'' + hero.cid + '\', tid: \'' + hero.tid + '\', commentListId: \'' + commentListId + '\'});" title="삭제" class="btn btn-mini waves-effect waves-light" style="padding:0px">'
|
|
tag += ' <i class="fa fa-trash"></i>'
|
|
tag += ' </button>'
|
|
|
|
} else {
|
|
tag += ' <button type="button" onclick="alert(\'내가 단 댓글입니다.\')" class="btn btn-mini ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : '') : '') + ' waves-effect waves-light">'
|
|
tag += ' <i class="fa fa-thumbs-up"></i>' + numberAbout(hero.like_count)
|
|
tag += ' </button>'
|
|
|
|
|
|
tag += ' <button type="button" onclick="doAllThingsInSafe(\'local/delete\', {target: \'comment\', hero: \'' + hero.cid + '\', tid: \'' + hero.tid + '\', commentListId: \'' + commentListId + '\'});" title="삭제" class="btn btn-mini waves-effect waves-light">'
|
|
tag += ' <i class="fa fa-trash"></i>'
|
|
tag += ' </button>'
|
|
|
|
}
|
|
|
|
}
|
|
tag += ' </div>'
|
|
|
|
tag += ' </div>'
|
|
|
|
|
|
return tag
|
|
}
|
|
|
|
function numberAbout (num) {
|
|
return num + ''
|
|
if (num < 1) {
|
|
return '0'
|
|
} else if (num < 10) {
|
|
return '1+'
|
|
} else if (num < 30) {
|
|
return '10+'
|
|
} else if (num < 50) {
|
|
return '30+'
|
|
} else if (num < 80) {
|
|
return '50+'
|
|
} else if (num < 100) {
|
|
return '80+'
|
|
} else {
|
|
return '100+'
|
|
}
|
|
}
|
|
|
|
function makeGuideItemTag (hero, noLinkFlag) {
|
|
var tag = ''
|
|
|
|
tag += ' <div class="card list-view-media">'
|
|
tag += ' <div class="card-block">'
|
|
tag += ' <div class="media">'
|
|
if (noLinkFlag === undefined) {
|
|
tag += ' <a class="media-left" href="/guides/detail?gid=' + hero.gid + '">'
|
|
}
|
|
|
|
tag += ' <img class="media-object card-list-img" src="' + (hero.profile_url === '' ? '/images/avatar-0.jpg' : hero.profile_url) + '" width="100" height="100" alt="Generic placeholder image">'
|
|
if (noLinkFlag === undefined) {
|
|
tag += ' </a>'
|
|
}
|
|
tag += ' <div class="media-body">'
|
|
tag += ' <div class="col-xs-12">'
|
|
tag += ' <h6 class="d-inline-block">'
|
|
tag += ' ' + hero.nick
|
|
tag += ' </h6>'
|
|
tag += ' <label class="label label-warning">완료된 동행 카운트 ' + numberAbout(hero.done_count) + '</label>'
|
|
tag += ' <i class="fa fa-star f-12 ' + (hero.score >= 1 ? 'text-c-yellow' : 'text-default') + '"></i>'
|
|
tag += ' <i class="fa fa-star f-12 ' + (hero.score >= 2 ? 'text-c-yellow' : 'text-default') + '"></i>'
|
|
tag += ' <i class="fa fa-star f-12 ' + (hero.score >= 3 ? 'text-c-yellow' : 'text-default') + '"></i>'
|
|
tag += ' <i class="fa fa-star f-12 ' + (hero.score >= 4 ? 'text-c-yellow' : 'text-default') + '"></i>'
|
|
tag += ' <i class="fa fa-star f-12 ' + (hero.score >= 5 ? 'text-c-yellow' : 'text-default') + '"></i>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="f-13 text-muted m-b-15">좋아요 : ' + numberAbout(hero.like_count) + '회</div>'
|
|
tag += ' <p>' + hero.memo + '</p>'
|
|
tag += ' <div class="m-t-15">'
|
|
tag += ' <button type="button" data-toggle="tooltip" title="메세지" class="btn btn-info btn-mini waves-effect waves-light">'
|
|
tag += ' <span class="icofont icofont-chat"></span>'
|
|
tag += ' </button>'
|
|
tag += ' <button type="button" data-toggle="tooltip" title="즐겨찾기" class="btn btn-info btn-mini waves-effect waves-light">'
|
|
tag += ' <span class="icofont icofont-star"></span>'
|
|
tag += ' </button>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
function statusToString (item) {
|
|
var tag = ''
|
|
switch (item.status) {
|
|
case 0:
|
|
tag = '승인대기중'
|
|
break;
|
|
case 1:
|
|
tag = '등록됨'
|
|
break;
|
|
case 4:
|
|
tag = '승인보류됨 - ' + item.reject_reason
|
|
break;
|
|
default:
|
|
tag = '' + item.status
|
|
break;
|
|
|
|
}
|
|
return tag
|
|
}
|
|
|
|
|
|
function makeInfoTag (dataType, data) {
|
|
|
|
var tag = ''
|
|
if (data.length === 0) {
|
|
tag += '데이터가 없습니다.'
|
|
} else {
|
|
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
switch (dataType) {
|
|
case 'center':
|
|
tag += ' <dt class="col-sm-3">센터명</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].name + '</dd>'
|
|
tag += ' <dt class="col-sm-3">대표자</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].owner + '</dd>'
|
|
tag += ' <dt class="col-sm-3">주소</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].address + ' ' + data[0].address_detail + '</dd>'
|
|
tag += ' <dt class="col-sm-3">전화번호</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].phone + '</dd>'
|
|
tag += ' <dt class="col-sm-3">이메일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].email + '</dd>'
|
|
tag += ' <dt class="col-sm-3">인사말</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].greeting + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3"></dt>'
|
|
tag += ' <dd class="col-sm-9"></dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">현재상태</dt>'
|
|
tag += ' <dd class="col-sm-9">' + statusToString(data[0]) + '</dd>'
|
|
|
|
break;
|
|
|
|
case 'staff':
|
|
tag += ' <dt class="col-sm-3">성명</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].name + '</dd>'
|
|
tag += ' <dt class="col-sm-3">핸드폰</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].phone + '</dd>'
|
|
tag += ' <dt class="col-sm-3">이메일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].email + '</dd>'
|
|
tag += ' <dt class="col-sm-3">인사말</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].greeting + '</dd>'
|
|
tag += ' <dt class="col-sm-3">프로필사진</dt>'
|
|
if (data[0].profile_url != null && data[0].profile_url != '') {
|
|
var tmpUrl = (data[0].profile_url + '').trim()
|
|
tag += ' <dd class="col-sm-9"><img height="180" width="180" src="' + tmpUrl + '"></dd>'
|
|
} else {
|
|
tag += ' <dd class="col-sm-9">없음</dd>'
|
|
}
|
|
|
|
tag += ' <dt class="col-sm-3">상태</dt>'
|
|
var statusText = ''
|
|
switch (data[0].status) {
|
|
case 0:
|
|
statusText = '초대 대기중'
|
|
break;
|
|
case 1:
|
|
statusText = '등록됨'
|
|
break;
|
|
default:
|
|
statusText = '알수없음(' + data[0].status + ')'
|
|
break;
|
|
}
|
|
tag += ' <dd class="col-sm-9">' + statusText + '</dd>'
|
|
|
|
|
|
if (data[0].status != 1) {
|
|
|
|
tag += ' <dt class="col-sm-3">초대방법</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].invite_by + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">초대코드</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].invite_code + '</dd>'
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'elder':
|
|
tag += ' <dt class="col-sm-3">성명</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].name + '</dd>'
|
|
tag += ' <dt class="col-sm-3">메모</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].memo + '</dd>'
|
|
tag += ' <dt class="col-sm-3">프로필사진 주소</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].profile_url + '</dd>'
|
|
|
|
|
|
if (data[0].profile_url != null && data[0].profile_url != '') {
|
|
tag += ' <dt class="col-sm-3">프로필 사진</dt>'
|
|
tag += ' <dd class="col-sm-9"><img height="180" width="180" src=' + data[0].profile_url + '>' + '</dd>'
|
|
|
|
} else {
|
|
tag += ' <dt class="col-sm-3">프로필 사진</dt>'
|
|
tag += ' <dd class="col-sm-9">없음</dd>'
|
|
}
|
|
|
|
|
|
|
|
tag += ' <dt class="col-sm-3">등록상태</dt>'
|
|
var statusText = '등록중'
|
|
switch (data[0].status) {
|
|
case 0:
|
|
statusText = '등록중'
|
|
break;
|
|
case 4:
|
|
statusText = '삭제됨'
|
|
break;
|
|
case 9:
|
|
statusText = '영구삭제됨'
|
|
break;
|
|
|
|
default:
|
|
statusText = '알수없음(' + data[0].status + ')'
|
|
|
|
}
|
|
tag += ' <dd class="col-sm-9">' + statusText + '</dd>'
|
|
tag += ' <dt class="col-sm-3">최근 수정일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + moment.utc(data[0].updated).local().locale("ko").format('LLLL') + '</dd>'
|
|
tag += ' <dt class="col-sm-3">등록일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + moment.utc(data[0].created).local().locale("ko").format('LLLL') + '</dd>'
|
|
|
|
break;
|
|
|
|
case 'family':
|
|
tag += ' <dt class="col-sm-3">이름</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].name + '</dd>'
|
|
tag += ' <dt class="col-sm-3">관계</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].relations + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">전화번호</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].phone + '</dd>'
|
|
tag += ' <dt class="col-sm-3">이메일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].email + '</dd>'
|
|
tag += ' <dt class="col-sm-3">프로필사진</dt>'
|
|
if (data[0].profile_url != null && data[0].profile_url != '') {
|
|
var tmpUrl = (data[0].profile_url + '').trim()
|
|
tag += ' <dd class="col-sm-9"><img height="180" width="180" src="' + tmpUrl + '"></dd>'
|
|
} else {
|
|
tag += ' <dd class="col-sm-9">없음</dd>'
|
|
}
|
|
|
|
tag += ' <dt class="col-sm-3">상태</dt>'
|
|
var statusText = ''
|
|
switch (data[0].status) {
|
|
case 0:
|
|
statusText = '초대 대기중'
|
|
break;
|
|
case 1:
|
|
statusText = '등록됨'
|
|
break;
|
|
default:
|
|
statusText = '알수없음(' + data[0].status + ')'
|
|
break;
|
|
}
|
|
tag += ' <dd class="col-sm-9">' + statusText + '</dd>'
|
|
|
|
|
|
if (data[0].status != 1) {
|
|
|
|
tag += ' <dt class="col-sm-3">초대방법</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].invite_by + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">초대코드</dt>'
|
|
tag += ' <dd class="col-sm-9">' + data[0].invite_code + '</dd>'
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
tag += ' </dl>'
|
|
}
|
|
|
|
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
function refreshProfileInfo (data) {
|
|
// center_info
|
|
var tag = makeInfoTag('<%=infos.profileType%>', data)
|
|
$('#profile_info').html(tag)
|
|
|
|
}
|
|
|
|
|
|
|
|
function refreshCenterInfo (data) {
|
|
// center_info
|
|
var tag = makeInfoTag('center', data)
|
|
$('#center_info').html(tag)
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function refreshElderInfo (data) {
|
|
// center_info
|
|
var tag = makeInfoTag('elder', data)
|
|
$('#elder_info').html(tag)
|
|
|
|
}
|
|
|
|
function refreshFamilyInfo (data) {
|
|
// center_info
|
|
var tag = makeInfoTag('family', data)
|
|
$('#family_info').html(tag)
|
|
|
|
}
|
|
|
|
|
|
function refreshStaffInfo (data) {
|
|
// center_info
|
|
var tag = makeInfoTag('staff', data)
|
|
$('#staff_info').html(tag)
|
|
|
|
}
|
|
|
|
function shorten (src, n) {
|
|
return src.substr(0, n) + ' ... ' + src.substr(src.length - n, src.length - 1)
|
|
}
|
|
|
|
|
|
function refreshRankTable (data) {
|
|
|
|
var tableId = 'rankTable'
|
|
|
|
$('#' + tableId + ' tbody').empty()
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
var newRow = $('<tr onclick="doAllThingsInSafe(\'goto\', {target: \'/profile?pid=' + data[i].pid + '\'})">');
|
|
var cols = ''
|
|
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
if (data[i].photo_url != '') {
|
|
cols += ' <img src="' + data[i].photo_url + '" alt="user image" class="img-radius img-40 align-top m-r-15">'
|
|
} else {
|
|
cols += ' <img src="/images/no_profile.png" alt="user image" class="img-radius img-40 align-top m-r-15">'
|
|
}
|
|
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].display_name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0">' + data[i].address_hint + '</p>'
|
|
cols += ' </div>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
cols += ' <td>' + data[i].score_sum + '</td>'
|
|
cols += ' <td>' + moment(data[i].created).locale("ko").fromNow() + '</td>'
|
|
cols += ' <td>'
|
|
if (data[i].accompanyFlag == true) {
|
|
cols += ' <label class="badge badge-inverse-primary">동반 가능</label>'
|
|
} else {
|
|
}
|
|
cols += ' </td>'
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
function makeActionTag (actionTag) {
|
|
var result = actionTag
|
|
|
|
var tmpAry = actionTag.split(':')
|
|
|
|
var action = tmpAry.length > 1 ? actionTag.replace(':' + tmpAry[tmpAry.length - 1], '') : actionTag
|
|
var target = tmpAry.length > 1 ? tmpAry[tmpAry.length - 1] : ''
|
|
|
|
|
|
switch (action) {
|
|
case 'visit':
|
|
result = '오늘 방문'
|
|
break;
|
|
|
|
case 'read':
|
|
result = '<a href="/depot/detail?cid=' + target + '">매물 확인</a>'
|
|
break;
|
|
|
|
case 'post:rate':
|
|
result = '<a href="/depot/detail?cid=' + target + '">매물 평가</a>'
|
|
break;
|
|
|
|
case 'post:comment':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글 등록</a>'
|
|
break;
|
|
|
|
case 'post:comment:like':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글에 좋아요</a>'
|
|
break;
|
|
|
|
case 'post:comment:dislike':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글에 싫어요</a>'
|
|
break;
|
|
|
|
|
|
case 'got:rate:good':
|
|
result = '<a href="/depot/detail?cid=' + target + '">긍정평가 받음</a>'
|
|
break;
|
|
|
|
case 'got:rate:notbad':
|
|
result = '<a href="/depot/detail?cid=' + target + '">평가 받음</a>'
|
|
break;
|
|
|
|
case 'got:rate:well':
|
|
result = '<a href="/depot/detail?cid=' + target + '">모호한 평가 받음</a>'
|
|
break;
|
|
|
|
case 'got:rate:bad':
|
|
result = '<a href="/depot/detail?cid=' + target + '">부정평가 받음</a>'
|
|
break;
|
|
|
|
|
|
case 'got:comment':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글 받음</a>'
|
|
break;
|
|
|
|
case 'got:comment:like':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글 좋아요 받음</a>'
|
|
break;
|
|
|
|
case 'got:comment:dislike':
|
|
result = '<a href="/depot/detail?cid=' + target + '">댓글 싫어요 받음</a>'
|
|
break;
|
|
|
|
case 'post:depot':
|
|
result = '<a href="/depot/detail?cid=' + target + '">매물 등록</a>'
|
|
break;
|
|
|
|
case 'accompany':
|
|
result = '<a href="/depot/detail?cid=' + target + '">구매동행 완료</a>'
|
|
break;
|
|
|
|
case 'post:review':
|
|
result = '<a href="/depot/detail?cid=' + target + '">동행 후기 등록</a>'
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
function refreshScoreDetailTable (data) {
|
|
|
|
var tableId = 'scoreDetailTable'
|
|
|
|
$('#' + tableId + ' tbody').empty()
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
var newRow = $('<tr>')
|
|
var cols = ''
|
|
|
|
cols += ' <td>' + data[i].serial + '</td>'
|
|
cols += ' <td>' + makeActionTag(data[i].action_tag) + '</td>'
|
|
cols += ' <td>' + data[i].score + '</td>'
|
|
cols += ' <td>' + moment.utc(data[i].created).local().locale("ko").format('LLLL') + '</td>'
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function refreshSquareTable (data) {
|
|
|
|
var tableId = 'square-table'
|
|
|
|
$('#' + tableId + ' tbody').empty()
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $('<tr onclick="doAllThingsInSafe(\'goto\', {target: \'/square/detail?cid=' + data[i].cid + '\'})">');
|
|
var cols = "";
|
|
|
|
|
|
cols += '<td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0">' + data[i].address + '</p>'
|
|
cols += ' </div>'
|
|
cols += ' </div>'
|
|
cols += '</td>'
|
|
|
|
cols += '<td>'
|
|
cols += '<a href="mailto:' + data[i].email + '">이메일 보내기</a>'
|
|
cols += '</td>'
|
|
|
|
cols += '<td>' + '<a href="tel:' + data[i].phone + '">전화 걸기</a>' + '</td>'
|
|
|
|
cols += '<td>' + moment.utc(data[i].created).local().locale("ko").format('LL') + '</td>'
|
|
|
|
cols += '<td>'
|
|
cols += ' <label class="badge badge-inverse-success">링크케어</label>'
|
|
cols += ' <label class="badge badge-inverse-primary">국비</label>'
|
|
cols += ' <label class="badge badge-inverse-default">국비</label>'
|
|
cols += ' <label class="badge badge-inverse-danger">단거</label>'
|
|
cols += ' <label class="badge badge-inverse-warning">태그1</label>'
|
|
cols += ' <label class="badge badge-inverse-info">태그2</label>'
|
|
cols += '</td>'
|
|
|
|
<% if (infos.userInfo.adminFlag === true) {%>
|
|
cols += ' <td>'
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/square/edit?cid=' + data[i].cid + '\'})"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'square\', hero: \'' + data[i].cid + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
cols += ' </td>'
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function refreshStaffList (data) {
|
|
// console.log('data=', data)
|
|
$('#staffListTable tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
cols += ' <a href="/staff/detail?sid=' + data[i].sid + '">'
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0">' + data[i].phone + '</p>'
|
|
cols += ' </div>'
|
|
cols += ' </a>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
switch (data[i].status) {
|
|
case 0:
|
|
cols += ' 승인 대기중'
|
|
break;
|
|
case 1:
|
|
cols += ' 등록됨'
|
|
break;
|
|
default:
|
|
cols += ' 알수없음(' + data[i].status + ')'
|
|
break;
|
|
}
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' ' + moment.utc(data[i].created).local().locale("ko").format('LLLL')
|
|
cols += ' </td>'
|
|
|
|
|
|
cols += ' <td>'
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/staff/edit?sid=' + data[i].sid + '\'})"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'staff\', hero: \'' + data[i].sid + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
cols += ' </td>'
|
|
|
|
|
|
|
|
|
|
|
|
newRow.append(cols);
|
|
$("#staffListTable").append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$("#centerListTable").append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
var postPool = {}
|
|
|
|
|
|
function makeTimelineItemForSquare (centerInfo, timelineItem) {
|
|
|
|
|
|
var tag = ''
|
|
|
|
tag += '<div class="col-sm-12">'
|
|
tag += ' <div class="card">'
|
|
tag += ' <div class="card-header">'
|
|
tag += ' <div class="d-inline-block align-middle">'
|
|
tag += ' <a href="javascript:void(0);">'
|
|
var profile_url = '/images/avatar-4.jpg'
|
|
tag += ' <img src="' + profile_url + '" alt="user image" class="img-radius img-40 align-top m-r-15" />'
|
|
tag += ' <div class="d-inline-block">'
|
|
tag += ' <h6>' + centerInfo.name + '</h6>'
|
|
tag += ' <p class="text-muted m-b-0">' + moment.utc(timelineItem.created).local().locale("ko").format('LLLL') + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' </a>'
|
|
|
|
tag += ' <div class="card-header-right">'
|
|
|
|
<% if (infos.loc === '/timeline') { %>
|
|
tag += ' <i class="feather icon-edit" onclick="doAllThingsInSafe(\'goto\', {target: \'/post/edit?pid=' + timelineItem.pid + '\'})"></i>'
|
|
tag += ' <i class="feather icon-trash" onclick="doAllThingsInSafe(\'local/delete\', {target: \'post\', hero: \'' + timelineItem.pid + '\'})"></i>'
|
|
|
|
<% } %>
|
|
|
|
|
|
|
|
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
tag += ' </div>'
|
|
|
|
|
|
tag += ' </div>'
|
|
tag += ' <div class="card" style="margin:20px">'
|
|
|
|
var filesAry = JSON.parse(timelineItem.files)
|
|
for (var i = 0; i < filesAry.length; i++) {
|
|
// tag += ' <img class="post-imv-cover" src="' + filesAry[i] + '">'
|
|
if (filesAry[i] !== null) {
|
|
|
|
var tmpNameAry = filesAry[i].name.split('.')
|
|
var tmpExt = tmpNameAry[tmpNameAry.length - 1]
|
|
|
|
if (tmpExt.toLowerCase() == 'mp4') {
|
|
tag += '<video class="d-block img-fluid img-thumbnail" style="object-fit: contain;" controls><source src="' + filesAry[i].localUrl + '" type="video/mp4">Your browser does not support the video tag.<a href="' + filesAry[i].localUrl + '">' + filesAry[i].localUrl + '</a></video>'
|
|
|
|
} else {
|
|
tag += ' <img class="d-block img-fluid img-thumbnail" style="object-fit: contain;" src="' + filesAry[i].localUrl + '">'
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
tag += ' <p class="content-group">'
|
|
tag += timelineItem.content
|
|
tag += ' </p>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="chat-card">'
|
|
tag += ' <div class="card-block">'
|
|
var commentListId = 'commentList_' + timelineItem.pid
|
|
// console.log('commentListId=', commentListId)
|
|
tag += ' <ul id="' + commentListId + '" class="list-view">'
|
|
tag += ' </ul>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
|
|
|
|
return tag
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function makeTimelineItem (elderInfo, timelineItem) {
|
|
|
|
|
|
postPool[timelineItem.pid] = elderInfo
|
|
|
|
// console.log('elderInfo=', elderInfo)
|
|
// console.log('timelineItem=', timelineItem)
|
|
var currentLikeInfo = null
|
|
|
|
currentLikeInfo = null
|
|
for (var i = 0; i < likeInfos.length; i++) {
|
|
if (likeInfos[i].cid == timelineItem.pid) {
|
|
currentLikeInfo = likeInfos[i]
|
|
}
|
|
}
|
|
// console.log('makeTimelineItem(), timelineItem=', timelineItem)
|
|
// console.log('makeTimelineItem(), likeInfos=', likeInfos)
|
|
// console.log('makeTimelineItem(), currentLikeInfo=', currentLikeInfo)
|
|
|
|
var tag = ''
|
|
|
|
tag += '<div class="col-sm-12">'
|
|
tag += ' <div class="card">'
|
|
tag += ' <div class="card-header">'
|
|
tag += ' <div class="d-inline-block align-middle">'
|
|
|
|
console.log('timelineItem=', timelineItem)
|
|
var tmpFromInfo = JSON.parse(timelineItem.from_info)
|
|
if (tmpFromInfo.name == undefined) {
|
|
tag += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/timeline?eid=' + timelineItem.eid + '\'})">'
|
|
var profile_url = '/images/avatar-4.jpg'
|
|
if (elderInfo.profile_url != null && elderInfo.profile_url.trim() != '') {
|
|
profile_url = elderInfo.profile_url
|
|
}
|
|
tag += ' <img src="' + profile_url + '" alt="user image" class="img-radius img-40 align-top m-r-15" />'
|
|
tag += ' <div class="d-inline-block">'
|
|
tag += ' <h6>' + elderInfo.name + ' 어르신</h6>'
|
|
tag += ' <p class="text-muted m-b-0">' + moment.utc(timelineItem.created).local().locale("ko").format('LLLL') + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' </a>'
|
|
} else {
|
|
tag += ' <a href="javascript:void(0);">'
|
|
var profile_url = '/images/avatar-4.jpg'
|
|
if (tmpFromInfo.photo != null && tmpFromInfo.photo.trim() != '') {
|
|
profile_url = tmpFromInfo.photo
|
|
}
|
|
tag += ' <img src="' + profile_url + '" alt="user image" class="img-radius img-40 align-top m-r-15" />'
|
|
tag += ' <div class="d-inline-block">'
|
|
tag += ' <h6>' + tmpFromInfo.name + '</h6>'
|
|
tag += ' <p class="text-muted m-b-0">' + moment.utc(timelineItem.created).local().locale("ko").format('LLLL') + '</p>'
|
|
tag += ' </div>'
|
|
tag += ' </a>'
|
|
|
|
}
|
|
|
|
tag += ' <div class="card-header-right">'
|
|
tag += ' <i class="feather icon-edit" onclick="doAllThingsInSafe(\'goto\', {target: \'/post/edit?pid=' + timelineItem.pid + '\'})"></i>'
|
|
tag += ' <i class="feather icon-trash" onclick="doAllThingsInSafe(\'local/delete\', {target: \'post\', hero: \'' + timelineItem.pid + '\'})"></i>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
tag += ' </div>'
|
|
|
|
|
|
tag += ' </div>'
|
|
tag += ' <div class="card" style="margin:20px">'
|
|
|
|
var filesAry = JSON.parse(timelineItem.files)
|
|
for (var i = 0; i < filesAry.length; i++) {
|
|
// tag += ' <img class="post-imv-cover" src="' + filesAry[i] + '">'
|
|
if (filesAry[i] !== null) {
|
|
|
|
var tmpNameAry = filesAry[i].name.split('.')
|
|
var tmpExt = tmpNameAry[tmpNameAry.length - 1]
|
|
|
|
if (tmpExt.toLowerCase() == 'mp4') {
|
|
tag += '<video class="d-block img-fluid img-thumbnail" style="object-fit: contain;" controls><source src="' + filesAry[i].localUrl + '" type="video/mp4">Your browser does not support the video tag.<a href="' + filesAry[i].localUrl + '">' + filesAry[i].localUrl + '</a></video>'
|
|
|
|
} else {
|
|
tag += ' <img class="d-block img-fluid img-thumbnail" style="object-fit: contain;" src="' + filesAry[i].localUrl + '">'
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
tag += ' <p class="content-group">'
|
|
tag += timelineItem.content
|
|
tag += ' </p>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="chat-card">'
|
|
tag += ' <div class="card-block">'
|
|
var commentListId = 'commentList_' + timelineItem.pid
|
|
// console.log('commentListId=', commentListId)
|
|
tag += ' <ul id="' + commentListId + '" class="list-view">'
|
|
tag += ' <li>'
|
|
tag += ' <div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
tag += ' <img src="/images/avatar-2.jpg" alt="user image" class="img-radius img-40">'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">이것은 댓글의 예 입니다. 그러니까 뭐라고 뭐라고 한다구요. 그렇다구요.</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>15분전</p>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </li>'
|
|
tag += ' <li>'
|
|
tag += ' <div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
tag += ' <img src="/images/avatar-2.jpg" alt="user image" class="img-radius img-40">'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="msg">'
|
|
tag += ' <p class="m-b-0">최신게 위에 오는게 맞죠. 그쵸?</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>36분전</p>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </li>'
|
|
tag += ' <li>'
|
|
tag += ' <div class="row m-b-20 received-chat">'
|
|
tag += ' <div class="col-auto p-r-0">'
|
|
tag += ' <img src="/images/avatar-2.jpg" alt="user image" class="img-radius img-40">'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col">'
|
|
tag += ' <div class="">'
|
|
tag += ' <p class="m-b-0">큰아들님이 좋아요를 누르셨습니다.</p>'
|
|
tag += ' </div>'
|
|
tag += ' <p class="text-muted m-b-0"><i class="fa fa-clock-o m-r-10"></i>36분전</p>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </li>'
|
|
tag += ' </ul>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="card-block">'
|
|
tag += ' <div class="row">'
|
|
tag += ' <div class="col-lg-6 col-md-12">'
|
|
tag += ' <div class="form-group">'
|
|
tag += ' <button id="like-post-btn-' + timelineItem.pid + '" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:post\', hero: \'' + timelineItem.pid + '\', domain: \'' + timelineItem.eid + '\', tag: \'like\'})" class="label-icon btn waves-effect waves-light ' + (currentLikeInfo ? (currentLikeInfo.tag === 'like' ? 'btn-danger' : 'btn-primary') : 'btn-primary') + ' btn-block"><i class="icofont icofont-thumbs-up"></i>좋아요</button>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col-lg-6 col-md-12">'
|
|
tag += ' <div class="form-group">'
|
|
tag += ' <button class="btn waves-effect waves-light btn-primary btn-outline-primary btn-block" onclick="getComment(\'' + timelineItem.pid + '\', \'' + commentListId + '\')"><i class="icofont icofont-comment"></i>댓글 달기</button>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
|
|
|
|
return tag
|
|
|
|
|
|
}
|
|
|
|
|
|
var elderInfo = {}
|
|
var postInfo = {}
|
|
var centerInfo = {}
|
|
var familyInfo = {}
|
|
|
|
function refreshTimelineList (data) {
|
|
// console.log('data=', data)
|
|
|
|
|
|
|
|
var divId = 'timeline-sub'
|
|
$('#' + divId).empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var tmpElderInfo = elderInfo
|
|
if (elderInfoPool[data[i].eid] !== undefined) {
|
|
tmpElderInfo = elderInfoPool[data[i].eid]
|
|
}
|
|
// console.log('tmpElderInfo=', tmpElderInfo)
|
|
|
|
var itemTag = ''
|
|
|
|
|
|
|
|
<% if (infos.loc === '/square/detail') { %>
|
|
itemTag = makeTimelineItemForSquare(currentCenterInfo, data[i])
|
|
<% } else if (infos.loc === '/elder/detail') { %>
|
|
itemTag = makeTimelineItem(tmpElderInfo, data[i])
|
|
<% } else { %>
|
|
// console.log('getParams=', getParams)
|
|
if (getParams['eid'] != undefined) {
|
|
itemTag = makeTimelineItem(tmpElderInfo, data[i])
|
|
} else if (getParams['cid'] != undefined) {
|
|
itemTag = makeTimelineItemForSquare(currentCenterInfo, data[i])
|
|
} else {
|
|
itemTag = makeTimelineItem(tmpElderInfo, data[i])
|
|
}
|
|
|
|
<% } %>
|
|
|
|
$('#' + divId).append(itemTag);
|
|
|
|
var commentListId = 'commentList_' + data[i].pid
|
|
|
|
<% if (infos.loc === '/timeline') { %>
|
|
doAllThingsInSafe('local/list', {target: 'comment:active', hero: data[i].pid, commentListId: commentListId})
|
|
|
|
<% } else if (infos.loc === '/square/detail') { %>
|
|
refreshCommentList(commentListId)
|
|
<% } else { %>
|
|
doAllThingsInSafe('local/list', {target: 'comment:active', hero: data[i].pid, commentListId: commentListId})
|
|
<% } %>
|
|
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + divId).append('표시할 소식이 없습니다. T.T');
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function refreshFamilyList (data) {
|
|
// console.log('data=', data)
|
|
var tableId = 'familyListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
var tmpElderInfo = elderInfo
|
|
if (elderInfoPool[data[i].eid] !== undefined) {
|
|
tmpElderInfo = elderInfoPool[data[i].eid]
|
|
}
|
|
console.log('tmpElderInfo=', tmpElderInfo)
|
|
|
|
var newRow = $("<tr>");
|
|
var cols = '';
|
|
|
|
|
|
if (tmpElderInfo) {
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
cols += ' <a href="/elder/detail?eid=' + tmpElderInfo.eid + '">'
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + tmpElderInfo.name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0"></p>'
|
|
cols += ' </div>'
|
|
cols += ' </a>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
|
|
} else {
|
|
cols += ' <td></td>'
|
|
}
|
|
|
|
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
<% if (infos.loc === '/elder/detail') {%>
|
|
cols += ' <a href="/family/detail?fid=' + data[i].fid + '">'
|
|
<% } else {%>
|
|
cols += ' <a href="javascript:void(0);">'
|
|
<% }%>
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0"></p>'
|
|
cols += ' </div>'
|
|
cols += ' </a>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' ' + data[i].relations + ''
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' ' + data[i].invite_by + ''
|
|
cols += ' </td>'
|
|
|
|
|
|
cols += ' <td>'
|
|
switch (data[i].status) {
|
|
case 0:
|
|
cols += ' 초대 대기중'
|
|
break;
|
|
case 1:
|
|
cols += ' 등록됨'
|
|
break;
|
|
|
|
case 4:
|
|
cols += ' 삭제됨'
|
|
break;
|
|
case 9:
|
|
cols += ' 영구삭제됨'
|
|
break;
|
|
|
|
default:
|
|
cols += ' 알수없음(' + data[i].status + ')'
|
|
break;
|
|
}
|
|
cols += ' </td>'
|
|
|
|
|
|
|
|
cols += ' <td>'
|
|
cols += ' ' + moment.utc(data[i].updated).local().locale("ko").format('LLLL') + ''
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' ' + moment.utc(data[i].created).local().locale("ko").format('LLLL') + ''
|
|
cols += ' </td>'
|
|
|
|
cols += ' <td>'
|
|
|
|
<% if (infos.loc === '/elder/detail') {%>
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/family/edit?fid=' + data[i].fid + '\'})"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'family\', hero: \'' + data[i].fid + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
<% } else {%>
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'family\', hero: \'' + data[i].fid + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
<% }%>
|
|
|
|
|
|
|
|
cols += ' </td>'
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshApproveReviewList (data) {
|
|
// console.log('data=', data)
|
|
|
|
var tableId = 'approveReviewListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $('<tr class="read">');
|
|
var cols = ''
|
|
var hero = data[i]
|
|
|
|
cols += '<td>' + hero.title + '</td>'
|
|
cols += '<td><a target="_blank" href="' + hero.url + '" class="email-name waves-effect">새창으로 열기</a></td>'
|
|
cols += '<td class="email-time">' + moment.utc(hero.created).locale("ko").fromNow() + '</td>'
|
|
|
|
cols += '<td>'
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="승인" onclick="doAllThingsInSafe(\'local/update\', {target: \'approve:review\', hero: \'' + hero.nid + '\', judgment: \'up\'})"><i class="icon feather icon-thumbs-up f-w-600 f-16 text-c-blue m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="유보" onclick="getReason(\'approve:review\', \'suspend\', \'' + hero.nid + '\')"><i class="icon feather icon-thumbs-down f-w-600 f-16 text-c-red m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="미리 보기" onclick="doAllThingsInSafe(\'goto\', {target: \'/review/detail?nid=' + hero.nid + '\'})"><i class="icon feather icon-play f-w-600 f-16 text-c-yellow m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="삭제" onclick="getReason(\'approve:review\', \'reject\', \'' + hero.nid + '\')"><i class="icon feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
cols += '</td>'
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function refreshApproveDepotList (data) {
|
|
// console.log('data=', data)
|
|
|
|
var tableId = 'approveDepotListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $('<tr class="read">');
|
|
var cols = ''
|
|
var hero = data[i]
|
|
|
|
cols += '<td>' + hero.title + '</td>'
|
|
cols += '<td><a target="_blank" href="' + hero.url + '" class="email-name waves-effect">새창으로 열기</a></td>'
|
|
cols += '<td class="email-time">' + moment.utc(hero.created).locale("ko").fromNow() + '</td>'
|
|
|
|
cols += '<td>'
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="승인" onclick="doAllThingsInSafe(\'local/update\', {target: \'approve:depot\', hero: \'' + hero.cid + '\', judgment: \'up\'})"><i class="icon feather icon-thumbs-up f-w-600 f-16 text-c-blue m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="유보" onclick="getReason(\'approve:depot\', \'suspend\', \'' + hero.cid + '\')"><i class="icon feather icon-thumbs-down f-w-600 f-16 text-c-red m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="미리 보기" onclick="doAllThingsInSafe(\'goto\', {target: \'/depot/detail?cid=' + hero.cid + '\'})"><i class="icon feather icon-play f-w-600 f-16 text-c-yellow m-r-15"></i></a>'
|
|
|
|
cols += ' <a href="javascript:;" data-toggle="tooltip" data-html="true" title="거절" onclick="getReason(\'approve:depot\', \'reject\', \'' + hero.cid + '\')"><i class="icon feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
cols += '</td>'
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function refreshReviewList (data) {
|
|
// console.log('data=', data)
|
|
|
|
var tableId = 'reviewListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $('<tr class="read">');
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
|
|
cols += ' <td>' + data[i].sender + '</td>'
|
|
cols += ' <td><a href="/review/detail?nid=' + data[i].nid + '" class="email-name waves-effect">' + data[i].title + '</a></td>'
|
|
var tmpAttachmentList = JSON.parse(data[i].attachments)
|
|
if (tmpAttachmentList.length > 0) {
|
|
cols += ' <td class="email-attch"><i class="icofont icofont-clip"></i></td>'
|
|
} else {
|
|
cols += ' <td class="email-attch"></td>'
|
|
}
|
|
|
|
cols += ' <td class="email-time">' + moment(data[i].updated).locale("ko").fromNow() + '</td>'
|
|
cols += ' <td class="email-time">' + moment(data[i].created).locale("ko").fromNow() + '</td>'
|
|
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function refreshNoteList (data) {
|
|
// console.log('data=', data)
|
|
|
|
var noteListMode = getParams['cid'] ? 'center' : 'family'
|
|
|
|
|
|
if (noteListMode == 'center') {
|
|
$('#note-button-console').css("display", "block" )
|
|
}
|
|
|
|
var tableId = 'noteListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $('<tr class="read">');
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
|
|
cols += ' <td>' + data[i].sender + '</td>'
|
|
cols += ' <td><a href="/note/detail?nid=' + data[i].nid + '&cid=' + data[i].from_id + '" class="email-name waves-effect">' + data[i].title + '</a></td>'
|
|
var tmpAttachmentList = JSON.parse(data[i].attachments)
|
|
if (tmpAttachmentList.length > 0) {
|
|
cols += ' <td class="email-attch"><i class="icofont icofont-clip"></i></td>'
|
|
} else {
|
|
cols += ' <td class="email-attch"></td>'
|
|
}
|
|
|
|
cols += ' <td class="email-time">' + moment(data[i].updated).locale("ko").fromNow() + '</td>'
|
|
cols += ' <td class="email-time">' + moment(data[i].created).locale("ko").fromNow() + '</td>'
|
|
|
|
cols += ' <td>'
|
|
|
|
if (noteListMode == 'center') {
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/note/edit?nid=' + data[i].nid + '&cid=' + data[i].from_id + '\'})"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'note\', hero: \'' + data[i].nid + '\', cid: \'' + data[i].from_id + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
}
|
|
|
|
cols += ' </td>'
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function refreshElderList (data) {
|
|
// console.log('data=', data)
|
|
var tableId = 'elderListTable'
|
|
$('#' + tableId + ' tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
cols += ' <a href="/elder/detail?eid=' + data[i].eid + '">'
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0">' + data[i].profile_url + '</p>'
|
|
cols += ' </div>'
|
|
cols += ' </a>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
|
|
cols += ' <td>'
|
|
cols += ' ' + data[i].memo
|
|
cols += ' </td>'
|
|
|
|
|
|
cols += ' <td>'
|
|
switch (data[i].status) {
|
|
case 0:
|
|
cols += ' 등록됨'
|
|
break;
|
|
case 4:
|
|
cols += ' 삭제됨'
|
|
break;
|
|
case 9:
|
|
cols += ' 영구삭제됨'
|
|
break;
|
|
|
|
default:
|
|
cols += ' 알수없음(' + data[i].status + ')'
|
|
break;
|
|
}
|
|
cols += ' </td>'
|
|
|
|
|
|
cols += ' <td>'
|
|
cols += ' <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/elder/edit?eid=' + data[i].eid + '\'})"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'elder\', hero: \'' + data[i].eid + '\'})"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
cols += ' </td>'
|
|
|
|
|
|
newRow.append(cols);
|
|
$('#' + tableId).append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$('#' + tableId).append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
// handleSupportList(rawList)
|
|
|
|
|
|
function refreshSupportList (data) {
|
|
// console.log('data=', data)
|
|
$('#supportListTable tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
cols += ' <td>' + data[i].name + '</td>'
|
|
|
|
cols += ' <td><a href="/admin/support/detail?uid=' + data[i].uid + '">' + data[i].message + '</td>'
|
|
|
|
cols += ' <td>'
|
|
cols += ' ' + moment.utc(data[i].created).local().locale("ko").format('LLLL')
|
|
cols += ' </td>'
|
|
|
|
|
|
|
|
|
|
newRow.append(cols);
|
|
$("#supportListTable").append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$("#supportListTable").append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function refreshCenterList (data) {
|
|
// console.log('data=', data)
|
|
$('#centerListTable tbody').empty()
|
|
for (var i = 0; i < data.length; i++) {
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
|
|
cols += ''
|
|
cols += ' <td>'
|
|
cols += ' <div class="d-inline-block align-middle">'
|
|
cols += ' <a href="/center/detail?cid=' + data[i].cid + '">'
|
|
cols += ' <div class="d-inline-block">'
|
|
cols += ' <h6>' + data[i].name + '</h6>'
|
|
cols += ' <p class="text-muted m-b-0">' + data[i].address + '</p>'
|
|
cols += ' </div>'
|
|
cols += ' </a>'
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' <div class="label-icon">'
|
|
cols += ' <a href="javascript:;">'
|
|
cols += ' <i class="icofont icofont-envelope"></i>'
|
|
cols += ' <label class="badge badge-primary badge-top-right">9</label>'
|
|
cols += ' </a>'
|
|
cols += ' '
|
|
cols += ' <a href="javascript:;">'
|
|
cols += ' <i class="icofont icofont-alarm"></i>'
|
|
cols += ' <label class="badge badge-danger badge-top-right">2</label>'
|
|
cols += ' </a>'
|
|
cols += ' '
|
|
cols += ' </div>'
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
switch (data[i].status) {
|
|
case 0:
|
|
cols += ' 승인 대기중'
|
|
break;
|
|
case 1:
|
|
cols += ' 등록됨'
|
|
break;
|
|
case 4:
|
|
cols += ' 승인 보류됨'
|
|
break;
|
|
default:
|
|
cols += ' 알수없음(' + data[i].status + ')'
|
|
break;
|
|
|
|
}
|
|
cols += ' </td>'
|
|
cols += ' <td>'
|
|
cols += ' ' + moment.utc(data[i].created).local().locale("ko").format('LLLL')
|
|
cols += ' </td>'
|
|
|
|
newRow.append(cols);
|
|
$("#centerListTable").append(newRow);
|
|
}
|
|
|
|
if (data.length == 0) {
|
|
|
|
$("#centerListTable").append($("<tr>").append('<tr class="no-data"><td colspan="14">표시할 데이터가 없습니다.</td></tr>'));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
async function getAccompanyHelloMessage () {
|
|
const { value: text } = await Swal.fire({
|
|
input: 'textarea',
|
|
inputPlaceholder: '구매 동행 후보 소개 등록',
|
|
inputAttributes: {
|
|
'aria-label': '간단한 자기 소개를 입력해 주세요.'
|
|
},
|
|
showCancelButton: true
|
|
})
|
|
|
|
if (text) {
|
|
doAllThingsInSafe('local/update', {target: 'role', role: 'guide', memo: text })
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getComment (hero, commentListId) {
|
|
// hero = target id
|
|
|
|
// alert('준비중입니다.')
|
|
// return
|
|
|
|
console.log("huk! commentListId=", commentListId)
|
|
console.log("huk! hero=", hero)
|
|
|
|
var tmpPostInfo = postPool[hero]
|
|
|
|
console.log("huk! tmpPostInfo=", tmpPostInfo)
|
|
var tmpEid = null
|
|
|
|
if (tmpPostInfo) {
|
|
tmpEid = tmpPostInfo.eid
|
|
} else {
|
|
tmpEid = getParams['eid'] ? getParams['eid'] : null
|
|
}
|
|
|
|
const { value: text } = await Swal.fire({
|
|
input: 'textarea',
|
|
inputPlaceholder: '댓글을 입력하세요.',
|
|
inputAttributes: {
|
|
'aria-label': '댓글을 입력하세요.'
|
|
},
|
|
showCancelButton: true
|
|
})
|
|
|
|
if (text) {
|
|
// Swal.fire('id=' + hero + ',댓글 : ' + text)
|
|
doAllThingsInSafe('local/insert', {target: 'comment', hero: hero, eid: tmpEid, comment: text, commentListId: commentListId})
|
|
}
|
|
|
|
}
|
|
|
|
|
|
async function getReason (target, tag, hero) {
|
|
// hero = target id
|
|
|
|
var reasonFor = ''
|
|
switch (tag) {
|
|
case 'suspend':
|
|
reasonFor = '유보'
|
|
break;
|
|
case 'reject':
|
|
reasonFor = '거절'
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
const { value: text } = await Swal.fire({
|
|
input: 'textarea',
|
|
inputPlaceholder: '사용자에게 보여질 ' + reasonFor + ' 사유를 입력해 주세요.',
|
|
inputAttributes: {
|
|
'aria-label': reasonFor + ' 사유를 입력하세요.'
|
|
},
|
|
showCancelButton: true
|
|
})
|
|
|
|
console.log('huk text=', text)
|
|
|
|
if (text) {
|
|
|
|
doAllThingsInSafe('local/update', {target: target, hero: hero, judgment: 'down', reason: text})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function makeAccompanyStatusTag (step) {
|
|
|
|
var stepTag = ''
|
|
|
|
switch (step) {
|
|
case 0:
|
|
stepTag = '<label class="label label-info">승인 대기중</label>'
|
|
break;
|
|
case 1:
|
|
stepTag = '<label class="label label-info">승인 대기중</label>'
|
|
break;
|
|
case 2:
|
|
stepTag = '<label class="label label-danger">취소됨</label>'
|
|
break;
|
|
case 3:
|
|
stepTag = '<label class="label label-danger">취소됨</label>'
|
|
break;
|
|
case 4:
|
|
stepTag = '<label class="label label-danger">거절됨</label>'
|
|
break;
|
|
case 5:
|
|
stepTag = '<label class="label label-info">결제 대기중</label>'
|
|
break;
|
|
case 6:
|
|
stepTag = '<label class="label label-danger">취소됨</label>'
|
|
break;
|
|
case 7:
|
|
stepTag = '<label class="label label-danger">취소됨</label>'
|
|
break;
|
|
case 8:
|
|
stepTag = '<label class="label label-danger">거절됨</label>'
|
|
break;
|
|
case 9:
|
|
stepTag = '<label class="label label-info">동행 대기중</label>'
|
|
break;
|
|
case 10:
|
|
stepTag = '<label class="label label-danger">종료됨</label>'
|
|
break;
|
|
case 11:
|
|
stepTag = '<label class="label label-info">평가 대기중</label>'
|
|
break;
|
|
case 12:
|
|
stepTag = '<label class="label label-info">평가 대기중</label>'
|
|
break;
|
|
case 13:
|
|
stepTag = '<label class="label label-info">평가 대기중</label>'
|
|
break;
|
|
case 14:
|
|
stepTag = '<label class="label label-info">평가 대기중</label>'
|
|
break;
|
|
case 15:
|
|
stepTag = '<label class="label label-info">종료됨</label>'
|
|
break;
|
|
|
|
case 99:
|
|
stepTag = '<label class="label label-danger">운영자에 의해 취소</label>'
|
|
break;
|
|
|
|
default:
|
|
stepTag = '<label class="label label-warning">???</label>'
|
|
}
|
|
|
|
return stepTag
|
|
}
|
|
|
|
function makeAccompanyItemTag (hero) {
|
|
var tag = ''
|
|
|
|
tag += '<div class="card list-view-media">'
|
|
tag += ' <div class="card-block">'
|
|
tag += ' <div class="media">'
|
|
tag += ' <div class="media-body">'
|
|
tag += ' <div class="col-xs-12">'
|
|
tag += ' <a href="/accompany/detail?aid=' + hero.aid + '&fromTag=' + tabControlTarget + '">'
|
|
tag += ' <h6 class="d-inline-block">'
|
|
tag += ' ' + moment.utc(hero.target_datetime).locale("ko").format('LLLL') + '분에 희망하는 동행'
|
|
tag += ' </h6>'
|
|
tag += ' ' + makeAccompanyStatusTag(hero.step)
|
|
tag += ' </div>'
|
|
tag += ' <div class="f-13 text-muted m-b-15">'
|
|
tag += ' 남은시간 : ' + moment.utc(hero.target_datetime).locale("ko").fromNow()
|
|
tag += ' </div>'
|
|
tag += ' <p>'
|
|
tag += ' ' + hero.memo
|
|
tag += ' </p>'
|
|
tag += ' <div class="m-t-15">'
|
|
tag += ' <a href="javascript:;"><i class="icon feather icon-edit f-w-600 f-16 m-r-15 text-c-green"></i></a><a href="javascript:;"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i></a>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function makeDepotItemTag (hero) {
|
|
var tag = ''
|
|
|
|
var tmpWidth = $( '#tabs' ).width();
|
|
|
|
// console.log('tmpWidth=', tmpWidth)
|
|
// $('.player-window').css('padding-bottom','50%');
|
|
|
|
|
|
|
|
|
|
tag += ' <div class="card list-view-media">'
|
|
|
|
|
|
|
|
|
|
tag += ' <div class="card-block">'
|
|
|
|
|
|
tag += ' <div class="media">'
|
|
|
|
|
|
|
|
tag += ' <a class="media-left" href="/depot/detail?cid=' + hero.cid + '">'
|
|
|
|
if (tmpWidth > 400) {
|
|
tag += ' <img class="media-object card-list-img" src="/api/local/logos/' + hero.brand + '.png" alt="Generic placeholder image">'
|
|
}
|
|
|
|
|
|
tag += ' </a>'
|
|
tag += ' <div class="media-body">'
|
|
tag += ' <div class="col-xs-12">'
|
|
tag += ' <a href="/depot/detail?cid=' + hero.cid + '">'
|
|
tag += ' <h6 class="d-inline-block">'
|
|
|
|
tag += ' ' + hero.title + ''
|
|
|
|
tag += ' </h6>'
|
|
tag += ' </a>'
|
|
if (hero.like_count !== 0) {
|
|
tag += ' <label class="label label-info">좋아요 ' + hero.like_count + '</label>'
|
|
}
|
|
if (hero.dislike_count !== 0) {
|
|
tag += ' <label class="label label-danger">싫어요 ' + hero.dislike_count + '</label>'
|
|
}
|
|
if (hero.report_count !== 0) {
|
|
tag += ' <label class="label label-info">신고 ' + hero.report_count + '</label>'
|
|
}
|
|
if (hero.comment_count !== 0) {
|
|
tag += ' <label class="label label-info">의견 ' + hero.comment_count + '</label>'
|
|
}
|
|
|
|
tag += ' <label class="label label-info">조회 ' + hero.hit_count + '</label>'
|
|
|
|
if (hero.heat > 0) {
|
|
tag += ' <label class="label label-danger">관심 ' + hero.heat + '</label>'
|
|
|
|
}
|
|
|
|
|
|
if (hero.score > 0) {
|
|
tag += ' <label class="label label-danger">스코어 ' + hero.score.toFixed(1) + '</label>'
|
|
|
|
}
|
|
|
|
var tmpSiteTag = hero.site_tag
|
|
|
|
if (tmpSiteTag.length > 15) {
|
|
switch (tmpSiteTag) {
|
|
case 'certifiedcar.hyundaicapital.com':
|
|
tmpSiteTag = 'cer...hyund...com'
|
|
break;
|
|
default:
|
|
tmpSiteTag = tmpSiteTag.substr(0, 15)
|
|
}
|
|
}
|
|
|
|
tag += ' </div>'
|
|
tag += ' <div class="f-13 text-muted m-b-15">' + hero.model_year + ' | ' + hero.mileage+ ' | ' + hero.price+ ' | ' + tmpSiteTag + '</div>'
|
|
if (hero.last_comment !== '') {
|
|
tag += ' <p>' + hero.last_comment + '</p>'
|
|
} else {
|
|
tag += ' <p>아직 입력된 댓글이 없습니다.</p>'
|
|
}
|
|
|
|
tag += ' <div class="m-t-15">'
|
|
tag += ' <button type="button" data-toggle="tooltip" title="Facebook" class="btn btn-facebook btn-mini waves-effect waves-light">'
|
|
tag += ' <span class="icofont icofont-social-facebook"></span>'
|
|
tag += ' </button>'
|
|
tag += ' <button type="button" data-toggle="tooltip" title="Twitter" class="btn btn-twitter btn-mini waves-effect waves-light">'
|
|
tag += ' <span class="icofont icofont-social-twitter"></span>'
|
|
tag += ' </button>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
function makeSubscriptionItemTag (hero) {
|
|
var tag = ''
|
|
tag += ' <div class="card list-view-media">'
|
|
tag += ' <div class="card-block">'
|
|
tag += ' <div class="media">'
|
|
tag += ' <a class="media-left" href="javascript:;">'
|
|
tag += ' <img id="subscription-img" class="media-object card-list-img img-100" src="' + hero.image + '" alt="Generic placeholder image">'
|
|
tag += ' </a>'
|
|
tag += ' <div class="media-body">'
|
|
tag += ' <div class="col-xs-12">'
|
|
tag += ' <h6 class="d-inline-block">' + hero.title + '</h6>'
|
|
|
|
var flagArray = hero.flags.split(',')
|
|
// console.log('flagArray=', flagArray)
|
|
for (var i = 0; i < flagArray.length; i++) {
|
|
var flag = flagArray[i].trim().toLowerCase()
|
|
// console.log('flag=', flag)
|
|
switch (flag) {
|
|
case 'best':
|
|
tag += ' <label class="label label-info">Best!</label>'
|
|
break;
|
|
case 'new':
|
|
tag += ' <label class="label label-primary">New!</label>'
|
|
break;
|
|
case 'hot':
|
|
tag += ' <label class="label label-danger">Hot!</label>'
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
}
|
|
|
|
// tag += ' <label class="label label-info">Best!</label>'
|
|
|
|
// doAllThingsInSafe('local/insert', {target: 'cart', key: key, name: name})
|
|
tag += ' </div>'
|
|
tag += ' <div class="f-13 text-muted m-b-15">'
|
|
tag += ' 월 ' + numberWithCommas(hero.amount) + '원'
|
|
tag += ' </div>'
|
|
tag += ' <p>' + hero.detail + '</p>'
|
|
tag += ' <div class="m-t-15">'
|
|
tag += ' <a class="btn btn-primary btn-add-task waves-effect waves-light m-t-10" href="/order?type=subscription&hero=' + hero.serial + '">정기배송 신청하기</a>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
function updateSubscriptionPreview (tag, val) {
|
|
previewSubscriptionItem[tag] = val
|
|
var target = $("#notice-preview")
|
|
target.html(makeSubscriptionItemTag(previewSubscriptionItem))
|
|
}
|
|
|
|
|
|
function updateNoticePreview (tag, val) {
|
|
// console.log('huk update notice preview... : ', tag, val, getFormattedNow())
|
|
var target = $("#" + tag)
|
|
if (target.is("textarea") || target.is('input')) {
|
|
target.val(val)
|
|
} else {
|
|
target.html(escapeHtml(val).replace(/(?:\r\n|\r|\n)/g, '<br />'))
|
|
}
|
|
|
|
if ($("#preview-notice-created").text() === '') {
|
|
$("#preview-notice-created").text(getFormattedNow())
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateFAQPreview (tag, val) {
|
|
|
|
var target = $("#" + tag)
|
|
if (target.is("textarea") || target.is('input')) {
|
|
target.val(val)
|
|
} else {
|
|
target.html(escapeHtml(val).replace(/(?:\r\n|\r|\n)/g, '<br />'))
|
|
}
|
|
}
|
|
|
|
|
|
<% if (infos.loc === '/notice/edit') {%>
|
|
<% if (hero === null) {%>
|
|
// new
|
|
<%} else {%>
|
|
// update
|
|
<%} %>
|
|
<%} %>
|
|
|
|
function getPostCode () {
|
|
new daum.Postcode({
|
|
oncomplete: function(data) {
|
|
// 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분입니다.
|
|
// 예제를 참고하여 다양한 활용법을 확인해 보세요.
|
|
// console.log('data=', data)
|
|
// 우편번호 data.zonecode
|
|
// 주소 data.address
|
|
//
|
|
|
|
|
|
<% if (infos.loc === '/center/new' || infos.loc === '/center/edit') {%>
|
|
$('#center_address').val(data.address)
|
|
$('#center_zipcode').val(data.zonecode)
|
|
|
|
|
|
|
|
<%} else if (
|
|
infos.loc === '/my/new' ||
|
|
infos.loc === '/my/edit' ||
|
|
infos.loc === '/profile/new' ||
|
|
infos.loc === '/profile/edit'
|
|
) {%>
|
|
|
|
|
|
$('#my-infos-zipcode').val(data.zonecode)
|
|
$('#my-infos-address').val(data.address)
|
|
|
|
|
|
|
|
|
|
<%} else {%>
|
|
$('#zipcode').val(data.zonecode)
|
|
$('#address').val(data.address)
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
}
|
|
}).open();
|
|
}
|
|
|
|
|
|
function floatchart() {
|
|
$(function() {
|
|
var options = {
|
|
legend: {
|
|
show: false
|
|
},
|
|
series: {
|
|
label: "",
|
|
curvedLines: {
|
|
active: true,
|
|
nrSplinePoints: 20
|
|
},
|
|
},
|
|
tooltip: {
|
|
show: true,
|
|
content: "x : %x | y : %y"
|
|
},
|
|
grid: {
|
|
hoverable: true,
|
|
borderWidth: 0,
|
|
labelMargin: 0,
|
|
axisMargin: 0,
|
|
minBorderMargin: 0,
|
|
},
|
|
yaxis: {
|
|
min: 0,
|
|
max: 30,
|
|
color: 'transparent',
|
|
font: {
|
|
size: 0,
|
|
}
|
|
},
|
|
xaxis: {
|
|
color: 'transparent',
|
|
font: {
|
|
size: 0,
|
|
}
|
|
}
|
|
};
|
|
$.plot($("#app-sale1"), [{
|
|
data: [
|
|
[0, 18],
|
|
[20, 10],
|
|
[35, 20],
|
|
[50, 10],
|
|
[65, 27],
|
|
[75, 15],
|
|
[90, 20],
|
|
],
|
|
color: "#ff5252",
|
|
lines: {
|
|
show: true,
|
|
fill: false,
|
|
lineWidth: 3
|
|
},
|
|
points: {
|
|
show: false
|
|
},
|
|
curvedLines: {
|
|
apply: true,
|
|
}
|
|
}], options);
|
|
$.plot($("#app-sale2"), [{
|
|
data: [
|
|
[0, 10],
|
|
[20, 25],
|
|
[35, 27],
|
|
[50, 10],
|
|
[65, 20],
|
|
[75, 10],
|
|
[90, 18],
|
|
],
|
|
color: "#448aff",
|
|
lines: {
|
|
show: true,
|
|
fill: false,
|
|
lineWidth: 3
|
|
},
|
|
points: {
|
|
show: false
|
|
},
|
|
curvedLines: {
|
|
apply: true,
|
|
}
|
|
}], options);
|
|
$.plot($("#app-sale3"), [{
|
|
data: [
|
|
[0, 18],
|
|
[20, 10],
|
|
[35, 20],
|
|
[50, 10],
|
|
[65, 27],
|
|
[75, 15],
|
|
[90, 20],
|
|
],
|
|
color: "#ffba57",
|
|
lines: {
|
|
show: true,
|
|
fill: false,
|
|
lineWidth: 3
|
|
},
|
|
points: {
|
|
show: false
|
|
},
|
|
curvedLines: {
|
|
apply: true,
|
|
}
|
|
}], options);
|
|
$.plot($("#app-sale4"), [{
|
|
data: [
|
|
[0, 10],
|
|
[20, 25],
|
|
[35, 27],
|
|
[50, 10],
|
|
[65, 20],
|
|
[75, 10],
|
|
[90, 18],
|
|
],
|
|
color: "#9ccc65",
|
|
lines: {
|
|
show: true,
|
|
fill: false,
|
|
lineWidth: 3
|
|
},
|
|
points: {
|
|
show: false
|
|
},
|
|
curvedLines: {
|
|
apply: true,
|
|
}
|
|
}], options);
|
|
});
|
|
}
|
|
|
|
|
|
var IMP = window.IMP; // 생략가능
|
|
IMP.init('imp04719163'); // 'iamport' 대신 부여받은 "가맹점 식별코드"를 사용
|
|
|
|
|
|
var cacheedCart = {}
|
|
|
|
var cartTitle = ''
|
|
var cartTotalAmount = 0
|
|
|
|
|
|
function handleCustomEvent(e) {
|
|
e.preventDefault();
|
|
|
|
var row = $(e.target).parent().closest("tr");
|
|
var key = row.find("td:nth-child(1)").text().trim();
|
|
var name = row.find("td:nth-child(2)").text().trim();
|
|
|
|
doAllThingsInSafe('local/insert', {target: 'cart', key: key, name: name})
|
|
}
|
|
|
|
function doFetchPost (cmd, params, cb) {
|
|
$.ajax({
|
|
url: '/api/' + cmd,
|
|
data: params,
|
|
type : 'post',
|
|
success: function (ret) {
|
|
// console.log('doFetchPost('+cmd+'), ret=', ret)
|
|
cb(null, ret)
|
|
},
|
|
error: function (request, status, error){
|
|
// console.log('request=', request)
|
|
// console.log('status=', status)
|
|
// console.log('error=', error)
|
|
var ret = request.responseJSON
|
|
cb(error, ret)
|
|
|
|
}
|
|
})
|
|
|
|
|
|
|
|
|
|
/*
|
|
axios.post(apiUrl + '/' + cmd, (data), { withCredentials: true, headers: { DomainKey: domainKey } })
|
|
.then(function (response) {
|
|
return response
|
|
})
|
|
.then(function (responseJson) {
|
|
cb(null, responseJson.data)
|
|
})
|
|
.catch(function (error) {
|
|
// console.error(error)
|
|
cb(error, {})
|
|
})
|
|
*/
|
|
}
|
|
|
|
function numberWithCommas(x) {
|
|
if (x === undefined) {
|
|
return '0'
|
|
} else {
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function refreshCart (currentCart) {
|
|
|
|
$(".task-content").empty();
|
|
|
|
var emptyMessage = $('<div id="empty-message" class="text-center"> <p></p>장바구니가 비어있습니다.<p></p> </div>');
|
|
$(emptyMessage).appendTo(".task-content").hide().fadeIn(300);
|
|
$("#cart-btns").hide();
|
|
|
|
|
|
if (Object.keys(currentCart).length === 2) {
|
|
$("#empty-message").show();
|
|
$("#cart-btns").hide();
|
|
} else {
|
|
$("#empty-message").hide();
|
|
$("#cart-btns").show();
|
|
Object.keys(currentCart).forEach(function(k, i) {
|
|
// console.log('k=', k)
|
|
// console.log('i=', i)
|
|
// console.log(currentCart[k]);
|
|
|
|
if (currentCart[k].count !== undefined && currentCart[k].unitAmount !== undefined) {
|
|
|
|
var add_todo = $('<div class="to-do-label"><div class="checkbox-fade fade-in-primary"><label class="check-task"><input type="hidden" value=""><span class="task-title-sp">' + currentCart[k].name + ' ₩' + numberWithCommas(currentCart[k].unitAmount) + ' x ' + currentCart[k].count + ' = ₩' + numberWithCommas(currentCart[k].amount) + '</span><span class="float-right hidden-phone"><i class="icofont icofont-ui-delete delete_todo" onclick="doAllThingsInSafe(\'local/delete\', {target: \'cart\', key: \'' + currentCart[k].key + '\'});"></i></span></label></div></div>');
|
|
|
|
$(add_todo).appendTo(".task-content").hide().fadeIn(300);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
cartTitle = currentCart.title
|
|
cartTotalAmount = currentCart.amount
|
|
|
|
$("#cartTotalAmount" ).text(numberWithCommas(cartTotalAmount));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function refreshBusinessBoard (businessInfo) {
|
|
if (businessInfo === null) {
|
|
|
|
$("#businessInfo-board-message").text('<%=__('사업자 정보가 표시되지 않고 있습니다.')%>')
|
|
|
|
$("#businessInfo-board").removeClass('alert-primary')
|
|
$("#businessInfo-board").addClass('alert-danger')
|
|
$("#businessInfo-preview").css("display", "none" )
|
|
|
|
|
|
$("#businessInfo-name").val('')
|
|
$("#businessInfo-owner").val('')
|
|
$("#businessInfo-address").val('')
|
|
$("#businessInfo-phone").val('')
|
|
$("#businessInfo-email").val('')
|
|
$("#businessInfo-capp_biz_cd").val('')
|
|
$("#businessInfo-registration_number").val('')
|
|
$("#businessInfo-note").val('')
|
|
|
|
|
|
} else {
|
|
|
|
$("#businessInfo-board-message").text('<%=__('사업자 정보가 표시되고 있습니다.')%>')
|
|
|
|
$("#businessInfo-board").removeClass('alert-danger')
|
|
$("#businessInfo-board").addClass('alert-primary')
|
|
$("#businessInfo-preview").css("display", "block" )
|
|
|
|
$("#businessInfo-name").val(businessInfo.name)
|
|
$("#businessInfo-owner").val(businessInfo.owner)
|
|
$("#businessInfo-address").val(businessInfo.address)
|
|
$("#businessInfo-phone").val(businessInfo.phone)
|
|
$("#businessInfo-email").val(businessInfo.email)
|
|
$("#businessInfo-registration_number").val(businessInfo.registration_number)
|
|
$("#businessInfo-capp_biz_cd").val(businessInfo.capp_biz_cd)
|
|
$("#businessInfo-note").val(businessInfo.note)
|
|
|
|
doSomeTrick(businessInfo, 'name')
|
|
doSomeTrick(businessInfo, 'owner')
|
|
doSomeTrick(businessInfo, 'address')
|
|
doSomeTrick(businessInfo, 'phone')
|
|
doSomeTrick(businessInfo, 'email')
|
|
doSomeTrick(businessInfo, 'registration_number')
|
|
doSomeTrick(businessInfo, 'capp_biz_cd')
|
|
doSomeTrick(businessInfo, 'note')
|
|
|
|
|
|
}
|
|
}
|
|
|
|
var payParams = null
|
|
|
|
function doSomeTrick (businessInfo, target) {
|
|
var targetVal = businessInfo[target]
|
|
// console.log('target=', target)
|
|
// console.log('targetVal=', targetVal)
|
|
if (targetVal === '') {
|
|
// console.log('hide...')
|
|
$("#businessInfo-preview-" + target).css("display", "none" )
|
|
$("#businessInfo-preview-" + target).prev().css("display", "none" )
|
|
} else {
|
|
// console.log('show...')
|
|
$("#businessInfo-preview-" + target).html(targetVal)
|
|
$("#businessInfo-preview-" + target).css("display", "block" )
|
|
$("#businessInfo-preview-" + target).prev().css("display", "block" )
|
|
}
|
|
}
|
|
|
|
|
|
function safeForUndefined (data, defaultValue) {
|
|
var defaultVal = defaultValue ? defaultValue : ''
|
|
if (data !== undefined) {
|
|
return data
|
|
} else {
|
|
return defaultVal
|
|
}
|
|
}
|
|
|
|
|
|
function tryToFill (myInfo, tag, defaultValue) {
|
|
if (myInfo.infos) {
|
|
$('#my-infos-' + tag).text(safeForUndefined(myInfo.infos[tag], defaultValue))
|
|
} else {
|
|
$('#my-infos-' + tag).text(safeForUndefined(undefined, '비공개'))
|
|
}
|
|
}
|
|
|
|
var currentMyScore = 0
|
|
|
|
function refreshMyBoard (myInfo) {
|
|
|
|
var tag = ''
|
|
|
|
if (myInfo.addon == undefined) {
|
|
myInfo.addon = {}
|
|
}
|
|
|
|
|
|
var loginProviderName = 'unknown'
|
|
|
|
if (getParams['pid'] == undefined) {
|
|
|
|
switch (myInfo.addon.provider) {
|
|
case 'facebook':
|
|
loginProviderName = 'facebook'
|
|
break;
|
|
case 'google':
|
|
loginProviderName = 'google'
|
|
break;
|
|
case 'kakao':
|
|
loginProviderName = 'kakao'
|
|
break;
|
|
case 'apple':
|
|
loginProviderName = 'apple'
|
|
break;
|
|
case 'id/password':
|
|
loginProviderName = 'id/password'
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<% if (infos.loc.endsWith('/my') || infos.loc.endsWith('/profile')) {%>
|
|
$('#my-login-provider').text(loginProviderName)
|
|
|
|
$('#my-display-name').text(myInfo.display_name)
|
|
|
|
|
|
if (myInfo.photo_url == '') {
|
|
tag = ' <dd class="col-sm-9"><img height="180" width="180" src="/images/no_profile.png" style="object-fit: contain;"></dd>'
|
|
} else {
|
|
tag = ' <dd class="col-sm-9"><img height="180" width="180" src=' + myInfo.photo_url + ' style="object-fit: contain;">' + '</dd>'
|
|
}
|
|
$('#my-photo-url').html(tag)
|
|
|
|
|
|
if (myInfo.infos == undefined) {
|
|
myInfo.infos = {score: myInfo.score}
|
|
}
|
|
currentMyScore = myInfo.score
|
|
tryToFill(myInfo, 'score', '0')
|
|
|
|
if (getParams['pid'] === undefined) {
|
|
$('#my-infos-score').html(numberWithCommas(myInfo.score) + '점, <a href="/score/detail?target=me">상세 내역 보기</a>')
|
|
|
|
if (myInfo.accompanyFlag == true && myInfo.gid != undefined) {
|
|
$('#actionBtnDiv').html('<a class="btn btn-primary btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'role\', role: \'user\'})">동행 후보 등록 취소</a>')
|
|
} else {
|
|
$('#actionBtnDiv').html('<a class="btn btn-primary btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/op\', {target: \'role:check\', role: \'guide\'})">동행 후보 등록 신청</a>')
|
|
}
|
|
|
|
|
|
} else {
|
|
$('#my-infos-score').html(numberWithCommas(myInfo.score) + '점')
|
|
|
|
|
|
if (myInfo.accompanyFlag == true && myInfo.gid != undefined) {
|
|
$('#actionBtnDiv').html('<a class="btn btn-primary btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'goto\', {target: \'/accompany/new?gid=' + myInfo.gid + '\'})">구매동행 신청</a>')
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tryToFill(myInfo, 'email', '없음')
|
|
tryToFill(myInfo, 'mobile', '없음')
|
|
tryToFill(myInfo, 'zipcode', '없음')
|
|
tryToFill(myInfo, 'address', '없음')
|
|
tryToFill(myInfo, 'addressDetail', '없음')
|
|
|
|
$('#my-updated').text(moment.utc(myInfo.updated).local().locale("ko").format('LLLL'))
|
|
$('#my-created').text(moment.utc(myInfo.created).local().locale("ko").format('LLLL'))
|
|
|
|
|
|
if (myInfo.addon.adminFlag === true) {
|
|
$('#my-etc').text('사이트 관리자 등급')
|
|
} else {
|
|
$('#my-etc').text('없음.')
|
|
}
|
|
|
|
|
|
|
|
<%} else if (infos.loc.endsWith('/new') || infos.loc.endsWith('/edit')) {%>
|
|
|
|
$('#my-display-name').val(myInfo.display_name)
|
|
$('#my-photo-url').val(myInfo.photo_url)
|
|
$('#my-infos-email').val(safeForUndefined(myInfo.infos.email, ''))
|
|
$('#my-infos-mobile').val(safeForUndefined(myInfo.infos.mobile, ''))
|
|
$('#my-infos-zipcode').val(safeForUndefined(myInfo.infos.zipcode, ''))
|
|
$('#my-infos-address').val(safeForUndefined(myInfo.infos.address, ''))
|
|
$('#my-infos-addressDetail').val(safeForUndefined(myInfo.infos.addressDetail, ''))
|
|
|
|
|
|
if (loginProviderName == 'id/password') {
|
|
$('#my-password-console').css("display", "block" )
|
|
} else {
|
|
$('#my-password-console').css("display", "none" )
|
|
}
|
|
|
|
$('#profile_file').on("change", function() {
|
|
console.log($(this).get(0).files.length)
|
|
for (var i = 0; i < $(this).get(0).files.length; ++i) {
|
|
doAllThingsInSafe('upload', {target: 'just', uploadFiles: [$(this).get(0).files[i]]})
|
|
break;
|
|
}
|
|
})
|
|
|
|
|
|
<%} %>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function refreshMyBoardBackup (myInfo) {
|
|
|
|
var targetSelector = null
|
|
|
|
|
|
|
|
|
|
var nickWarnTooltipTag = '<span class="mytooltip tooltip-effect-5">'
|
|
nickWarnTooltipTag += '<span class="tooltip-item">(!)</span>'
|
|
nickWarnTooltipTag += '<span class="tooltip-content clearfix">'
|
|
nickWarnTooltipTag += '<span class="tooltip-text">다른 사람들에게 보여지는 이름이므로 신중하게 결정하세요!</span>'
|
|
nickWarnTooltipTag += '</span>'
|
|
nickWarnTooltipTag += '</span>'
|
|
|
|
|
|
|
|
var tag = ''
|
|
|
|
|
|
<% if (infos.loc === '/my') {%>
|
|
|
|
targetSelector = $('#div-profile')
|
|
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
|
|
var loginProviderName = 'unknown'
|
|
switch (myInfo.addon.provider) {
|
|
case 'facebook':
|
|
loginProviderName = 'facebook'
|
|
break;
|
|
case 'google':
|
|
loginProviderName = 'google'
|
|
break;
|
|
case 'kakao':
|
|
loginProviderName = 'kakao'
|
|
break;
|
|
case 'apple':
|
|
loginProviderName = 'apple'
|
|
break;
|
|
case 'id/password':
|
|
loginProviderName = 'id/password'
|
|
break;
|
|
}
|
|
|
|
tag += ' <dt class="col-sm-3">로그인 방법</dt>'
|
|
tag += ' <dd class="col-sm-9">' + loginProviderName + '</dd>'
|
|
|
|
|
|
tag += ' <dt class="col-sm-3">외부 표시 이름 ' + nickWarnTooltipTag + '</dt>'
|
|
tag += ' <dd class="col-sm-9">' + myInfo.display_name + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">프로필 사진</dt>'
|
|
|
|
if (myInfo.photo_url == '') {
|
|
// tag += ' <dd class="col-sm-9">없음</dd>'
|
|
tag += ' <dd class="col-sm-9"><img height="180" width="180" src="/images/no_profile.png" style="object-fit: contain;"></dd>'
|
|
} else {
|
|
tag += ' <dd class="col-sm-9"><img height="180" width="180" src=' + myInfo.photo_url + ' style="object-fit: contain;">' + '</dd>'
|
|
}
|
|
|
|
tag += ' <dt class="col-sm-3">이메일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + safeForUndefined(myInfo.infos.email, '없음') + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">핸드폰번호</dt>'
|
|
tag += ' <dd class="col-sm-9">' + safeForUndefined(myInfo.infos.mobile, '없음') + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">우편번호</dt>'
|
|
tag += ' <dd class="col-sm-9">' + safeForUndefined(myInfo.infos.zipcode, '없음') + '</dd>'
|
|
|
|
|
|
tag += ' <dt class="col-sm-3">주소</dt>'
|
|
tag += ' <dd class="col-sm-9">' + safeForUndefined(myInfo.infos.address, '없음') + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">상세 주소</dt>'
|
|
tag += ' <dd class="col-sm-9">' + safeForUndefined(myInfo.infos.addressDetail, '없음') + '</dd>'
|
|
|
|
|
|
tag += ' <dt class="col-sm-3">최종 수정일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + moment.utc(myInfo.updated).local().locale("ko").format('LLLL') + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">가입일</dt>'
|
|
tag += ' <dd class="col-sm-9">' + moment.utc(myInfo.created).local().locale("ko").format('LLLL') + '</dd>'
|
|
|
|
if (myInfo.addon.adminFlag === true) {
|
|
|
|
tag += ' <dt class="col-sm-3"></dt>'
|
|
tag += ' <dd class="col-sm-9"></dd>'
|
|
|
|
tag += ' <dt class="col-sm-3"></dt>'
|
|
tag += ' <dd class="col-sm-9">관리자 자격을 가지고 계십니다.</dd>'
|
|
}
|
|
|
|
|
|
tag += ' </dl>'
|
|
|
|
|
|
<%} else if (infos.loc === '/my/new' || infos.loc === '/my/edit') {%>
|
|
|
|
targetSelector = $('#from-profile')
|
|
|
|
var inputWithCheckButtonTag = ''
|
|
inputWithCheckButtonTag += ' <div class="right-icon-control">'
|
|
inputWithCheckButtonTag += ' <div class="input-group input-group-button">'
|
|
inputWithCheckButtonTag += ' <input id="profile_display_name" type="text" class="form-control" value="' + myInfo.display_name + '">'
|
|
inputWithCheckButtonTag += ' <div class="input-group-append">'
|
|
inputWithCheckButtonTag += ' <button class="btn btn-primary waves-effect waves-light" type="button" onclick="doAllThingsInSafe(\'local/op\', {target: \'check\', hero: $(\'#profile_display_name\').val()})"><i class="feather icon-message-circle"></i></button>'
|
|
inputWithCheckButtonTag += ' </div>'
|
|
inputWithCheckButtonTag += ' </div>'
|
|
inputWithCheckButtonTag += ' </div>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">외부 표시 이름'+nickWarnTooltipTag+'</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_display_name" type="text" class="form-control" value="' + myInfo.display_name + '">'
|
|
//tag += ' ' + inputWithCheckButtonTag
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
|
|
var inputWithUploadButtonTag = ''
|
|
inputWithUploadButtonTag += ' <div class="right-icon-control">'
|
|
inputWithUploadButtonTag += ' <div class="input-group input-group-button">'
|
|
inputWithUploadButtonTag += ' <input id="profile_file" type="file" accept="image/*" class="form-control">'
|
|
inputWithUploadButtonTag += ' <div class="input-group-append">'
|
|
inputWithUploadButtonTag += ' <button class="btn btn-primary waves-effect waves-light" type="button" onclick="doAllThingsInSafe(\'local/op\', {target: \'upload\', hero: $(\'#profile_display_name\').val()})"><i class="feather icon-upload"></i></button>'
|
|
inputWithUploadButtonTag += ' </div>'
|
|
inputWithUploadButtonTag += ' </div>'
|
|
inputWithUploadButtonTag += ' </div>'
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">프로필 사진 주소</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_photo_url" type="text" class="form-control" value="' + myInfo.photo_url + '">'
|
|
tag += ' <input id="profile_file" type="file" accept="image/*" class="form-control">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">이메일</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_infos_email" type="text" class="form-control" value="' + safeForUndefined(myInfo.infos.email, '') + '">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">핸드폰</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_infos_mobile" type="text" class="form-control" value="' + safeForUndefined(myInfo.infos.mobile, '') + '">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
|
|
var inputWithAddressButtonTag = ''
|
|
inputWithAddressButtonTag += ' <div class="right-icon-control">'
|
|
inputWithAddressButtonTag += ' <div class="input-group input-group-button">'
|
|
inputWithAddressButtonTag += ' <input id="profile_infos_zipcode" type="text" class="form-control" value="' + safeForUndefined(myInfo.infos.zipcode, '') + '">'
|
|
inputWithAddressButtonTag += ' <div class="input-group-append">'
|
|
inputWithAddressButtonTag += ' <button class="btn btn-primary waves-effect waves-light" type="button" onclick="doAllThingsInSafe(\'local/op\', {target: \'address\'})"><i class="feather icon-search"></i></button>'
|
|
inputWithAddressButtonTag += ' </div>'
|
|
inputWithAddressButtonTag += ' </div>'
|
|
inputWithAddressButtonTag += ' </div>'
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">우편번호</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' ' + inputWithAddressButtonTag
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">주소</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_infos_address" type="text" class="form-control" value="' + safeForUndefined(myInfo.infos.address, '') + '">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
tag += ' <div class="form-group row">'
|
|
tag += ' <label class="col-sm-3 col-form-label">상세 주소</label>'
|
|
tag += ' <div class="col-sm-9">'
|
|
tag += ' <input id="profile_infos_address_detail" type="text" class="form-control" value="' + safeForUndefined(myInfo.infos.addressDetail, '') + '">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
var passwordChgTag = ''
|
|
passwordChgTag += ' <div class="form-group row">'
|
|
passwordChgTag += ' <label class="col-sm-2 col-form-label">비밀번호</label>'
|
|
passwordChgTag += ' <div class="col-sm-10">'
|
|
passwordChgTag += ' <input id="profile_password" type="password" class="form-control" placeholder="비밀번호 변경을 원하는 경우 입력하세요." autocomplete="off">'
|
|
passwordChgTag += ' </div>'
|
|
passwordChgTag += ' </div>'
|
|
|
|
passwordChgTag += ' <div class="form-group row">'
|
|
passwordChgTag += ' <label class="col-sm-2 col-form-label">비밀번호 확인</label>'
|
|
passwordChgTag += ' <div class="col-sm-10">'
|
|
passwordChgTag += ' <input id="profile_password_confirm" type="password" class="form-control" placeholder="비밀번호 변경을 원하는 경우 입력하세요." autocomplete="off">'
|
|
passwordChgTag += ' </div>'
|
|
passwordChgTag += ' </div>'
|
|
|
|
// tag += passwordChgTag
|
|
|
|
|
|
|
|
<%} %>
|
|
|
|
targetSelector.empty().hide();
|
|
targetSelector.html(tag)
|
|
targetSelector.fadeIn(300);
|
|
|
|
|
|
<% if (infos.loc === '/my/new' || infos.loc === '/my/edit') {%>
|
|
|
|
$('#profile_file').on("change", function() {
|
|
console.log($(this).get(0).files.length)
|
|
for (var i = 0; i < $(this).get(0).files.length; ++i) {
|
|
doAllThingsInSafe('upload', {target: 'just', uploadFiles: [$(this).get(0).files[i]]})
|
|
break;
|
|
}
|
|
})
|
|
|
|
<%} %>
|
|
|
|
|
|
}
|
|
|
|
function refreshMaintenanceBoard (maintenanceInfo) {
|
|
if (maintenanceInfo === null) {
|
|
|
|
$("#maintenance-board-message").text('<%=__('지금은 점검중이 아닙니다.')%>')
|
|
|
|
$("#maintenance-board").addClass('alert-primary')
|
|
$("#maintenance-board").removeClass('alert-danger')
|
|
$("#maintenance-off-btns").css("display", "block" )
|
|
$("#maintenance-on-btns").css("display", "none" )
|
|
|
|
$("#maintenance-title").val('')
|
|
$("#maintenance-description").val('')
|
|
$("#maintenance-until").val('')
|
|
$("#maintenance-type").val('all')
|
|
|
|
|
|
} else {
|
|
|
|
$("#maintenance-board-message").text('<%=__('지금은 점검중 입니다.')%>')
|
|
|
|
$("#maintenance-off-btns").css("display", "none" )
|
|
$("#maintenance-on-btns").css("display", "block" )
|
|
$("#maintenance-board").addClass('alert-danger')
|
|
$("#maintenance-board").removeClass('alert-primary')
|
|
|
|
$("#maintenance-title").val(maintenanceInfo.title)
|
|
$("#maintenance-description").val(maintenanceInfo.description)
|
|
$("#maintenance-until").val(maintenanceInfo.until)
|
|
$("#maintenance-type").val(maintenanceInfo.type)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function ajaxPreprocess (op, params) {
|
|
|
|
var nextParams = {
|
|
type: 'post',
|
|
data: makeHero(op, {...params, ts: new Date()}),
|
|
}
|
|
|
|
switch (op) {
|
|
|
|
case 'local/refresh':
|
|
|
|
switch (params.target) {
|
|
case 'beans':
|
|
$('#beansInfo').empty()
|
|
var tmpTag = '<strong>새로 고침 중 </strong>'
|
|
$('#beansInfo').html(tmpTag)
|
|
break;
|
|
|
|
default:
|
|
}
|
|
break;
|
|
|
|
|
|
case 'list':
|
|
case 'local/list':
|
|
case 'local/select':
|
|
nextParams.type = 'get'
|
|
break;
|
|
|
|
|
|
case 'withdrawal':
|
|
|
|
case 'insert':
|
|
case 'select':
|
|
case 'update':
|
|
case 'delete':
|
|
|
|
|
|
case 'local/insert':
|
|
case 'local/update':
|
|
case 'local/delete':
|
|
|
|
case 'local/subscribe':
|
|
case 'local/unsubscribe':
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'local/upload':
|
|
|
|
var formData = new FormData();
|
|
|
|
console.log('local/upload, params=', params)
|
|
|
|
|
|
<% if (infos.loc === '/timeline') { %>
|
|
if (getParams['eid'] != undefined) {
|
|
params.target = 'hello:new'
|
|
} else if (getParams['cid'] != undefined) {
|
|
params.target = 'square:new'
|
|
}
|
|
|
|
<% } %>
|
|
|
|
|
|
var airList = []
|
|
Object.keys(previewPool).forEach((key, i) => {
|
|
var tmpItem = previewPool[key]
|
|
if (tmpItem.from !== 'air') {
|
|
formData.append('upload-file', tmpItem.file, tmpItem.file.name);
|
|
} else {
|
|
airList.push(tmpItem)
|
|
}
|
|
})
|
|
|
|
formData.append('airList', JSON.stringify(airList));
|
|
|
|
if (params.target.startsWith('note:')) {
|
|
|
|
|
|
|
|
formData.append('target', params.target);
|
|
|
|
|
|
formData.append('fromId', currentCenterInfo.cid);
|
|
formData.append('sender', currentCenterInfo.name);
|
|
formData.append('toId', 'family');
|
|
|
|
formData.append('receivers', $('#note-receivers').val());
|
|
formData.append('title', $('#note-title').val());
|
|
formData.append('content', preCheckNote($('#summernote').summernote('code')));
|
|
|
|
if (params.target === 'note:new') {
|
|
formData.append('target', 'note:new');
|
|
formData.append('hero', getParams['cid']);
|
|
} else if (params.target === 'note:edit') {
|
|
formData.append('target', 'note:edit');
|
|
formData.append('hero', getParams['nid']);
|
|
formData.append('cid', getParams['cid']);
|
|
}
|
|
|
|
} else if (params.target.startsWith('review:')) {
|
|
formData.append('target', params.target);
|
|
|
|
|
|
formData.append('title', $('#review-title').val());
|
|
formData.append('content', preCheckNote($('#summernote').summernote('code')));
|
|
|
|
if (params.target === 'review:new') {
|
|
formData.append('target', 'review:new');
|
|
} else if (params.target === 'review:edit') {
|
|
formData.append('target', 'review:edit');
|
|
formData.append('hero', getParams['nid']);
|
|
}
|
|
|
|
} else if (params.target.startsWith('post:')) {
|
|
formData.append('message', $('#post-message').val());
|
|
|
|
if (params.target === 'post:new') {
|
|
formData.append('target', 'post:new');
|
|
formData.append('hero', getParams['eid']);
|
|
} else if (params.target === 'post:edit') {
|
|
formData.append('target', 'post:edit');
|
|
formData.append('hero', getParams['pid']);
|
|
}
|
|
} else if (params.target.startsWith('square:')) {
|
|
formData.append('message', $('#post-message').val());
|
|
|
|
if (params.target === 'square:new') {
|
|
formData.append('target', 'square:new');
|
|
formData.append('hero', getParams['cid']);
|
|
} else if (params.target === 'square:edit') {
|
|
formData.append('target', 'square:edit');
|
|
formData.append('hero', getParams['pid']);
|
|
}
|
|
|
|
} else if (params.target.startsWith('hello:')) {
|
|
formData.append('message', $('#post-message').val());
|
|
|
|
if (params.target === 'hello:new') {
|
|
formData.append('target', 'hello:new');
|
|
formData.append('hero', getParams['eid']);
|
|
} else if (params.target === 'hello:edit') {
|
|
formData.append('target', 'hello:edit');
|
|
formData.append('hero', getParams['pid']);
|
|
}
|
|
|
|
}
|
|
nextParams.data = formData
|
|
nextParams = {
|
|
...nextParams,
|
|
contentType : false,
|
|
processData: false,
|
|
xhr: function() { //XMLHttpRequest 재정의 가능
|
|
var xhr = $.ajaxSettings.xhr();
|
|
xhr.upload.onprogress = function(e) { //progress 이벤트 리스너 추가
|
|
var percent = e.loaded * 100 / e.total;
|
|
// setProgress(percent);
|
|
var percentInt = parseInt(percent)
|
|
console.log('percentInt=', percentInt)
|
|
};
|
|
return xhr;
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
case 'upload':
|
|
|
|
var formData = new FormData();
|
|
|
|
var airList = []
|
|
|
|
if (params.target === 'note:new' || params.target === 'note:edit') {
|
|
|
|
Object.keys(previewPool).forEach((key, i) => {
|
|
var tmpItem = previewPool[key]
|
|
if (tmpItem.from !== 'air') {
|
|
formData.append('upload-file', tmpItem.file, tmpItem.file.name);
|
|
} else {
|
|
airList.push(tmpItem)
|
|
}
|
|
})
|
|
formData.append('message', $('#post-message').val());
|
|
|
|
formData.append('airList', JSON.stringify(airList));
|
|
|
|
|
|
formData.append('fromId', currentCenterInfo.cid);
|
|
formData.append('sender', currentCenterInfo.name);
|
|
formData.append('toId', 'family');
|
|
|
|
if (params.target === 'note:new') {
|
|
formData.append('receivers', $('#note-receivers').val());
|
|
formData.append('title', $('#note-title').val());
|
|
formData.append('content', preCheckNote($('#summernote').summernote('code')));
|
|
} else if (params.target === 'note:edit') {
|
|
formData.append('receivers', $('#note-receivers').val());
|
|
formData.append('title', $('#note-title').val());
|
|
formData.append('content', preCheckNote($('#summernote').summernote('code')));
|
|
}
|
|
|
|
} else {
|
|
$.each(params.uploadFiles, function(i, file) {
|
|
if(file.upload != 'disable') {
|
|
formData.append('upload-file', file, file.name);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formData.append('target', params.target);
|
|
<% if (infos.loc === '/note/edit') {%>
|
|
formData.append('hero', getParams['nid']);
|
|
<%}%>
|
|
|
|
nextParams.data = formData
|
|
nextParams = {
|
|
...nextParams,
|
|
contentType : false,
|
|
processData: false,
|
|
xhr: function() { //XMLHttpRequest 재정의 가능
|
|
var xhr = $.ajaxSettings.xhr();
|
|
xhr.upload.onprogress = function(e) { //progress 이벤트 리스너 추가
|
|
var percent = e.loaded * 100 / e.total;
|
|
// setProgress(percent);
|
|
var percentInt = parseInt(percent)
|
|
// console.log('percentInt=', percentInt)
|
|
$("#progress-upload").attr("aria-valuenow", percentInt + '');
|
|
$("#progress-upload").width(percentInt + '%');
|
|
};
|
|
return xhr;
|
|
}
|
|
}
|
|
break;
|
|
|
|
default:
|
|
nextParams = null
|
|
}
|
|
|
|
if (nextParams === null) {
|
|
Swal.fire('알 수 없는 ajsx 요청', op + ' : ' + params.target, 'error');
|
|
}
|
|
|
|
|
|
if (op === 'local/insert') {
|
|
if (params.target === 'depot') {
|
|
if (
|
|
$("#target_url").val() == '' ||
|
|
$("#site_tag").val() == '' ||
|
|
$("#car_id").val() == '' ||
|
|
$("#title").val() == '' ||
|
|
$("#brand").val() == '' ||
|
|
$("#model_year").val() == '' ||
|
|
$("#price").val() == '' ||
|
|
$("#mileage").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '모든 값을 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
} else if (params.target === 'accompany') {
|
|
if (
|
|
$("#accompany_url").val() == '' ||
|
|
$("#accompany_place").val() == '' ||
|
|
$("#accompany_datetime").val() == '' ||
|
|
$("#accompany_price").val() == '' ||
|
|
$("#accompany_time").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '모든 값을 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
} else if (params.target === 'center') {
|
|
if (
|
|
$("#center_name").val() == '' ||
|
|
$("#center_address").val() == '' ||
|
|
$("#center_zipcode").val() == '' ||
|
|
$("#center_address_detail").val() == '' ||
|
|
$("#center_owner").val() == '' ||
|
|
$("#center_phone").val() == '' ||
|
|
$("#center_fax").val() == '' ||
|
|
$("#center_email").val() == '' ||
|
|
$("#center_greeting").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '모든 값을 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
if ($("#agreeAll").is(":checked") == false) {
|
|
Swal.fire('약관 동의는 필수 입니다.', '법률에 의해 반드시 약관에 동의해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
} else if (params.target === 'comment') {
|
|
if (
|
|
$("#comment-message").val() == ''
|
|
) {
|
|
nextParams = null
|
|
}
|
|
} else if (params.target === 'staff') {
|
|
if (
|
|
$("#staff_name").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '이름을 반드시 입력하셔야 합니다.', 'error');
|
|
nextParams = null
|
|
|
|
} else if (
|
|
($("#staff_phone").val() == '' && $("#staff_email").val() == '')
|
|
) {
|
|
Swal.fire('입력 오류', '핸드폰번호나 이메일중 하나는 반드시 입력하셔야 합니다.', 'error');
|
|
nextParams = null
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} else if (op === 'local/upload') {
|
|
if (params.target === 'post') {
|
|
if (
|
|
$("#post-message").val() == '' && Object.keys(previewPool).length == 0
|
|
) {
|
|
Swal.fire('입력 오류', '뭐라도 입력하셔야 해요.', 'error');
|
|
nextParams = null
|
|
}
|
|
}
|
|
|
|
} else if (op === 'update') {
|
|
if (params.target === 'profile') {
|
|
if (
|
|
$("#my-display-name").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '외부 표시 이름을 반드시 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
if (
|
|
$("#my-password").val() != '' &&
|
|
$("#my-password").val() != $("#my-password-confirm").val()
|
|
) {
|
|
Swal.fire('입력 오류', '비밀번호 확인 입력 내용이 일치하지 않습니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
|
|
|
|
}
|
|
} else if (op === 'local/select') {
|
|
if (params.target === 'invitation') {
|
|
if (
|
|
$("#invitation_code").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '초대 코드를 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
}
|
|
} else if (op === 'local/update') {
|
|
if (params.target === 'invitation') {
|
|
if (params.step === 'code') {
|
|
if (
|
|
$("#invitation_code").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '초대 코드를 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
} else if (params.step === 'medium') {
|
|
if (
|
|
$("#invitation_medium").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '초대 코드를 받으신 이메일 혹은 핸드폰 번호를 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
} else if (params.step === 'verify') {
|
|
if (
|
|
$("#invitation_verify_code").val() == ''
|
|
) {
|
|
Swal.fire('입력 오류', '입력하신 수신 방법으로 도착한 2차 확인코드를 입력해야 합니다.', 'error');
|
|
nextParams = null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
return nextParams
|
|
|
|
}
|
|
|
|
function refreshRateInfo (rateInfo) {
|
|
|
|
// console.log('rateInfo=', rateInfo)
|
|
|
|
$('#info-ike-count-sum').html('' + numberWithCommas(rateInfo.total) + '')
|
|
$('#info-ike-count-detail').html('긍정 ' + numberWithCommas(rateInfo.opt1 + rateInfo.opt2) + ', 부정 ' + numberWithCommas(rateInfo.opt3 + rateInfo.opt4))
|
|
|
|
var recommandRatio = (rateInfo.opt1 / rateInfo.total) * 100
|
|
var nutralRatio = ((rateInfo.opt2 + rateInfo.opt3) / rateInfo.total) * 100
|
|
var antiRatio = (rateInfo.opt4 / rateInfo.total) * 100
|
|
|
|
if (rateInfo.total == 0) {
|
|
recommandRatio = 0
|
|
nutralRatio = 0
|
|
antiRatio = 0
|
|
|
|
}
|
|
|
|
$('#info-result-good').html('' + (recommandRatio).toFixed(1) + '%, score ' + (rateInfo.ratedScore).toFixed(1))
|
|
$('#info-result-etc').html('중립 ' + (nutralRatio).toFixed(1) + '%, 반대 ' + (antiRatio).toFixed(1) + '%')
|
|
|
|
}
|
|
|
|
|
|
function refreshCommentList (divId, hero) {
|
|
// currentDomainCommentInfos = rawList
|
|
|
|
|
|
// console.log("divId=", divId)
|
|
|
|
$("#" + divId).empty().hide();
|
|
|
|
var totalTag = ''
|
|
|
|
var currentDomainCommentInfos = commentPool[divId] ? commentPool[divId] : []
|
|
// console.log('currentDomainCommentInfos=', currentDomainCommentInfos)
|
|
|
|
for (var i = 0; i < currentDomainCommentInfos.length; i++) {
|
|
if (hero) {
|
|
if (hero.hero === currentDomainCommentInfos[i].cid) {
|
|
console.log('update count! befor=', currentDomainCommentInfos[i])
|
|
if (hero.likeToggleFlag === true) {
|
|
if (hero.oldTag === '' && hero.newTag === 'like') {
|
|
currentDomainCommentInfos[i].like_count++
|
|
}
|
|
if (hero.oldTag === '' && hero.newTag === 'dislike') {
|
|
currentDomainCommentInfos[i].dislike_count++
|
|
}
|
|
if (hero.oldTag === 'like' && hero.newTag === '') {
|
|
currentDomainCommentInfos[i].like_count--
|
|
}
|
|
if (hero.oldTag === 'dislike' && hero.newTag === '') {
|
|
currentDomainCommentInfos[i].dislike_count--
|
|
}
|
|
if (hero.oldTag === 'like' && hero.newTag === 'dislike') {
|
|
currentDomainCommentInfos[i].like_count--
|
|
currentDomainCommentInfos[i].dislike_count++
|
|
}
|
|
if (hero.oldTag === 'dislike' && hero.newTag === 'like') {
|
|
currentDomainCommentInfos[i].like_count++
|
|
currentDomainCommentInfos[i].dislike_count--
|
|
}
|
|
} else {
|
|
if (hero.oldTag === 'like' && hero.newTag === '') {
|
|
currentDomainCommentInfos[i].like_count--
|
|
}
|
|
if (hero.oldTag === '' && hero.newTag === 'dislike') {
|
|
currentDomainCommentInfos[i].dislike_count++
|
|
}
|
|
if (hero.oldTag === 'dislike' && hero.newTag === 'dislike') {
|
|
var countDiff = hero.newCount - hero.oldCount
|
|
if (countDiff > 0) {
|
|
currentDomainCommentInfos[i].dislike_count++
|
|
} else {
|
|
currentDomainCommentInfos[i].dislike_count--
|
|
}
|
|
}
|
|
|
|
if (hero.oldTag === 'dislike' && hero.newTag === '') {
|
|
currentDomainCommentInfos[i].dislike_count--
|
|
}
|
|
if (hero.oldTag === '' && hero.newTag === 'like') {
|
|
currentDomainCommentInfos[i].like_count++
|
|
}
|
|
if (hero.oldTag === 'like' && hero.newTag === 'like') {
|
|
var countDiff = hero.newCount - hero.oldCount
|
|
if (countDiff > 0) {
|
|
currentDomainCommentInfos[i].like_count++
|
|
} else {
|
|
currentDomainCommentInfos[i].like_count--
|
|
}
|
|
}
|
|
}
|
|
console.log('update count! after=', currentDomainCommentInfos[i])
|
|
}
|
|
}
|
|
|
|
$("#" + divId).append('<li>' + makeCommentItemTag(currentDomainCommentInfos[i]) + '</li>');
|
|
|
|
}
|
|
$("#" + divId).show().fadeIn(300);
|
|
|
|
}
|
|
|
|
|
|
|
|
function makePagenationTag ( opTag, actionTag, subTag ) {
|
|
|
|
var pageId = "#ul-pagination"
|
|
if (subTag !== undefined) {
|
|
pageId += '_' + subTag
|
|
}
|
|
$(pageId).empty()
|
|
|
|
var liTag = ''
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber > 1 ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: 0, length: currentPageSize })" tabindex="-1">First</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber > 1 ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: (currentPageNumber - 2) * currentPageSize, length: currentPageSize })" tabindex="-1">Prev</a>'
|
|
liTag += '</li>'
|
|
|
|
if (currentPageNumber - 1 > 0) {
|
|
liTag += '<li class="page-item"><a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: (currentPageNumber -2) * currentPageSize, length: currentPageSize })">' + (currentPageNumber - 1) + '</a></li>'
|
|
}
|
|
|
|
|
|
liTag += '<li class="page-item active">'
|
|
liTag += '<a class="page-link" href="javascript:;">' + (currentPageNumber) + ' <span class="sr-only">(current)</span></a>'
|
|
liTag += '</li>'
|
|
|
|
if (currentPageNumber + 1 <= totalPageCount) {
|
|
liTag += '<li class="page-item"><a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: (currentPageNumber) * currentPageSize, length: currentPageSize })">' + (currentPageNumber + 1) + '</a></li>'
|
|
}
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber < totalPageCount ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: (currentPageNumber) * currentPageSize, length: currentPageSize })">Next</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber < totalPageCount ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'' + opTag + '\', {target: \'' + actionTag + '\', start: totalPageCount * currentPageSize, length: currentPageSize })">Last</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
$(pageId).append(liTag);
|
|
|
|
}
|
|
|
|
|
|
function ajaxSuccessProcess (op, params, ret, title, message) {
|
|
|
|
|
|
console.log('doAjax(), ret=', ret)
|
|
|
|
switch (op) {
|
|
case 'local/subscribe':
|
|
if (title && message) {
|
|
Swal.fire(title, message, "success", {
|
|
buttons: {
|
|
ok: {
|
|
text: "신청 내역 보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
window.location.replace('/tracking');
|
|
});
|
|
|
|
} else {
|
|
Swal.fire('주문 성공', "정기배송 서비스 신청이 완료되었습니다.", "success", {
|
|
buttons: {
|
|
ok: {
|
|
text: "신청 내역 보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
window.location.replace('/tracking');
|
|
});
|
|
|
|
}
|
|
break;
|
|
|
|
case 'insert':
|
|
// // type, message, created, name
|
|
|
|
switch (params.target) {
|
|
case 'support:ask':
|
|
var tmpChatObj = {
|
|
type: 'send',
|
|
message: escapeHtml($("#support-message").val()),
|
|
created: moment.utc().format(),
|
|
name: '<%=infos.userInfo.profile.display_name%>',
|
|
}
|
|
$("#support-chat").append(makeSupportItemTag(tmpChatObj));
|
|
$("#support-message").val('')
|
|
break;
|
|
|
|
case 'support:reply':
|
|
var tmpChatObj = {
|
|
type: 'received',
|
|
message: escapeHtml($("#support-message").val()),
|
|
created: moment.utc().format(),
|
|
name: '<%=infos.userInfo.profile.display_name%>',
|
|
}
|
|
$("#support-chat").append(makeSupportItemTag(tmpChatObj));
|
|
$("#support-message").val('')
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'update':
|
|
switch (params.target) {
|
|
case 'businessInfo':
|
|
refreshBusinessBoard(params)
|
|
break;
|
|
case 'maintenance':
|
|
refreshMaintenanceBoard(params)
|
|
break;
|
|
|
|
case 'profile':
|
|
<% if (infos.loc === '/my/new' || infos.loc === '/my/edit') {%>
|
|
|
|
location.href = '/my'
|
|
|
|
<%} %>
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
break;
|
|
|
|
case 'select':
|
|
switch (params.target) {
|
|
case 'businessInfo':
|
|
refreshBusinessBoard(ret.data[0])
|
|
break;
|
|
case 'maintenance':
|
|
refreshMaintenanceBoard(ret.data[0])
|
|
break;
|
|
|
|
case 'me':
|
|
refreshMyBoard(ret.data[0])
|
|
break;
|
|
|
|
case 'profile':
|
|
refreshMyBoard(ret.data[0])
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
break;
|
|
|
|
case 'delete':
|
|
switch (params.target) {
|
|
case 'businessInfo':
|
|
refreshBusinessBoard(null)
|
|
break;
|
|
case 'maintenance':
|
|
refreshMaintenanceBoard(null)
|
|
break;
|
|
|
|
case 'file':
|
|
doAllThingsInSafe('list', {target: 'files:active', start: (currentPageNumber - 1) * currentPageSize, length: currentPageSize})
|
|
break;
|
|
|
|
|
|
case 'note':
|
|
doAllThingsInSafe('local/list', {target: 'note:active'})
|
|
break;
|
|
|
|
case 'review':
|
|
doAllThingsInSafe('local/list', {target: 'review:active'})
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
case 'list':
|
|
case 'local/list':
|
|
|
|
if (ret.responseCode === 401) {
|
|
Swal.fire('권한이 없음', '현재 페이지의 정보를 볼 권한이 없습니다.', 'error')
|
|
return
|
|
}
|
|
recordsTotal = parseInt(ret.recordsTotal)
|
|
totalPageCount = parseInt(ret.totalPageCount)
|
|
currentPageSize = parseInt(ret.pageSize)
|
|
currentPageNumber = parseInt(ret.currentPageNumber)
|
|
var rawList = ret.data
|
|
|
|
switch (params.target) {
|
|
case 'support:my':
|
|
case 'support:user':
|
|
|
|
$("#support-chat").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = rawList.length - 1; i > -1; i--) {
|
|
|
|
currentSupportInfo = {
|
|
uid: rawList[i].uid,
|
|
sessionId: rawList[i].session_id,
|
|
}
|
|
|
|
|
|
$("#support-chat").append(makeSupportItemTag(rawList[i]));
|
|
|
|
}
|
|
$("#support-chat").show().fadeIn(300);
|
|
|
|
makePagenationTag('list', params.target)
|
|
|
|
console.log('currentSupportInfo=', currentSupportInfo)
|
|
|
|
|
|
|
|
break;
|
|
case 'address:active':
|
|
if (rawList.length > 0) {
|
|
currentAddress = rawList[0]
|
|
|
|
|
|
<% if (infos.loc === '/order') {%>
|
|
|
|
$("#name").val(currentAddress.name)
|
|
$("#phone").val(currentAddress.phone)
|
|
$("#zipcode").val(currentAddress.zip_code)
|
|
$("#address").val(currentAddress.address_1)
|
|
$("#addressDetail").val(currentAddress.address_2)
|
|
$("#email").val(currentAddress.email)
|
|
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/my') {%>
|
|
|
|
$("#address").val(currentAddress.zip_code + ' ' + currentAddress.address_1 + ' ' + currentAddress.address_2)
|
|
$("#phone").val(currentAddress.phone)
|
|
$("#email").val(currentAddress.email)
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
/*
|
|
base.tag = ''
|
|
base.is_default = 0
|
|
$("#name").val()
|
|
base.phone = escapeHtml($("#phone").val())
|
|
base.zip_code = escapeHtml($("#zipcode").val())
|
|
base.address_1 = escapeHtml($("#address").val())
|
|
base.address_2 = escapeHtml($("#addressDetail").val())
|
|
*/
|
|
|
|
|
|
|
|
} else {
|
|
currentAddress = {}
|
|
}
|
|
|
|
break;
|
|
case 'order:active':
|
|
|
|
|
|
$("#trackingContentOrder").html('');
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
totalTag += makeTrackingTag(rawList[i])
|
|
}
|
|
$("#trackingContentOrder").html(totalTag).show().fadeIn(300);
|
|
break;
|
|
|
|
|
|
case 'subscription:my:active':
|
|
|
|
|
|
$("#trackingContentSubscription").html('');
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
totalTag += makeSubscriptionListTag(rawList[i])
|
|
}
|
|
$("#trackingContentSubscription").html(totalTag).show().fadeIn(300);
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'subscription:active':
|
|
|
|
$("#subscriptionList").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
$("#subscriptionList").append('<li>' + makeSubscriptionItemTag(rawList[i]) + '</li>');
|
|
|
|
}
|
|
$("#subscriptionList").show().fadeIn(300);
|
|
break;
|
|
|
|
|
|
case 'depot:active':
|
|
|
|
$("#depotList").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
$("#depotList").append('<li>' + makeDepotItemTag(rawList[i]) + '</li>');
|
|
|
|
}
|
|
$("#depotList").show().fadeIn(300);
|
|
|
|
makePagenationTag('local/list', 'depot:active')
|
|
break;
|
|
|
|
|
|
case 'guide:active':
|
|
|
|
$("#guideList").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
$("#guideList").append('<li>' + makeGuideItemTag(rawList[i]) + '</li>');
|
|
|
|
}
|
|
$("#guideList").show().fadeIn(300);
|
|
|
|
makePagenationTag('local/list', 'guide:active')
|
|
break;
|
|
|
|
case 'center:active':
|
|
refreshCenterList(rawList)
|
|
makePagenationTag('local/list', 'center:active')
|
|
break;
|
|
|
|
case 'support:active':
|
|
refreshSupportList(rawList)
|
|
makePagenationTag('list', 'support:active')
|
|
break;
|
|
|
|
|
|
case 'staff:active':
|
|
refreshStaffList(rawList)
|
|
makePagenationTag('local/list', 'staff:active')
|
|
break;
|
|
|
|
case 'family:active':
|
|
refreshFamilyList(rawList)
|
|
makePagenationTag('local/list', 'family:active')
|
|
break;
|
|
|
|
case 'family:my':
|
|
|
|
<% if (infos.loc === '/timeline') { %>
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
if (rawList[i].eid == getParams['eid']) {
|
|
currentFamilyInfo = rawList[i]
|
|
|
|
<% console.log('infos.userInfo.profile.photo_url = ', infos.userInfo.profile.photo_url) %>
|
|
|
|
var my_profile_url = '<%=infos.userInfo.profile.photo_url %>'
|
|
|
|
if (my_profile_url !== '') {
|
|
$('#elder_profile').attr('src', my_profile_url)
|
|
}
|
|
|
|
$('#elder_name').html('<h6>' + elderInfo.name + '님의 ' + currentFamilyInfo.relations + '</h6>' )
|
|
$('#post-message').attr('placeholder', elderInfo.name + ' 어르신에게 소식을 남겨 볼까요?');
|
|
|
|
|
|
}
|
|
}
|
|
<% } else { %>
|
|
refreshFamilyList(rawList)
|
|
makePagenationTag('local/list', 'family:my')
|
|
<% } %>
|
|
|
|
break;
|
|
|
|
|
|
case 'elder:active':
|
|
refreshElderList(rawList)
|
|
makePagenationTag('local/list', 'elder:active')
|
|
break;
|
|
|
|
case 'elder:my':
|
|
elderInfoPool = {}
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
elderInfoPool[rawList[i].eid] = rawList[i]
|
|
}
|
|
console.log('elderInfoPool=', elderInfoPool)
|
|
|
|
<% if (infos.loc === '/family') {%>
|
|
doAllThingsInSafe('local/list', {target: 'family:my'})
|
|
<%} else {%>
|
|
doAllThingsInSafe('local/list', {target: 'timeline:active'})
|
|
<%} %>
|
|
break;
|
|
|
|
|
|
case 'timeline:center':
|
|
refreshTimelineList(rawList)
|
|
makePagenationTag('local/list', 'timeline:center', 'timeline')
|
|
break;
|
|
|
|
|
|
case 'timeline:elder':
|
|
refreshTimelineList(rawList)
|
|
makePagenationTag('local/list', 'timeline:elder', 'timeline')
|
|
break;
|
|
|
|
case 'timeline:active':
|
|
refreshTimelineList(rawList)
|
|
makePagenationTag('local/list', 'timeline:active', 'timeline')
|
|
break;
|
|
|
|
|
|
|
|
case 'depot:ready':
|
|
refreshApproveDepotList(rawList)
|
|
makePagenationTag('local/list', 'depot:ready')
|
|
break;
|
|
|
|
case 'review:ready':
|
|
refreshApproveReviewList(rawList)
|
|
makePagenationTag('local/list', 'review:ready')
|
|
break;
|
|
|
|
|
|
|
|
case 'review:active':
|
|
refreshReviewList(rawList)
|
|
makePagenationTag('local/list', 'review:active')
|
|
break;
|
|
|
|
|
|
case 'note:active':
|
|
refreshNoteList(rawList)
|
|
makePagenationTag('local/list', 'note:active')
|
|
break;
|
|
|
|
|
|
|
|
case 'comment:active':
|
|
var tmpPoolId = params.commentListId ? params.commentListId : 'commentList'
|
|
commentPool[tmpPoolId] = rawList
|
|
// console.log('after list, params=', params)
|
|
|
|
refreshCommentList(tmpPoolId)
|
|
<% if (infos.appInfo.type === 'chachachak') {%>
|
|
makePagenationTag('local/list', 'comment:active')
|
|
<%} %>
|
|
|
|
|
|
|
|
/*
|
|
$("#commentList").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
$("#commentList").append('<li>' + makeCommentItemTag(rawList[i]) + '</li>');
|
|
|
|
}
|
|
$("#commentList").show().fadeIn(300);
|
|
|
|
makePagenationTag('local/list', 'comment:active')
|
|
*/
|
|
break;
|
|
|
|
case 'accompany:received':
|
|
case 'accompany:sent':
|
|
$("#accompanyList").empty().hide();
|
|
|
|
var totalTag = ''
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
$("#accompanyList").append('<li>' + makeAccompanyItemTag(rawList[i]) + '</li>');
|
|
}
|
|
$("#accompanyList").show().fadeIn(300);
|
|
|
|
makePagenationTag('local/list', tabControlTarget)
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'score':
|
|
refreshScoreDetailTable(rawList)
|
|
makePagenationTag('local/list', 'score')
|
|
break;
|
|
|
|
|
|
case 'square':
|
|
refreshSquareTable(rawList)
|
|
makePagenationTag('local/list', 'square')
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
switch (params.target) {
|
|
case 'files:active':
|
|
$("#ul-files").empty()
|
|
for (var i = 0; i < rawList.length; i++) {
|
|
var name = rawList[i].name
|
|
var nameAry = name.split('.')
|
|
var ext = nameAry[nameAry.length - 1]
|
|
var url = '/api/file/' + rawList[i].fid + '.' + ext
|
|
var liTag = ''
|
|
liTag += '<div class="card list-view-media">'
|
|
liTag += '<div class="card-block">'
|
|
liTag += '<div class="media">'
|
|
liTag += '<a class="media-left" href="' + url + '">'
|
|
liTag += '<img height="100" width="100" class="media-object card-list-img" src="' + url + '" alt="' + name + '">'
|
|
// liTag += '<img class="media-object card-list-img" src="/admindek/images/avatar-2.jpg" alt="Generic placeholder image">'
|
|
liTag += '</a>'
|
|
liTag += '<div class="media-body">'
|
|
liTag += '<div class="col-xs-12">'
|
|
liTag += '<h6 class="d-inline-block" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 195px; height: 20px;" data-toggle="tooltip" data-placement="top" data-trigger="hover" title="' + name + '">'
|
|
liTag += 'filename : ' + name
|
|
liTag += '</h6>'
|
|
liTag += '</div>'
|
|
liTag += '<p>link url : ' + url
|
|
liTag += '</p>'
|
|
liTag += '<p>serial : ' + rawList[i].serial
|
|
liTag += '</p>'
|
|
liTag += '<div class="m-t-15">'
|
|
liTag += '<button type="button" onclick="doAllThingsInSafe(\'delete\', {target: \'file\', hero: ' + rawList[i].serial + '})" data-toggle="tooltip" title="Delete" class="btn btn-mini waves-effect waves-light">'
|
|
liTag += '<span class="fa fa-trash"></span>'
|
|
liTag += '</button>'
|
|
liTag += '</div>'
|
|
liTag += '</div>'
|
|
liTag += '</div>'
|
|
liTag += '</div>'
|
|
liTag += '</div>'
|
|
$('#ul-files').append(liTag);
|
|
}
|
|
/*
|
|
$("#ul-pagination").empty()
|
|
|
|
liTag = ''
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber > 1 ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: 0, length: currentPageSize})" tabindex="-1">First</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber > 1 ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: (currentPageNumber - 2) * currentPageSize, length: currentPageSize})" tabindex="-1">Previous</a>'
|
|
liTag += '</li>'
|
|
|
|
if (currentPageNumber - 1 > 0) {
|
|
liTag += '<li class="page-item"><a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: (currentPageNumber -2) * currentPageSize, length: currentPageSize})">' + (currentPageNumber - 1) + '</a></li>'
|
|
}
|
|
|
|
|
|
liTag += '<li class="page-item active">'
|
|
liTag += '<a class="page-link" href="javascript:;">' + (currentPageNumber) + ' <span class="sr-only">(current)</span></a>'
|
|
liTag += '</li>'
|
|
|
|
if (currentPageNumber + 1 <= totalPageCount) {
|
|
liTag += '<li class="page-item"><a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: (currentPageNumber) * currentPageSize, length: currentPageSize})">' + (currentPageNumber + 1) + '</a></li>'
|
|
}
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber < totalPageCount ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: (currentPageNumber) * currentPageSize, length: currentPageSize})">Next</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
liTag += '<li class="page-item ' + (currentPageNumber < totalPageCount ? '' : 'disabled') + '">'
|
|
liTag += '<a class="page-link" href="javascript:;" onclick="doAllThingsInSafe(\'list\', {target: \'files:active\', start: totalPageCount * currentPageSize, length: currentPageSize})">Last</a>'
|
|
liTag += '</li>'
|
|
|
|
|
|
$('#ul-pagination').append(liTag);
|
|
*/
|
|
makePagenationTag('list', 'files:active')
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
case 'local/refresh':
|
|
switch (params.target) {
|
|
case 'beans':
|
|
doAllThingsInSafe('local/select', {target: 'beans'})
|
|
break;
|
|
default:
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
case 'local/update':
|
|
case 'local/insert':
|
|
case 'local/delete':
|
|
|
|
|
|
switch (params.target) {
|
|
|
|
case 'approve:depot':
|
|
doAllThingsInSafe('local/list', {target: 'depot:ready'})
|
|
break;
|
|
|
|
case 'approve:review':
|
|
doAllThingsInSafe('local/list', {target: 'review:ready'})
|
|
break;
|
|
|
|
case 'note':
|
|
doAllThingsInSafe('local/list', {target: 'note:active', hero: currentCenterInfo.cid})
|
|
|
|
break;
|
|
|
|
case 'review':
|
|
location.href = '/review'
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'role':
|
|
// console.log('ret=',ret)
|
|
$('#role').empty()
|
|
var tmpTag = ret.role === 'guide' ? '가이드' : '구매자'
|
|
$('#role').html(tmpTag)
|
|
|
|
doAllThingsInSafe('local/select', {target: 'profile'})
|
|
|
|
break;
|
|
|
|
case 'cart:clear':
|
|
// console.log('ret=',ret)
|
|
refreshCart(['a', 'b'])
|
|
Swal.fire('새로운 시작', '장바구니를 모두 비웠습니다!', 'success')
|
|
break;
|
|
|
|
case 'depot':
|
|
if (op == 'local/delete') {
|
|
Swal.fire('완료', '삭제되었습니다.. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/depot'
|
|
})
|
|
|
|
} else if (op == 'local/insert') {
|
|
Swal.fire('완료', '저장되었습니다.. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/depot'
|
|
})
|
|
}
|
|
break;
|
|
|
|
case 'elder':
|
|
console.log('ret=',ret)
|
|
Swal.fire('완료', '저장되었습니다. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/elder?cid=' + getParams['cid']
|
|
})
|
|
break;
|
|
|
|
|
|
case 'vote':
|
|
|
|
|
|
refreshRateInfo (ret.result)
|
|
|
|
update_count_remain--
|
|
update_count_remain = update_count_remain >= 0 ? update_count_remain : 0
|
|
|
|
$("#btn-vote").html('저장' + ' ('+ update_count_remain + '/' + 3 + ')');
|
|
|
|
Swal.fire('나이스!', '입력하신 값들이 모두 저장되었습니다. ' + '<br>남은 수정 가능 횟수는 ' + update_count_remain + '회', 'success')
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'comment':
|
|
$("#comment-message").val('')
|
|
|
|
console.log('params=', params)
|
|
var tmpPoolId = params.commentListId ? params.commentListId : 'commentList'
|
|
|
|
if (op === 'local/delete') {
|
|
doAllThingsInSafe('local/list', {target: 'comment:active', hero: params.tid , commentListId: tmpPoolId})
|
|
} else if (op === 'local/insert') {
|
|
doAllThingsInSafe('local/list', {target: 'comment:active', hero: params.hero, commentListId: tmpPoolId})
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'like:comment':
|
|
console.log('ret.finalResult=', ret.finalResult)
|
|
var currentLikeInfo = null
|
|
for (var i = 0; i < likeInfos.length; i++) {
|
|
if (likeInfos[i].cid == ret.finalResult.hero) {
|
|
currentLikeInfo = likeInfos[i]
|
|
}
|
|
}
|
|
|
|
console.log('currentLikeInfo=', currentLikeInfo)
|
|
if (currentLikeInfo !== null) {
|
|
currentLikeInfo.tag = ret.finalResult.newTag
|
|
currentLikeInfo.count = ret.finalResult.newCount
|
|
} else {
|
|
var tmpLikeInfo = {
|
|
domain: elderInfo.eid,
|
|
cid: ret.finalResult.hero,
|
|
tag: ret.finalResult.newTag,
|
|
count: ret.finalResult.newCount
|
|
}
|
|
likeInfos.push(tmpLikeInfo)
|
|
}
|
|
var tmpPoolId = params.commentListId ? params.commentListId : 'commentList'
|
|
refreshCommentList(tmpPoolId, ret.finalResult)
|
|
break;
|
|
|
|
case 'like:post':
|
|
console.log('ret.finalResult=', ret.finalResult)
|
|
|
|
var currentLikeInfo = null
|
|
for (var i = 0; i < likeInfos.length; i++) {
|
|
if (likeInfos[i].cid == ret.finalResult.hero) {
|
|
currentLikeInfo = likeInfos[i]
|
|
}
|
|
}
|
|
if (currentLikeInfo !== null) {
|
|
currentLikeInfo.tag = ret.finalResult.newTag
|
|
currentLikeInfo.count = ret.finalResult.newCount
|
|
}
|
|
var selectId = 'like-post-btn-' + ret.finalResult.hero
|
|
|
|
if (ret.finalResult.newTag === 'like') {
|
|
$('#' + selectId).removeClass('btn-primary')
|
|
$('#' + selectId).addClass('btn-danger')
|
|
} else {
|
|
$('#' + selectId).removeClass('btn-danger')
|
|
$('#' + selectId).addClass('btn-primary')
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// refreshCommentList(params.commentListId, ret.finalResult)
|
|
break;
|
|
|
|
|
|
case 'accompany':
|
|
if (op === 'local/insert') {
|
|
Swal.fire('신청 완료', '신청이 입력되었습니다. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/accompany'
|
|
})
|
|
} else if (op === 'local/update') {
|
|
if (
|
|
(currentAccompanyInfo.step === 2 ||
|
|
currentAccompanyInfo.step === 3 ||
|
|
currentAccompanyInfo.step === 4 ||
|
|
currentAccompanyInfo.step === 6 ||
|
|
currentAccompanyInfo.step === 7 ||
|
|
currentAccompanyInfo.step === 8 ||
|
|
currentAccompanyInfo.step === 10 ||
|
|
currentAccompanyInfo.step === 16 ||
|
|
currentAccompanyInfo.step === 44)
|
|
&& params.op === 'stop'
|
|
) {
|
|
Swal.fire('삭제 완료', '리스트로 돌아 갑니다.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/accompany'
|
|
})
|
|
} else {
|
|
doAllThingsInSafe('local/select', {target: 'accompany', hero: getParams['aid']})
|
|
}
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
case 'center':
|
|
if (op === 'local/insert') {
|
|
Swal.fire('등록 신청 완료', '센터 등록 신청이 입력되었습니다. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/center'
|
|
})
|
|
} else if (op === 'local/update') {
|
|
Swal.fire('신청 수정 완료', '센터 정보가 변경되었습니다. 리스트 페이지로 이동해 확인해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/center'
|
|
})
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
case 'staff':
|
|
if (op === 'local/insert') {
|
|
Swal.fire('등록 완료', '스텝 등록이 완료되었습니다. 상세 보기 화면으로 이동해 초대를 진행해 주세요.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/staff/detail?sid=' + ret.result.sid
|
|
})
|
|
} else if (op === 'local/update') {
|
|
Swal.fire('수정 완료', '스텝 정보가 변경되었습니다.', 'success')
|
|
.then((result) => {
|
|
// window.location.href = '/center'
|
|
location.reload();
|
|
})
|
|
|
|
} else if (op === 'local/delete') {
|
|
Swal.fire('삭제 완료', '스텝 정보가 삭제되었습니다.', 'success')
|
|
.then((result) => {
|
|
window.location.href = '/staff?cid=' + ret.result.cid
|
|
})
|
|
|
|
}
|
|
break;
|
|
|
|
case 'post':
|
|
|
|
<% if (infos.loc == '/elder/detail') {%>
|
|
|
|
Swal.fire('삭제 완료', '확인을 누르면 리스트를 갱신합니다.', 'success')
|
|
.then((result) => {
|
|
|
|
doAllThingsInSafe('local/select', {target: 'like', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'family:active', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:elder', hero: getParams['eid']})
|
|
|
|
})
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'local/select':
|
|
|
|
switch (params.target) {
|
|
|
|
|
|
case 'profile':
|
|
refreshMyBoard(ret.data[0])
|
|
break;
|
|
|
|
|
|
case 'rank:day':
|
|
case 'rank:week':
|
|
case 'rank:month':
|
|
refreshRankTable(ret.data)
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'pid':
|
|
location.href = '/profile?pid=' + ret.data[0]
|
|
|
|
break;
|
|
|
|
|
|
case 'dig':
|
|
// console.log("HUK HUK HUK HUK, ret=", ret)
|
|
$('#search-result-console').html(ret.data.tmpHTML)
|
|
// <div class="funding-counts">
|
|
$('#map-canvas').css("display", "none" )
|
|
|
|
|
|
break;
|
|
|
|
case 'role':
|
|
// console.log('ret=',ret)
|
|
$('#role').empty()
|
|
var tmpTag = ret.data.length === 0 ? '구매자' : '가이드'
|
|
$('#role').html(tmpTag)
|
|
|
|
// console.log('ret.data[0].memo=', ret.data[0].memo)
|
|
|
|
|
|
|
|
$('#guide-memo').val(ret.data.length != 0 ? ret.data[0].memo : '')
|
|
$('#profile-image-url').val(ret.data.length != 0 ? ret.data[0].profile_url : '')
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'beans':
|
|
// console.log('ret=',ret)
|
|
$('#beansInfo').empty()
|
|
var tmpTag = '<strong>최근 리스트 갱신 시각 </strong> <code>' + ret.updatedAt + '</code>'
|
|
$('#beansInfo').html(tmpTag)
|
|
break;
|
|
|
|
case 'cart':
|
|
payParams = {
|
|
name: ret.data[0].title,
|
|
amount: ret.data[0].amount,
|
|
phone: currentAddress ? currentAddress.phone : '',
|
|
address_1: currentAddress ? currentAddress.address_1 : '',
|
|
address_2: currentAddress ? currentAddress.address_2 : '',
|
|
zip_code: currentAddress ? currentAddress.zip_code : '',
|
|
}
|
|
$('#cartTitle').text(ret.data[0].title + ', ' + numberWithCommas(ret.data[0].amount) + '원');
|
|
// doAllThingsInSafe('pay', payParams)
|
|
refreshCart(ret.data[0])
|
|
break;
|
|
|
|
case 'subscription':
|
|
// console.log('oh my god...', )
|
|
$('#cartTitle').text('정기배송 '+ ret.data[0].title + ', ' + numberWithCommas(ret.data[0].amount) + '원');
|
|
break;
|
|
|
|
|
|
|
|
case 'depot':
|
|
// console.log('oh my god...', )
|
|
var tmpTag = ''
|
|
if (ret.data[0].status == 0) {
|
|
|
|
tmpTag += ' <div class="alert alert-danger border-danger">'
|
|
tmpTag += ' <strong>승인 대기중'
|
|
tmpTag += ' </div>'
|
|
|
|
|
|
} else if (ret.data[0].status == 1) {
|
|
|
|
} else if (ret.data[0].status == 2) {
|
|
tmpTag += ' <div class="alert alert-danger border-danger">'
|
|
tmpTag += ' <strong>승인 거절됨 : </strong> <code>' + ret.data[0].reason + '</code> <a href="/support">일대일 문의</a> <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'depot\', hero: \'' + ret.data[0].cid + '\'})">완전 삭제</a>'
|
|
tmpTag += ' </div>'
|
|
|
|
} else if (ret.data[0].status == 4) {
|
|
tmpTag += ' <div class="alert alert-danger border-danger">'
|
|
tmpTag += ' <strong>관리자에 의해 삭제됨 : </strong> <code>' + ret.data[0].reason + '</code> <a href="/support">일대일 문의</a> <a href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/delete\', {target: \'depot\', hero: \'' + ret.data[0].cid + '\'})">완전 삭제</a>'
|
|
tmpTag += ' </div>'
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpTag += '<div class="alert alert-primary border-primary">'
|
|
tmpTag += '<strong>원 정보 링크 : </strong> <span id="info-url"><a target="_blank" href="' + ret.data[0].url + '"><code>' + ret.data[0].url + '</code></a></span>'
|
|
tmpTag += '</div>'
|
|
$('#depot-header').html(tmpTag)
|
|
|
|
|
|
$('#info-url').html('<a target="_blank" href="' + ret.data[0].url + '"><code>' + ret.data[0].url + '</code></a>')
|
|
$('#info-title').html('<h5>' + ret.data[0].title + '</h5>')
|
|
|
|
var etcTag = ''
|
|
etcTag += '<p>판매가 : ' + ret.data[0].price + '</p>'
|
|
etcTag += '<p>연식 : ' + ret.data[0].model_year + '</p>'
|
|
etcTag += '<p>주행거리 : ' + ret.data[0].mileage + '</p>'
|
|
etcTag += '<p>매물 등록 사이트 : ' + ret.data[0].site_tag + '</p>'
|
|
etcTag += '<p>작성자 한마디 : </p>'
|
|
etcTag += '<div class="card comp-card">'
|
|
etcTag += '<div class="card-body">'
|
|
etcTag += ret.data[0].memo
|
|
etcTag += '</div>'
|
|
etcTag += '</div>'
|
|
|
|
$('#info-etc').html(etcTag)
|
|
|
|
$('#info-hit-count').html('' + numberWithCommas(ret.data[0].hit_count) + '')
|
|
// $('#info-created').html('' + moment(ret.data[0].created).locale("ko").fromNow() + ' 부터')
|
|
$('#info-created').html('' + moment(ret.data[0].created).locale("ko").fromNow() + ' 부터')
|
|
|
|
|
|
|
|
|
|
var rateInfo = JSON.parse(ret.data[0].rate_info)
|
|
rateInfo.ratedScore = rateInfo.ratedScore ? rateInfo.ratedScore : 0
|
|
rateInfo.total = rateInfo.total ? rateInfo.total : 0
|
|
rateInfo.opt1 = rateInfo.opt1 ? rateInfo.opt1 : 0
|
|
rateInfo.opt2 = rateInfo.opt2 ? rateInfo.opt2 : 0
|
|
rateInfo.opt3 = rateInfo.opt3 ? rateInfo.opt3 : 0
|
|
rateInfo.opt4 = rateInfo.opt4 ? rateInfo.opt4 : 0
|
|
|
|
refreshRateInfo(rateInfo)
|
|
|
|
/*
|
|
$('#info-ike-count-sum').html('' + numberWithCommas(rateInfo.total) + '')
|
|
$('#info-ike-count-detail').html('긍정 ' + numberWithCommas(rateInfo.opt1 + rateInfo.opt2) + ', 부정 ' + numberWithCommas(rateInfo.opt3 + rateInfo.opt4))
|
|
|
|
var recommandRatio = (rateInfo.opt1 / rateInfo.total) * 100
|
|
var nutralRatio = ((rateInfo.opt2 + rateInfo.opt3) / rateInfo.total) * 100
|
|
var antiRatio = (rateInfo.opt4 / rateInfo.total) * 100
|
|
|
|
$('#info-result-good').html('' + (recommandRatio).toFixed(1) + '%, score ' + (rateInfo.ratedScore).toFixed(1))
|
|
$('#info-result-etc').html('중립 ' + (nutralRatio).toFixed(1) + '%, 반대 ' + (antiRatio).toFixed(1) + '%')
|
|
|
|
*/
|
|
|
|
// doAllThingsInSafe('local/list', {target: 'comment:active'})
|
|
doAllThingsInSafe('local/select', {target: 'like', hero: getParams['cid']})
|
|
|
|
break;
|
|
|
|
case 'vote':
|
|
// console.log('oh my god...', )
|
|
if (ret.data.length === 1) {
|
|
|
|
var update_count = ret.data[0].update_count
|
|
|
|
update_count_remain = 3 - update_count
|
|
|
|
update_count_remain = update_count_remain >= 0 ? update_count_remain : 0
|
|
|
|
$("#btn-vote").html('저장' + ' ('+ update_count_remain + '/' + 3 + ')');
|
|
|
|
|
|
|
|
|
|
var idPrefix = 'vote-'
|
|
|
|
for (var i = 1; i <= 4; i++) {
|
|
var tmpId = idPrefix + i
|
|
// console.log('check ', tmpId)
|
|
if (ret.data[0].vote === tmpId) {
|
|
$('#' + tmpId).prop('checked', true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#vote-comment").val(ret.data[0].comment)
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'guide':
|
|
// console.log('oh my god...', ret.data[0])
|
|
if (ret.data.length === 0) {
|
|
|
|
Swal.fire('잘못된 파라메타', '잘못된 가이드 아이디입니다. 잠시 후 다시 시도하세요.', 'error')
|
|
.then((result) => {
|
|
window.location.href = '/'
|
|
})
|
|
|
|
|
|
} else {
|
|
var tmpTag = makeGuideItemTag(ret.data[0], true)
|
|
$('#guide_info').html(tmpTag)
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'accompany':
|
|
// console.log('oh my god...', ret.data[0])
|
|
if (ret.data.length === 0) {
|
|
|
|
Swal.fire('정보 읽기 실패', '정보를 읽어 올 수 없습니다.. 잠시 후 다시 시도하세요.', 'error')
|
|
.then((result) => {
|
|
window.location.href = '/accompany'
|
|
})
|
|
|
|
|
|
} else {
|
|
updateAccompanyDetailTag(ret.data[0])
|
|
|
|
if (ret.data[0].step === 0 && getParams['fromTag'] === 'accompany:received') {
|
|
doAllThingsInSafe(
|
|
'local/update',
|
|
{target: 'accompany', hero: ret.data[0].aid, from: getParams['fromTag'], op: 'go', step: 0}
|
|
)
|
|
}
|
|
|
|
currentAccompanyInfo = ret.data[0]
|
|
|
|
/*
|
|
var targetUrl = ret.data[0].target_url
|
|
var proxy = 'https://cors-anywhere.inspond.com/';
|
|
var finalURL = proxy + targetUrl;
|
|
$.get(finalURL, function(response) {
|
|
// console.log('response=', response)
|
|
// parseSiteContents(targetUrl, response)
|
|
tmpCarInfo = parseSiteContentsRaw(targetUrl, response)
|
|
currentCarInfo = tmpCarInfo
|
|
doAllThingsInSafe('local/select', {target: 'search:depot', site_tag: tmpCarInfo.siteTag, car_id: tmpCarInfo.car_id})
|
|
}).fail(function(err) {
|
|
// console.log('err=', err)
|
|
if (err.status === 404) {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
} else {
|
|
alert('error : ' + err.responseText)
|
|
}
|
|
});
|
|
*/
|
|
doAllThingsInSafe('local/select', {target: 'grap', hero: ret.data[0].target_url, pos: 2})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'search:depot':
|
|
if (ret.data.length === 0) {
|
|
updateAccompanyDetailTag(currentAccompanyInfo, tmpCarInfo)
|
|
} else {
|
|
updateAccompanyDetailTag(currentAccompanyInfo, {...ret.data[0], inDepotFlag: true})
|
|
}
|
|
break;
|
|
|
|
|
|
case 'invitation':
|
|
if (ret.data.length === 0) {
|
|
Swal.fire('잘못된 코드', '입력하신 코드를 찾을 수 없습니다. 틀린 글자가 없는지 확인해 주세요.', 'error');
|
|
} else {
|
|
var invitationTicket = ret.data[0]
|
|
if (invitationTicket.status === 1) {
|
|
Swal.fire('사용된 코드', '이미 사용된 코드 입니다.', 'error');
|
|
} else if (invitationTicket.status === 4) {
|
|
Swal.fire('취소된 초대', '초대하신 분이 초대를 취소하셨습니다.', 'error');
|
|
} else if (invitationTicket.status === 0) {
|
|
|
|
// $("#invitation_code").attr("readonly", true);
|
|
//$("#invitation_code").removeAttr("readonly")
|
|
|
|
if (invitationTicket.level === 0) {
|
|
Swal.fire({
|
|
title: '초대',
|
|
text: invitationTicket.title + ' 초대에 응하시겠습니까?',
|
|
icon: 'question',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: '초대 수락',
|
|
cancelButtonText: '초대 거절',
|
|
}).then((result) => {
|
|
if (result.value) {
|
|
$("#invitation_code").attr("readonly", true);
|
|
doAllThingsInSafe('local/update', {target: 'invitation'})
|
|
}
|
|
})
|
|
} else if (invitationTicket.level === 1) {
|
|
$("#invitation_code").attr("readonly", true);
|
|
$("#guide_text").html('<strong>' + invitationTicket.title + ' 2차 확인</strong>')
|
|
$("#invite_step_3").css("display", "block");
|
|
Swal.fire('2차 코드 입력', '초대 코드를 받으신 핸드폰 혹은 이메일로 2차 확인 코드를 발송해 드렸습니다. 확인 후 입력해 주세요.', 'info');
|
|
} else if (invitationTicket.level === 2) {
|
|
$("#invitation_code").attr("readonly", true);
|
|
$("#guide_text").html('<strong>' + invitationTicket.title + ' 초대 코드 수신 방법 확인</strong>')
|
|
$("#invite_step_2").css("display", "block");
|
|
Swal.fire('초대 방법 확인', '초대 코드를 받으신 핸드폰 혹은 이메일주소를 입력해 주세요.', 'info');
|
|
} else {
|
|
Swal.fire('확인 오류', '알 수 없는 코드 레벨 : ' + invitationTicket.level + '<br>운영팀에 문의해 주세요.', 'error');
|
|
}
|
|
} else {
|
|
Swal.fire('확인 오류', '알 수 없는 코드 상태 : ' + invitationTicket.status + '<br>운영팀에 문의해 주세요.', 'error');
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'center':
|
|
|
|
if (ret.data.length === 1) {
|
|
currentCenterInfo = ret.data[0]
|
|
}
|
|
|
|
|
|
<% if (infos.loc === '/center/edit') {%>
|
|
if (ret.data.length === 1) {
|
|
$('#center_name').val(ret.data[0].name)
|
|
$('#center_zipcode').val(ret.data[0].zipcode)
|
|
$('#center_address').val(ret.data[0].address)
|
|
$('#center_address_detail').val(ret.data[0].address_detail)
|
|
$('#center_owner').val(ret.data[0].owner)
|
|
$('#center_phone').val(ret.data[0].phone)
|
|
$('#center_fax').val(ret.data[0].fax)
|
|
$('#center_email').val(ret.data[0].email)
|
|
$('#center_greeting').val(ret.data[0].greeting)
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
<%} else if (infos.loc === '/profile') { %>
|
|
refreshProfileInfo(ret.data)
|
|
<%} else if (infos.loc === '/note') { %>
|
|
if (ret.data.length === 1) {
|
|
currentCenterInfo = ret.data[0]
|
|
$('#note-page-title').text(currentCenterInfo.name + ' 노트 리스트')
|
|
doAllThingsInSafe('local/list', {target: 'note:active', hero: currentCenterInfo.cid})
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
|
|
<%} else if (infos.loc === '/note/new') { %>
|
|
if (ret.data.length === 1) {
|
|
currentCenterInfo = ret.data[0]
|
|
$('#note-page-title').text(currentCenterInfo.name + ' 새 노트 작성')
|
|
|
|
$('#note-receivers').val(currentCenterInfo.name + ' 보호자 여러분').focus();
|
|
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
<%} else if (infos.loc === '/timeline') { %>
|
|
// HUKHUKHUK
|
|
if (ret.data.length === 1) {
|
|
currentCenterInfo = ret.data[0]
|
|
// $('#elder_profile').attr("", elderInfo.profile_url)
|
|
$('#elder_name').html('<h6>' + currentCenterInfo.name + '</h6>' )
|
|
$('#post-message').attr('placeholder', '센터에는 어떤 일이 있었나요?');
|
|
|
|
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/post/edit') {%>
|
|
$('#timeline-input-div').css("display", "block" )
|
|
$('#elder_name').html('<h6>' + currentCenterInfo.name + '</h6>' )
|
|
$('#post-message').attr('placeholder', '센터에는 어떤 일이 있었나요?');
|
|
|
|
|
|
|
|
var tmpImgAry = JSON.parse(postInfo.files)
|
|
for (var i = 0; i < tmpImgAry.length; i++) {
|
|
console.log('huk previewLastIdx=', previewLastIdx)
|
|
var tmpKey = 'fileKey_' + (previewLastIdx)
|
|
console.log('tmpKey=', tmpKey)
|
|
|
|
var tmpPreviewItem = {
|
|
from: 'air',
|
|
localUrl: tmpImgAry[i].localUrl,
|
|
name: tmpImgAry[i].name,
|
|
size: tmpImgAry[i].size,
|
|
type: tmpImgAry[i].type,
|
|
key: tmpKey,
|
|
imgTagId: 'imgTag_' + (previewLastIdx)
|
|
}
|
|
previewPool[tmpKey] = tmpPreviewItem
|
|
previewLastIdx++
|
|
}
|
|
makePreviewAlive()
|
|
|
|
$('#post-message').val(postInfo.content)
|
|
|
|
|
|
<%} else { %>
|
|
refreshCenterInfo(ret.data)
|
|
<%}%>
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'staff':
|
|
|
|
<% if (infos.loc === '/staff/edit') {%>
|
|
if (ret.data.length === 1) {
|
|
$('#staff_name').val(ret.data[0].name)
|
|
$('#staff_phone').val(ret.data[0].phone)
|
|
$('#staff_email').val(ret.data[0].email)
|
|
$('#staff_greeting').val(ret.data[0].greeting)
|
|
$('#staff_profile_url').val(ret.data[0].profile_url)
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/staff/detail') {%>
|
|
|
|
refreshStaffInfo(ret.data)
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/profile') {%>
|
|
refreshProfileInfo(ret.data)
|
|
<%} %>
|
|
|
|
|
|
break;
|
|
|
|
case 'family':
|
|
|
|
if (ret.data.length === 1) {
|
|
|
|
<% if (infos.loc === '/family/detail') {%>
|
|
refreshFamilyInfo(ret.data)
|
|
<%} else if (infos.loc === '/family/edit') {%>
|
|
$('#family_name').val(ret.data[0].name)
|
|
$('#family_relations').val(ret.data[0].relations)
|
|
$('#family_phone').val(ret.data[0].phone)
|
|
$('#family_email').val(ret.data[0].email)
|
|
$('#family_profile_url').val(ret.data[0].profile_url)
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/profile') {%>
|
|
refreshProfileInfo(ret.data)
|
|
<%} %>
|
|
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
break;
|
|
|
|
case 'elder':
|
|
|
|
if (ret.data.length == 1) {
|
|
elderInfo = ret.data[0]
|
|
getParams['cid'] = ret.data[0].cid
|
|
|
|
if (elderInfo.profile_url != null && elderInfo.profile_url.trim() != '') {
|
|
$('#elder_profile').attr("src", elderInfo.profile_url)
|
|
}
|
|
$('#elder_name').html('<h6>' + elderInfo.name + ' 어르신</h6>' )
|
|
|
|
}
|
|
|
|
|
|
if (ret.data.length === 1) {
|
|
$('#elder_name').val(ret.data[0].name)
|
|
$('#elder_memo').val(ret.data[0].memo)
|
|
$('#elder_profile_url').val(ret.data[0].profile_url)
|
|
} else {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
}
|
|
|
|
|
|
|
|
<% if (infos.loc === '/elder/detail') {%>
|
|
|
|
|
|
|
|
refreshElderInfo(ret.data)
|
|
doAllThingsInSafe('local/select', {target: 'like', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'family:active', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:elder', hero: getParams['eid']})
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/post/edit') {%>
|
|
$('#timeline-input-div').css("display", "block" )
|
|
var tmpImgAry = JSON.parse(postInfo.files)
|
|
for (var i = 0; i < tmpImgAry.length; i++) {
|
|
console.log('huk previewLastIdx=', previewLastIdx)
|
|
var tmpKey = 'fileKey_' + (previewLastIdx)
|
|
console.log('tmpKey=', tmpKey)
|
|
|
|
var tmpPreviewItem = {
|
|
from: 'air',
|
|
localUrl: tmpImgAry[i].localUrl,
|
|
name: tmpImgAry[i].name,
|
|
size: tmpImgAry[i].size,
|
|
type: tmpImgAry[i].type,
|
|
key: tmpKey,
|
|
imgTagId: 'imgTag_' + (previewLastIdx)
|
|
}
|
|
previewPool[tmpKey] = tmpPreviewItem
|
|
previewLastIdx++
|
|
}
|
|
makePreviewAlive()
|
|
|
|
$('#post-message').val(postInfo.content)
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/profile') {%>
|
|
refreshProfileInfo(ret.data)
|
|
<%} %>
|
|
|
|
|
|
break;
|
|
|
|
case 'post':
|
|
if (ret.data.length == 0) {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
|
|
} else {
|
|
postInfo = ret.data[0]
|
|
if (postInfo.eid !== 'square') {
|
|
doAllThingsInSafe('local/select', {target: 'elder', hero: postInfo.eid})
|
|
} else {
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: postInfo.cid})
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
case 'like':
|
|
likeInfos = ret.data
|
|
<% if (infos.appInfo.type === 'chachachak') {%>
|
|
doAllThingsInSafe('local/list', {target: 'comment:active', hero: getParams['cid']})
|
|
<%} %>
|
|
break;
|
|
|
|
|
|
case 'grap':
|
|
// console.log('huk ret.data=', ret.data)
|
|
if (ret.data.error) {
|
|
Swal.fire('서버오류', '정보 읽어오기 실패' + '<BR>' + (ret.data.error.message ? ret.data.error.message : ret.data.error.toString()), 'error');
|
|
} else {
|
|
if (params.pos === 1) {
|
|
parseSiteContents(params.hero, ret.data)
|
|
} else if (params.pos === 2) {
|
|
doAllThingsInSafe('local/select', {target: 'search:depot', site_tag: ret.data.siteTag, car_id: ret.data.car_id})
|
|
|
|
} else if (params.pos === 3) {
|
|
tmpCarInfo = ret.data
|
|
doAllThingsInSafe('local/insert', {target: 'accompany'})
|
|
} else {
|
|
Swal.fire('서버오류', '정보 읽어오기 실패' + '<BR>' + '잘못된 위치 정보 : ' + params.pos, 'error');
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
case 'note':
|
|
case 'review':
|
|
if (ret.data.length == 0) {
|
|
alert('대상을 찾을 수 없습니다. ')
|
|
} else {
|
|
|
|
<% if (infos.loc === '/review/detail') {%>
|
|
$('#review-title').text(ret.data[0].title)
|
|
$('#review-updated').text(moment.utc(ret.data[0].updated).locale("ko").format('LLLL'))
|
|
$('#review-sender').text(ret.data[0].sender)
|
|
$('#review-sender-info').text('[나중에 부가 정보가 들어갑니다.]')
|
|
$('#review-content').empty()
|
|
$('#review-content').html(ret.data[0].content)
|
|
|
|
|
|
var tmpCurrentLikeInfo = null
|
|
var tmpTag = ''
|
|
tmpTag += ' <div class="row">'
|
|
tmpTag += ' <div class="col-lg-6 col-md-12">'
|
|
tmpTag += ' <div class="form-group">'
|
|
tmpTag += ' <button id="like-review-btn" onclick="doAllThingsInSafe(\'local/update\', {target: \'like:review\', hero: \'' + ret.data[0].nid + '\', domain: \'' + 'review' + '\', tag: \'like\'})" class="label-icon btn waves-effect waves-light ' + (tmpCurrentLikeInfo ? (tmpCurrentLikeInfo.tag === 'like' ? 'btn-danger' : 'btn-primary') : 'btn-primary') + ' btn-block"><i class="icofont icofont-thumbs-up"></i>좋아요</button>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' <div class="col-lg-6 col-md-12">'
|
|
tmpTag += ' <div class="form-group">'
|
|
tmpTag += ' <button class="btn waves-effect waves-light btn-primary btn-outline-primary btn-block" onclick="getComment(\'' + ret.data[0].nid + '\')"><i class="icofont icofont-comment"></i>댓글 달기</button>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
|
|
|
|
if (ret.data[0].myReviewFlag == true) {
|
|
tmpTag += ' <div class="row">'
|
|
tmpTag += ' <div class="col-lg-6 col-md-12">'
|
|
tmpTag += ' <div class="form-group">'
|
|
tmpTag += ' <button id="like-review-btn" onclick="doAllThingsInSafe(\'goto\', {target: \'/review/edit?nid=' + ret.data[0].nid + '\'})" class="label-icon btn waves-effect waves-light btn-danger btn-block"><i class="icofont icofont-thumbs-up"></i>수정</button>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' <div class="col-lg-6 col-md-12">'
|
|
tmpTag += ' <div class="form-group">'
|
|
tmpTag += ' <button id="like-review-btn" onclick="doAllThingsInSafe(\'local/delete\', {target: \'review\', hero: \'' + ret.data[0].nid + '\'})" class="label-icon btn waves-effect waves-light btn-danger btn-block"><i class="icofont icofont-thumbs-up"></i>삭제</button>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
tmpTag += ' </div>'
|
|
|
|
}
|
|
|
|
|
|
$('#actionBtnDiv').html(tmpTag)
|
|
|
|
|
|
|
|
|
|
$('#review-attachments').empty()
|
|
var attachments = JSON.parse(ret.data[0].attachments)
|
|
if (attachments.length > 0) {
|
|
var attachmentsTag = ''
|
|
attachmentsTag += ''
|
|
attachmentsTag += ' <i class="icofont icofont-clip f-20 m-r-10"></i>첨부 파일 <b>(' + attachments.length + ')</b>'
|
|
attachmentsTag += ' <div class="row mail-img m-b-20">'
|
|
|
|
console.log('attachments=', attachments)
|
|
|
|
for (var i = 0; i < attachments.length; i++) {
|
|
|
|
console.log('attachments[i]=', attachments[i])
|
|
|
|
var tmpMimeType = getMimeTypeFromPath(attachments[i].name)
|
|
|
|
attachmentsTag += ' <div class="col-sm-4 col-md-2 col-xs-12">'
|
|
|
|
switch (tmpMimeType) {
|
|
case 'image':
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="' + attachments[i].localUrl + '" alt="attachments image"><BR>' + attachments[i].name + '</a>'
|
|
break;
|
|
|
|
case 'video':
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="/images/mp4_icon.png" alt="attachments video"><BR>' + attachments[i].name + '</a>'
|
|
break;
|
|
|
|
default:
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="/images/file_icon.png" alt="attachments file"><BR>' + attachments[i].name + '</a>'
|
|
}
|
|
attachmentsTag += ' </div>'
|
|
}
|
|
|
|
attachmentsTag += ' </div>'
|
|
$('#review-attachments').html(attachmentsTag)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/note/detail') {%>
|
|
$('#note-title').text(ret.data[0].title)
|
|
$('#note-updated').text(moment.utc(ret.data[0].updated).locale("ko").format('LLLL'))
|
|
$('#note-sender').text(ret.data[0].sender)
|
|
$('#note-content').empty()
|
|
$('#note-content').html(ret.data[0].content)
|
|
|
|
$('#note-attachments').empty()
|
|
var attachments = JSON.parse(ret.data[0].attachments)
|
|
if (attachments.length > 0) {
|
|
var attachmentsTag = ''
|
|
attachmentsTag += ''
|
|
attachmentsTag += ' <i class="icofont icofont-clip f-20 m-r-10"></i>첨부 파일 <b>(' + attachments.length + ')</b>'
|
|
attachmentsTag += ' <div class="row mail-img m-b-20">'
|
|
|
|
for (var i = 0; i < attachments.length; i++) {
|
|
|
|
var tmpMimeType = getMimeTypeFromPath(attachments[i].name)
|
|
|
|
attachmentsTag += ' <div class="col-sm-4 col-md-2 col-xs-12">'
|
|
|
|
switch (tmpMimeType) {
|
|
case 'image':
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="' + attachments[i].localUrl + '" alt="attachments image"><BR>' + attachments[i].name + '</a>'
|
|
break;
|
|
|
|
case 'video':
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="/images/mp4_icon.png" alt="attachments video"><BR>' + attachments[i].name + '</a>'
|
|
break;
|
|
|
|
default:
|
|
attachmentsTag += ' <a href="' + attachments[i].localUrl + '" download="' + attachments[i].name + '"><img height="100" width="100" class="img-fluid img-thumbnail" src="/images/file_icon.png" alt="attachments file"><BR>' + attachments[i].name + '</a>'
|
|
}
|
|
attachmentsTag += ' </div>'
|
|
}
|
|
|
|
attachmentsTag += ' </div>'
|
|
$('#note-attachments').html(attachmentsTag)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/note/edit') {%>
|
|
|
|
$('#note-receivers').val(ret.data[0].receivers).focus();
|
|
$('#note-title').val(ret.data[0].title).focus();
|
|
|
|
$('#summernote').summernote('code', ret.data[0].content);
|
|
|
|
|
|
|
|
var tmpImgAry = JSON.parse(ret.data[0].attachments)
|
|
for (var i = 0; i < tmpImgAry.length; i++) {
|
|
console.log('huk previewLastIdx=', previewLastIdx)
|
|
var tmpKey = 'fileKey_' + (previewLastIdx)
|
|
console.log('tmpKey=', tmpKey)
|
|
|
|
var tmpPreviewItem = {
|
|
from: 'air',
|
|
localUrl: tmpImgAry[i].localUrl,
|
|
name: tmpImgAry[i].name,
|
|
type: tmpImgAry[i].type,
|
|
size: tmpImgAry[i].size,
|
|
key: tmpKey,
|
|
imgTagId: 'imgTag_' + (previewLastIdx)
|
|
}
|
|
previewPool[tmpKey] = tmpPreviewItem
|
|
previewLastIdx++
|
|
}
|
|
makePreviewAlive()
|
|
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/review/edit') { %>
|
|
|
|
$('#review-receivers').val(ret.data[0].receivers).focus();
|
|
$('#review-title').val(ret.data[0].title).focus();
|
|
|
|
$('#summernote').summernote('code', ret.data[0].content);
|
|
|
|
|
|
|
|
var tmpImgAry = JSON.parse(ret.data[0].attachments)
|
|
for (var i = 0; i < tmpImgAry.length; i++) {
|
|
console.log('huk previewLastIdx=', previewLastIdx)
|
|
var tmpKey = 'fileKey_' + (previewLastIdx)
|
|
console.log('tmpKey=', tmpKey)
|
|
|
|
var tmpPreviewItem = {
|
|
from: 'air',
|
|
localUrl: tmpImgAry[i].localUrl,
|
|
name: tmpImgAry[i].name,
|
|
type: tmpImgAry[i].type,
|
|
size: tmpImgAry[i].size,
|
|
key: tmpKey,
|
|
imgTagId: 'imgTag_' + (previewLastIdx)
|
|
}
|
|
previewPool[tmpKey] = tmpPreviewItem
|
|
previewLastIdx++
|
|
}
|
|
makePreviewAlive()
|
|
|
|
|
|
|
|
|
|
<%}%>
|
|
|
|
}
|
|
break;
|
|
|
|
case 'square':
|
|
// console.log('oh my god...', ret.data[0])
|
|
if (ret.data.length === 0) {
|
|
|
|
Swal.fire('잘못된 파라메타', '잘못된 센터 아이디입니다. 잠시 후 다시 시도하세요.', 'error')
|
|
.then((result) => {
|
|
window.location.href = '/square'
|
|
})
|
|
} else {
|
|
currentCenterInfo = ret.data[0]
|
|
$('#sd-name').html(currentCenterInfo.name + ' <label class="label label-primary">링크케어</label>')
|
|
$('#sd-tags').empty()
|
|
// $('#sd-tags').html('<label class="label label-primary">링크케어</label>')
|
|
$('#sd-address').text(currentCenterInfo.address)
|
|
$('#sd-greeting').text(currentCenterInfo.greeting)
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'upload':
|
|
|
|
<% if (infos.loc == '/admin/upload') {%>
|
|
currentPageSize = 3
|
|
currentPageNumber = 1
|
|
doAllThingsInSafe('list', {target: 'files:active', start: (currentPageNumber - 1) * currentPageSize, length: currentPageSize})
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc == '/my/edit' || infos.loc == '/profile/edit') {%>
|
|
var uploadResult = ret.files[0]
|
|
$('#my-photo-url').val(uploadResult.localUrl)
|
|
<%} %>
|
|
|
|
<% if ((infos.loc === '/note/new' || infos.loc === '/note/edit')) {%>
|
|
var tmpUrls = []
|
|
|
|
if (ret.files) {
|
|
for (var i = 0; i < ret.files.length; i++) {
|
|
tmpUrls.push(ret.files[i].localUrl)
|
|
$('#summernote').summernote('insertImage', ret.files[i].localUrl);
|
|
}
|
|
console.log('tmpUrls=', tmpUrls)
|
|
}
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if ((infos.loc === '/review/new' || infos.loc === '/review/edit')) {%>
|
|
var tmpUrls = []
|
|
|
|
if (ret.files) {
|
|
for (var i = 0; i < ret.files.length; i++) {
|
|
tmpUrls.push(ret.files[i].localUrl)
|
|
$('#summernote').summernote('insertImage', ret.files[i].localUrl);
|
|
}
|
|
console.log('tmpUrls=', tmpUrls)
|
|
}
|
|
|
|
<%} %>
|
|
|
|
|
|
break;
|
|
|
|
case 'local/upload':
|
|
|
|
|
|
<% if (infos.loc == '/post/edit') {%>
|
|
|
|
|
|
Swal.fire('저장 완료', '확인을 누르면 이전 화면으로 돌아 갑니다.', 'success')
|
|
.then((result) => {
|
|
|
|
window.history.back()
|
|
window.history.back()
|
|
|
|
})
|
|
|
|
|
|
<%} else if (infos.loc == '/elder/detail') {%>
|
|
|
|
Swal.fire('저장 완료', '확인을 누르면 리스트를 갱신합니다.', 'success')
|
|
.then((result) => {
|
|
$('#post-message').val('')
|
|
previewPool = {}
|
|
makePreviewAlive()
|
|
doAllThingsInSafe('local/select', {target: 'like', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'family:active', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:elder', hero: getParams['eid']})
|
|
|
|
})
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if ((infos.loc === '/note/new' || infos.loc === '/note/edit')) {%>
|
|
|
|
Swal.fire('저장 완료', '리스트로 가서 결과를 확인하세요.', 'success')
|
|
.then((result) => {
|
|
window.location = '/note' + '?cid=' + getParams['cid']
|
|
})
|
|
|
|
|
|
<%} %>
|
|
|
|
<% if ((infos.loc === '/review/new' || infos.loc === '/review/edit')) {%>
|
|
|
|
Swal.fire('저장 완료', '리스트로 가서 결과를 확인하세요.', 'success')
|
|
.then((result) => {
|
|
window.location = '/review'
|
|
})
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
if (title && message) {
|
|
Swal.fire(title, message, 'success')
|
|
.then((result) => {
|
|
switch (op) {
|
|
case 'withdrawal':
|
|
window.location.replace('/');
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
function ajaxErrorProcess (op, params, response, title, message) {
|
|
|
|
console.log('huk ajaxErrorProcess(), response=', response)
|
|
|
|
if (title && message) {
|
|
Swal.fire(title, message + '<BR>' + response.responseMessage, 'error');
|
|
} else {
|
|
if (response.responseMessage.code !== undefined ) {
|
|
if (response.responseMessage.code === 'ER_DUP_ENTRY') {
|
|
if (params.target === 'profile') {
|
|
Swal.fire('입력 오류', '입력하신 이름은 이미 다른 사람이 사용중입니다.', 'error');
|
|
} else {
|
|
Swal.fire('서버 오류', '같은 값이 이미 저장되어 있습니다.', 'error');
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
Swal.fire('서버 오류', response.responseMessage.code + (response.responseMessage.sqlMessage ? ' - ' + response.responseMessage.sqlMessage : '' ) , 'error');
|
|
}
|
|
} else {
|
|
Swal.fire('서버 오류', response.responseMessage, 'error');
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// doAjax(opType, params)
|
|
async function testMixin (opType, params) {
|
|
|
|
// doAjax(opType, params)
|
|
switch (params.step) {
|
|
case 5:
|
|
const swalWithBootstrapButtons = Swal.mixin({
|
|
customClass: {
|
|
confirmButton: 'btn btn-success',
|
|
cancelButton: 'btn btn-danger'
|
|
},
|
|
buttonsStyling: false
|
|
})
|
|
|
|
swalWithBootstrapButtons.fire({
|
|
title: '보수 결제',
|
|
text: "동행 보수 100,000원을 결제 하시겠습니까?",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonText: '결제',
|
|
cancelButtonText: '취소',
|
|
reverseButtons: true
|
|
}).then((result) => {
|
|
if (result.value) {
|
|
swalWithBootstrapButtons.fire(
|
|
'결제 완료',
|
|
'결제 되었다고 가정합니다.',
|
|
'success'
|
|
)
|
|
doAjax(opType, params)
|
|
} else if (
|
|
/* Read more about handling dismissals below */
|
|
result.dismiss === Swal.DismissReason.cancel
|
|
) {
|
|
swalWithBootstrapButtons.fire(
|
|
'취소',
|
|
'취소되었습니다.',
|
|
'error'
|
|
)
|
|
}
|
|
})
|
|
break;
|
|
|
|
default:
|
|
|
|
|
|
const { value: fruit } = await Swal.fire({
|
|
title: '만족도 평가',
|
|
input: 'select',
|
|
inputOptions: {
|
|
'vg': '매우 만족',
|
|
'g': '만족',
|
|
'n': '보통',
|
|
'b': '불만족',
|
|
'vb': '매우 불만족'
|
|
},
|
|
inputPlaceholder: '만족도 평가',
|
|
showCancelButton: true,
|
|
inputValidator: (value) => {
|
|
return new Promise((resolve) => {
|
|
resolve()
|
|
})
|
|
}
|
|
})
|
|
|
|
if (fruit) {
|
|
Swal.fire(`당신의 선택: ${fruit}`)
|
|
doAjax(opType, params)
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var currentAccompanyInfo = {}
|
|
var currentCarInfo = {}
|
|
|
|
function doAjax (op, params, progressMessage, successTitle, successMessage, errorTitle, errorMessage) {
|
|
|
|
var nextParams = ajaxPreprocess (op, params)
|
|
|
|
if (nextParams === null) {
|
|
// Swal.fire('알 수 없는 ajsx 요청', op + ' : ' + params.target, 'error');
|
|
return
|
|
} else {
|
|
|
|
console.log('doAjax(), op=', op)
|
|
console.log('doAjax(), params=', params)
|
|
|
|
|
|
if (progressMessage) {
|
|
Swal.fire({
|
|
title: progressMessage
|
|
});
|
|
Swal.showLoading()
|
|
}
|
|
|
|
$.ajax({
|
|
url: '/api/' + op,
|
|
dataType: 'json',
|
|
...nextParams,
|
|
success: function (ret) {
|
|
// console.log('ret=', ret)
|
|
if (progressMessage) {
|
|
Swal.hideLoading()
|
|
Swal.close()
|
|
}
|
|
ajaxSuccessProcess (op, params, ret, successTitle, successMessage)
|
|
},
|
|
error: function (request, status, error){
|
|
// console.log('request=', request)
|
|
// console.log('status=', status)
|
|
// console.log('error=', error)
|
|
if (progressMessage) {
|
|
Swal.hideLoading()
|
|
Swal.close()
|
|
}
|
|
if (request.responseJSON === undefined) {
|
|
Swal.fire('서버 오류', request.fail().status + ' ' + request.fail().statusText, 'error');
|
|
} else {
|
|
ajaxErrorProcess (op, params, request.responseJSON, errorTitle, errorMessage)
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function getFormattedDatetime (targetDatetime) {
|
|
var dateString =
|
|
targetDatetime.getFullYear() + "-" +
|
|
("0" + (targetDatetime.getMonth()+1)).slice(-2) + "-" +
|
|
("0" + targetDatetime.getDate()).slice(-2) + "T" +
|
|
("0" + targetDatetime.getHours()).slice(-2) + ":" +
|
|
("0" + targetDatetime.getMinutes()).slice(-2) + ":" +
|
|
("0" + targetDatetime.getSeconds()).slice(-2);
|
|
return dateString
|
|
}
|
|
|
|
var tmpCarInfo = {}
|
|
|
|
function preCheckAccompany () {
|
|
|
|
var targetUrl = $("#accompany_url").val()
|
|
doAllThingsInSafe('local/select', {target: 'grap', hero: targetUrl, pos: 3})
|
|
|
|
/*
|
|
var targetUrl = $("#accompany_url").val()
|
|
var proxy = 'https://cors-anywhere.inspond.com/';
|
|
var finalURL = proxy + targetUrl;
|
|
$.get(finalURL, function(response) {
|
|
console.log('response=', response)
|
|
// parseSiteContents(targetUrl, response)
|
|
tmpCarInfo = parseSiteContentsRaw(targetUrl, response)
|
|
doAllThingsInSafe('local/insert', {target: 'accompany'})
|
|
}).fail(function(err) {
|
|
console.log('err=', err)
|
|
if (err.status === 404) {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
} else {
|
|
alert('error : ' + err.responseText)
|
|
}
|
|
});
|
|
*/
|
|
}
|
|
|
|
|
|
function preCheckNote (code) {
|
|
var filteredCode = ''
|
|
|
|
var phpkey1 = "<"+"?php",
|
|
phpkeyend = "?>",
|
|
stylekey1 = "<style>",
|
|
stylekey2 = "<style type=\"text/css\">",
|
|
stylekeyend = "</style>",
|
|
scriptkey1 = "<script>",
|
|
scriptkey2 = "<script type=\"text/javascript\">",
|
|
scriptkeyend = "</script>";
|
|
|
|
|
|
filteredCode = $.trim(code)
|
|
.replace(/<!--\?php/g, phpkey1)
|
|
.replace(/\?-->/g, phpkeyend)
|
|
.replace(/<style>/g, stylekey1)
|
|
.replace(/<style type="text\/css">/g, stylekey2)
|
|
.replace(/<\/style>/g, stylekeyend)
|
|
.replace(/<script>/g, scriptkey1)
|
|
.replace(/<script type="text\/javascript">/g, scriptkey2)
|
|
.replace(/<\/script>/g, scriptkeyend);
|
|
|
|
return filteredCode
|
|
|
|
}
|
|
|
|
|
|
function makeHero (op, base) {
|
|
// console.log('before base=', base)
|
|
switch (base.target) {
|
|
|
|
case 'note':
|
|
|
|
if (op === 'insert') {
|
|
base.receivers = $('#note-receivers').val();
|
|
base.title = $('#note-title').val();
|
|
base.content = preCheckNote($('#summernote').summernote('code'));
|
|
} else if (op === 'update') {
|
|
base.receivers = $('#note-receivers').val();
|
|
base.title = $('#note-title').val();
|
|
base.content = preCheckNote($('#summernote').summernote('code'));
|
|
} else if (op === 'select') {
|
|
if (base.nid == undefined) {
|
|
base.nid = getParams['nid']
|
|
}
|
|
}
|
|
|
|
// console.log('for note, base=', base)
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'review':
|
|
|
|
if (op === 'insert') {
|
|
base.title = $('#review-title').val();
|
|
base.content = preCheckNote($('#summernote').summernote('code'));
|
|
} else if (op === 'update') {
|
|
base.title = $('#review-title').val();
|
|
base.content = preCheckNote($('#summernote').summernote('code'));
|
|
} else if (op === 'select') {
|
|
if (base.nid == undefined) {
|
|
base.nid = getParams['nid']
|
|
}
|
|
}
|
|
|
|
// console.log('for note, base=', base)
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'faq':
|
|
base.hero = $("#faq-serial").val()
|
|
// base.question = escapeHtml($("#faq-question").val())
|
|
// base.answer = escapeHtml($("#faq-answer").val())
|
|
base.question = $("#faq-question").val()
|
|
base.answer = $("#faq-answer").val()
|
|
|
|
break;
|
|
|
|
case 'notice':
|
|
base.hero = $("#notice-serial").val()
|
|
// base.title = escapeHtml($("#notice-title").val())
|
|
// base.detail = escapeHtml($("#notice-detail").val())
|
|
base.title = $("#notice-title").val()
|
|
base.detail = $("#notice-detail").val()
|
|
|
|
break;
|
|
|
|
case 'support:ask':
|
|
if (op === 'insert') {
|
|
base.message = escapeHtml($("#support-message").val())
|
|
} else if (op === 'delete') {
|
|
base.hero = currentSupportInfo.sessionId
|
|
base.uid = currentSupportInfo.uid
|
|
}
|
|
|
|
break;
|
|
|
|
case 'support:reply':
|
|
base.message = escapeHtml($("#support-message").val())
|
|
base.uid = currentSupportInfo.uid
|
|
base.sessionId = currentSupportInfo.sessionId
|
|
|
|
break;
|
|
|
|
case 'address':
|
|
base.tag = ''
|
|
base.is_default = 0
|
|
base.name = escapeHtml($("#name").val())
|
|
base.phone = escapeHtml($("#phone").val())
|
|
base.zip_code = escapeHtml($("#zipcode").val())
|
|
base.address_1 = escapeHtml($("#address").val())
|
|
base.address_2 = escapeHtml($("#addressDetail").val())
|
|
if (currentAddress.serial !== undefined) {
|
|
base.hero = currentAddress.serial
|
|
}
|
|
break;
|
|
|
|
case 'depot':
|
|
base.url = $("#target_url").val()
|
|
base.site_tag = $("#site_tag").val()
|
|
base.car_id = $("#car_id").val()
|
|
base.title = escapeHtml($("#title").val())
|
|
base.brand = escapeHtml($("#brand").val())
|
|
base.model_year = escapeHtml($("#model_year").val())
|
|
base.price = escapeHtml($("#price").val())
|
|
base.mileage = escapeHtml($("#mileage").val())
|
|
base.memo = escapeHtml($("#memo").val())
|
|
// base.reg_number = escapeHtml($("#reg_number").val())
|
|
base.reg_number = 'N/A'
|
|
|
|
break;
|
|
|
|
case 'accompany':
|
|
if (op === 'local/insert') {
|
|
base.hero = getParams['gid']
|
|
base.url = $("#accompany_url").val()
|
|
base.site_tag = tmpCarInfo.siteTag
|
|
base.car_id = tmpCarInfo.car_id
|
|
base.place = $("#accompany_place").val()
|
|
base.datetime = $("#accompany_datetime").val()
|
|
base.price = $("#accompany_price").val()
|
|
base.time = $("#accompany_time").val()
|
|
base.memo = $("#accompany_memo").val()
|
|
} else if (op === 'local/select') {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'center':
|
|
if (op === 'local/insert') {
|
|
|
|
base.name = $("#center_name").val()
|
|
base.address = $("#center_address").val()
|
|
base.zipcode = $("#center_zipcode").val()
|
|
base.address_detail = $("#center_address_detail").val()
|
|
base.owner = $("#center_owner").val()
|
|
base.phone = $("#center_phone").val()
|
|
base.fax = $("#center_fax").val()
|
|
base.email = $("#center_email").val()
|
|
base.greeting = $("#center_greeting").val()
|
|
|
|
} else if (op === 'local/update') {
|
|
base.name = $("#center_name").val()
|
|
base.address = $("#center_address").val()
|
|
base.zipcode = $("#center_zipcode").val()
|
|
base.address_detail = $("#center_address_detail").val()
|
|
base.owner = $("#center_owner").val()
|
|
base.phone = $("#center_phone").val()
|
|
base.fax = $("#center_fax").val()
|
|
base.email = $("#center_email").val()
|
|
base.greeting = $("#center_greeting").val()
|
|
base.hero = getParams['cid']
|
|
|
|
} else if (op === 'local/select') {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'staff':
|
|
if (op === 'local/insert' || op === 'local/update') {
|
|
|
|
base.name = $("#staff_name").val()
|
|
base.phone = $("#staff_phone").val()
|
|
base.email = $("#staff_email").val()
|
|
base.greeting = $("#staff_greeting").val()
|
|
base.profile_url = $("#staff_profile_url").val()
|
|
base.cid = getParams['cid']
|
|
base.sid = getParams['sid']
|
|
base.hero = getParams['sid']
|
|
|
|
} else if (op === 'local/select') {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'elder':
|
|
if (op === 'local/insert' || op === 'local/update') {
|
|
base.name = $("#elder_name").val()
|
|
base.memo = $("#elder_memo").val()
|
|
base.profile_url = $("#elder_profile_url").val()
|
|
base.cid = getParams['cid']
|
|
base.eid = getParams['eid']
|
|
base.hero = getParams['eid']
|
|
} else if (op === 'local/select') {
|
|
if (base.hero === undefined) {
|
|
base.hero = getParams['eid']
|
|
}
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'family':
|
|
if (op === 'local/insert' || op === 'local/update') {
|
|
base.name = $("#family_name").val()
|
|
base.relations = $("#family_relations").val()
|
|
base.phone = $("#family_phone").val()
|
|
base.email = $("#family_email").val()
|
|
base.profile_url = $("#family_profile_url").val()
|
|
base.hero = getParams['fid'] ? getParams['fid'] : getParams['eid']
|
|
} else if (op === 'local/select') {
|
|
base.hero = getParams['fid']
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'elder:active':
|
|
if (op === 'local/list') {
|
|
base.cid = getParams['cid']
|
|
} else if (op === 'local/select') {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'comment':
|
|
if (op === 'local/delete') {
|
|
|
|
} else if (op === 'local/insert') {
|
|
if (base.comment === undefined) {
|
|
base.comment = $("#comment-message").val()
|
|
// base.cid = getParams['cid']
|
|
}
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case 'like':
|
|
if (base.domain === undefined) {
|
|
base.domain = getParams['cid']
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'role':
|
|
base.memo = base.memo ? base.memo : $("#guide-memo").val()
|
|
base.profile_url = base.profile_url ? base.profile_url : $("#profile-image-url").val()
|
|
break;
|
|
|
|
case 'invitation':
|
|
if (op === 'local/select') {
|
|
base.hero = $("#invitation_code").val()
|
|
} else if (op === 'local/update') {
|
|
base.hero = $("#invitation_code").val()
|
|
base.medium = $("#invitation_medium").val()
|
|
base.verify = $("#invitation_verify_code").val()
|
|
} else if (op === 'local/insert') {
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'comment:active':
|
|
|
|
if (base.hero === undefined) {
|
|
base.hero = getParams['cid']
|
|
}
|
|
|
|
break;
|
|
|
|
case 'subscription':
|
|
base = {...base, ...previewSubscriptionItem}
|
|
if (previewSubscriptionItem.serial !== undefined) {
|
|
base.hero = previewSubscriptionItem.serial
|
|
}
|
|
|
|
|
|
case 'vote':
|
|
|
|
var currentVote = 'none'
|
|
|
|
var idPrefix = 'vote-'
|
|
|
|
for (var i = 1; i <= 4; i++) {
|
|
var tmpId = idPrefix + i
|
|
// console.log('check ', tmpId)
|
|
|
|
var tmpChecked = $("#" + tmpId).is(":checked")
|
|
|
|
if (tmpChecked) {
|
|
currentVote = tmpId
|
|
break;
|
|
}
|
|
}
|
|
|
|
// console.log('currentVote=', currentVote)
|
|
|
|
|
|
|
|
base.hero = getParams['cid']
|
|
base.vote = currentVote
|
|
base.comment = escapeHtml($("#vote-comment").val())
|
|
break;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'profile':
|
|
|
|
base.displayName = $('#my-display-name').val()
|
|
base.photoUrl = $('#my-photo-url').val()
|
|
var tmpInfos = {
|
|
|
|
}
|
|
tmpInfos.email = $('#my-infos-email').val()
|
|
tmpInfos.mobile = $('#my-infos-mobile').val()
|
|
tmpInfos.zipcode = $('#my-infos-zipcode').val()
|
|
tmpInfos.address = $('#my-infos-address').val()
|
|
tmpInfos.addressDetail = $('#my-infos-addressDetail').val()
|
|
|
|
base.infos = JSON.stringify(tmpInfos)
|
|
|
|
if ($('#my-password').val() == $('#my-password-confirm').val() && $('#my-password').val() != '') {
|
|
base.password = $('#my-password').val()
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
// console.log('after base=', base)
|
|
return base
|
|
}
|
|
var currentAddress = null
|
|
|
|
function makeCarId (url) {
|
|
var hash = CryptoJS.MD5(url);
|
|
var key = CryptoJS.enc.Utf8.parse(hash); // hex로 변환
|
|
var base64 = CryptoJS.enc.Base64.stringify(key); // hex를 원래 포멧으로 변환
|
|
|
|
// console.log("hash:", hash);
|
|
// console.log("car_id:", base64);
|
|
|
|
return base64
|
|
|
|
// doAllThingsInSafe('local/select', {target: 'depot', hero: base64})
|
|
|
|
// $("#car_id").val(base64)
|
|
|
|
}
|
|
|
|
|
|
function parseSiteContentsRaw(url, response) {
|
|
var resultPool = {
|
|
autoParsed : true
|
|
}
|
|
resultPool.siteTag = getDomain(url)
|
|
|
|
var tmpAry = [];
|
|
var tmpAry2 = []
|
|
var tmpAry3 = []
|
|
|
|
|
|
switch (resultPool.siteTag) {
|
|
case 'm-park.co.kr':
|
|
case 'm.m-park.co.kr':
|
|
// 식별 아이디 <meta name="WT.z_CarId" content="
|
|
tmpAry = response.match(/<meta property="og:url" content="(.|\n)*?\/>/)[0];
|
|
// console.log('tmpAry=', tmpAry)
|
|
tmpAry2 = tmpAry.split('"')
|
|
tmpAry3 = tmpAry2[3].split('=')
|
|
|
|
resultPool.car_id = tmpAry3[1]
|
|
|
|
|
|
|
|
|
|
// 제목 <meta property="og:title" content="[이차 어때요?]
|
|
tmpAry = response.match(/<meta property="og:title" content="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
tmpAry3 = tmpAry2[3].split(']')
|
|
|
|
|
|
resultPool.title = tmpAry3[1]
|
|
|
|
|
|
// 기타 정보 <meta property="og:description" content="
|
|
var tmpIdx = response.indexOf('<ul class="info">');
|
|
|
|
// console.log('tmpIdx=', tmpIdx)
|
|
|
|
// console.log('hit=', response.substr(tmpIdx, 600))
|
|
tmpAry2 = response.substr(tmpIdx, 600).split('<li>')
|
|
|
|
|
|
for(var i = 0; i < tmpAry2.length; i++) {
|
|
tmpAry2[i] = tmpAry2[i].substr(0, tmpAry2[i].indexOf('<'))
|
|
}
|
|
// console.log('tmpAry2=', tmpAry2)
|
|
|
|
// $("#model_year").val(tmpAry2[1].replace(' ', ' '))
|
|
resultPool.model_year = tmpAry2[1].replace(' ', ' ')
|
|
//
|
|
// $("#mileage").val(tmpAry2[2])
|
|
resultPool.mileage = tmpAry2[2]
|
|
|
|
|
|
tmpIdx = response.indexOf('<p class="price">');
|
|
tmpAry2 = response.substr(tmpIdx, 100).split('>')
|
|
|
|
// console.log('tmpAry2=', tmpAry2)
|
|
|
|
tmpAry3 = tmpAry2[1].trim().split(' ')
|
|
|
|
// console.log('tmpAry3=', tmpAry3)
|
|
|
|
// $("#price").val(tmpAry3[0])
|
|
resultPool.price = tmpAry3[0]
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'ucar.co.kr':
|
|
case 'm.ucar.co.kr':
|
|
|
|
// console.log('response=', response)
|
|
// 식별 아이디 <input type="hidden" name="sns_url" value="http://ucar.co.kr/buy/car_view.asp?CarID=100219&CarGbnCode=002001">
|
|
tmpAry = response.match(/<input type="hidden" name="sns_url" value="(.|\n)*?\>/)[0];
|
|
tmpAry = tmpAry.replace('&', '=')
|
|
tmpAry2 = tmpAry.split('=')
|
|
|
|
// $("#car_id").val(tmpAry2[4])
|
|
resultPool.car_id = tmpAry2[4]
|
|
|
|
|
|
// 제목 <h2 class="sub_tit left">
|
|
tmpAry = response.match(/(?!>)([^><]+)(?=<\/h2>)/)[0];
|
|
tmpAry = tmpAry.replace(/ /g,' ').trim()
|
|
// console.log('tmpAry=', tmpAry)
|
|
|
|
// $("#title").val(tmpAry)
|
|
resultPool.title = tmpAry
|
|
|
|
// 기타 정보
|
|
tmpAry = response.match(/<div\s+class="etc_info">[\S\s]*?<\/div>/gi)[0];
|
|
// console.log('tmpAry=', tmpAry)
|
|
tmpAry2 = tmpAry.replace(/<\/span>/g,'').split('<span>')
|
|
// console.log('tmpAry2=', tmpAry2)
|
|
|
|
// $("#model_year").val(tmpAry2[2])
|
|
resultPool.model_year = tmpAry2[2]
|
|
// $("#price").val(tmpAry3[1])
|
|
// $("#mileage").val(tmpAry2[3])
|
|
resultPool.mileage = tmpAry2[3]
|
|
|
|
|
|
// 가격 <span class="price">3,790</span>
|
|
tmpAry = response.match(/<span\s+class="price">[\S\s]*?<\/span>/gi)[1];
|
|
// console.log('tmpAry=', tmpAry)
|
|
tmpAry2 = tmpAry.replace(/<\/span>/g,'').split('>')
|
|
// console.log('tmpAry2=', tmpAry2)
|
|
|
|
// $("#price").val(tmpAry2[1] + '만원')
|
|
resultPool.price = tmpAry2[1] + '만원'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'kbchachacha.com':
|
|
case 'm.kbchachacha.com':
|
|
|
|
//<meta property="og:url" content="https://www.kbchachacha.com/public/car/detail.kbc?carSeq=20444342"/>
|
|
tmpAry = response.match(/<meta property="og:url" content="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
tmpAry3 = tmpAry2[3].split('=')
|
|
// $("#car_id").val(tmpAry3[1])
|
|
resultPool.car_id = tmpAry3[1]
|
|
|
|
|
|
tmpAry = response.match(/<meta name="description" content="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
tmpAry3 = tmpAry2[3].split(' / ')
|
|
|
|
|
|
// $("#title").val(tmpAry3[0])
|
|
resultPool.title = tmpAry3[0]
|
|
|
|
// $("#model_year").val(tmpAry3[3])
|
|
resultPool.model_year = tmpAry3[3]
|
|
|
|
//$("#price").val(tmpAry3[1])
|
|
resultPool.price = tmpAry3[1]
|
|
|
|
// $("#mileage").val(tmpAry3[2])
|
|
resultPool.mileage = tmpAry3[2]
|
|
|
|
|
|
break;
|
|
|
|
case 'certifiedcar.hyundaicapital.com':
|
|
case 'm.certifiedcar.hyundaicapital.com':
|
|
|
|
// 식별 아이디 <input type="hidden" name="xc_vcl_cd" id="xc_vcl_cd" value="
|
|
tmpAry = response.match(/<input type="hidden" name="xc_vcl_cd" id="xc_vcl_cd" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#car_id").val(tmpAry2[7])
|
|
resultPool.car_id = tmpAry2[7]
|
|
|
|
|
|
// 차 이름 <input type="hidden" id="c_description" value="
|
|
tmpAry = response.match(/<input type="hidden" id="c_description" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#title").val(tmpAry2[5])
|
|
resultPool.title = tmpAry2[5]
|
|
|
|
|
|
// 가격 <input type="hidden" name="xc_hope_sel_prc" id="xc_hope_sel_prc" value="
|
|
tmpAry = response.match(/<input type="hidden" name="xc_hope_sel_prc" id="xc_hope_sel_prc" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
tmpAry3 = tmpAry2[7].split('.')
|
|
|
|
// $("#price").val(numberWithCommas(tmpAry3[0]) + ' 만원')
|
|
resultPool.price = numberWithCommas(tmpAry3[0]) + ' 만원'
|
|
|
|
// 연식 <input type="hidden" name="xc_pyy_yy" id="xc_pyy_yy" value="
|
|
tmpAry = response.match(/<input type="hidden" name="xc_pyy_yy" id="xc_pyy_yy" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#model_year").val(tmpAry2[7] + ' 년식')
|
|
resultPool.model_year = tmpAry2[7] + ' 년식'
|
|
|
|
// 주행거리 <input type="hidden" name="xc_dvml" id="xc_dvml" value="
|
|
tmpAry = response.match(/<input type="hidden" name="xc_dvml" id="xc_dvml" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#mileage").val(numberWithCommas(tmpAry2[7]) + ' km')
|
|
resultPool.mileage = numberWithCommas(tmpAry2[7]) + ' km'
|
|
|
|
break;
|
|
|
|
|
|
case 'kcar.com':
|
|
case 'm.kcar.com':
|
|
tmpAry3 = url.split('=')
|
|
// $("#car_id").val(tmpAry3[1])
|
|
resultPool.car_id = tmpAry3[1]
|
|
resultPool.mileage = tmpAry3[1]
|
|
|
|
// <meta property="og:title" content="
|
|
tmpAry = response.match(/<meta property="og:title" content="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#title").val(tmpAry2[3])
|
|
resultPool.title = tmpAry2[3]
|
|
|
|
// 가격 <input type="hidden" name="v_caramt" value="
|
|
tmpAry = response.match(/<input type="hidden" name="v_caramt" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#price").val(tmpAry2[5] + ' 만원')
|
|
resultPool.price = tmpAry2[5] + ' 만원'
|
|
|
|
// 연식 <input type="hidden" name="i_sMfrFrom" value="
|
|
tmpAry = response.match(/<input type="hidden" name="i_sMfrFrom" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#model_year").val(tmpAry2[5].substring(0, 4) + '년' + tmpAry2[5].substring(4) + '월식')
|
|
resultPool.model_year = tmpAry2[5].substring(0, 4) + '년' + tmpAry2[5].substring(4) + '월식'
|
|
|
|
// 주행거리 <input type="hidden" name="i_iMileage" id="i_iMileage" value="
|
|
tmpAry = response.match(/<input type="hidden" name="i_iMileage" id="i_iMileage" value="(.|\n)*?\/>/)[0];
|
|
tmpAry2 = tmpAry.split('"')
|
|
|
|
// $("#mileage").val(numberWithCommas(tmpAry2[7]) + ' km')
|
|
resultPool.mileage = numberWithCommas(tmpAry2[7]) + ' km'
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
var hash = CryptoJS.MD5(url);
|
|
var key = CryptoJS.enc.Utf8.parse(hash); // hex로 변환
|
|
var base64 = CryptoJS.enc.Base64.stringify(key); // hex를 원래 포멧으로 변환
|
|
|
|
// console.log("hash:", hash);
|
|
// console.log("base64:", base64);
|
|
|
|
// $("#car_id").val(base64)
|
|
resultPool.car_id = base64
|
|
resultPool.autoParsed = false
|
|
|
|
|
|
// $("#car_id").removeAttr("readonly")
|
|
// $("#title").removeAttr("readonly")
|
|
// $("#model_year").removeAttr("readonly")
|
|
// $("#price").removeAttr("readonly")
|
|
// $("#mileage").removeAttr("readonly")
|
|
|
|
// alert('자동 입력을 수행할 수 없습니다. 직접 값을 입력해 주세요.')
|
|
|
|
|
|
}
|
|
|
|
return resultPool
|
|
|
|
}
|
|
|
|
|
|
function parseSiteContents (url, parsedInfo) {
|
|
|
|
$("#site_tag").val(parsedInfo.siteTag)
|
|
|
|
$("#car_id").val(parsedInfo.car_id)
|
|
|
|
$("#car_id").attr("readonly", true);
|
|
$("#title").attr("readonly", true);
|
|
$("#brand").attr("readonly", true);
|
|
$("#model_year").attr("readonly", true);
|
|
$("#price").attr("readonly", true);
|
|
$("#mileage").attr("readonly", true);
|
|
|
|
|
|
|
|
|
|
if (parsedInfo.autoParsed === false) {
|
|
$("#title").removeAttr("readonly")
|
|
$("#brand").removeAttr("readonly")
|
|
$("#model_year").removeAttr("readonly")
|
|
$("#price").removeAttr("readonly")
|
|
$("#mileage").removeAttr("readonly")
|
|
|
|
$("#title").val('');
|
|
$("#brand").val('');
|
|
$("#model_year").val('');
|
|
$("#price").val('');
|
|
$("#mileage").val('');
|
|
|
|
|
|
alert('자동 입력을 수행할 수 없습니다. 직접 값을 입력해 주세요.')
|
|
|
|
|
|
|
|
|
|
} else {
|
|
$("#title").val(parsedInfo.title);
|
|
$("#brand").val(parsedInfo.brand);
|
|
$("#model_year").val(parsedInfo.model_year);
|
|
$("#price").val(parsedInfo.price);
|
|
$("#mileage").val(parsedInfo.mileage);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function parseSiteContentsOld(url, response) {
|
|
|
|
|
|
var parsedInfo = parseSiteContentsRaw(url, response)
|
|
|
|
// console.log('parsedInfo=',parsedInfo)
|
|
alert('huk!')
|
|
|
|
|
|
$("#site_tag").val(parsedInfo.siteTag)
|
|
|
|
$("#car_id").val(parsedInfo.car_id)
|
|
|
|
$("#car_id").attr("readonly", true);
|
|
$("#title").attr("readonly", true);
|
|
$("#brand").attr("readonly", true);
|
|
$("#model_year").attr("readonly", true);
|
|
$("#price").attr("readonly", true);
|
|
$("#mileage").attr("readonly", true);
|
|
|
|
|
|
|
|
|
|
if (parsedInfo.autoParsed === false) {
|
|
$("#title").removeAttr("readonly")
|
|
$("#brand").removeAttr("readonly")
|
|
$("#model_year").removeAttr("readonly")
|
|
$("#price").removeAttr("readonly")
|
|
$("#mileage").removeAttr("readonly")
|
|
|
|
alert('자동 입력을 수행할 수 없습니다. 직접 값을 입력해 주세요.')
|
|
|
|
|
|
|
|
|
|
} else {
|
|
$("#title").val(parsedInfo.title);
|
|
$("#brand").val(parsedInfo.brand);
|
|
$("#model_year").val(parsedInfo.model_year);
|
|
$("#price").val(parsedInfo.price);
|
|
$("#mileage").val(parsedInfo.mileage);
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
function doLocalOp (params) {
|
|
|
|
console.log('doLocalOp(), params=', params)
|
|
|
|
switch (params.target) {
|
|
|
|
|
|
case 'role:check':
|
|
if (currentMyScore < 300 && params.role == 'guide') {
|
|
Swal.fire('이런 이런', '점수가 300점을 넘어야 지원하실 수 있습니다. 현재 점수는 ' + numberWithCommas(currentMyScore) + ' 입니다.', 'error');
|
|
} else {
|
|
getAccompanyHelloMessage()
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
case 'address':
|
|
getPostCode()
|
|
break;
|
|
|
|
case 'file':
|
|
$("#files").trigger("click");
|
|
break;
|
|
|
|
case 'preview':
|
|
console.log('huk preview')
|
|
if (previewPool[params.hero] !== undefined) {
|
|
delete previewPool[params.hero]
|
|
makePreviewAlive()
|
|
}
|
|
|
|
break;
|
|
|
|
case 'flutter':
|
|
console.log('huk flutter')
|
|
switch (params.tag) {
|
|
case 'openPopup':
|
|
amIokArray.push(params.tag)
|
|
sendMessageToAppRaw({cmd: 'local/op', target: 'popup:open', url: 'https://hatch.inspond.com/popup-1'})
|
|
break;
|
|
case 'closePopup':
|
|
|
|
sendMessageToAppRaw({cmd: 'local/op', target: 'popup:close', payload: params.payload})
|
|
break;
|
|
|
|
case 'openDrawer':
|
|
sendMessageToAppRaw({cmd: 'local/op', target: 'drawer:open'})
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
Swal.fire('<%=__('오류 발생')%>', '<%=__('아이쿠! 이런건 뭔지 모릅니다요!')%>' + '<br>' + 'local/op, target=' + params.target, 'error');
|
|
}
|
|
}
|
|
|
|
|
|
var amIokArray = []
|
|
|
|
|
|
|
|
function _doAllThingsInSafe (opType, params) {
|
|
|
|
// console.log('_doAllThingsInSafe(), opType =', opType)
|
|
// console.log('_doAllThingsInSafe(), params =', params)
|
|
|
|
|
|
|
|
if (window.jQuery) {
|
|
// jQuery is loaded
|
|
|
|
|
|
|
|
|
|
|
|
if (authFlag === false) {
|
|
if (opType === 'local/update' && params.target === 'vote') {
|
|
Swal.fire('<%=__('앗차!')%>', '<%=__('로그인 한 사용자만 평가를 입력할 수 있습니다. 가입절차 없이 바로 간단하게 소셜 로그인 하세요.')%>', 'info');
|
|
return
|
|
}
|
|
|
|
if (opType === 'local/update' && (params.target === 'comment:like' || params.target === 'comment:dislike')) {
|
|
Swal.fire('<%=__('앗차!')%>', '<%=__('로그인 한 사용자만 댓글 평가를 입력할 수 있습니다. 가입절차 없이 바로 간단하게 소셜 로그인 하세요.')%>', 'info');
|
|
return
|
|
}
|
|
|
|
if (opType === 'local/insert' && (params.target === 'comment')) {
|
|
Swal.fire('<%=__('앗차!')%>', '<%=__('로그인 한 사용자만 댓글을 입력할 수 있습니다. 가입절차 없이 바로 간단하게 소셜 로그인 하세요.')%>', 'info');
|
|
return
|
|
}
|
|
|
|
} else {
|
|
// update_count_remain
|
|
if (opType === 'local/update' && params.target === 'vote' && update_count_remain <= 0) {
|
|
Swal.fire('<%=__('앗차!')%>', '<%=__('이미 수정 가능 횟수를 모두 사용하셨어요. 더이상 의견을 수정할 수 없습니다.')%>', 'info');
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log('_doAllThingsInSafe(), opType=', opType)
|
|
// console.log('_doAllThingsInSafe(), params=', params)
|
|
|
|
var base = {}
|
|
|
|
switch (opType) {
|
|
|
|
case 'local/op':
|
|
doLocalOp(params)
|
|
break;
|
|
|
|
|
|
case 'fcm':
|
|
doAjax(opType, params)
|
|
break;
|
|
|
|
case 'goto':
|
|
window.location.href = params.target
|
|
return false;
|
|
break;
|
|
|
|
case 'withdrawal':
|
|
Swal.fire({
|
|
title: '서비스 탈퇴',
|
|
text: "회원 가입을 취소하시겠습니까?",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: '다시 생각해 볼께요.',
|
|
cancelButtonText: '탈퇴!',
|
|
}).then((result) => {
|
|
if (!result.value) {
|
|
doAjax('withdrawal', {}, '서버와 통신중...', '탈퇴 완료', '다음에 또 뵙기를 바랍니다.', '탈퇴 오류', '죄송합니다. 잠시후에 다시 시도해 주세요.')
|
|
}
|
|
})
|
|
break;
|
|
|
|
|
|
case 'local/parse':
|
|
var targetUrl = $("#target_url").val()
|
|
if (targetUrl === '') {
|
|
alert('매물 정보 주소를 입력하세요.')
|
|
} else {
|
|
/*
|
|
var proxy = 'https://cors-anywhere.inspond.com/';
|
|
var finalURL = proxy + targetUrl;
|
|
$.get(finalURL, function(response) {
|
|
// console.log('response=', response)
|
|
parseSiteContents(targetUrl, response)
|
|
}).fail(function(err) {
|
|
// console.log('err=', err)
|
|
if (err.status === 404) {
|
|
alert('error : ' + '해당 주소의 정보를 읽어올 수 없습니다. (404)')
|
|
} else {
|
|
alert('error : ' + err.responseText)
|
|
}
|
|
});
|
|
*/
|
|
doAllThingsInSafe('local/select', {target: 'grap', hero: targetUrl, pos: 1})
|
|
}
|
|
break;
|
|
|
|
case 'list':
|
|
case 'local/list':
|
|
doAjax(opType, params)
|
|
break;
|
|
|
|
case 'local/refresh':
|
|
// doAjax(opType, params, '통신중...', '원두 리스트 새로고침', '성공!', '원두 리스트 새로고침', '실패!')
|
|
doAjax(opType, params, '통신중...')
|
|
|
|
break;
|
|
|
|
case 'local/delete':
|
|
case 'local/update':
|
|
case 'local/insert':
|
|
case 'local/select':
|
|
if (opType === 'local/insert' && params.target === 'cart') {
|
|
doAjax(opType, params, '통신중', '카트에 저장', '훌륭하신 선택입니다!')
|
|
} else if (opType === 'local/update' && params.target === 'accompany') {
|
|
var fromTag = getParams['fromTag']
|
|
if (currentAccompanyInfo.step === 5 && fromTag === 'accompany:sent' && params.op === 'go') {
|
|
// 결제 먼저 하고, 그 담에 ajax 호출
|
|
testMixin(opType, params)
|
|
} else if (currentAccompanyInfo.step === 13 && fromTag === 'accompany:sent' && params.op === 'go') {
|
|
// 평가 입력하고 그 담에 ajax 호출
|
|
testMixin(opType, params)
|
|
} else if (currentAccompanyInfo.step === 13 && fromTag === 'accompany:received' && params.op === 'go') {
|
|
// 평가 입력하고 그 담에 ajax 호출
|
|
testMixin(opType, params)
|
|
} else if (currentAccompanyInfo.step === 14 && fromTag === 'accompany:received' && params.op === 'go') {
|
|
// 평가 입력하고 그 담에 ajax 호출
|
|
testMixin(opType, params)
|
|
} else if (currentAccompanyInfo.step === 15 && fromTag === 'accompany:sent' && params.op === 'go') {
|
|
// 평가 입력하고 그 담에 ajax 호출
|
|
testMixin(opType, params)
|
|
} else {
|
|
doAjax(opType, params)
|
|
}
|
|
|
|
} else if (opType === 'local/select' && params.target === 'grap') {
|
|
doAjax(opType, params, '매물 정보를 읽어오는 중...')
|
|
} else if (opType === 'local/select' && params.target === 'dig') {
|
|
$('#search-result-console').html('찾기 시작...')
|
|
doAjax(opType, params, '뭐든 찾아보 중...')
|
|
} else if ((opType === 'local/insert' || opType === 'local/update') && params.target === 'elder') {
|
|
doAjax(opType, params, '서버에 저장중...')
|
|
} else {
|
|
|
|
doAjax(opType, params)
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
case 'local/upload':
|
|
doAjax(opType, params, '업로드...')
|
|
break;
|
|
|
|
|
|
case 'upload':
|
|
doAjax(opType, params, '업로드...')
|
|
break;
|
|
|
|
|
|
case 'delete':
|
|
case 'update':
|
|
case 'insert':
|
|
case 'select':
|
|
doAjax(opType, params)
|
|
break;
|
|
|
|
|
|
case 'maintenance':
|
|
var maintenanceInfo = ''
|
|
switch (params.op) {
|
|
case 'update':
|
|
|
|
if (
|
|
$("#maintenance-title").val() === '' ||
|
|
$("#maintenance-description").val() === '' ||
|
|
$("#maintenance-until").val() === '' ||
|
|
$("#maintenance-type").val() === ''
|
|
) {
|
|
Swal.fire('<%=__('오류 발생')%>', '<%=__('모든 항목에 값을 입력해 주세요.')%>', 'error');
|
|
return
|
|
}
|
|
|
|
maintenanceInfo = {
|
|
title: $("#maintenance-title").val(),
|
|
description: $("#maintenance-description").val(),
|
|
until: $("#maintenance-until").val(),
|
|
type: $("#maintenance-type").val(),
|
|
}
|
|
doAjax('update', {target: 'maintenance', ...maintenanceInfo}, '통신중...')
|
|
break;
|
|
|
|
case 'end':
|
|
maintenanceInfo = null
|
|
doAjax('delete', {target: 'maintenance'}, '통신중...')
|
|
break;
|
|
|
|
case 'urgent':
|
|
var tomorrow = new Date();
|
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
var until = getFormattedDatetime(tomorrow)
|
|
// console.log('until=', until)
|
|
maintenanceInfo = {
|
|
title: '<%=__('임시점검')%>',
|
|
description: '<%=__('서비스 개선을 위한 임시 점검 중입니다.')%>',
|
|
until: until.substring(0, 16),
|
|
type: 'all',
|
|
}
|
|
doAjax('update', {target: 'maintenance', ...maintenanceInfo}, '통신중...')
|
|
break;
|
|
|
|
default:
|
|
Swal.fire('<%=__('오류 발생')%>', '<%=__('알 수 없는 op :')%> ' + params.op , 'error');
|
|
}
|
|
/*
|
|
if (maintenanceInfo !== '') {
|
|
doFetchPost('maintenance', {maintenanceInfo: maintenanceInfo}, function (error, response) {
|
|
if (response.responseCode !== 200) {
|
|
// alert('error : ' + response.responseMessage)
|
|
Swal.fire('<%=__('오류 발생')%>', response.responseMessage, 'error');
|
|
} else {
|
|
refreshMaintenanceBoard(response.maintenanceInfo)
|
|
|
|
switch (params.op) {
|
|
case 'update':
|
|
Swal.fire('<%=__('점검 개시')%>', '<%=__('지정하신 옵션으로 점검이 시작되었습니다.')%>', 'success');
|
|
break;
|
|
|
|
case 'end':
|
|
Swal.fire('<%=__('점검 종료')%>', '<%=__('점검이 종료되었습니다.')%>', 'success');
|
|
break;
|
|
|
|
case 'urgent':
|
|
Swal.fire('<%=__('긴급 점검 개시')%>', '<%=__('지정하신 옵션으로 점검이 시작되었습니다.')%>', 'success');
|
|
break;
|
|
}
|
|
}
|
|
})
|
|
|
|
} else {
|
|
Swal.fire('<%=__('오류 발생')%>', '<%=__('알 수 없는 op :')%> ' + params.op , 'error');
|
|
}
|
|
*/
|
|
break;
|
|
|
|
|
|
|
|
case 'businessInfo':
|
|
var businessInfo = ''
|
|
switch (params.op) {
|
|
case 'update':
|
|
|
|
businessInfo = {
|
|
name: $("#businessInfo-name").val(),
|
|
owner: $("#businessInfo-owner").val(),
|
|
address: $("#businessInfo-address").val(),
|
|
phone: $("#businessInfo-phone").val(),
|
|
email: $("#businessInfo-email").val(),
|
|
registration_number: $("#businessInfo-registration_number").val(),
|
|
capp_biz_cd: $("#businessInfo-capp_biz_cd").val(),
|
|
note: $("#businessInfo-note").val()
|
|
}
|
|
doAjax('update', {target: 'businessInfo', ...businessInfo}, '통신중...')
|
|
break;
|
|
|
|
case 'delete':
|
|
businessInfo = null
|
|
doAjax('delete', {target: 'businessInfo'}, '통신중...')
|
|
break;
|
|
|
|
default:
|
|
Swal.fire('<%=__('오류 발생')%>', '<%=__('알 수 없는 op :')%> ' + params.op , 'error');
|
|
return
|
|
|
|
}
|
|
|
|
/*
|
|
doFetchPost('businessinfo', {businessInfo: businessInfo}, function (error, response) {
|
|
if (response.responseCode !== 200) {
|
|
// alert('error : ' + response.responseMessage)
|
|
Swal.fire('<%=__('오류 발생')%>', response.responseMessage, 'error');
|
|
} else {
|
|
refreshBusinessBoard(response.businessInfo)
|
|
|
|
switch (params.op) {
|
|
case 'update':
|
|
Swal.fire('<%=__('정보 변경 완료')%>', '<%=__('입력하신 값들이 반영되었습니다.')%>', 'success');
|
|
break;
|
|
|
|
case 'delete':
|
|
Swal.fire('<%=__('정보 삭제 완료')%>', '<%=__('더 이상 사업자 정보가 표시되지 않습니다.')%>', 'success');
|
|
break;
|
|
|
|
}
|
|
}
|
|
})
|
|
*/
|
|
|
|
break;
|
|
|
|
|
|
case 'local/subscribe':
|
|
doAjax(opType, params, '통신중...', '정기배송 신청', '신청 내용이 서버에 잘 저장되었습니다.', '정기배송 신청', '오류가 발생하였습니다.')
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'local/unsubscribe':
|
|
// console.log('oh my god, params=', params)
|
|
|
|
doFetchPost(opType, params, function (error, response) {
|
|
if (response.responseCode !== 200) {
|
|
// alert('error : ' + response.responseMessage)
|
|
Swal.fire( "오류" , "정기배송 취소중 오류 발생\n" + response.responseMessage , "error" )
|
|
} else {
|
|
// alert('cart op ok')
|
|
// console.log('verify response=', response)
|
|
// window.location.replace('/tracking');
|
|
|
|
Swal.fire('취소 성공', "정기배송 서비스 신청이 종료되었습니다.", "success", {
|
|
buttons: {
|
|
ok: {
|
|
text: "신청 내역 보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
window.location.replace('/tracking');
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
break;
|
|
|
|
|
|
case 'subscribe':
|
|
var billingParams = {
|
|
pg : "html5_inicis.INIBillTst", // 실제 계약 후에는 실제 상점아이디로 변경
|
|
pay_method : 'card',
|
|
merchant_uid : 'daddybeans_merchant_' + new Date().getTime(),
|
|
customer_uid: params.customer_uid, // 카드(빌링키)와 1:1로 대응하는 값
|
|
name : '정기 배송 카드 등록',
|
|
amount : 0,
|
|
buyer_email : '<%=infos.userInfo.loginFlag? infos.userInfo.email : ''%>',
|
|
buyer_name : '<%=infos.userInfo.loginFlag? infos.userInfo.userName : 'anoymous'%>',
|
|
buyer_tel : params.phone,
|
|
buyer_addr : params.address_1 + ' ' + params.address_2,
|
|
buyer_postcode : params.zip_code,
|
|
m_redirect_url : 'https://daddybeans.inspond.com/api/local/subscribe'
|
|
}
|
|
IMP.request_pay(billingParams
|
|
, function(rsp) {
|
|
// console.log('rsp=', rsp)
|
|
if (rsp.success) {
|
|
// 빌링키 발급 성공
|
|
|
|
doFetchPost('local/subscribe', {...params}, function (error, response) {
|
|
|
|
// console.log('subscribe error=', error)
|
|
// console.log('subscribe response=', response)
|
|
|
|
|
|
if (response.responseCode !== 200) {
|
|
// alert('error : ' + response.responseMessage)
|
|
Swal.fire( "Oops" , "Something went wrong!\n" + response.responseMessage , "error" )
|
|
} else {
|
|
// alert('cart op ok')
|
|
// console.log('subscribe response=', response)
|
|
// window.location.replace('/tracking');
|
|
|
|
Swal.fire("Good job!", "주문이 완료되었습니다.", "success", {
|
|
buttons: {
|
|
ok: {
|
|
text: "주문 내역 보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
window.location.replace('/tracking');
|
|
});
|
|
|
|
}
|
|
})
|
|
|
|
|
|
} else {
|
|
// 빌링키 발급 실패
|
|
if (rsp.error_msg === '사용자가 결제를 취소하셨습니다') {
|
|
|
|
} else {
|
|
Swal.fire( "Oops" , "Something went wrong!\n" + rsp.error_msg, "error" )
|
|
}
|
|
|
|
}
|
|
})
|
|
|
|
break;
|
|
|
|
|
|
case 'pay':
|
|
|
|
|
|
IMP.request_pay({
|
|
pg : 'inicis', // version 1.1.0부터 지원.
|
|
pay_method : 'card',
|
|
merchant_uid : 'daddybeans_merchant_' + new Date().getTime(),
|
|
name : params.name,
|
|
amount : params.amount,
|
|
buyer_email : '<%=infos.userInfo.loginFlag? infos.userInfo.email : ''%>',
|
|
buyer_name : '<%=infos.userInfo.loginFlag? infos.userInfo.userName : 'anoymous'%>',
|
|
buyer_tel : params.phone,
|
|
buyer_addr : params.address_1 + ' ' + params.address_2,
|
|
buyer_postcode : params.zip_code,
|
|
m_redirect_url : 'https://daddybeans.inspond.com/api/local/verify'
|
|
}, function(rsp) {
|
|
/*
|
|
if ( rsp.success ) {
|
|
var msg = '결제가 완료되었습니다.';
|
|
msg += '고유ID : ' + rsp.imp_uid;
|
|
msg += '상점 거래ID : ' + rsp.merchant_uid;
|
|
msg += '결제 금액 : ' + rsp.paid_amount;
|
|
msg += '카드 승인번호 : ' + rsp.apply_num;
|
|
} else {
|
|
var msg = '결제에 실패하였습니다.';
|
|
msg += '에러내용 : ' + rsp.error_msg;
|
|
}
|
|
// alert(msg);
|
|
*/
|
|
// console.log('rsp=', rsp)
|
|
if (rsp.success === false) {
|
|
if (rsp.error_msg === '사용자가 결제를 취소하셨습니다') {
|
|
|
|
} else {
|
|
Swal.fire( "Oops" , "Something went wrong!\n" + rsp.error_msg, "error" )
|
|
}
|
|
|
|
} else {
|
|
doFetchPost('local/verify', rsp, function (error, response) {
|
|
|
|
// console.log('verify error=', error)
|
|
// console.log('verify response=', response)
|
|
|
|
|
|
if (response.responseCode !== 200) {
|
|
// alert('error : ' + response.responseMessage)
|
|
Swal.fire( "Oops" , "Something went wrong!\n" + response.responseMessage , "error" )
|
|
} else {
|
|
// alert('cart op ok')
|
|
// console.log('verify response=', response)
|
|
// window.location.replace('/tracking');
|
|
|
|
Swal.fire("Good job!", "주문이 완료되었습니다.", "success", {
|
|
buttons: {
|
|
ok: {
|
|
text: "주문 내역 보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
window.location.replace('/tracking');
|
|
});
|
|
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
alert('unknown opType : ' + opType + ', ' + params)
|
|
console.error('unhandled op, opType=', opType, ', param=', params)
|
|
}
|
|
} else {
|
|
alert('jquery not loaded yet. try again after few seconds...')
|
|
}
|
|
|
|
}
|
|
|
|
|
|
var uploadFiles = []
|
|
|
|
var recordsTotal = 0
|
|
var totalPageCount = 0
|
|
var currentPageSize = 3
|
|
var currentPageNumber = 1
|
|
|
|
|
|
function updateAccompanyDetailTag (hero, carInfo) {
|
|
var tag = ''
|
|
|
|
if (carInfo === undefined) {
|
|
// accompany_detail_1
|
|
tag = ''
|
|
tag += ' <h4 class="sub-title">매물 정보를 확인중...</h4>'
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
tag += ' <dt class="col-sm-3">매물 url</dt>'
|
|
tag += ' <dd class="col-sm-9"><a href="' + hero.target_url + '" target="_blank">' + hero.target_url + '</a></dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차명</dt>'
|
|
tag += ' <dd class="col-sm-9">loading...</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">판매가</dt>'
|
|
tag += ' <dd class="col-sm-9">loading...</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">연식</dt>'
|
|
tag += ' <dd class="col-sm-9">loading...</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">주행거리</dt>'
|
|
tag += ' <dd class="col-sm-9">loading...</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차차착 등록여부</dt>'
|
|
tag += ' <dd class="col-sm-9">확인중...</dd>'
|
|
|
|
tag += ' </dl>'
|
|
|
|
|
|
} else if (carInfo.inDepotFlag === undefined) {
|
|
// accompany_detail_1
|
|
tag = ''
|
|
tag += ' <h4 class="sub-title">매물 정보</h4>'
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
tag += ' <dt class="col-sm-3">매물 url</dt>'
|
|
tag += ' <dd class="col-sm-9"><a href="' + hero.target_url + '" target="_blank">' + hero.target_url + '</a></dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차명</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.title + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">판매가</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.price + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">연식</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.model_year + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">주행거리</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.mileage + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차차착 등록여부</dt>'
|
|
tag += ' <dd class="col-sm-9">미등록</dd>'
|
|
|
|
tag += ' </dl>'
|
|
|
|
} else {
|
|
|
|
tag = ''
|
|
tag += ' <h4 class="sub-title">매물 정보</h4>'
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
tag += ' <dt class="col-sm-3">매물 url</dt>'
|
|
tag += ' <dd class="col-sm-9"><a href="' + hero.target_url + '" target="_blank">' + hero.target_url + '</a></dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차명</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.title + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">판매가</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.price + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">연식</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.model_year + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">주행거리</dt>'
|
|
tag += ' <dd class="col-sm-9">' + carInfo.mileage + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">차차착 등록여부</dt>'
|
|
tag += ' <dd class="col-sm-9"><a href="/depot/detail?cid=' + carInfo.cid + '">등록됨 (/depot/detail?cid=' + carInfo.cid + ')</a></dd>'
|
|
|
|
tag += ' </dl>'
|
|
}
|
|
|
|
|
|
$("#accompany_detail_1").empty().hide();
|
|
$("#accompany_detail_1").html(tag)
|
|
$("#accompany_detail_1").show().fadeIn(300);
|
|
|
|
|
|
|
|
// accompany_detail_2
|
|
tag = ''
|
|
tag += ' <h4 class="sub-title">동행 요청 사항</h4>'
|
|
tag += ' <dl class="dl-horizontal row">'
|
|
|
|
tag += ' <dt class="col-sm-3">만날 장소</dt>'
|
|
tag += ' <dd class="col-sm-9">' + hero.target_place + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">희망 일시</dt>'
|
|
// tag += ' <dd class="col-sm-9">' + moment.utc(hero.target_datetime).local().locale("ko").format('LLLL') + '</dd>'
|
|
tag += ' <dd class="col-sm-9">' + moment.utc(hero.target_datetime).locale("ko").format('LLLL') + '</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">동행 보수</dt>'
|
|
tag += ' <dd class="col-sm-9">' + numberWithCommas(hero.target_price) + '원</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3">동행 시간</dt>'
|
|
tag += ' <dd class="col-sm-9">만난 후로부터 ' + hero.target_time + '시간</dd>'
|
|
|
|
tag += ' <dt class="col-sm-3 text-truncate">기타 요구사항</dt>'
|
|
tag += ' <dd class="col-sm-9">' + hero.memo + '</dd>'
|
|
tag += ' </dl>'
|
|
|
|
// tag += ' <h4 class="sub-title">' + moment(hero.target_datetime).locale("ko").fromNow() + '에 만료됩니다. 그 전에 결정해 주세요.</h4>'
|
|
tag += ' <h4 class="sub-title">' + moment(hero.target_datetime).locale("ko").fromNow() + '에 만료됩니다. 그 전에 결정해 주세요.</h4>'
|
|
|
|
$("#accompany_detail_2").empty().hide();
|
|
$("#accompany_detail_2").html(tag)
|
|
$("#accompany_detail_2").show().fadeIn(300);
|
|
|
|
|
|
// btn_div
|
|
tag = ''
|
|
|
|
var fromTag = getParams['fromTag']
|
|
switch (hero.step) {
|
|
case 0:
|
|
case 1:
|
|
// 승인 대기중
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">요청 취소</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-info btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">요청 수락</a>'
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">요청 거절</a>'
|
|
}
|
|
break;
|
|
|
|
|
|
case 5:
|
|
// 결제 대기
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">수수료 결제하기</a>'
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">신청 취소</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">수락 철회</a>'
|
|
}
|
|
break;
|
|
|
|
|
|
case 9:
|
|
// 동행 대기중. 동행 확인 버튼을 아무도 누르지 않았다.
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">동행 확인</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">돟행 확인</a>'
|
|
}
|
|
break;
|
|
|
|
case 11:
|
|
// 동행 대기중. 후보자가 동행 확인을 눌러야 한다.
|
|
if (fromTag === 'accompany:sent') {
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">돟행 확인</a>'
|
|
}
|
|
break;
|
|
|
|
case 12:
|
|
// 동행 대기중. 신청자가 동행 확인을 눌러야 한다.
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">동행 확인</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
}
|
|
break;
|
|
|
|
case 13:
|
|
// 평가하기. 양측이 모두 평가를 남겨야 한다.
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">동행 평가</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">돟행 평가</a>'
|
|
}
|
|
|
|
break;
|
|
|
|
case 14:
|
|
// 신청자는 평가를 남겼고 후보자가 평가를 입력해야 한다.
|
|
if (fromTag === 'accompany:sent') {
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">돟행 평가</a>'
|
|
}
|
|
break;
|
|
|
|
case 15:
|
|
// 양측이 모두 평가를 남겼다. 모든 절차 완료됨.
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'go\', step: ' + hero.step + '});">돟행 평가</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
}
|
|
break;
|
|
|
|
case 2:
|
|
case 3:
|
|
case 4:
|
|
|
|
case 6:
|
|
case 7:
|
|
case 8:
|
|
|
|
case 10: // 결제 이후 동작이 없이 기간이 만료되었다.
|
|
case 16: // 모든 처리가 정상 완료되었다. 삭제 가능.
|
|
case 44:
|
|
// 직권으로 처리 종료. 양측은 삭제만 가능.
|
|
if (fromTag === 'accompany:sent') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">삭제</a>'
|
|
} else if (fromTag === 'accompany:received') {
|
|
tag += ' <a class="btn btn-danger btn-add-task waves-effect waves-light m-t-10" href="javascript:void(0);" onclick="doAllThingsInSafe(\'local/update\', {target: \'accompany\', hero: \'' + hero.aid + '\', from: \'' + fromTag + '\', op: \'stop\', step: ' + hero.step + '});">삭제</a>'
|
|
}
|
|
break;
|
|
|
|
|
|
case 99:
|
|
// 처리 일시 중단. 양측도 아무것도 할 수 없음.
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
$("#btn_div").empty().hide();
|
|
$("#btn_div").html(tag)
|
|
$("#btn_div").show().fadeIn(300);
|
|
|
|
|
|
}
|
|
|
|
function makeSubscriptionListTag (subscriptionInfo) {
|
|
var tag = ''
|
|
|
|
tag += '<div class="card latest-update-card">'
|
|
tag += ' <div class="card-header">'
|
|
tag += ' <h5>정기배송 ' + subscriptionInfo.title + '</h5>'
|
|
tag += ' <div class="card-header-right">'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="card-block">'
|
|
tag += ' <div class="scroll-widget">'
|
|
tag += ' <div class="latest-update-box">'
|
|
|
|
|
|
switch (subscriptionInfo.status) {
|
|
case 0:
|
|
tag += ' <div class="row p-t-20">'
|
|
tag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
tag += ' <i class="b-primary update-icon ring"></i>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col p-l-5">'
|
|
tag += ' <a href="javascript:;"><h6>다음 배송 예정일은 아래와 같습니다.</h6></a>'
|
|
tag += ' <p class="text-muted m-b-0">' + subscriptionInfo.upcoming + ', <a href="javascript:;" class="text-c-blue"> 상세 정보</a></p>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
break;
|
|
case 4:
|
|
tag += ' <div class="row p-t-20">'
|
|
tag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
tag += ' <i class="b-danger update-icon ring"></i>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="col p-l-5">'
|
|
tag += ' <a href="javascript:;"><h6>정기배송이 취소 되었습니다.</h6></a>'
|
|
tag += ' <p class="text-muted m-b-0">' + subscriptionInfo.updated + ', <a href="javascript:;" class="text-c-red"> 상세 정보</a></p>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (subscriptionInfo.status !== 0) {
|
|
// 삭제
|
|
|
|
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="card-footer">'
|
|
tag += ' <div class="text-right">'
|
|
tag += ' <a href="javascript:;" onclick="doAllThingsInSafe(\'local/delete\', {target: \'subscription:my\', hero: \'' + subscriptionInfo.subscription_id + '\'});"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i>정기배송 삭제하기</a>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
|
|
} else {
|
|
// 취소
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += ' <div class="card-footer">'
|
|
tag += ' <div class="text-right">'
|
|
tag += ' <a href="javascript:;" onclick="doAllThingsInSafe(\'local/update\', {target: \'subscription:my\', hero: \'' + subscriptionInfo.subscription_id + '\', status: 4});"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i>정기배송 취소하기</a>'
|
|
tag += ' </div>'
|
|
tag += ' </div>'
|
|
tag += '</div>'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tag
|
|
}
|
|
|
|
|
|
function makeTrackingTag (orderInfo) {
|
|
var order = JSON.parse(orderInfo.detail)
|
|
var current_step_memo = JSON.parse(orderInfo.current_step_memo)
|
|
var trackingTag = ''
|
|
trackingTag += ''
|
|
trackingTag += '<div class="card latest-update-card">'
|
|
trackingTag += ' <div class="card-header">'
|
|
trackingTag += ' <h5><code><span>' + order.title + ', ' + numberWithCommas(order.amount) + '원 - ' + orderInfo.order_id + '</span></code></h5>'
|
|
trackingTag += ' <div class="card-header-right">'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="card-block">'
|
|
trackingTag += ' <div class="scroll-widget">'
|
|
trackingTag += ' <div class="latest-update-box">'
|
|
|
|
for (var i = 0; i < current_step_memo.length; i++) {
|
|
switch (current_step_memo[i].step) {
|
|
|
|
case 0:
|
|
// 주문 접수됨
|
|
trackingTag += ' <div class="row p-t-20 p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-primary update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + ', <a href="javascript:;" class="text-c-blue"> 주문 상세 정보</a></p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
case 1:
|
|
// 관리자 확인됨
|
|
trackingTag += ' <div class="row p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-primary update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + '</p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
case 2:
|
|
// 취소됨
|
|
trackingTag += ' <div class="row p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-danger update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + ', <a href="javascript:;" class="text-c-red"> 취소 상세 정보</a></p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
case 3:
|
|
// 제작중
|
|
trackingTag += ' <div class="row p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-success update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + '</p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
// 배송중
|
|
trackingTag += ' <div class="row p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-primary update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + ', <a href="javascript:;" class="text-c-blue"> 배송 상세 정보</a></p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
case 5:
|
|
// 배송 완료
|
|
trackingTag += ' <div class="row">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-success update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + '</p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
|
|
|
|
case 6:
|
|
// 관리자에 의해 취소됨
|
|
trackingTag += ' <div class="row p-b-30">'
|
|
trackingTag += ' <div class="col-auto text-right update-meta p-r-0">'
|
|
trackingTag += ' <i class="b-danger update-icon ring"></i>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="col p-l-5">'
|
|
trackingTag += ' <a href="javascript:;"><h6>' + current_step_memo[i].message + '</h6></a>'
|
|
trackingTag += ' <p class="text-muted m-b-0">' + current_step_memo[i].created + ', <a href="javascript:;" class="text-c-red"> 취소 상세 정보</a></p>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
}
|
|
|
|
// console.log('huk orderInfo.current_step=', orderInfo.current_step)
|
|
|
|
|
|
if (orderInfo.current_step === 2 || orderInfo.current_step === 5 || orderInfo.current_step === 6) {
|
|
// 삭제
|
|
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="card-footer">'
|
|
trackingTag += ' <div class="text-right">'
|
|
trackingTag += ' <a href="javascript:;" onclick="doAllThingsInSafe(\'local/delete\', {target: \'order\', hero: \'' + orderInfo.order_id + '\'});"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i>주문 삭제하기</a>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += '</div>'
|
|
|
|
|
|
|
|
|
|
} else {
|
|
// 취소
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' <div class="card-footer">'
|
|
trackingTag += ' <div class="text-right">'
|
|
trackingTag += ' <a href="javascript:;" onclick="doAllThingsInSafe(\'local/update\', {target: \'order\', hero: \'' + orderInfo.order_id + '\', step: 2});"><i class="feather icon-trash-2 f-w-600 f-16 text-c-red"></i>주문 취소하기</a>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += ' </div>'
|
|
trackingTag += '</div>'
|
|
|
|
|
|
}
|
|
|
|
|
|
return trackingTag
|
|
}
|
|
|
|
|
|
|
|
var likeInfos = []
|
|
// var currentDomainLikeInfos = []
|
|
var commentPool = {}
|
|
// var currentDomainCommentInfos = []
|
|
|
|
var update_count_remain = 3
|
|
|
|
var authFlag = <%=infos.userInfo.loginFlag ? 'true' : 'false'%>
|
|
|
|
var getParams = {}
|
|
|
|
var tabControlTarget = 'accompany:received'
|
|
|
|
function doAjaxForApp (op, params, cb) {
|
|
var nextParams = ajaxPreprocess(op, params)
|
|
if (nextParams === null) {
|
|
cb(new Error('bad parameter'), null)
|
|
} else {
|
|
$.ajax({
|
|
url: '/api/' + op,
|
|
dataType: 'json',
|
|
...nextParams,
|
|
success: function (ret) {
|
|
console.log('ret=', ret)
|
|
cb(null, ret)
|
|
},
|
|
error: function (request, status, error){
|
|
console.log('request=', request)
|
|
console.log('status=', status)
|
|
console.log('error=', error)
|
|
cb(error, request.responseJSON)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
var internalPrefix = 'cbid@@sec:'
|
|
|
|
function sendMessageToApp (src, res) {
|
|
|
|
if (typeof xCommApp !== 'undefined') {
|
|
// the variable is defined
|
|
|
|
console.log('xCommApp found...')
|
|
|
|
var toAppMessage = {
|
|
...res
|
|
}
|
|
|
|
toAppMessage[internalPrefix + 'src'] = src
|
|
|
|
if (src[internalPrefix + 'cbIdx']) {
|
|
toAppMessage[internalPrefix + 'cbIdx'] = src[internalPrefix + 'cbIdx']
|
|
}
|
|
|
|
xCommApp.postMessage(JSON.stringify(toAppMessage))
|
|
|
|
} else {
|
|
console.log('xCommApp not found. wasted : ', res)
|
|
}
|
|
|
|
}
|
|
*/
|
|
|
|
var toAppMessageQueue = []
|
|
var toAppMessageTimerId = null
|
|
var toAppMessageRetryCountOut = 3
|
|
|
|
function checkToAppMessageQueue () {
|
|
if (toAppMessageQueue.length > 0) {
|
|
if (typeof _sendMessageToApp === 'function') {
|
|
while (toAppMessageQueue.length > 0) {
|
|
var pickedOne = toAppMessageQueue.shift();
|
|
_sendMessageToApp(pickedOne.src, pickedOne.res)
|
|
}
|
|
clearInterval(toAppMessageTimerId);
|
|
console.log('checkToAppMessageQueue() end...')
|
|
} else {
|
|
|
|
toAppMessageRetryCountOut--
|
|
if (toAppMessageRetryCountOut < 0) {
|
|
console.log('checkToAppMessageQueue(), Retry Countout. dispose all')
|
|
console.log('toAppMessageQueue=', toAppMessageQueue)
|
|
toAppMessageRetryCountOut = 3
|
|
toAppMessageQueue = []
|
|
clearInterval(toAppMessageTimerId);
|
|
} else {
|
|
console.log('checkToAppMessageQueue(), wait...', toAppMessageQueue)
|
|
}
|
|
}
|
|
} else {
|
|
clearInterval(toAppMessageTimerId);
|
|
console.log('checkToAppMessageQueue() end...')
|
|
}
|
|
}
|
|
|
|
|
|
function sendMessageToApp (src, res) {
|
|
if (toAppMessageQueue.length > 0) {
|
|
toAppMessageQueue.push({src: src, res: res})
|
|
} else {
|
|
if (typeof _sendMessageToApp === 'function') {
|
|
console.log('_sendMessageToApp(), ok')
|
|
_sendMessageToApp(src, res)
|
|
} else {
|
|
console.log('sendMessageToApp(), queued...')
|
|
toAppMessageQueue.push({src: src, res: res})
|
|
toAppMessageTimerId = setInterval(checkToAppMessageQueue, 1000)
|
|
}
|
|
}
|
|
}
|
|
|
|
function sendMessageToAppRaw (msg) {
|
|
console.log('typeof xCommApp=', typeof xCommApp)
|
|
console.log('sendMessageToAppRaw(), msg=', msg)
|
|
if (typeof xCommApp === 'object') {
|
|
console.log('xCommApp ok')
|
|
xCommApp.postMessage(JSON.stringify(msg))
|
|
} else {
|
|
console.log('no xCommApp found')
|
|
}
|
|
}
|
|
|
|
|
|
function xCommWeb (paramString) {
|
|
|
|
var src = JSON.parse(paramString)
|
|
console.log('message from xCommApp. paramString : ', paramString)
|
|
console.log('message from xCommApp. src : ', src)
|
|
// alert('paramString=' + paramString)
|
|
|
|
if (src['callback'] != undefined) {
|
|
console.log('huk callback = ', src['callback'])
|
|
console.log('huk payload = ', JSON.stringify(src['payload']))
|
|
console.log('huk amIokArray = ', amIokArray)
|
|
|
|
// window.location.reload()
|
|
} else {
|
|
switch (src.cmd) {
|
|
case 'api/signin':
|
|
case 'api/signup':
|
|
console.log('huk src=', src)
|
|
src.info = JSON.stringify(src.info)
|
|
doAjaxWork(src, function (err, ret) {
|
|
var res = {}
|
|
res = {
|
|
...ret
|
|
}
|
|
sendMessageToApp (src, res)
|
|
})
|
|
break;
|
|
|
|
case 'api/update':
|
|
doAjaxWork(src, function (err, ret) {
|
|
var res = {}
|
|
res = {
|
|
...ret
|
|
}
|
|
sendMessageToApp (src, res)
|
|
})
|
|
break;
|
|
|
|
case 'local/select':
|
|
console.log('token: ', src.token)
|
|
console.log('duid: ', src.duid)
|
|
break;
|
|
|
|
case 'goto':
|
|
sendMessageToApp (src, {responseCode: 0, responseMessage: 'ok'})
|
|
window.location.href = src.target
|
|
|
|
break;
|
|
|
|
case 'fcm':
|
|
sendMessageToAppRaw({cmd: 'select', target: 'fcm'})
|
|
break;
|
|
|
|
case 'notification':
|
|
sendMessageToAppRaw({cmd: 'select', target: src.target})
|
|
break;
|
|
|
|
|
|
default:
|
|
if (src.rpl !== undefined) {
|
|
handleXCommRpl(src)
|
|
} else {
|
|
sendMessageToApp (src, {responseCode: 500, responseMessage: 'unhandled cmd ' + src.cmd})
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function handleFCM (fcmItem) {
|
|
switch (fcmItem.data.eventTag) {
|
|
case 'post:new':
|
|
Swal.fire('푸쉬메세지', fcmItem.data.body + '<BR>내용을 확인하시겠습니까?' , "info", {
|
|
buttons: {
|
|
ok: {
|
|
text: "내용보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
if (value.isConfirmed) {
|
|
window.location.replace(fcmItem.data.location);
|
|
} else {
|
|
checkFCMinLoop()
|
|
}
|
|
});
|
|
break;
|
|
|
|
default:
|
|
Swal.fire('푸쉬메세지', fcmItem.data.title + '<BR>' + fcmItem.data.body, "info", {
|
|
buttons: {
|
|
ok: {
|
|
text: "내용보기",
|
|
value: "ok",
|
|
}
|
|
},
|
|
})
|
|
.then((value) => {
|
|
if (value.isConfirmed) {
|
|
if (fcmItem.data.location != undefined) {
|
|
window.location.replace(fcmItem.data.location);
|
|
} else {
|
|
checkFCMinLoop()
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var fcmList = []
|
|
|
|
function checkFCMinLoop () {
|
|
|
|
console.log('check wait fcm...')
|
|
|
|
if (fcmList.length > 0) {
|
|
var fcmItem = fcmList[0]
|
|
fcmList.shift()
|
|
handleFCM(fcmItem)
|
|
} else {
|
|
console.log('no wait fcm...')
|
|
}
|
|
}
|
|
|
|
function handleXCommRpl (msg) {
|
|
// alert('handleXCommRpl(), msg=' + JSON.stringify(msg))
|
|
switch (msg.target) {
|
|
case 'fcmToken':
|
|
doAllThingsInSafe('update', {target: 'fcmToken', duid: msg.duid, token: msg.token})
|
|
break;
|
|
|
|
case 'fcm':
|
|
var msgAry = msg.messageList
|
|
fcmList = fcmList.concat(msgAry)
|
|
checkFCMinLoop()
|
|
|
|
doAllThingsInSafe('update', {target: 'fcm', fcm: msg, hero: msg.duid})
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
}
|
|
|
|
function doAjaxWork (src, cb) {
|
|
$.ajax({
|
|
url: '/' + src.cmd,
|
|
type: 'post',
|
|
dataType: 'json',
|
|
data: src,
|
|
success: function (ret) {
|
|
console.log('ret=', ret)
|
|
cb(null, ret)
|
|
},
|
|
error: function (request, status, error){
|
|
console.log('request=', request)
|
|
console.log('status=', status)
|
|
console.log('error=', error)
|
|
var ret = request.responseJSON
|
|
cb(error, ret)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
const appJSChannelName = 'xCommApp'
|
|
|
|
function checkAppLogin () {
|
|
var checkResult = eval('typeof ' + appJSChannelName)
|
|
|
|
// console.log('checkResult=', checkResult)
|
|
|
|
if (checkResult == 'undefined') {
|
|
// alert('checkResult is not good')
|
|
// not in a app's webview
|
|
} else {
|
|
if (checkResult == 'object') {
|
|
// maybe we are in app's webview
|
|
|
|
<%
|
|
console.log('infos.userInfo.loginFlag=', infos.userInfo.loginFlag)
|
|
console.log('infos.userInfo.fcmTokenFlag=', infos.userInfo.fcmTokenFlag)
|
|
%>
|
|
|
|
<% if (infos.userInfo.loginFlag == true && infos.userInfo.fcmTokenFlag == false) {%>
|
|
sendMessageToAppRaw({cmd: 'select', target: 'fcmToken'})
|
|
<%} %>
|
|
} else {
|
|
// alert('checkResult is ' + checkResult)
|
|
// I don't know what it is...
|
|
console.log('unhandled checkResult=', checkResult)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
var previewPool = {}
|
|
var previewLastIdx = 1
|
|
|
|
|
|
function makePreviewAlive () {
|
|
|
|
$('#preview-console').empty()
|
|
|
|
Object.keys(previewPool).forEach((key, i) => {
|
|
var tmpItem = previewPool[key]
|
|
var imgTag = ''
|
|
if (tmpItem.from === 'air') {
|
|
|
|
var tmpMimeType = getMimeTypeFromPath(tmpItem.localUrl)
|
|
|
|
var tmpMediaTag = ''
|
|
if (tmpMimeType === 'video') {
|
|
|
|
|
|
tmpMediaTag = '<video class="card-img-top img-fluid img-thumbnail" ><source src="' + tmpItem.localUrl + '" id="' + tmpItem.imgTagId + '"></video>'
|
|
|
|
} else if (tmpMimeType === 'image') {
|
|
tmpMediaTag = '<img class="card-img-top img-fluid img-thumbnail" src="' + tmpItem.localUrl + '" id="' + tmpItem.imgTagId + '">'
|
|
} else {
|
|
tmpMediaTag = '<img class="card-img-top img-fluid img-thumbnail" src="/images/file_icon.png" id="' + tmpItem.imgTagId + '">' + tmpItem.localUrl
|
|
|
|
}
|
|
|
|
imgTag += '<div class="col-sm-4 col-md-2 col-xs-12">' + tmpMediaTag + '<button onclick="doAllThingsInSafe(\'local/op\', {target: \'preview\', hero: \'' + tmpItem.key + '\'});" type="button" class="close " aria-label="Close" ><i class="icofont icofont-close-line-circled"></i></button></div>'
|
|
|
|
$('#preview-console').append(imgTag)
|
|
|
|
|
|
} else {
|
|
|
|
var tmpMimeType = getMimeTypeFromPath(tmpItem.file.name)
|
|
|
|
|
|
var tmpMediaTag = ''
|
|
if (tmpMimeType === 'video') {
|
|
tmpMediaTag = '<video class="card-img-top img-fluid img-thumbnail" ><source src="#" id="' + tmpItem.imgTagId + '"></video>'
|
|
|
|
} else if (tmpMimeType === 'image') {
|
|
tmpMediaTag = '<img class="card-img-top img-fluid img-thumbnail" src="#" id="' + tmpItem.imgTagId + '">'
|
|
} else {
|
|
tmpMediaTag = '<img class="card-img-top img-fluid img-thumbnail" src="/images/file_icon.png" id="' + tmpItem.imgTagId + '">' + tmpItem.file.name
|
|
}
|
|
|
|
imgTag += '<div class="col-sm-4 col-md-2 col-xs-12">' + tmpMediaTag + '<button onclick="doAllThingsInSafe(\'local/op\', {target: \'preview\', hero: \'' + tmpItem.key + '\'});" type="button" class="close " aria-label="Close" ><i class="icofont icofont-close-line-circled"></i></button></div>'
|
|
|
|
$('#preview-console').append(imgTag)
|
|
|
|
if (tmpMimeType === 'video') {
|
|
$('#' + tmpItem.imgTagId)[0].src = URL.createObjectURL(tmpItem.file);
|
|
$('#' + tmpItem.imgTagId).parent()[0].load();
|
|
} else if (tmpMimeType === 'image') {
|
|
if (tmpItem.cache !== undefined) {
|
|
$('#' + tmpItem.imgTagId).attr('src', tmpItem.cache);
|
|
} else {
|
|
var reader = new FileReader();
|
|
|
|
reader.fileKey = tmpItem.key
|
|
reader.onload = function(e) {
|
|
var tmpItem = previewPool[e.target.fileKey]
|
|
tmpItem.cache = e.target.result
|
|
$('#' + tmpItem.imgTagId).attr('src', tmpItem.cache);
|
|
}
|
|
reader.readAsDataURL(tmpItem.file);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function readURL(input) {
|
|
// previewPool = {}
|
|
if (input.files && input.files[0]) {
|
|
for (var i = 0; i < input.files.length; i++) {
|
|
// console.log('previewLastIdx=', previewLastIdx)
|
|
var tmpKey = 'fileKey_' + (previewLastIdx)
|
|
// console.log('tmpKey=', tmpKey)
|
|
|
|
// console.log('input.files[i]=', input.files[i])
|
|
|
|
var tmpPreviewItem = {
|
|
key: tmpKey,
|
|
file: input.files[i],
|
|
name: input.files[i].name,
|
|
type: input.files[i].type,
|
|
size: input.files[i].size,
|
|
imgTagId: 'imgTag_' + (previewLastIdx)
|
|
}
|
|
previewPool[tmpKey] = tmpPreviewItem
|
|
previewLastIdx++
|
|
}
|
|
makePreviewAlive()
|
|
$("#files").val('')
|
|
}
|
|
}
|
|
|
|
function notify(message, type){
|
|
$.growl({
|
|
message: message
|
|
},{
|
|
type: type,
|
|
allow_dismiss: false,
|
|
label: 'Cancel',
|
|
className: 'btn-xs btn-inverse',
|
|
placement: {
|
|
from: 'bottom',
|
|
align: 'right'
|
|
},
|
|
delay: 2500,
|
|
animate: {
|
|
enter: 'animated fadeInRight',
|
|
exit: 'animated fadeOutRight'
|
|
},
|
|
offset: {
|
|
x: 30,
|
|
y: 30
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
|
|
function getMimeTypeFromPath (path) {
|
|
|
|
var tmpAry = path.split('.')
|
|
var tmpExt = tmpAry[tmpAry.length - 1]
|
|
|
|
var resultMimetype = 'file'
|
|
|
|
switch (tmpExt) {
|
|
case 'jpeg':
|
|
case 'jpg':
|
|
case 'jpe':
|
|
case 'png':
|
|
case 'gif':
|
|
resultMimetype = 'image'
|
|
break;
|
|
|
|
case 'mp4':
|
|
resultMimetype = 'video'
|
|
break;
|
|
|
|
default:
|
|
resultMimetype = 'file'
|
|
}
|
|
|
|
return resultMimetype
|
|
}
|
|
|
|
|
|
var currentFamilyInfo = {}
|
|
var currentCenterInfo = {}
|
|
|
|
var elderInfoPool = {}
|
|
|
|
var currentSupportInfo = {}
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
if( !( 'WebSocket' in window ) ) {
|
|
// no websocket...
|
|
} else {
|
|
connectWsChat();
|
|
}
|
|
|
|
|
|
checkAppLogin()
|
|
|
|
// console.log('huk document ready...')
|
|
|
|
getParams = getJsonFromUrl()
|
|
|
|
|
|
|
|
$("#files").change(function(e){
|
|
readURL(this);
|
|
});
|
|
|
|
// console.log('getParams=', getParams)
|
|
|
|
|
|
$('.nav li a').click(function(){
|
|
|
|
var data = $(this).attr("href");
|
|
|
|
// console.log(data);
|
|
|
|
setCookie('accompanyTabIdx', data, 1000)
|
|
|
|
switch (data) {
|
|
case '#accompany-list-received':
|
|
tabControlTarget = 'accompany:received'
|
|
doAllThingsInSafe('local/list', {target: tabControlTarget})
|
|
break;
|
|
|
|
case '#accompany-list-sent':
|
|
tabControlTarget = 'accompany:sent'
|
|
doAllThingsInSafe('local/list', {target: tabControlTarget})
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
<% if (infos.loc === '/score/detail') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'score', hero: getParams['target']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/square') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'square'})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/square/detail') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'square', hero: getParams['cid']})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:center', hero: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/support' && infos.userInfo.loginFlag) {%>
|
|
|
|
doAllThingsInSafe('list', {target: 'support:my'})
|
|
|
|
$("#support-message").keydown(function(key) {
|
|
if (key.keyCode == 13) {
|
|
key.preventDefault();
|
|
doAllThingsInSafe('insert', {target: 'support:ask'})
|
|
}
|
|
});
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/admin/support' && infos.userInfo.loginFlag) {%>
|
|
|
|
doAllThingsInSafe('list', {target: 'support:active'})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/admin/support/detail' && infos.userInfo.loginFlag) {%>
|
|
|
|
doAllThingsInSafe('list', {target: 'support:user', hero: getParams['uid']})
|
|
|
|
$("#support-message").keydown(function(key) {
|
|
if (key.keyCode == 13) {
|
|
key.preventDefault();
|
|
doAllThingsInSafe('insert', {target: 'support:reply'})
|
|
}
|
|
});
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/my' || infos.loc === '/my/new' || infos.loc === '/my/edit') {%>
|
|
|
|
doAllThingsInSafe('select', {target: 'profile'})
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/profile' || infos.loc === '/profile/new' || infos.loc === '/profile/edit') {%>
|
|
|
|
// doAllThingsInSafe('select', {target: 'profile'})
|
|
|
|
<% if (infos.profileType === 'center') {%>
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
<%} else if (infos.profileType === 'staff') {%>
|
|
doAllThingsInSafe('local/select', {target: 'staff', hero: getParams['sid']})
|
|
<%} else if (infos.profileType === 'elder') {%>
|
|
doAllThingsInSafe('local/select', {target: 'elder', hero: getParams['eid']})
|
|
<%} else if (infos.profileType === 'family') {%>
|
|
doAllThingsInSafe('local/select', {target: 'family', hero: getParams['fid']})
|
|
<%} else if (infos.profileType === 'other') {%>
|
|
doAllThingsInSafe('local/select', {target: 'profile', hero: getParams['pid']})
|
|
<%} else if (infos.profileType === 'me') {%>
|
|
doAllThingsInSafe('local/select', {target: 'profile'})
|
|
<%} else {%>
|
|
doAllThingsInSafe('local/select', {target: 'profile'})
|
|
<%} %>
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/admin/upload') {%>
|
|
|
|
currentPageSize = 3
|
|
currentPageNumber = 1
|
|
doAllThingsInSafe('list', {target: 'files:active', start: (currentPageNumber - 1) * currentPageSize, length: currentPageSize})
|
|
|
|
$('#upload-file').on("change", function(){
|
|
// console.log('huk change')
|
|
|
|
uploadFiles = [];
|
|
for (var i = 0; i < $(this).get(0).files.length; ++i) {
|
|
uploadFiles.push($(this).get(0).files[i]);
|
|
}
|
|
// console.log('uploadFiles=', uploadFiles)
|
|
|
|
});
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/tracking') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'order:active'})
|
|
doAllThingsInSafe('local/list', {target: 'subscription:my:active'})
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/note') {%>
|
|
|
|
refreshNoteList([])
|
|
makePagenationTag('local/list', 'note:active')
|
|
|
|
if (getParams['cid']) {
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
} else {
|
|
doAllThingsInSafe('local/list', {target: 'note:active'})
|
|
}
|
|
|
|
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/review') {%>
|
|
|
|
refreshReviewList([])
|
|
makePagenationTag('local/list', 'review:active')
|
|
|
|
|
|
doAllThingsInSafe('local/list', {target: 'review:active'})
|
|
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/note/detail') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'note', hero: getParams['nid'], cid: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/review/detail') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'review', hero: getParams['nid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/note/new' || infos.loc === '/note/edit') {%>
|
|
|
|
|
|
$('#summernote').summernote({
|
|
lang: 'ko-KR', // default: 'en-US'
|
|
height: 300, // set editor height
|
|
minHeight: null, // set minimum height of editor
|
|
maxHeight: null, // set maximum height of editor
|
|
focus: true, // set focus to editable area after initializing summernote
|
|
|
|
|
|
maximumImageFileSize: 5 * 1024 * 1024, // 5 MB
|
|
callbacks:{
|
|
|
|
onImageUpload : function(files) {
|
|
uploadFiles = [];
|
|
for (var i = 0; i < files.length; ++i) {
|
|
uploadFiles.push(files[i]);
|
|
}
|
|
console.log('uploadFiles=', uploadFiles)
|
|
doAllThingsInSafe('upload', {target: 'just', uploadFiles: uploadFiles})
|
|
},
|
|
|
|
|
|
onImageUploadError: function(msg){
|
|
console.log(msg + ' (5 MB)');
|
|
Swal.fire('이미지 첨부 오류', msg + ' (5MB)', 'error');
|
|
},
|
|
}
|
|
|
|
});
|
|
// var markupStr = $('#summernote').summernote('code');
|
|
// var markupStr = 'hello world';
|
|
// $('#summernote').summernote('code', markupStr);
|
|
|
|
<% if (infos.loc === '/note/edit') {%>
|
|
doAllThingsInSafe('local/select', {target: 'note', hero: getParams['nid'], cid: getParams['cid']})
|
|
<%} else {%>
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
<%} %>
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/review/new' || infos.loc === '/review/edit') {%>
|
|
|
|
|
|
$('#summernote').summernote({
|
|
lang: 'ko-KR', // default: 'en-US'
|
|
height: 300, // set editor height
|
|
minHeight: null, // set minimum height of editor
|
|
maxHeight: null, // set maximum height of editor
|
|
focus: true, // set focus to editable area after initializing summernote
|
|
|
|
|
|
maximumImageFileSize: 5 * 1024 * 1024, // 5 MB
|
|
callbacks:{
|
|
|
|
onImageUpload : function(files) {
|
|
uploadFiles = [];
|
|
for (var i = 0; i < files.length; ++i) {
|
|
uploadFiles.push(files[i]);
|
|
}
|
|
console.log('uploadFiles=', uploadFiles)
|
|
doAllThingsInSafe('upload', {target: 'just', uploadFiles: uploadFiles})
|
|
},
|
|
|
|
|
|
onImageUploadError: function(msg){
|
|
console.log(msg + ' (5 MB)');
|
|
Swal.fire('이미지 첨부 오류', msg + ' (5MB)', 'error');
|
|
},
|
|
}
|
|
|
|
});
|
|
// var markupStr = $('#summernote').summernote('code');
|
|
// var markupStr = 'hello world';
|
|
// $('#summernote').summernote('code', markupStr);
|
|
$('#review-case').val('case2').focus();
|
|
|
|
<% if (infos.loc === '/review/edit') {%>
|
|
doAllThingsInSafe('local/select', {target: 'review', hero: getParams['nid']})
|
|
<%} else {%>
|
|
doAllThingsInSafe('local/select', {target: 'accompany:done'})
|
|
<%} %>
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/tracking') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'order:active'})
|
|
doAllThingsInSafe('local/list', {target: 'subscription:my:active'})
|
|
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.appInfo.type === 'fleetco' && infos.loc === '/lab') {%>
|
|
|
|
$("#search-target").autocomplete({
|
|
open: function(){
|
|
setTimeout(function () {
|
|
$('#search-target').css('z-index', 99999999999999);
|
|
}, 0);
|
|
},
|
|
source: function (request, response) {
|
|
console.log('on autocomplete, request=', request)
|
|
console.log('on autocomplete, response=', response)
|
|
|
|
|
|
var targetUrl = 'http://suggestqueries.google.com/complete/search?client=firefox&q=' + encodeURIComponent(request.term)
|
|
var proxy = 'https://cors-anywhere.inspond.com/';
|
|
var finalURL = proxy + targetUrl;
|
|
$.getJSON(finalURL, function(data) {
|
|
// console.log('data=', data)
|
|
response(data[1]);
|
|
|
|
}).fail(function(err) {
|
|
console.log('err=', err)
|
|
});
|
|
},
|
|
minLength: 2
|
|
});
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/') {%>
|
|
|
|
<% if (infos.appInfo.type === 'linkcare') {%>
|
|
|
|
<% if (infos.countObj.familyCount !== 0) {%>
|
|
doAllThingsInSafe('local/list', {target: 'elder:my'})
|
|
// doAllThingsInSafe('local/list', {target: 'timeline:active'})
|
|
<%} else if (infos.countObj.staffCount !== 0 || infos.countObj.createrCount !== 0 ) { %>
|
|
doAllThingsInSafe('local/list', {target: 'center:active'})
|
|
<%} %>
|
|
|
|
// sendMessageToApp ({}, {cmd: 'local/op', target: 'dummy', msg: 'Hello, app! #1'})
|
|
// sendMessageToApp ({}, {cmd: 'local/op', target: 'dummy', msg: 'Hello, app! #2'})
|
|
// sendMessageToAppRaw({cmd: 'hello'})
|
|
|
|
<%} else if (infos.appInfo.type === 'chachachak') { %>
|
|
|
|
var popupTag = 'popup20200821'
|
|
var popupCookie = getCookie(popupTag)
|
|
|
|
console.log('popupCookie=', popupCookie)
|
|
|
|
|
|
if (popupCookie === null) {
|
|
|
|
Swal.fire({
|
|
html: '<h3>이곳은 "재능기부" 커뮤니티 입니다!!!</h3>' +
|
|
'<div>' +
|
|
'<p>차(車)에 대한 여러분의 지식과 경험을 공유해 주세요.</p>' +
|
|
'<ul>' +
|
|
'<li>여러분의 조그마한 재능기부가 많은 사람들에게 축복이 되고, 도움이 되고 또 커다란 행복이 됩니다. </li>' +
|
|
'<li> </li>' +
|
|
'<li>‘차차착’은 중고차 거래에 관심이 많은 분들을 위한 서비스 입니다. 중고차 매물을 게시판에 올려 서로 의견을 주고 받을 수 있고, 중고차 거래를 하러 갈 때에는 경험이 많은 다른 사용자에게 도움을 청할 수도 있습니다. 첫차로 중고차를 선택하는 경우가 많은 만큼 ‘차차착’이 좋은 경험을 제공해 드릴 수 있기를 희망합니다.</li>' +
|
|
'</ul>' +
|
|
'</div>' +
|
|
'<h3>국내 최초 차 사랑 나눔 무료 커뮤니티 ; 차차착_닷_컴</h3>',
|
|
|
|
|
|
showCloseButton: false,
|
|
showCancelButton: false,
|
|
focusConfirm: false,
|
|
|
|
confirmButtonText:
|
|
'<i class="fa fa-thumbs-up"></i> 하룻동안 보지 않기',
|
|
confirmButtonAriaLabel: 'Thumbs up, great!',
|
|
})
|
|
.then((value) => {
|
|
console.log('value=', value)
|
|
if (value.isConfirmed) {
|
|
// var openAfter = 1 / 24 / 60 // 1 min
|
|
var openAfter = 1 // 1 day
|
|
var ts = new Date();
|
|
setCookie(popupTag, ts, openAfter)
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
<%} %>
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/center') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'center:active'})
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/center/detail') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/center/edit') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/post/edit') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'post', hero: getParams['pid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/staff') {%>
|
|
|
|
refreshStaffList([])
|
|
doAllThingsInSafe('local/list', {target: 'staff:active', hero: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/staff/edit') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'staff', hero: getParams['sid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/staff/detail') {%>
|
|
|
|
refreshStaffInfo([])
|
|
doAllThingsInSafe('local/select', {target: 'staff', hero: getParams['sid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/elder') {%>
|
|
|
|
refreshElderList([])
|
|
doAllThingsInSafe('local/list', {target: 'elder:active', hero: getParams['cid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/elder/edit') {%>
|
|
|
|
|
|
doAllThingsInSafe('local/select', {target: 'elder', hero: getParams['eid']})
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/elder/detail') {%>
|
|
|
|
$('#timeline-input-div').css("display", "block" )
|
|
|
|
doAllThingsInSafe('local/select', {target: 'elder', hero: getParams['eid']})
|
|
// doAllThingsInSafe('local/list', {target: 'timeline:elder', hero: getParams['eid']})
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/family') {%>
|
|
refreshFamilyList([])
|
|
doAllThingsInSafe('local/list', {target: 'elder:my'})
|
|
// doAllThingsInSafe('local/list', {target: 'family:my'})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/family/edit') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'family', hero: getParams['fid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/family/detail') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'family', hero: getParams['fid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/timeline') {%>
|
|
|
|
|
|
|
|
if (getParams['cid'] != undefined) {
|
|
// center timeline.
|
|
$('#timeline-input-div').css("display", "block" )
|
|
doAllThingsInSafe('local/select', {target: 'center', hero: getParams['cid']})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:center', hero: getParams['cid']})
|
|
} else if (getParams['eid'] != undefined) {
|
|
// elder timeline.
|
|
$('#timeline-input-div').css("display", "block" )
|
|
doAllThingsInSafe('local/select', {target: 'elder', hero: getParams['eid']})
|
|
doAllThingsInSafe('local/list', {target: 'family:my'})
|
|
doAllThingsInSafe('local/list', {target: 'timeline:elder', hero: getParams['eid']})
|
|
|
|
|
|
<% console.log(infos.userInfo.profile.photo_url) %>
|
|
|
|
|
|
/*
|
|
|
|
if (elderInfo.profile_url != null && elderInfo.profile_url.trim() != '') {
|
|
$('#elder_profile').attr("src", elderInfo.profile_url)
|
|
}
|
|
|
|
$('#elder_name').html('<h6>' + currentCenterInfo.name + '</h6>' )
|
|
$('#post-message').attr('placeholder', '센터에는 어떤 일이 있었나요?');
|
|
|
|
*/
|
|
|
|
|
|
|
|
} else {
|
|
doAllThingsInSafe('local/list', {target: 'elder:my'})
|
|
}
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/accompany') {%>
|
|
|
|
var accompanyTabIdx = getCookie('accompanyTabIdx')
|
|
// heat, latest, recommanded
|
|
if (accompanyTabIdx == null) {
|
|
accompanyTabIdx = '#accompany-list-received'
|
|
setCookie('accompanyTabIdx', accompanyTabIdx, 1000)
|
|
}
|
|
console.log('huk tab accompanyTabIdx=', accompanyTabIdx)
|
|
$('a[href="' + accompanyTabIdx + '"]').click();
|
|
|
|
|
|
|
|
doAllThingsInSafe('local/list', {target: tabControlTarget})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/accompany/detail') {%>
|
|
|
|
// console.log('getParams=', getParams)
|
|
|
|
doAllThingsInSafe('local/select', {target: 'accompany', hero: getParams['aid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/accompany/new') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'guide', hero: getParams['gid']})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/admin/approve/depot') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'depot:ready'})
|
|
|
|
<%} %>
|
|
|
|
<% if (infos.loc === '/admin/approve/review') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'review:ready'})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/score') {%>
|
|
|
|
var scoreListTabIdx = getCookie('scoreListTabIdx')
|
|
// heat, latest, recommanded
|
|
if (scoreListTabIdx == null) {
|
|
scoreListTabIdx = '#day'
|
|
setCookie('scoreListTabIdx', scoreListTabIdx, 1000)
|
|
}
|
|
console.log('huk tab scoreListTabIdx=', scoreListTabIdx)
|
|
$('a[href="' + scoreListTabIdx + '"]').click();
|
|
|
|
|
|
doAllThingsInSafe('local/select', {target: 'rank:' + scoreListTabIdx.replace('#', '')})
|
|
|
|
|
|
|
|
$("ul.md-tabs li").click(function() {
|
|
console.log('huk ul.tabs li')
|
|
scoreListTabIdx = $(this).find("a").attr("href")
|
|
setCookie('scoreListTabIdx', scoreListTabIdx, 1000)
|
|
|
|
doAllThingsInSafe('local/select', {target: 'rank:' + scoreListTabIdx.replace('#', '')})
|
|
|
|
});
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/depot') {%>
|
|
|
|
var tmpWidth = $( '#tabs' ).width();
|
|
|
|
// console.log('tmpWidth=', tmpWidth)
|
|
if (tmpWidth < 400) {
|
|
/*
|
|
$('.card-block').css('padding-bottom','10px');
|
|
$('.card-block').css('padding-top','10px');
|
|
$('.card-block').css('padding-left','10px');
|
|
$('.card-block').css('padding-right','10px');
|
|
|
|
$('.page-wrapper').css('padding-bottom','0px');
|
|
*/
|
|
}
|
|
|
|
|
|
|
|
|
|
var depotListTabIdx = getCookie('depotListTabIdx')
|
|
// heat, latest, recommanded
|
|
if (depotListTabIdx == null) {
|
|
depotListTabIdx = '#heat'
|
|
setCookie('depotListTabIdx', depotListTabIdx, 1000)
|
|
}
|
|
console.log('huk tab depotListTabIdx=', depotListTabIdx)
|
|
$('a[href="' + depotListTabIdx + '"]').click();
|
|
|
|
var orderTag = 'heat'
|
|
var orderDir = 'desc'
|
|
|
|
switch (depotListTabIdx) {
|
|
case '#heat':
|
|
orderTag = 'heat'
|
|
break;
|
|
|
|
case '#latest':
|
|
orderTag = 'serial'
|
|
break;
|
|
|
|
case '#recommanded':
|
|
orderTag = 'score'
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
var columnItem = {}
|
|
columnItem[orderTag] = {data: orderTag}
|
|
|
|
doAllThingsInSafe('local/list', {target: 'depot:active', columns: columnItem, order: [{column: orderTag, dir: orderDir}]})
|
|
|
|
|
|
|
|
$("ul.md-tabs li").click(function() {
|
|
console.log('huk ul.tabs li')
|
|
depotListTabIdx = $(this).find("a").attr("href")
|
|
setCookie('depotListTabIdx', depotListTabIdx, 1000)
|
|
|
|
switch (depotListTabIdx) {
|
|
case '#heat':
|
|
orderTag = 'heat'
|
|
break;
|
|
|
|
case '#latest':
|
|
orderTag = 'serial'
|
|
break;
|
|
|
|
case '#recommanded':
|
|
orderTag = 'score'
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
var columnItem = {}
|
|
|
|
columnItem[orderTag] = {data: orderTag}
|
|
|
|
doAllThingsInSafe('local/list', {target: 'depot:active', columns: columnItem, order: [{column: orderTag, dir: orderDir}]})
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if (infos.loc === '/guides') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'guide:active'})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/depot/detail') {%>
|
|
|
|
|
|
|
|
$("#comment-message").keydown(function(key) {
|
|
if (key.keyCode == 13) {
|
|
key.preventDefault();
|
|
doAllThingsInSafe('local/insert', {target: 'comment', hero: getParams['cid'], commentListId: 'commentList' })
|
|
}
|
|
});
|
|
|
|
|
|
doAllThingsInSafe('local/select', {target: 'depot', hero: getParams['cid']})
|
|
|
|
|
|
if (authFlag === true) {
|
|
doAllThingsInSafe('local/select', {target: 'vote', hero: getParams['cid']})
|
|
}
|
|
|
|
|
|
|
|
$("#btn-vote").html('저장' + ' ('+ 3 + '/' + 3 + ')');
|
|
|
|
|
|
$("input:checkbox").on('click', function() {
|
|
|
|
if ( $(this).prop('checked') ) {
|
|
// $(this).parent().addClass("selected");
|
|
// console.log($(this).attr('id'), 'checked')
|
|
|
|
var idPrefix = 'vote-'
|
|
|
|
for (var i = 1; i <= 4; i++) {
|
|
var tmpId = idPrefix + i
|
|
// console.log('check ', tmpId)
|
|
if ($(this).attr('id') === tmpId) {
|
|
$('#' + tmpId).prop('checked', $(this).prop('checked'));
|
|
} else {
|
|
$('#' + tmpId).prop('checked', !$(this).prop('checked'));
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
// $(this).parent().removeClass("selected");
|
|
// console.log($(this).attr('id'), 'unchecked')
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/role') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'role'})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/admin/beans') {%>
|
|
|
|
doAllThingsInSafe('local/select', {target: 'beans'})
|
|
|
|
<%} %>
|
|
|
|
|
|
<% if (infos.loc === '/admin/subscription/edit') {%>
|
|
|
|
var target = $("#notice-preview")
|
|
target.html(makeSubscriptionItemTag(previewSubscriptionItem))
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
<% if (infos.loc === '/subscription') {%>
|
|
|
|
doAllThingsInSafe('local/list', {target: 'subscription:active'})
|
|
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
var currentLocationRaw = window.location.href
|
|
currentLocationRaw = currentLocationRaw.toLowerCase()
|
|
|
|
if (currentLocationRaw.endsWith("/")) {
|
|
currentLocationRaw = currentLocationRaw.substring(0, currentLocationRaw.length - 1);
|
|
}
|
|
|
|
var currentLocationRawAry = currentLocationRaw.split('?')
|
|
var currentLocationAry = currentLocationRawAry[0].split('/')
|
|
var currentLocation = currentLocationAry[currentLocationAry.length - 1]
|
|
|
|
var listTarget = currentLocation
|
|
|
|
if (currentLocationAry.length > 3) {
|
|
if (currentLocationAry[currentLocationAry.length - 2] === 'logs') {
|
|
listTarget = 'log:'+currentLocation
|
|
}
|
|
} else {
|
|
listTarget = currentLocation
|
|
}
|
|
|
|
// console.log("listTarget=", listTarget)
|
|
|
|
var apiRoot = '/api/list?'
|
|
|
|
if (listTarget === 'subscription' || listTarget === 'order' || listTarget === 'guides') {
|
|
apiRoot = '/api/local/list?'
|
|
}
|
|
|
|
// console.log("apiRoot=", apiRoot)
|
|
|
|
$('#target-list').DataTable( {
|
|
"processing": true,
|
|
"serverSide": true,
|
|
"ajax": apiRoot + "target=" + listTarget + ':active' + '&lang=<%=infos.lang%>',
|
|
|
|
|
|
<% if (infos.loc === '/admin/notice') {%>
|
|
"columns": [
|
|
{ "data": "title" },
|
|
{ "data": "detail" },
|
|
{ "data": "flags" },
|
|
{ "data": "status" },
|
|
{ "data": "created" },
|
|
{ "data": "serial" }
|
|
],
|
|
"order": [[ 4, "desc" ]],
|
|
"columnDefs": [
|
|
{
|
|
"targets": 0,
|
|
"data": "title",
|
|
"render": function ( data, type, row, meta ) {
|
|
/*
|
|
console.log('0')
|
|
console.log('data=', data)
|
|
console.log('type=', type)
|
|
console.log('row=', row)
|
|
console.log('meta=', meta)
|
|
*/
|
|
return type === 'display' && data.length > 10 ?
|
|
'<span title="'+data+'">'+data.substr( 0, 10 )+'...</span>' :
|
|
data;
|
|
}
|
|
},
|
|
{
|
|
"targets": 1,
|
|
"data": "detail",
|
|
"render": function ( data, type, row, meta ) {
|
|
/*
|
|
console.log('1')
|
|
console.log('data=', data)
|
|
console.log('type=', type)
|
|
console.log('row=', row)
|
|
console.log('meta=', meta)
|
|
*/
|
|
|
|
return type === 'display' && data.length > 20 ?
|
|
'<span title="'+data+'">'+data.substr( 0, 20 )+'...</span>' :
|
|
data;
|
|
}
|
|
},
|
|
{
|
|
"targets": 5,
|
|
"data": "serial",
|
|
"render": function ( data, type, row, meta ) {
|
|
/*
|
|
console.log('5')
|
|
console.log('data=', data)
|
|
console.log('type=', type)
|
|
console.log('row=', row)
|
|
console.log('meta=', meta)
|
|
*/
|
|
|
|
return '<a href=/admin/notice/edit?hero='+data+'>Edit</a>';
|
|
}
|
|
}
|
|
],
|
|
|
|
<%} else if (infos.loc === '/admin/order'){%>
|
|
"columns": [
|
|
{ "data": "order_id" },
|
|
{ "data": "uid" },
|
|
{ "data": "detail" },
|
|
{ "data": "amount" },
|
|
{ "data": "current_step" },
|
|
{ "data": "current_step_memo" },
|
|
{ "data": "status" },
|
|
{ "data": "status_memo" },
|
|
{ "data": "order_info" },
|
|
{ "data": "pay_info" },
|
|
{ "data": "delivery_info" },
|
|
{ "data": "updated" },
|
|
{ "data": "created" },
|
|
],
|
|
"order": [[ 12, "desc" ]],
|
|
"columnDefs": [
|
|
],
|
|
|
|
|
|
<%} else if (infos.loc === '/guides'){%>
|
|
"columns": [
|
|
{ "data": "nick" },
|
|
{ "data": "name" },
|
|
{ "data": "status" },
|
|
{ "data": "created" },
|
|
],
|
|
"order": [[ 3, "desc" ]],
|
|
"columnDefs": [
|
|
],
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/admin/subscription'){%>
|
|
"columns": [
|
|
{ "data": "display_order" },
|
|
{ "data": "title" },
|
|
{ "data": "flags" },
|
|
{ "data": "image" },
|
|
{ "data": "detail" },
|
|
{ "data": "amount" },
|
|
{ "data": "status" },
|
|
{ "data": "serial" }
|
|
],
|
|
"order": [[ 0, "desc" ]],
|
|
"columnDefs": [
|
|
{
|
|
"targets": 7,
|
|
"data": "serial",
|
|
"render": function ( data, type, row, meta ) {
|
|
/*
|
|
console.log('5')
|
|
console.log('data=', data)
|
|
console.log('type=', type)
|
|
console.log('row=', row)
|
|
console.log('meta=', meta)
|
|
*/
|
|
|
|
return '<a href=/admin/subscription/edit?hero='+data+'>Edit</a>';
|
|
}
|
|
}
|
|
],
|
|
|
|
|
|
<%} else if (infos.loc === '/admin/faq'){%>
|
|
"columns": [
|
|
{ "data": "question" },
|
|
{ "data": "answer" },
|
|
{ "data": "status" },
|
|
{ "data": "serial" }
|
|
],
|
|
"order": [[ 3, "desc" ]],
|
|
"columnDefs": [
|
|
{
|
|
"targets": 0,
|
|
"data": "question",
|
|
"render": function ( data, type, row, meta ) {
|
|
return type === 'display' && data.length > 10 ?
|
|
'<span title="'+data+'">'+data.substr( 0, 10 )+'...</span>' :
|
|
data;
|
|
}
|
|
},
|
|
{
|
|
"targets": 1,
|
|
"data": "answer",
|
|
"render": function ( data, type, row, meta ) {
|
|
return type === 'display' && data.length > 20 ?
|
|
'<span title="'+data+'">'+data.substr( 0, 20 )+'...</span>' :
|
|
data;
|
|
}
|
|
},
|
|
{
|
|
"targets": 3,
|
|
"data": "serial",
|
|
"render": function ( data, type, row, meta ) {
|
|
return '<a href=/admin/faq/edit?hero='+data+'>Edit</a>';
|
|
}
|
|
}
|
|
],
|
|
<%} else if (infos.loc === '/admin/support'){%>
|
|
"columns": [
|
|
{ "data": "name" },
|
|
{ "data": "message" },
|
|
{ "data": "status" },
|
|
{ "data": "created" },
|
|
{ "data": "serial" }
|
|
],
|
|
"order": [[ 4, "desc" ]],
|
|
"columnDefs": [
|
|
/*
|
|
{
|
|
"targets": [ 0 ],
|
|
"visible": false,
|
|
"searchable": false
|
|
},
|
|
*/
|
|
],
|
|
|
|
<%} else if (infos.loc === '/admin/users'){%>
|
|
"columns": [
|
|
{ "data": "uid" },
|
|
{ "data": "name" },
|
|
{ "data": "auth_type" },
|
|
{ "data": "user_level" },
|
|
{ "data": "credit_real" },
|
|
{ "data": "credit_bonus" },
|
|
{ "data": "lock_flag" },
|
|
{ "data": "status" },
|
|
{ "data": "created" }
|
|
],
|
|
"order": [[ 8, "desc" ]],
|
|
"columnDefs": [
|
|
/*
|
|
{
|
|
"targets": [ 0 ],
|
|
"visible": false,
|
|
"searchable": false
|
|
},
|
|
*/
|
|
],
|
|
|
|
<%} else if (infos.loc === '/admin/logs/user'){%>
|
|
"columns": [
|
|
{ "data": "uid" },
|
|
{ "data": "tag" },
|
|
{ "data": "memo" },
|
|
{ "data": "created" }
|
|
],
|
|
"order": [[ 3, "desc" ]],
|
|
"columnDefs": [
|
|
{
|
|
"targets": 2,
|
|
"data": "memo",
|
|
"render": function ( data, type, row, meta ) {
|
|
// console.log('data=', data)
|
|
var searchTerm = ' req = '
|
|
var indexOfFirst = data.indexOf(searchTerm);
|
|
var jsonString = data.substring( indexOfFirst + searchTerm.length, data.length )
|
|
// console.log('jsonString=', jsonString)
|
|
var json = {}
|
|
var html = jsonString
|
|
try {
|
|
var json = JSON.parse(jsonString)
|
|
$('#json-renderer').jsonBrowse(json, {collapsed: false});
|
|
$('#json-renderer').css("display", "none" )
|
|
html = $('#json-renderer').html()
|
|
}
|
|
catch (e) {
|
|
// console.log('parse error! e=', e)
|
|
// console.log('parse error!', row)
|
|
html = jsonString
|
|
}
|
|
|
|
|
|
// console.log('json=', json)
|
|
|
|
// console.log('html=', html)
|
|
return html;
|
|
}
|
|
}
|
|
],
|
|
|
|
<%} else if (infos.loc === '/admin/logs/credit'){%>
|
|
"columns": [
|
|
{ "data": "uid" },
|
|
{ "data": "tag" },
|
|
{ "data": "real" },
|
|
{ "data": "bonus" },
|
|
{ "data": "memo" },
|
|
{ "data": "by" },
|
|
{ "data": "created" }
|
|
],
|
|
"order": [[ 6, "desc" ]],
|
|
"columnDefs": [
|
|
/*
|
|
{
|
|
"targets": [ 0 ],
|
|
"visible": false,
|
|
"searchable": false
|
|
},
|
|
*/
|
|
],
|
|
|
|
<%} %>
|
|
|
|
});
|
|
|
|
$('.js--triggerAnimation').on('click',function(e){
|
|
e.preventDefault();
|
|
var anim = $('.js--animations').val();
|
|
testAnim(anim);
|
|
});
|
|
|
|
$('.js--animations').on('change',function(){
|
|
var anim = $(this).val();
|
|
testAnim(anim);
|
|
});
|
|
|
|
function testAnim(x) {
|
|
$('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
|
|
$(this).removeClass();
|
|
});
|
|
};
|
|
|
|
|
|
|
|
$.extend($.validator.messages, {
|
|
required: "필수 항목입니다.",
|
|
remote: "항목을 수정하세요.",
|
|
email: "유효하지 않은 E-Mail주소입니다.",
|
|
url: "유효하지 않은 URL입니다.",
|
|
date: "올바른 날짜를 입력하세요.",
|
|
dateISO: "올바른 날짜(ISO)를 입력하세요.",
|
|
number: "유효한 숫자가 아닙니다.",
|
|
digits: "숫자만 입력 가능합니다.",
|
|
creditcard: "신용카드 번호가 바르지 않습니다.",
|
|
equalTo: "같은 값을 다시 입력하세요.",
|
|
extension: "올바른 확장자가 아닙니다.",
|
|
maxlength: $.validator.format("{0}자를 넘을 수 없습니다. "),
|
|
minlength: $.validator.format("{0}자 이상 입력하세요."),
|
|
rangelength: $.validator.format("문자 길이가 {0} 에서 {1} 사이의 값을 입력하세요."),
|
|
range: $.validator.format("{0} 에서 {1} 사이의 값을 입력하세요."),
|
|
max: $.validator.format("{0} 이하의 값을 입력하세요."),
|
|
min: $.validator.format("{0} 이상의 값을 입력하세요.")
|
|
})
|
|
|
|
|
|
// $('.date').mask('00/00/0000');
|
|
|
|
|
|
|
|
<% if (infos.loc === '/cart') {%>
|
|
doAllThingsInSafe('local/select', {target: 'cart'})
|
|
|
|
|
|
|
|
|
|
<%} else if (infos.loc === '/order'){%>
|
|
|
|
|
|
|
|
var form = $("#example-advanced-form").show();
|
|
|
|
form.steps({
|
|
headerTag: "h3",
|
|
bodyTag: "fieldset",
|
|
transitionEffect: "slideLeft",
|
|
onStepChanging: function(event, currentIndex, newIndex) {
|
|
// console.log("onStepChanging(), currentIndex=", currentIndex)
|
|
// console.log("onStepChanging(), newIndex=", newIndex)
|
|
// console.log("onStepChanging(), #agreeAll=", $("#agreeAll").is(":checked"))
|
|
if (currentIndex == 0 && $("#agreeAll").is(":checked") == false) {
|
|
Swal.fire('약관 동의는 필수 입니다.', '법률에 의해 반드시 약관에 동의해야 합니다.', 'error');
|
|
return false
|
|
}
|
|
|
|
// Allways allow previous action even if the current form is not valid!
|
|
if (currentIndex > newIndex) {
|
|
return true;
|
|
}
|
|
// Forbid next action on "Warning" step if the user is to young
|
|
if (newIndex === 3 && Number($("#age-2").val()) < 18) {
|
|
return false;
|
|
}
|
|
// Needed in some cases if the user went back (clean up)
|
|
if (currentIndex < newIndex) {
|
|
// To remove error styles
|
|
form.find(".body:eq(" + newIndex + ") label.error").remove();
|
|
form.find(".body:eq(" + newIndex + ") .error").removeClass("error");
|
|
}
|
|
form.validate().settings.ignore = ":disabled,:hidden";
|
|
return form.valid();
|
|
},
|
|
onStepChanged: function(event, currentIndex, priorIndex) {
|
|
// console.log("onStepChanged(), event=", event)
|
|
// console.log("onStepChanged(), currentIndex=", currentIndex)
|
|
// console.log("onStepChanged(), priorIndex=", priorIndex)
|
|
|
|
// Inputmask().mask(document.querySelectorAll("input"));
|
|
// Used to skip the "Warning" step if the user is old enough.
|
|
/*
|
|
if (currentIndex === 2 && Number($("#age-2").val()) >= 18) {
|
|
form.steps("next");
|
|
}
|
|
// Used to skip the "Warning" step if the user is old enough and wants to the previous step.
|
|
if (currentIndex === 1 && priorIndex === 0 && currentAddress === null) {
|
|
form.steps("previous");
|
|
}
|
|
*/
|
|
if (currentIndex === 1 && priorIndex === 0 && currentAddress === null) {
|
|
doAllThingsInSafe('local/list', {target: 'address:active'})
|
|
}
|
|
|
|
|
|
if (currentIndex === 2 && priorIndex === 1 || currentIndex === 0 && priorIndex === 1) {
|
|
|
|
|
|
var heroForAddress = {
|
|
tag: '',
|
|
is_default: 0,
|
|
name: $("#name").val(),
|
|
phone: $("#phone").val(),
|
|
zip_code: $("#zipcode").val(),
|
|
address_1: $("#address").val(),
|
|
address_2: $("#addressDetail").val()
|
|
}
|
|
|
|
if (
|
|
currentAddress.tag != heroForAddress.tag ||
|
|
currentAddress.is_default != heroForAddress.is_default ||
|
|
currentAddress.name != heroForAddress.name ||
|
|
currentAddress.phone != heroForAddress.phone ||
|
|
currentAddress.zip_code != heroForAddress.zip_code ||
|
|
currentAddress.address_1 != heroForAddress.address_1 ||
|
|
currentAddress.address_2 != heroForAddress.address_2
|
|
) {
|
|
if (currentAddress.serial !== undefined) {
|
|
doAllThingsInSafe('local/update', {target: 'address'})
|
|
} else {
|
|
doAllThingsInSafe('local/insert', {target: 'address'})
|
|
}
|
|
} else {
|
|
// go for pay...
|
|
// doAllThingsInSafe('local/select', {target: 'cart'})
|
|
// doAllThingsInSafe('pay', payParams)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
onFinishing: function(event, currentIndex) {
|
|
// console.log("huk 3")
|
|
form.validate().settings.ignore = ":disabled";
|
|
return form.valid();
|
|
},
|
|
onFinished: function(event, currentIndex) {
|
|
// console.log("huk 4")
|
|
|
|
var heroForAddress = {
|
|
tag: '',
|
|
is_default: 0,
|
|
name: $("#name").val(),
|
|
phone: $("#phone").val(),
|
|
zip_code: $("#zipcode").val(),
|
|
address_1: $("#address").val(),
|
|
address_2: $("#addressDetail").val()
|
|
}
|
|
|
|
// console.log('heroForAddress=', heroForAddress)
|
|
// console.log('currentAddress=', currentAddress)
|
|
|
|
if (
|
|
currentAddress.tag != heroForAddress.tag ||
|
|
currentAddress.is_default != heroForAddress.is_default ||
|
|
currentAddress.name != heroForAddress.name ||
|
|
currentAddress.phone != heroForAddress.phone ||
|
|
currentAddress.zip_code != heroForAddress.zip_code ||
|
|
currentAddress.address_1 != heroForAddress.address_1 ||
|
|
currentAddress.address_2 != heroForAddress.address_2
|
|
) {
|
|
if (currentAddress.serial !== undefined) {
|
|
doAllThingsInSafe('local/update', {target: 'address'})
|
|
} else {
|
|
doAllThingsInSafe('local/insert', {target: 'address'})
|
|
}
|
|
} else {
|
|
// go for pay...
|
|
// doAllThingsInSafe('local/select', {target: 'cart'})
|
|
|
|
}
|
|
|
|
var heroForPay = {
|
|
cardNumber: $("#cardNumber").val(),
|
|
cardExpire: $("#cardExpire").val(),
|
|
cardBirthday: $("#cardBirthday").val(),
|
|
cardPasscode: $("#cardPasscode").val()
|
|
}
|
|
|
|
// console.log('heroForPay=', heroForPay)
|
|
|
|
<% if (hero === null) {%>
|
|
payParams.name = heroForAddress.name
|
|
payParams.phone = heroForAddress.phone
|
|
payParams.address_1 = heroForAddress.address_1
|
|
payParams.address_2 = heroForAddress.address_2
|
|
payParams.zip_code = heroForAddress.zip_code
|
|
|
|
doAllThingsInSafe('pay', payParams)
|
|
<%} else {%>
|
|
|
|
payParams = {}
|
|
payParams.name = heroForAddress.name
|
|
payParams.phone = heroForAddress.phone
|
|
payParams.address_1 = heroForAddress.address_1
|
|
payParams.address_2 = heroForAddress.address_2
|
|
payParams.zip_code = heroForAddress.zip_code
|
|
|
|
var subscriptionItem = <%-JSON.stringify(hero)%>
|
|
// doAllThingsInSafe('local/subscribe', {...heroForAddress, ...heroForPay, ...subscriptionItem})
|
|
doAllThingsInSafe('subscribe', {customer_uid: '<%=hero.customer_uid%>', ...heroForAddress, ...heroForPay, ...subscriptionItem})
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
// $('.content input[type="text"]').val('');
|
|
// $('.content input[type="email"]').val('');
|
|
// $('.content input[type="password"]').val('');
|
|
}
|
|
}).validate({
|
|
errorPlacement: function errorPlacement(error, element) {
|
|
|
|
element.before(error);
|
|
},
|
|
rules: {
|
|
confirm: {
|
|
equalTo: "#password-2"
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
<% if (hero === null) {%>
|
|
doAllThingsInSafe('local/select', {target: 'cart'})
|
|
<%} else {%>
|
|
doAllThingsInSafe('local/select', {target: 'subscription', hero: '<%=hero.serial%>'})
|
|
|
|
// Inputmask().mask(document.querySelectorAll("input"));
|
|
// $(":input").inputmask();
|
|
// $("#cardExpire").inputmask({ mask: "99/9999"});
|
|
|
|
// $('#cardNumber').mask("0000000000000000", {placeholder: "____-____-____-____"});
|
|
// $('#cardExpire').mask("000000", {placeholder: "mm/yyyy"});
|
|
// $('#cardBirthday').mask("000000", {placeholder: "yymmdd"});
|
|
// $('#cardPasscode').mask("00", {placeholder: "__"});
|
|
/*
|
|
$('#cardNumber').mask("0000-0000-0000-0000", {placeholder: "____-____-____-____"});
|
|
var cleave = new Cleave('#cardNumber', {
|
|
blocks: [4, 4, 4, 4],
|
|
delimiter: '-',
|
|
|
|
});
|
|
|
|
|
|
$('#cardExpire').mask("0000-00", {placeholder: "YYYY-MM"});
|
|
var cleave = new Cleave('#cardExpire', {
|
|
blocks: [4, 2],
|
|
delimiter: '-',
|
|
});
|
|
|
|
$('#cardBirthday').mask("000000", {placeholder: "YYMMDD"});
|
|
var cleave = new Cleave('#cardBirthday', {
|
|
});
|
|
|
|
$('#cardPasscode').mask("00", {placeholder: "__"});
|
|
var cleave = new Cleave('#cardPasscode', {
|
|
});
|
|
*/
|
|
<%} %>
|
|
|
|
|
|
|
|
|
|
|
|
<%}%>
|
|
|
|
|
|
$("#agreeAll").change(function(){
|
|
if($("#agreeAll").is(":checked")){
|
|
$("#agree1").prop("checked", true);
|
|
$("#agree2").prop("checked", true);
|
|
$("#agree3").prop("checked", true);
|
|
$("#agree4").prop("checked", true);
|
|
}else{
|
|
$("#agree1").prop("checked", false);
|
|
$("#agree2").prop("checked", false);
|
|
$("#agree3").prop("checked", false);
|
|
$("#agree4").prop("checked", false);
|
|
}
|
|
});
|
|
|
|
$("#agree1").change(function(){
|
|
if($("#agree1").is(":checked")){
|
|
if ( $("#agree1").is(":checked") && $("#agree2").is(":checked") && $("#agree3").is(":checked") && $("#agree4").is(":checked") ) {
|
|
$("#agreeAll").prop("checked", true);
|
|
}
|
|
}else{
|
|
$("#agreeAll").prop("checked", false);
|
|
}
|
|
});
|
|
|
|
$("#agree2").change(function(){
|
|
if($("#agree2").is(":checked")){
|
|
if ( $("#agree1").is(":checked") && $("#agree2").is(":checked") && $("#agree3").is(":checked") && $("#agree4").is(":checked") ) {
|
|
$("#agreeAll").prop("checked", true);
|
|
}
|
|
}else{
|
|
$("#agreeAll").prop("checked", false);
|
|
}
|
|
});
|
|
$("#agree3").change(function(){
|
|
if($("#agree3").is(":checked")){
|
|
if ( $("#agree1").is(":checked") && $("#agree2").is(":checked") && $("#agree3").is(":checked") && $("#agree4").is(":checked") ) {
|
|
$("#agreeAll").prop("checked", true);
|
|
}
|
|
}else{
|
|
$("#agreeAll").prop("checked", false);
|
|
}
|
|
});
|
|
|
|
$("#agree4").change(function(){
|
|
if($("#agree4").is(":checked")){
|
|
if ( $("#agree1").is(":checked") && $("#agree2").is(":checked") && $("#agree3").is(":checked") && $("#agree4").is(":checked") ) {
|
|
$("#agreeAll").prop("checked", true);
|
|
}
|
|
}else{
|
|
$("#agreeAll").prop("checked", false);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
floatchart()
|
|
$(window).on('resize', function() {
|
|
floatchart();
|
|
});
|
|
$('#mobile-collapse').on('click', function() {
|
|
setTimeout(function() {
|
|
floatchart();
|
|
}, 700);
|
|
});
|
|
$(".scroll-widget").slimScroll({
|
|
size: "5px",
|
|
height: "290px",
|
|
allowPageScroll: false,
|
|
});
|
|
|
|
|
|
var chart = AmCharts.makeChart("deal-analytic-chart", {
|
|
"type": "serial",
|
|
"theme": "light",
|
|
"dataDateFormat": "YYYY-MM-DD",
|
|
"precision": 2,
|
|
"valueAxes": [{
|
|
"id": "v1",
|
|
"position": "left",
|
|
"autoGridCount": false,
|
|
"labelFunction": function(value) {
|
|
return "$" + Math.round(value) + "M";
|
|
}
|
|
}, {
|
|
"id": "v2",
|
|
"gridAlpha": 0,
|
|
"autoGridCount": false
|
|
}],
|
|
"graphs": [{
|
|
"id": "g1",
|
|
"valueAxis": "v2",
|
|
"bullet": "round",
|
|
"bulletBorderAlpha": 1,
|
|
"bulletColor": "#FFFFFF",
|
|
"bulletSize": 8,
|
|
"hideBulletsCount": 50,
|
|
"lineThickness": 3,
|
|
"lineColor": "#2ed8b6",
|
|
"title": "Market Days",
|
|
"useLineColorForBulletBorder": true,
|
|
"valueField": "market1",
|
|
"balloonText": "[[title]]<br /><b style='font-size: 130%'>[[value]]</b>"
|
|
}, {
|
|
"id": "g2",
|
|
"valueAxis": "v2",
|
|
"bullet": "round",
|
|
"bulletBorderAlpha": 1,
|
|
"bulletColor": "#FFFFFF",
|
|
"bulletSize": 8,
|
|
"hideBulletsCount": 50,
|
|
"lineThickness": 3,
|
|
"lineColor": "#e95753",
|
|
"title": "Market Days ALL",
|
|
"useLineColorForBulletBorder": true,
|
|
"valueField": "market2",
|
|
"balloonText": "[[title]]<br /><b style='font-size: 130%'>[[value]]</b>"
|
|
}],
|
|
"chartCursor": {
|
|
"pan": true,
|
|
"valueLineEnabled": true,
|
|
"valueLineBalloonEnabled": true,
|
|
"cursorAlpha": 0,
|
|
"valueLineAlpha": 0.2
|
|
},
|
|
"categoryField": "date",
|
|
"categoryAxis": {
|
|
"parseDates": true,
|
|
"dashLength": 1,
|
|
"minorGridEnabled": true
|
|
},
|
|
"legend": {
|
|
"useGraphSettings": true,
|
|
"position": "top"
|
|
},
|
|
"balloon": {
|
|
"borderThickness": 1,
|
|
"shadowAlpha": 0
|
|
},
|
|
"dataProvider": [{
|
|
"date": "2013-01-16",
|
|
"market1": 71,
|
|
"market2": 75
|
|
}, {
|
|
"date": "2013-01-17",
|
|
"market1": 80,
|
|
"market2": 84
|
|
}, {
|
|
"date": "2013-01-18",
|
|
"market1": 78,
|
|
"market2": 83
|
|
}, {
|
|
"date": "2013-01-19",
|
|
"market1": 85,
|
|
"market2": 88
|
|
}, {
|
|
"date": "2013-01-20",
|
|
"market1": 87,
|
|
"market2": 85
|
|
}, {
|
|
"date": "2013-01-21",
|
|
"market1": 97,
|
|
"market2": 88
|
|
}, {
|
|
"date": "2013-01-22",
|
|
"market1": 93,
|
|
"market2": 88
|
|
}, {
|
|
"date": "2013-01-23",
|
|
"market1": 85,
|
|
"market2": 80
|
|
}, {
|
|
"date": "2013-01-24",
|
|
"market1": 90,
|
|
"market2": 85
|
|
}]
|
|
});
|
|
|
|
|
|
|
|
$('#target-list').DataTable();
|
|
|
|
})
|
|
</script>
|