|
|
@@ -193,9 +193,9 @@
|
|
|
<option value="">[선택]</option>
|
|
|
<option th:if="${cate1NoList}" th:each="oneData, status : ${cate1NoList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
</select>
|
|
|
- <input type="text" class="off w80" name="brandCd" id="brandCd" required="required" placeholder="브랜드그룹번호" data-valid-name="브랜드그룹번호"/>
|
|
|
+ <input type="text" class="off w80" name="brandCd" id="brandCd" placeholder="브랜드그룹번호" data-valid-name="브랜드그룹번호"/>
|
|
|
<button type="button" class="off btn btn-base btn-lg" id="btnSearchBrandGroup" onclick="fnBrandGroupSearch('')">브랜드 조회</button>
|
|
|
- <input type="text" class="off w80" name="planSq" id="planSq" required="required" placeholder="기획전번호" data-valid-name="기획전번호"/>
|
|
|
+ <input type="text" class="off w80" name="planSq" id="planSq" placeholder="기획전번호" data-valid-name="기획전번호"/>
|
|
|
<button type="button" class="off btn btn-base btn-lg" id="btnSearchPlan" onclick="fnPlanSearch('')">기획전 조회</button>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -262,7 +262,7 @@
|
|
|
<td colspan="7">
|
|
|
<div id="ImageArea">
|
|
|
이미지파일 : <span class="uFile w300">
|
|
|
- <input id="imgUrl1" name="imgUrl" type="file" class="uFileInput w300" data-valid-name="이미지파일"/>
|
|
|
+ <input id="imgUrl1" name="imgUrl" type="file" class="uFileInput w300" data-valid-name="이미지파일" onchange="fnFileUpload(this);"/>
|
|
|
<label for="imgUrl1" class="uFileLabel">파일선택</label>
|
|
|
<input type="hidden" name="orgImgFileNm"/>
|
|
|
<input type="hidden" name="newImgFileNm"/>
|
|
|
@@ -365,6 +365,9 @@
|
|
|
$("#planSq"+sub).removeClass("on").addClass("off");
|
|
|
$("#btnSearchPlan"+sub).removeClass("on").addClass("off");
|
|
|
}
|
|
|
+ $("#cate1No"+sub).val('');
|
|
|
+ $("#brandCd"+sub).val('');
|
|
|
+ $("#planSq"+sub).val('');
|
|
|
};
|
|
|
|
|
|
// 검색조건 초기화
|
|
|
@@ -390,6 +393,124 @@
|
|
|
$('#detailForm input[name=planSq]').removeClass("on").addClass("off");
|
|
|
imgDivLen = 1;
|
|
|
});
|
|
|
+
|
|
|
+ // 데이터 validation 체크
|
|
|
+ function dataValidation(){
|
|
|
+ // 날짜체크
|
|
|
+ var fromDate = $('#detailForm input[name=dispStdt]').val().replace(/[^0-9]/g, '')+$('#detailForm #stTimeHour').val()+$('#detailForm #stTimeMin').val();
|
|
|
+ var toDate = $('#detailForm input[name=dispEddt]').val().replace(/[^0-9]/g, '')+$('#detailForm #edTimeHour').val()+$('#detailForm #edTimeMin').val();
|
|
|
+ if(fromDate > toDate){
|
|
|
+ mcxDialog.alert('노출 시작일자는 종료일자 보다 클 수 없습니다.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ //전시위치 체크(30,31,40)
|
|
|
+ var selectViewPage = $('#detailForm select[name=viewPage]').val();
|
|
|
+
|
|
|
+ if(selectViewPage=='G037_30'){
|
|
|
+ if(gagajf.isNull($('#detailForm select[name=cate1No]').val())){
|
|
|
+ mcxDialog.alert('카테고리를 선택해 주세요.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else if(selectViewPage=='G037_31'){
|
|
|
+ if(gagajf.isNull($('#detailForm input[name=brandCd]').val())){
|
|
|
+ mcxDialog.alert('브랜드 코드를 입력해 주세요.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }else if(selectViewPage=='G037_40'){
|
|
|
+ if(gagajf.isNull($('#detailForm input[name=planSq]').val())){
|
|
|
+ mcxDialog.alert('기획전 번호를 입력해 주세요.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var orgFileNm = $('#detailForm #imgFileNm1').html();
|
|
|
+ var imgFileNm = $('#detailForm input[name=newImgFileNm]').val();
|
|
|
+ if(gagajf.isNull(orgFileNm)){
|
|
|
+ if(gagajf.isNull(imgFileNm)){
|
|
|
+ mcxDialog.alert('이미지파일을 선택해 주세요.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 이미지 첨부
|
|
|
+ var fnFileUpload = function (obj){
|
|
|
+ var file = obj.files[0];
|
|
|
+ file.name = 'test';
|
|
|
+ if (typeof(file) == 'undefined'){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ gagajf.ajaxFileUpload('/common/file/upload?subDir=/display/popup'
|
|
|
+ , file
|
|
|
+ , function(result) {
|
|
|
+ $(obj).closest('div').find('input:hidden[name=orgImgFileNm]').val(result.oldFileName);
|
|
|
+ $(obj).closest('div').find('input:hidden[name=newImgFileNm]').val(result.newFileName);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 저장
|
|
|
+ */
|
|
|
+ $("#btnSave").on('click',function(){
|
|
|
+ console.log('저장을 눌렀다@');
|
|
|
+ // 필수값 validation 체크
|
|
|
+ if (!gagajf.validation('#detailForm')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 데이터 validation 체크
|
|
|
+ if(!dataValidation()){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 이미지 파일 체크
|
|
|
+ // 기존 이미지 명있는데 그대로 쓰면 -> orgImg
|
|
|
+ // 기존 이미지 명있는데 새로 등록 -> newImg
|
|
|
+ var imgUrl = '';
|
|
|
+ var orgFileNm = $('#detailForm #imgFileNm1').html();
|
|
|
+ var imgFileNm = $('#detailForm input[name=newImgFileNm]').val();
|
|
|
+ if(gagajf.isNull(orgFileNm)){
|
|
|
+ imgUrl = imgFileNm;
|
|
|
+ }else{
|
|
|
+ if(gagajf.isNull(imgFileNm)){
|
|
|
+ imgUrl = orgFileNm;
|
|
|
+ }else{
|
|
|
+ imgUrl = imgFileNm;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var fromDate = $('#detailForm input[name=dispStdt]').val().replace(/[^0-9]/g, '')+$('#detailForm #stTimeHour').val()+$('#detailForm #stTimeMin').val()+'00';
|
|
|
+ var toDate = $('#detailForm input[name=dispEddt]').val().replace(/[^0-9]/g, '')+$('#detailForm #edTimeHour').val()+$('#detailForm #edTimeMin').val()+'59';
|
|
|
+
|
|
|
+ var data = {
|
|
|
+ popupSq : $('#detailForm input[name=popupSq]').val()
|
|
|
+ ,siteCd : $('#detailForm select[name=siteCd]').val()
|
|
|
+ ,viewPage : $('#detailForm select[name=viewPage]').val()
|
|
|
+ ,cate1No : $('#detailForm select[name=cate1No]').val()
|
|
|
+ ,brandCd : $('#detailForm input[name=brandCd]').val()
|
|
|
+ ,planSq : $('#detailForm input[name=planSq]').val()
|
|
|
+ ,frontGb : $('#detailForm select[name=frontGb]').val()
|
|
|
+ ,unexpDays : $('#detailForm input[name=unexpDays]').val()
|
|
|
+ ,dispOrd : $('#detailForm input[name=dispOrd]').val()
|
|
|
+ ,dispStdt : fromDate
|
|
|
+ ,dispEddt : toDate
|
|
|
+ ,imgUrl1 : imgUrl
|
|
|
+ ,orgFileNm : orgFileNm
|
|
|
+ ,newImgFileNm1 : imgUrl
|
|
|
+ ,linkUrl1 : $('#detailForm input[name=linkUrl]').val()
|
|
|
+ };
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
+ gagajf.ajaxJsonSubmit($('#detailForm').prop('action'), jsonData, fnPopupSaveCollback);
|
|
|
+ });
|
|
|
+
|
|
|
+ var fnPopupSaveCollback = function (result){
|
|
|
+ $('#btnSearch').trigger('click');
|
|
|
+ }
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
// Create a agGrid
|