| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- <!DOCTYPE html>
- <html lang="ko"
- xmlns:th="http://www.thymeleaf.org">
- <!--
- *******************************************************************************
- * @source : GoodsPriceReserveForm.html
- * @desc : 상품 가격 예약관리
- *============================================================================
- * STYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER DATE AUTHOR DESCRIPTION
- * === =========== ========== =============================================
- * 1.0 2020.11.13 eskim 최초 작성
- *******************************************************************************
- -->
- <div id="main">
- <!-- 메인타이틀 영역 -->
- <div class="main-title">
- </div>
- <!-- //메인타이틀 영역 -->
- <!-- 메뉴 설명 -->
- <div class="infoBox menu-desc">
- </div>
- <form id="goodsPriceResForm" name="goodsPriceResForm" action="#" th:action="@{'/goods/price/reserve/list'}">
- <input type="hidden" id="selfGoodsYn" name="selfGoodsYn" value="Y"/>
- <input type="hidden" id="searchGb" name="searchGb" />
- <input type="hidden" id="arrGoodsCd" name="arrGoodsCd" />
- <!-- 패널 영역1 -->
- <div class="panelStyle" >
- <!-- TITLE -->
- <div class="panelTitle">
- <h3><i class="fa fa-info-circle"></i>아래 검색조건 중 하나를 꼭 입력해 주세요.</h3>
- </div>
- <!-- //TITLE -->
- <div class="panelContent">
- <table class="frmStyle">
- <colgroup>
- <col width="10%"/>
- <col width="23%"/>
- <col width="10%"/>
- <col width="23%"/>
- <col width="10%"/>
- <col/>
- </colgroup>
- <tr>
- <th>업체/브랜드</th>
- <td colspan="3">
- <select name="supplyCompCd" id="supplyCompCd">
- <option value="" th:if="${sessionInfo.roleCd} != 'G001_B000'">[전체]</option>
- <option th:if="${supplyCompList}" th:each="oneData, status : ${supplyCompList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- <span id="multiBrand"></span>
- </td>
- <th rowspan="3">키워드</th>
- <td rowspan="3">
- <select name="search" id="search">
- <option value="searchGoodsCd">상품코드</option>
- <option value="searchGoodsNum">품번</option>
- <option value="searchSupplyGoodsCd">업체상품코드</option>
- </select>
- <textarea class="textareaR3 w50p" name="condition" id="condition"></textarea>
- </td>
- </tr>
- <tr>
- <th>상품명</th>
- <td>
- <input type="text" class="w200" name="goodsNm" id="goodsNm" maxlength="50"/>
- </td>
- <th>예약가격</th>
- <td>
- <input type="text" class="w100 aR" name="goodsPriceResSt" id="goodsPriceResSt" maxlength="10" data-valid-type="numeric"/>원 ~ <input type="text" class="w100 aR" name="goodsPriceResEd" id="goodsPriceResEd" maxlength="10" data-valid-type="numeric"/>원
- </td>
- </tr>
- <tr>
- <th>시즌/년도</th>
- <td colspan="3">
- <select name="styleYear" id="styleYear">
- <option value="">[전체]</option>
- <option th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- <select name="seasonCd" id="seasonCd">
- <option value="">[전체]</option>
- <option th:if="${seasonList}" th:each="oneData, status : ${seasonList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
- </select>
- </td>
- </tr>
- <tr>
- <th>예약일</th>
- <td colspan="5" id="sellTerms"></td>
- </tr>
- </table>
- <ul class="panelBar">
- <li class="center">
- <button type="button" class="btn btn-gray btn-lg" id="btnInit" >초기화</button>
- <button type="button" class="btn btn-info btn-lg" id="btnSearch" >조회</button>
- </li>
- </ul>
- </div>
- <!-- //검색조건 영역 -->
- </div>
- <!-- 패널 영역1 -->
- <div class="panelStyle">
- <!-- 검색결과 영역 -->
- <!-- 상단버튼 영역 -->
- <ul class="panelBar">
- <li>
- <select id="excelSample" name="excelSample">
- <option value="">[선택]</option>
- <option value="SF003">상품엑셀조회양식</option>
- <option value="SF018" th:if="${sessionInfo.roleCd == 'G001_0000' OR sessionInfo.roleCd == 'G001_A000' OR sessionInfo.roleCd == 'G001_A101' OR sessionInfo.roleCd == 'G001_A100' OR sessionInfo.roleCd == 'G001_A001'}">상품가격예약등록양식</option>
- </select>
- <button type="button" class="btn btn-default btn-lg" id="btnExcelSampleDownLoad">다운로드</button>
- <button type="button" class="btn btn-base btn-lg" id="btnGoodsExcelUpLoad">엑셀조회</button>
- <button type="button" class="btn btn-success btn-lg" id="btnGoodsExcelSave" th:if="${sessionInfo.roleCd == 'G001_0000' OR sessionInfo.roleCd == 'G001_A000' OR sessionInfo.roleCd == 'G001_A101' OR sessionInfo.roleCd == 'G001_A100' OR sessionInfo.roleCd == 'G001_A001'}">상품가격예약등록</button>
- <button type="button" class="btn btn-success btn-lg" id="btnGoodsPriceResSave">예약등록</button>
- <button type="button" class="btn btn-danger btn-lg" id="btnGoodsPriceResDelete">예약삭제</button>
- </li>
- <li class="right">
- 검색결과 : <strong><span id="gridRowTotalCount">0</span> 건</strong>
-
- 쪽번호 <span id="pgNo">0</span>/ <strong id="endPgNo">0</strong>
- <select id="pageSize" name="pageSize">
- <option value="50" selected="selected">50개씩 보기</option>
- <option value="100">100개씩 보기</option>
- <option value="500">500개씩 보기</option>
- <option value="1000">1000개씩 보기</option>
- </select>
- <input type="hidden" name="pageNo" id="pageNo" value ="1"/>
- </li>
- </ul>
- <!-- //상단버튼 영역 -->
- <div id="gridList" style="width: 100%; height: 550px;" class="ag-theme-balham"></div>
- <ul class="panelBar">
- <li class="center">
- <div class="tablePaging" id="goodsListPagination"></div>
- </li>
- </ul>
- <!-- 검색결과 영역 -->
- </div>
- </form>
- <!-- //패널 영역2 -->
- </div>
- <script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js?v=2019072202"></script>
- <script th:inline="javascript">
- /*<![CDATA[*/
- var sessRoleCd = [[${sessionInfo.roleCd}]];
- var goodsStatList = gagajf.convertToArray([[${goodsStatList}]]);
- var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
- var columnDefs = [
- {width: 40, minWidth: 40, cellClass: 'text-right', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
- {headerName: 'No', width: 60, cellClass: 'text-center',
- valueGetter: function(params) { return cfnGridNumner('goodsPriceResForm',params.node.rowIndex, 'A');}
- },
- {headerName: "브랜드명", field: "brandEnm", width: 110, cellClass: 'text-center'},
- {headerName: "상품코드", field: "goodsCd", width: 110, cellClass: 'text-center'},
- {headerName: "상품명", field: "goodsNm", width: 200, cellClass: 'text-left'
- ,cellRenderer: function(params) {
- return '<a href="javascript:void(0);">' + params.value + '</a>';
- }
- },
- {headerName: "상품상태", field: "goodsStat" , width: 100, cellClass: 'text-center',
- cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
- valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
- valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
- },
- {headerName: "현재상품가격", field: "currPrice", width: 110, cellClass: 'text-right'
- ,valueFormatter: function(params) {return params.value.addComma();}
- },
- {headerName: "예약상품가격", field: "resGoodsPrice", width: 110, cellClass: 'text-right'
- ,valueFormatter: function(params) {return params.value.addComma();}
- ,cellStyle : function(params){return { 'color': 'red'}}
- },
- {headerName: "예약시작일시", field: "applyStdt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
- }
- },
- {headerName: "예약종료일시", field: "applyEddt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
- }
- },
- {headerName: "등록일시", field: "regDt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
- }
- },
- {headerName: "등록자", field: "regNm", width: 100, cellClass: 'text-center'},
- {headerName: "수정일시", field: "updDt", width: 150, cellClass: 'text-center',
- cellRenderer: function(params) {
- return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") : '';
- }
- },
- {headerName: "수정자", field: "updNm", width: 100, cellClass: 'text-center'},
- {headerName: "상품가겨예약순번", field: "goodsPriceResSq", hide: true},
- {headerName: "적용여부", field: "applyYn", hide: true}
- ];
-
- // Get GridOptions
- var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
- // 중복 선택 가능
- gridOptions.rowSelection = 'multiple';
- gridOptions.suppressRowClickSelection = true;
- //gridOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
- // Row Click
- gridOptions.onCellClicked = function(event) {
- var goodsCd = event.data.goodsCd;
- if (event.colDef.field == "goodsNm"){
- cfnOpenGoodsDetailPopup('U',goodsCd);
- }else if (event.colDef.field == "goodsCd"){
-
- }
- }
- // 초기화 클릭시
- $('#btnInit').on('click', function() {
- fnInit();
- });
-
- var fnInit = function(){
- $("#goodsPriceResForm input[name=siteCd]").prop("disabled", true);
- $("#goodsPriceResForm input[name=siteCd]").addClass("formControl");
-
- $('#goodsPriceResForm')[0].reset();
- //$("#goodsPriceResForm input[type=radio]").removeClass("checked");
- $("#goodsPriceResForm input[type=checkbox]").removeClass("checked");
- //$("#goodsPriceResForm input[type=radio]").parent("label").removeClass("checked");
- $("#goodsPriceResForm input[type=checkbox]").parent("label").removeClass("checked");
- $("#goodsPriceResForm input[type=radio][checked]").parent("label").addClass("checked");
- $("#multiBrand").empty();
- }
-
- // 조회클릭시
- $('#btnSearch').on('click', function() {
- $("#goodsPriceResForm input[name=pageNo]").val('1');
- fnGoodsPriceSearch('BASIC');
- });
- // 조회
- var fnGoodsPriceSearch = function(gbn) {
-
- if (typeof(gbn) != 'undefined' && gbn == 'EXCEL'){
- $("#goodsPriceResForm input[name=searchGb]").val("EXCEL");
- }else if (typeof(gbn) != 'undefined' && gbn == 'EXCELRESULT'){
- $("#goodsPriceResForm input[name=searchGb]").val("EXCELRESULT");
- }else{
- $("#goodsPriceResForm input[name=searchGb]").val("BASIC");
- }
-
-
- if(!fnConditionCheck()) return;
-
- gagaPaging.init('goodsPriceResForm', fnSearchCallBack, 'goodsListPagination', $('#goodsPriceResForm').find('#pageSize').val());
- gagaPaging.load($("#goodsPriceResForm input[name=pageNo]").val());
- }
- // 조회 (등록 창 닫을 때)
- var fnGoodsRsvtTnmListSearch = function(gbn) {
- if (typeof(gbn) != 'undefined' && gbn == 'EXCEL'){
- $("#goodsPriceResForm input[name=searchGb]").val("EXCEL");
- }else{
- $("#goodsPriceResForm input[name=searchGb]").val("BASIC");
- }
- gagaPaging.init('goodsPriceResForm', fnSearchCallBack, 'goodsListPagination', $('#goodsPriceResForm').find('#pageSize').val());
- gagaPaging.load($("#goodsPriceResForm input[name=pageNo]").val());
- }
- //검색 조건 확인
- var fnConditionCheck = function(){
- var formId = '#goodsPriceResForm';
- var form = document.goodsPriceResForm;
- if($("#goodsPriceResForm input[name=searchGb]").val() == "EXCEL" || $("#goodsPriceResForm input[name=searchGb]").val() == "EXCELRESULT") {
- return true;
- }
-
- var searchFlag = false;
- var cnt = 0;
- /* if( !gagajf.isNull($("#goodsPriceResForm select[name=supplyCompCd]").val())
- || !gagajf.isNull($("#goodsPriceResForm input[name=condition]").val())
- || (!gagajf.isNull($("#goodsPriceResForm input[name=stDate]").val()) && !gagajf.isNull($("#goodsPriceResForm input[name=edDate]").val()))
- ){
- searchFlag = true;
- }else{ */
- for (i = 0; i < form.elements.length; i++ ) {
- var el = form.elements[i];
- if ($(el).prop("type") == "text" || $(el).prop("type") == "textarea" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize")) {
- if (!(el.value == null || el.value == "")) {
- cnt++;
- }
- }
- }
-
- if(cnt > 0) searchFlag = true;
-
- /* } */
-
- if(searchFlag == false){
- mcxDialog.alert("검색조건을 입력하세요.");
- return false;
- }
-
- var fromDate = $('#goodsPriceResForm input[name=stDate]').val();
- var toDate = $('#goodsPriceResForm input[name=edDate]').val();
-
- if (!gagajf.isNull(fromDate) || !gagajf.isNull(toDate)) {
-
- if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
- mcxDialog.alertC("등록일 조회시 시작일자와 종료일자를 입력하세요.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#goodsPriceResForm input[name=stDate]').focus();
- }
- });
- return false;
- }
- if (fromDate > toDate) {
- mcxDialog.alert("노출기간 시작일자는 종료일자 보다 클 수 없습니다.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#goodsPriceResForm input[name=stDate]').focus();
- }
- });
- return false;
- }
- }
- return true;
- }
-
- var fnSearchCallBack = function(result){
- $('#goodsPriceResForm').find('#gridRowTotalCount').html(result.pageing.pageable.totalCount.addComma());
- $('#goodsPriceResForm').find('#pageNo').val(result.pageing.pageable.pageNo.addComma());
- $('#goodsPriceResForm').find('#pgNo').html(result.pageing.pageable.pageNo.addComma());
- $('#goodsPriceResForm').find('#endPgNo').html(result.pageing.pageable.totalPage.addComma());
- gridOptions.api.setRowData(result.goodsPriceResList);
- gagaPaging.createPagination(result.pageing.pageable);
- }
-
- //페이징
- $('#goodsPriceResForm select[name=pageSize]').on('change', function() {
- $("#goodsPriceResForm input[name=pageNo]").val('1');
- fnGoodsPriceSearch($("#goodsPriceResForm input[name=searchGb]").val());
- });
-
- //업체변경시
- $('#goodsPriceResForm select[name=supplyCompCd]').on('change', function() {
- var actionUrl = '/renderer/supplyCompany/brand/list/' + $(this).val();
- if(sessRoleCd == "G001_B000"){
- actionUrl = '/renderer/brand/AuthBrandlist';
- }
- cfnCreateMultiCombo(actionUrl,"multiBrand", "[전체]",null, 'Y');
- });
-
- //엑셀 상품 조회
- $('#btnGoodsExcelUpLoad').on('click', function() {
- cfnExcelUploadPopup('goodsPriceExcelUpload', 'goodsPriceExcelUpload');
- });
-
- var goodsPriceExcelUpload = function(result){
- var data = {procJob : result.procJob
- ,excelFileNm : result.excelFileNm
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/goods/search/excelupload/save', jsonData, fnGoodsPriceExcelUploadCallBack);
- }
-
- var fnGoodsPriceExcelUploadCallBack = function(result){
- fnGoodsPriceSearch("EXCEL");
- }
-
- //예약등록 팝업
- $('#btnGoodsPriceResSave').click(function(e) {
- var actionUrl = "/goods/price/reserve/popup/form";
- cfnOpenModalPopup(actionUrl, 'popupGoodsPriceReserve');
- });
-
- //예약삭제
- $('#btnGoodsPriceResDelete').click(function(e) {
- //상품선택여부 확인처리 추가
- var selectedData = gridOptions.api.getSelectedRows();
- if (selectedData.length == 0) {
- mcxDialog.alert('선택된 행이 없습니다.');
- return false;
- }
-
- var arrGoodsCd = [];
- var arrGoodsPriceResSq = [];
- var chkFlag = false;
- //selectedData = gagaAgGrid.getAllRowData(gridOptions);
- $.each(selectedData, function(idx, item) {
-
- if (gagajf.isNull(item.goodsPriceResSq) || item.goodsPriceResSq == "0"){
- chkFlag = true;
- mcxDialog.alert(item.goodsCd +"상품은 가격이 예약된 상품이 아닙니다.");
- return false;
- }
-
- var toDateStr = new Date().format("YYYYMMDDHHmmss");
- if (toDateStr > item.applyEddt){
- chkFlag = true;
- mcxDialog.alertC("종료된 예약 상품은 삭제할 수 없습니다.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#goodsRsvtTnmForm input[name=applyEdYMD]').focus();
- }
- });
- return false;
- }
-
- if ((toDateStr > item.applyStdt) && ("Y" == $('#goodsRsvtTnmForm input[name=applyYn]').val())){
- chkFlag = true;
- mcxDialog.alertC("시작된 예약 상품은 삭제할 수 없습니다.", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#goodsRsvtTnmForm input[name=applyEdYMD]').focus();
- }
- });
- return false;
- }
-
- arrGoodsCd.push(item.goodsCd);
- arrGoodsPriceResSq.push(item.goodsPriceResSq);
- });
- if (chkFlag){
- return;
- }
-
- mcxDialog.confirm('삭제하시겠습니까?', {
- cancelBtnText: "취소",
- sureBtnText: "확인",
- sureBtnClick: function(){
- var data = {arrGoodsCd : arrGoodsCd
- ,arrGoodsPriceResSq : arrGoodsPriceResSq
- };
-
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/goods/price/reserve/delete', jsonData, fnGoodsPriceResDeleteCollBack);
- }
- });
- });
-
- var fnGoodsPriceResDeleteCollBack = function(){
- //fnGoodsRsvtTnmListSearch($("#goodsPriceResForm input[name=searchGb]").val());
- }
-
- //엑셀양식 다운로드
- $('#btnExcelSampleDownLoad').on('click', function (){
- var gb = $("#goodsPriceResForm select[name=excelSample]").val();
- if (gagajf.isNull(gb)){
- mcxDialog.alertC("다운로드 할 양식을 선택해주세요", {
- sureBtnText: "확인",
- sureBtnClick: function() {
- $('#goodsPriceResForm select[name=excelSample]').focus();
- }
- });
- return false;
- }
-
- cfnDownloadSampleFile($("#goodsPriceResForm select[name=excelSample]").val());
-
- });
-
- //엑셀 상품 가격예약 저장
- $('#btnGoodsExcelSave').on('click', function() {
- cfnExcelUploadPopup('goodsPriceResvExcelUpload', 'goodsPriceResvExcelSave');
- });
-
- var goodsPriceResvExcelSave = function(result){
- mcxDialog.confirm('상품가격예약을 진행하시겠습니까?', {
- cancelBtnText: "취소",
- sureBtnText: "확인",
- sureBtnClick: function(){
- var data = {procJob : result.procJob
- ,excelFileNm : result.excelFileNm
- };
- var jsonData = JSON.stringify(data);
- gagajf.ajaxJsonSubmit('/goods/price/excelupload/save', jsonData, fnGoodsSizeStockExcelSaveCallBack);
- }
- });
- }
-
- var fnGoodsSizeStockExcelSaveCallBack = function(result){
- fnGoodsPriceSearch("EXCELRESULT");
- }
-
- $(document).ready(function() {
- cfnCreateCalendar('#sellTerms', 'applyStdt', 'applyEddt', true, '예약일', 'X');
- var chkBeforSkipFlag = ' <label class="chkBox"><input type="checkbox" name="beforSkipFlag" value="Y" >이전데이터 제외</label>';
- $("#goodsPriceResForm").find('#sellTerms').append(chkBeforSkipFlag);
-
- // Create a agGrid
- gagaAgGrid.createGrid('gridList', gridOptions);
- });
- /*]]>*/
- </script>
-
- </html>
|