| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837 |
- <!DOCTYPE html>
- <html lang="ko"
- xmlns:th="http://www.thymeleaf.org">
- <!--
- *******************************************************************************
- * @source : MainMultiContentsPopupForm.html
- * @desc : 메인전시 컨텐츠 멀티 팝업 Page
- *============================================================================
- * STYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER DATE AUTHOR DESCRIPTION
- * === =========== ========== =============================================
- * 1.0 2021.2.24 bin2107 최초 작성
- *******************************************************************************
- -->
- <div class="modalPopup" data-width="1500" >
- <div class="panelStyle">
- <div class="panelTitle">
- <h2 id="multiPopTitle" th:text="${contentsLoc}">Multi</h2>
- <button type="button" class="close" onclick="fnMainMultiContentsPopupFormClose()"><i class="fa fa-times"></i></button>
- </div>
- <div class="panelContent">
- <ul class="panelBar">
- <li class="aL">
- <span class="cBlue">* 상단으로 드래그&드랍하여 순서 변경 가능합니다.</span>
- </li>
- <li class="aR">
- <button type="button" class="btn btn btn-base btn-sm" th:if="${contentsLoc == 'SMM007'}" onclick="fnAddBrand(this);">브랜드 추가</button> <!--id="btnBrandAddRow"-->
- <button type="button" class="btn btn btn-base btn-sm" th:if="${contentsLoc == 'SMM009' or contentsLoc == 'SMM012'}" onclick="fnAddBrand(this);">MD 탭 추가</button>
- <button type="button" class="btn btn btn-dark btn-sm" id="btnMultiPopSave">임시저장</button>
- <input type="hidden" name="uploadDefaultUrlMultiPop" id="uploadDefaultUrlMultiPop" th:value="${@environment.getProperty('upload.image.view') + '/contents/'}"/>
- <input type="hidden" name="uploadDefaultBrandUrlPop" id="uploadDefaultBrandUrlPop" th:value="${@environment.getProperty('upload.image.view') + '/contents/brand/'}"/>
- <input type="hidden" name="uploadDefaultPlanUrlPop" id="uploadDefaultPlanUrlPop" th:value="${@environment.getProperty('upload.image.view') + '/contents/planning/'}"/>
- </li>
- </ul>
- </div>
- <form style="height:600px; width:1470px; overflow:auto;" id="multiPopSortable">
- <input type="hidden" name="mdTitle">
- </form>
- </div>
- </div>
- <script th:inline="javascript">
- /*<![CDATA[*/
- var cateNo = [[${cateNo}]];
- var contentsLoc = [[${contentsLoc}]];
- var contentsLocArr = gagajf.convertToArray([[${contentsLocList}]]);
- var tdWidth = $("#sortable").find("td").width();
- var tdDeleteWidth = parseInt(tdWidth/11, 10);
- tdWidth = tdWidth - tdDeleteWidth;
- /**
- * 컨텐츠 미리보기 리스트
- */
- var fnGetMultiContentsPreviewList = function (){
- $("#multiPopSortable").html('');
- $("#multiPopSortable").html('');
- var data = {cateNo : cateNo
- ,contentsLoc : contentsLoc
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/display/contents/preview/list', jsonData, fnCreatePopLayout);
- }
- var fnCreatePopLayout = function (result){
- var html = '';
- for(var i=0; i<result.length; i++){
- var dispStdt = result[i].dispStdt.split(" ");
- var dispEddt = result[i].dispEddt.split(" ");
- var brandGroupImg = result[i].brandGroupImg;
- html += '<table class="frmStyle tableTest" style="margin-bottom:30px" id="tabTable'+i+'" tableIdx="'+i+'">';
- html += '<colgroup>';
- html += '<col style="width:10%;"/>';
- html += '<col style="width:55%;"/>';
- html += '<col/>';
- html += '</colgroup>';
- html += '<thead><tr><th>전시일시</th><td><input name="dispStdt" type="text" class="w80 schDate" maxlength="10" required="required" data-valid-name="노출시작일" data-valid-type="calendar" value="'+dispStdt[0]+'"/>';
- html += '<select name="stTimeHour" required="required" data-valid-name="노출기간 시작시간">';
- html += fnCreateTimeOption(24, dispStdt[1].split(":")[0]);
- html += '</select>';
- html += '<select name="stTimeMin" required="required" data-valid-name="노출기간 시작시간">';
- html += fnCreateTimeOption(60, dispStdt[1].split(":")[1]);
- html += '</select>';
- html += '<span> ~ </span>';
- html += '<input name="dispEddt" type="text" class="w80 schDate" maxlength="10" required="required" data-valid-name="노출종료일" data-valid-type="calendar" value="'+dispEddt[0]+'"/>';
- html += '<select name="edTimeHour" required="required" data-valid-name="노출기간 종료시간">';
- html += fnCreateTimeOption(24, dispEddt[1].split(":")[0]);
- html += '</select>';
- html += '<select name="edTimeMin" required="required" data-valid-name="노출기간 종료시간">';
- html += fnCreateTimeOption(60, dispEddt[1].split(":")[1]);
- html += '</select>';
- html += '<input name="dispOrd" type="text" class="w80"placeholder="전시순서" style="margin-left:5px; text-align:center" value="'+result[i].dispOrd+'"/>';
- html += '</td>';
- html += '<td class="aL">';
- if(contentsLoc=='SMM007') {
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
- }
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this,this,this);">상품추가</button>';
- html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
- html += '</tr>';
- if(contentsLoc=='SMM009' || contentsLoc=='SMM012'){
- html += '<tr>';
- html += '<th>MD탭문구</th>';
- html += '<td colspan="3"><input type="text" name="mdTitle" id="mdTitle" style="width:30%;" value="' + result[i].mdTitle + '"></td>';
- html += '</tr>';
- }
- if(contentsLoc=='SMM007') {
- html += '<tr>';
- html += '<th>브랜드코드</th>';
- html += '<td colspan="3"><input type="text" name="brandGroupNo" style="width:30%;" value="' + result[i].brandGroupNo + '">';
- html += '<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGetBrandGroup(this);">브랜드조회</button>';
- html += '</td>';
- html += '</tr>';
- /*html += fnAddBrandImgRow(result[i].brandGroupImg);*/
- }
- html += '</thead><tbody>';
- if(contentsLoc=='SMM007') {
- for (var j = 1; j < 8; j++) {
- var imgPath = eval("result[" + i + "].imgPath" + j);
- var strVar = eval("result[" + i + "].strVar" + j);
- var strTitle = eval("result["+i+"].strTitle" + j);
- var subText = eval("result["+i+"].subText" + j);
- if (!gagajf.isNull(strVar) || !gagajf.isNull(imgPath)) {
- html += fnAddPlanRow(strVar, imgPath);
- }
- if(strTitle!=null && strTitle!='null' && strTitle!='' ){
- html += fnAddTitlePopRow(strTitle);
- }
- if(subText!=null && subText!='null' && subText!='' ){
- html += fnAddSubTextPopRow(subText);
- }
- }
- }
- if(!gagajf.isNull(result[i].goodsCdList)){
- html += fnAddGoodsRow(result[i].goodsCdList,result[i].goodsNmList,result[i].goodsImgList);
- }
- html += '</tbody></table>';
- }
- $("#multiPopSortable").append(html);
- $("#multiPopSortable").sortable();
- $(".itemWrap").sortable();
- $('.schDate').datepicker("destroy");
- $('.schDate').datepicker({
- changeMonth: true,
- changeYear: true,
- defaultDate: $('.schDate').val()
- });
- }
- /**
- * 브랜드이미지 불러오기
- */
- var brandImgIdx = 0;
- var fnAddBrandImgRow = function (param){
- var src = '';
- var imgPath = '';
- if(typeof param!='object'){
- src = $("#uploadDefaultBrandUrlPop").val().replace('/contents/brand/', '')+param;
- imgPath = param;
- }
- var html = '<tr name="brandImgRow">';
- html += '<th>브랜드이미지</th>';
- html += '<td colspan="3">';
- html += ' <div class="uFile w300">';
- html += ' <input id="brandFile_'+brandImgIdx+'" name="file" type="file" class="uFileInput w300" onchange="fnBrandImgFileUpload(this, '+brandImgIdx+')">';
- html += ' <label for="brandFile_'+brandImgIdx+'" class="uFileLabel">파일선택</label>';
- html += ' <input type="hidden" name="brandImgPath" value="'+imgPath+'">';
- html += ' <input type="hidden" name="brandNewImgFile" value="">';
- html += ' </div>';
- html += ' <div id="brandImgViewPop_'+brandImgIdx+'" class=';
- if (src != '') {
- html += '"on">';
- } else {
- html += '"off">';
- }
- html += ' <img id="brandPreViewUrlPop_'+brandImgIdx+'" src="'+src+'" style="height:100px; max-width:500px;" onclick="cfnOpenImagePreViewPopup(\'brandPreViewUrlPop\',$(this).attr(\'src\'));"/>';
- html += ' </div>';
- html += '</td>';
- html += '</tr>';
- return html;
- }
- /**
- * 브랜드 추가 버튼
- */
- var brandIdx = 0;
- var fnAddBrand = function (param) {
- var src = '';
- var imgPath = '';
- if (typeof param != 'object') {
- src = $("#uploadDefaultBrandUrlPop").val().replace('/contents/brand', '') + param;
- imgPath = param;
- }
- var html = '<table class="frmStyle tableTest" style="margin-bottom:30px" id="tabTable'+brandIdx+'" tableIdx="'+brandIdx+'">';
- html += '<colgroup>';
- html += '<col style="width:10%;"/>';
- html += '<col style="width:55%;"/>';
- html += '<col/>';
- html += '</colgroup>';
- html += '<thead><tr><th>전시일시</th><td><input name="dispStdt" type="text" class="w80 schDate" maxlength="10" required="required" data-valid-name="노출시작일" data-valid-type="calendar"/>';
- html += '<select name="stTimeHour" required="required" data-valid-name="노출기간 시작시간">';
- html += fnCreateTimeOption(24);
- html += '</select>';
- html += '<select name="stTimeMin" required="required" data-valid-name="노출기간 시작시간">';
- html += fnCreateTimeOption(60);
- html += '</select>';
- html += '<span> ~ </span>';
- html += '<input name="dispEddt" type="text" class="w80 schDate" maxlength="10" required="required" data-valid-name="노출종료일" data-valid-type="calendar"/>';
- html += '<select name="edTimeHour" required="required" data-valid-name="노출기간 종료시간">';
- html += fnCreateTimeOption(24, 23);
- html += '</select>';
- html += '<select name="edTimeMin" required="required" data-valid-name="노출기간 종료시간">';
- html += fnCreateTimeOption(60, 59);
- html += '</select>';
- html += '<input name="dispOrd" type="text" class="w80" placeholder="전시순서" style="margin-left:5px; text-align:center"/>';
- html += '</td>';
- html += '<td class="aL">';
- if(contentsLoc=='SMM007') {
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
- }
- html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddGoodsRow(this,this,this);">상품추가</button>';
- html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
- html += '</tr>';
- if(contentsLoc=='SMM009' || contentsLoc=='SMM012'){
- html += '<tr>';
- html += '<th>MD탭문구</th>';
- html += '<td colspan="3"><input type="text" name="mdTitle" id="mdTitle" style="width:30%;"></td>';
- html += '</tr>';
- }
- if(contentsLoc=='SMM007'){
- html += '<tr>';
- html += '<th>브랜드코드</th>';
- html += '<td colspan="3"><input type="text" name="brandGroupNo" style="width:30%;">';
- html += '<button type="button" class="btn btnRight btn-success btn-lg" onclick="fnGetBrandGroup(this);">브랜드조회</button>';
- html += '</td>';
- html += '</tr>';
- /* html += '<tr name="brandImgRow">';
- html += '<th>브랜드이미지</th>';
- html += '<td colspan="3">';
- html += ' <div class="uFile w300">';
- html += ' <input id="brandFile_' + brandIdx + '" name="file" type="file" class="uFileInput w300" onchange="fnBrandImgFileUpload(this, ' + brandIdx + ')">';
- html += ' <label for="brandFile_' + brandIdx + '" class="uFileLabel">파일선택</label>';
- html += ' <input type="hidden" name="brandImgPath" value="' + imgPath + '">';
- html += ' <input type="hidden" name="brandNewImgFile" value="">';
- html += ' </div>';
- html += ' <div id="brandImgViewPop_' + brandIdx + '" class=';
- if (src != '') {
- html += '"on">';
- } else {
- html += '"off">';
- }
- html += ' <img id="brandPreViewUrlPop_' + brandIdx + '" src="" style="height:100px; max-width:500px;" onclick="cfnOpenImagePreViewPopup(\'brandPreViewUrlPop\',$(this).attr(\'src\'));"/>';
- html += ' </div>';
- html += '</td>';
- html += '</tr>';*/
- }
- html += '</thead><tbody></tbody></table>';
- brandIdx++;
- $("#multiPopSortable").prepend(html);
- $("#multiPopSortable").sortable();
- /*$("#multiPopSortable").sortable({
- stop : function (event, table){
- $(".tableTest").each(function(i){
- $(this).attr('id','tabTable'+i);
- console.log($(this).attr('id'));
- });
- }
- });*/
- $('.schDate').datepicker("destroy");
- $('.schDate').datepicker({
- changeMonth: true,
- changeYear: true,
- defaultDate: $('.schDate').val()
- });
- fnReloadIdx();
- }
- var fnReloadIdx = function (){
- $(".tableTest").each(function(i){
- $(this).attr('id','tabTable'+i);
- $(this).find("input[name=dispOrd]").val(i+1);
- //console.log($(this).attr('id'));
- });
- }
- /**
- * 브랜드 이미지 첨부
- */
- var fnBrandImgFileUpload = function (obj, ind){
- var file = obj.files[0];
- file.name = 'test';
- if (typeof(file) == 'undefined'){
- return;
- }
- // 파일 업로드
- gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents/brand/'
- , file
- , function(result) {
- $(obj).closest('div').find('input:hidden[name=brandNewImgFile]').val(result.newFileName);
- $("#brandPreViewUrlPop_"+ind).attr('src', $("#uploadDefaultBrandUrlPop").val()+result.newFileName);
- $("#brandImgViewPop_"+ind).removeClass("off").addClass("on");
- }
- , 'image'
- );
- }
- /**
- * 브랜드그룹 조회
- */
- var tblNm;
- var fnGetBrandGroup = function (obj){
- tblNm = $(obj).closest("table").attr('id');
- //console.log('tblNm:::::'+tblNm);
- cfnOpenBrandGroupListPopup("callBackBrandGroup", "S", "S");
- }
- var callBackBrandGroup = function (result){
- $("#"+tblNm).find("input[name=brandGroupNo]").val(result[0].brandGroupNo);
- }
- /**
- * 기획전/배너 추가
- */
- var planImgIndex = 0;
- var fnAddPlanRow = function (strvar, param){
- var src = '';
- var imgPath = '';
- if(typeof param!='object'){
- src = $("#uploadDefaultPlanUrlPop").val().replace('/contents/planning/', '')+param;
- imgPath = param;
- }
- var html = '<tr name="planRow">';
- html += '<th>기획전/배너<br>링크/이미지</th>';
- html += '<td><input type="text" name="planLink" id="planLink'+planImgIndex+'" value="'+strvar+'"></td>';
- html += '<td><div class="uFile w300">';
- html += '<input id="planFile_'+planImgIndex+'" name="file" type="file" class="uFileInput w300" onchange="fnPlanFileUpload(this, '+planImgIndex+')"/>';
- html += '<label for="planFile_'+planImgIndex+'" class="uFileLabel">파일선택</label>';
- html += '<input type="hidden" name="planImgPath" value="'+imgPath+'"/>';
- html += '<input type="hidden" name="planNewImgFile" value="" />';
- html += '</div>';
- html += '<div id="planImgViewPop_'+planImgIndex+'" class=';
- if(src!=''){
- html += '"on">';
- }else{
- html += '"off">';
- }
- html += '<img id="planPreViewUrlPop_'+planImgIndex+'" src="'+src+'" style="height:100px; max-width:500px;" onclick="cfnOpenImagePreViewPopup(\'planPreimgViewPop\',$(this).attr(\'src\'));"/>';
- html += '</div></td>';
- html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
- html += '</tr>';
- if(typeof param == 'object'){
- if($(param).closest("table").find("tbody").find("tr[name=planRow]").length>4){
- mcxDialog.alert("기획전/배너는 5개까지 등록 가능합니다");
- return;
- }
- planImgIndex++;
- $(param).closest("table").find("tbody").append(html);
- }else{
- planImgIndex++;
- return html;
- }
- }
- // 기획전/배너 파일첨부
- var fnPlanFileUpload = function (obj, ind){
- var file = obj.files[0];
- file.name = 'test';
- if (typeof(file) == 'undefined'){
- return;
- }
- // 파일 업로드
- gagajf.ajaxFileUpload('/common/file/upload?subDir=/contents/planning'
- , file
- , function(result) {
- $(obj).closest('div').find('input:hidden[name=planNewImgFile]').val(result.newFileName);
- $("#planPreViewUrlPop_"+ind).attr('src', $("#uploadDefaultPlanUrlPop").val()+result.newFileName);
- $("#planImgViewPop_"+ind).removeClass("off").addClass("on");
- }
- , 'image'
- );
- }
- /**
- * 타이틀추가
- */
- var fnAddTitlePopRow = function (param){
- var val = typeof param=='object'?'':param;
- var html = '<tr name="titlePopRow">';
- html += '<th>타이틀</th>';
- html += '<td><input name="title" type="text" maxlength="200" data-valid-name="타이틀" value="'+val+'"/></td>';
- html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
- html += '</tr>';
- if(typeof param == 'object'){
- if($(param).closest("table").find("tbody").find("tr[name=titlePopRow]").length>3){
- mcxDialog.alert("타이틀은 4개까지 등록 가능합니다");
- return;
- }
- $(param).closest("table").find("tbody").append(html);
- }else{
- return html;
- }
- }
- /**
- * 서브텍스트추가
- */
- var fnAddSubTextPopRow = function (param){
- var val = typeof param=='object'?'':param;
- var html = '<tr name="subTextPopRow">'
- html += '<th>서브텍스트</th>';
- html += '<td><input type="text" name="subText" maxlength="200" value="'+val+'"/></td>';
- html += '<td class="aL"><button type="button" class="btn icn" onclick="fnDeleteTrRow(this);"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
- html += '</tr>';
- if(typeof param == 'object'){
- if($(param).closest("table").find("tbody").find("tr[name=subTextPopRow]").length>3){
- mcxDialog.alert("서브텍스트는 4개까지 등록 가능합니다");
- return;
- }
- $(param).closest("table").find("tbody").append(html);
- }else{
- return html;
- }
- }
- // 컨텐츠 행삭제
- var fnDeleteBrandRow = function (obj){
- $(obj).closest("table").remove();
- fnReloadIdx();
- }
- // 행삭제
- var fnDeleteTrRow = function (obj){
- $(obj).closest("tr").remove();
- }
- // 컨텐츠 추가 날짜 설정
- var fnCreateTimeOption = function(val, sel) {
- var html = '';
- for(var i=0; i<val; i++){
- var time = 0;
- if(i<10){
- time = '0'+i;
- }else {
- time = i;
- }
- var select = false;
- if(sel==time){
- select = true;
- }
- if(val==24){
- time += '시';
- }else if(val==60){
- time += '분';
- }
- html += '<option value="'+time+'"';
- if(select){
- html += 'selected="selected"';
- }
- html += '>'+time+'</option>';
- }
- return html;
- }
- // 창닫기
- var fnMainMultiContentsPopupFormClose = function (){
- uifnPopupClose('popupMainMultiContents');
- }
- /**
- * 임시저장
- */
- var dataArr = [];
- $("#btnMultiPopSave").on("click", function(){
- if(!gagajf.checkRequired("#multiPopSortable")){
- return;
- }
- dataArr = [];
- $("#multiPopSortable .tableTest").each(function(){ //$("#multiPopSortable table").each(function(){
- var newImgFileArr = [];
- var imgPath1 = '';
- var imgPath2 = '';
- var imgPath3 = '';
- var imgPath4 = '';
- var imgPath5 = '';
- var imgPath6 = '';
- var imgPath7 = '';
- var imgPath8 = '';
- var strVar1 = '';
- var strVar2 = '';
- var strVar3 = '';
- var strVar4 = '';
- var strVar5 = '';
- var strVar6 = '';
- var strVar7 = '';
- var strVar8 = '';
- var strTitle1 = '';
- var strTitle2 = '';
- var strTitle3 = '';
- var strTitle4 = '';
- var subText1 = '';
- var subText2 = '';
- var subText3 = '';
- var subText4 = '';
- var goodsImgArr = [];
- var goodsCdArr = [];
- var goodsNmArr = [];
- var i = 1;
- $(this).find('input[name=planImgPath]').each(function(){
- eval("imgPath" + i + "='"+$(this).val()+"'");
- i++;
- });
- $(this).find('input[name=planNewImgFile]').each(function(){
- newImgFileArr.push($(this).val());
- });
- i = 1;
- $(this).find('input[name=planLink]').each(function(){
- _mall = [[${@environment.getProperty('domain.front')}]];
- var val = $(this).val();
- val = val.replace('https:'+_mall, '');
- val = val.replace('http:'+_mall, '');
- val = val.replace(_mall, '');
- eval("strVar" + i + "='"+val+"'");
- i++;
- });
- i = 1;
- $(this).find('input[name=title]').each(function(){
- var title = $(this).val().replace(/[\']/gi, "\\'");
- eval("strTitle" + i + "='"+title+"'");
- i++;
- });
- i = 1;
- $(this).find('input[name=subText]').each(function(){
- var subText = $(this).val().replace(/[\']/gi, "\\'");
- eval("subText" + i + "='"+subText+"'");
- i++;
- });
- $(this).find('input[name=goodsImgPath]').each(function(){
- goodsImgArr.push($(this).val());
- });
- $(this).find('input[name=goodsCd]').each(function(){
- goodsCdArr.push($(this).val());
- });
- $(this).find('input[name=goodsNm]').each(function(){
- goodsNmArr.push($(this).val());
- });
- var dispStdt = $(this).find("[name=dispStdt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=stTimeHour]").val().replace('시', '') + "" +$(this).find("[name=stTimeMin]").val().replace('분', '') + "00";
- var dispEddt = $(this).find("[name=dispEddt]").val().replace(/[^0-9]/g, '') + "" +$(this).find("[name=edTimeHour]").val().replace('시', '') + "" +$(this).find("[name=edTimeMin]").val().replace('분', '') + "59";
- var dispOrd = $(this).find("[name=dispOrd]").val();
- var brandGroupNo = $(this).find("[name=brandGroupNo]").val();
- var brandGroupImg = $(this).find("[name=brandNewImgFile]").val();
- var mdTitle = $(this).find("[name=mdTitle]").val();
- var data = {cateNo : cateNo
- , contentsLoc : contentsLoc
- , dispStdt : dispStdt
- , dispEddt : dispEddt
- , newImgFileArr : newImgFileArr
- , imgPath1 : imgPath1
- , imgPath2 : imgPath2
- , imgPath3 : imgPath3
- , imgPath4 : imgPath4
- , imgPath5 : imgPath5
- , imgPath6 : imgPath6
- , imgPath7 : imgPath7
- , imgPath8 : imgPath8
- , strVar1 : strVar1
- , strVar2 : strVar2
- , strVar3 : strVar3
- , strVar4 : strVar4
- , strVar5 : strVar5
- , strVar6 : strVar6
- , strVar7 : strVar7
- , strVar8 : strVar8
- , strTitle1 : strTitle1
- , strTitle2 : strTitle2
- , strTitle3 : strTitle3
- , strTitle4 : strTitle4
- , subText1 : subText1
- , subText2 : subText2
- , subText3 : subText3
- , subText4 : subText4
- , brandGroupNo : brandGroupNo
- , brandGroupImg : brandGroupImg
- , mdTitle : mdTitle
- , useYn : 'Y'
- , dispOrd : dispOrd
- , multiContentsYn : 'Y'
- , goodsCdArr : goodsCdArr
- , goodsNmArr : goodsNmArr
- , goodsImgArr : goodsImgArr
- };
- dataArr.push(data);
- });
- if(dataArr.length==0){
- var data = {cateNo : cateNo
- , contentsLoc : contentsLoc
- };
- dataArr.push(data);
- }else{
- var dataArrSort = [];
- dataArr.forEach(function(item, index){
- if(dataArr[index].dispOrd>0){
- for(var i=1; i<dataArr.length; i++){
- if(i>index){
- if(dataArr[index].dispOrd==dataArr[i].dispOrd){
- dataArr[i].dispOrd = Number(dataArr[i].dispOrd) + 1;
- }
- }
- }
- }
- });
- dataArr.forEach(function(item, index){
- if(dataArr[index].dispOrd != ''){
- dataArrSort[dataArr[index].dispOrd-1] = item;
- }
- });
- dataArr.forEach(function(item, index){
- if(dataArr[index].dispOrd == ''){
- var empty = false;
- for(var i=0; i<dataArrSort.length; i++){
- if(typeof dataArrSort[i] == 'undefined'){
- dataArrSort[i] = item;
- empty = true;
- break;
- }
- };
- if(!empty){
- dataArrSort.push(item);
- }
- }
- });
- dataArr = dataArrSort;
- }
- var jsonData = JSON.stringify(dataArr);
- mcxDialog.confirm('컨텐츠를 저장 하시겠습니까?', {
- cancelBtnText: "취소",
- sureBtnText: "확인",
- sureBtnClick: function(){
- gagajf.ajaxJsonSubmit('/display/contents/preview/save', jsonData, fnGetMultiContentsPreviewList);
- }
- });
- });
- /**
- * 상품추가
- */
- var goodsIdx = 0;
- var fnAddGoodsRow = function (param, param2, param3){
- var addRow = "goodsListTd"+goodsIdx;
- //console.log('addRow::'+addRow);
- var html = '<tr name="goodsRow">';
- html += '<th>상품추가<br><button type="button" class="btn btn-base btn-lg" onclick="fnSearchGoods(\''+addRow+'\');">상품조회</button>';
- html += '<br></br><button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteTrRow(this);">삭제</button>';
- html += '</th>';
- html += '<td colspan="3">';
- //html += '<table style="border-style: solid;border-color: #ac2925; width:100%; height:20px;">';
- //html += '<colgroup>';
- //html += '<col style="width:90%;"/>';
- //html += '<col style="width:10%;"/>';
- //html += '<col/>';
- //html += '</colgroup>';
- //html += '<thead>';
- html += '<div class="sortableWrap" data-unit="7" style="overflow-y:scroll;">';
- html += '<div class="itemWrap" id="goodsListTd'+goodsIdx+'">';
- if(typeof param!='object'){
- var goodsCdList = [];
- var goodsNmList = [];
- var goodsImgList = [];
- goodsCdList = param;
- goodsNmList = param2;
- goodsImgList = param3;
- // 여기서 부터 시작! 상품불러오는거 똑같이 html 추가해서 체크
- // +) 저장할때 TMP_CONTENTS_GOODS 에 상품코드, 상품명, 상품이미지경로 추가해서 3개다 불러와서 데이터 뿌릴수 있게
- $.each(goodsCdList.split(','),function (i){
- html += '<ul id="goodsUl'+i+'" class="item ui-state-default goodsClass" style="min-height:120px;"> ';
- goodsImg = goodsImgList.split(',')[i];
- goodsCd = goodsCdList.split(',')[i];
- goodsNm = goodsNmList.split(',')[i];
- html += '<li class="img">';
- var imgPath = _goodsUrl;
- html += '<img src="'+imgPath+ "/" +goodsImg+'" onerror="this.src=\'/image/no.gif\';"/>';
- html += '</li>';
- html += '<li class="cont">';
- html += '<ul>';
- html += '<li class="no" name="goodsCdLi"><span>'+goodsCd+'</span>';
- html += '<input type="hidden" name="goodsImgPath" value="'+goodsImg+'">';
- html += '<input type="hidden" name="goodsCd" value="'+goodsCd+'">';
- html += '<input type="hidden" name="goodsNm" value="'+goodsNm+'">';
- html += '<span style="margin-left:5px;"><a href="javascript:void(0);" id="delId" onclick="fnRemoveGoods(this,'+i+');">X</a></span>';
- html += '</li>';
- html += '</li>';
- html += '<li class="title">'+goodsNm+'</li>';
- html += '</ul>';
- html += '</ul>';
- });
- }
- html += '</div>';
- html += '</div>';
- //html += '</thead>';
- //html += '</table>';
- html += '</td>';
- html += '</tr>';
- if(typeof param == 'object'){
- if($(param).closest("table").find("tbody").find("tr[name=goodsRow]").length>0){
- mcxDialog.alert("상품추가 ROW는 1개 등록 가능합니다");
- return;
- }
- goodsIdx++;
- $(param).closest("table").find("tbody").append(html);
- }else{
- goodsIdx++;
- return html;
- }
- fnReloadIdx();
- }
- /**
- * 상품조회
- */
- var addRowTd;
- var fnSearchGoods = function (obj){
- addRowTd = obj;
- cfnOpenGoodsPopup('fnAddMultiContentsGoods');
- }
- var firstOrd = '';
- //var uploadGoodsUrl = _goodsUrl [[${@environment.getProperty('upload.goods.view')}]];
- var fnAddMultiContentsGoods = function(result){
- console.log('goodsRowIdx>>>>'+addRowTd);
- var html='';
- for(let i = 0 ; i < result.length ; i++) {
- if(i==0){
- firstOrd = result[i].dispOrd;
- }
- html+='<ul id="goodsUl'+i+'" class="item ui-state-default goodsClass" style="min-height:120px;" ';
- if(result[i].goodsStat!="G008_90" || result[i].currStockQty<1){
- html += 'background:#f5f5f5;';
- }
- html += '">';
- html += '<li class="img">';
- var imgPath = '';
- //if(result[i].imgType=='A'){
- imgPath = _goodsUrl;
- //}
- html += '<img src="'+imgPath+ "/" +result[i].sysImgNm+'" onerror="this.src=\'/image/no.gif\';"/>';
- html += '</li>';
- html += '<li class="cont">';
- html += '<ul>';
- html += '<li class="no" name="goodsCdLi"><span>'+result[i].goodsCd+'</span>';
- html += '<input type="hidden" name="goodsImgPath" value="'+result[i].sysImgNm+'">';
- html += '<input type="hidden" name="goodsCd" value="'+result[i].goodsCd+'">';
- html += '<input type="hidden" name="goodsNm" value="'+result[i].goodsNm+'">';
- html += '<span style="margin-left:5px;"><a href="javascript:void(0);" id="delId" onclick="fnRemoveGoods(this,'+i+');">X</a></span>';
- html += '</li>';
- html += '<li class="title">'+result[i].goodsNm+'</li>';
- /*html += '<li>';
- html += '<span>전시순서 :</span>';
- html += '<input type="text" name="dispOrdEdit" value="" />';
- html += '<input type="text" name="setDispOrd" value="'+result[i].dispOrd+'"/>';
- html += '</li>';*/
- html += '</ul>';
- html += '</li>';
- html += '</ul>';
- }
- $("#"+addRowTd).append(html);
- $("#"+addRowTd).sortable();
- /*$("#"+addRowTd).sortable({
- stop: function(event, ui) {
- if(gagajf.isNull(firstOrd)){
- firstOrd = 1;
- }else{
- firstOrd = Number(firstOrd);
- }
- $("#"+addRowTd+" .item").each(function(i){
- $(this).find("input[name=setDispOrd]").val(i+firstOrd);
- });
- }
- });*/
- $("#"+addRowTd).disableSelection();
- uifnPopupClose('popupGoods');
- fnReloadGoodsListIdx(addRowTd);
- }
- var fnReloadGoodsListIdx = function (obj){
- var tableId = obj
- $("#"+tableId +" .goodsClass").each(function (i){
- $(this).attr('id','goodsUl'+i);
- $(this).find("#delId").attr('onclick','fnRemoveGoods(this,'+i+');');
- });
- }
- var fnRemoveGoods = function (obj , idx){
- var divId = $(obj).closest('div').attr('id');
- $("#"+divId+" #goodsUl"+idx).remove();
- fnReloadGoodsListIdx(divId);
- }
- $(document).ready(function() {
- $("#multiPopTitle").text("["+contentsLoc+"] "+gagaAgGrid.lookupValue(contentsLocArr, contentsLoc));
- $("#multiPopSortable").sortable({
- stop: function(event, ui) {
- fnReloadIdx();
- }
- });
- $("#multiPopSortable").disableSelection();
- fnGetMultiContentsPreviewList();
- fnReloadIdx();
- });
- /*]]>*/
- </script>
- </html>
|