You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
4.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. <div class="page-header" data-fit-aside>
  2. <h1 class="page-title">팝업 관리</h1>
  3. </div>
  4. <div class="ax-button-group" data-fit-aside>
  5. <div class="left">
  6. <button type="button" onclick="grid.form()" class="btn btn-primary"><i class="fal fa-plus"></i> 신규 팝업 등록</button>
  7. </div>
  8. <div class="right">
  9. <button type="button" onclick="grid.refresh()" class="btn btn-default"><i class="fal fa-sync"></i> 새로고침</button>
  10. </div>
  11. </div>
  12. <div class="grid-wrapper" data-fit-content>
  13. <div class="grid-container" id="grid-container"></div>
  14. </div>
  15. <script>
  16. var grid = new GRID('#grid-container', {
  17. paging: {
  18. pageSize: 15
  19. },
  20. columns: [
  21. {caption:'번호', dataField:'nums', alignment:'right', dataType:'number', format:'fixedPoint', width:80},
  22. {caption:'표시상태', dataField:'pop_state', alignment:'center', width:80},
  23. {caption:'팝업 구분', dataField:'pop_type', alignment:'center', width:80, customizeText: function(cell) { return cell.value == 'N' ? '레이어' : '새창' }},
  24. {caption:'팝업 이름', dataField:'pop_title', alignment:'left', minWidth:120},
  25. {caption:'너비 (px)', dataField:'pop_width', alignment:'right', dataType:'number', format:'fixedPoint', width:80},
  26. {caption:'높이 (px)', dataField:'pop_height', alignment:'right', dataType:'number', format:'fixedPoint', width:80},
  27. {caption:'표시 시작일', dataField:'pop_start', alignment:'center', width:120},
  28. {caption:'표시 종료일', dataField:'pop_end', alignment:'center', width:120},
  29. {caption:'최종수정자', dataField:'upd_username', alignment:'center', width:120},
  30. {caption:'최종수정일', dataField:'upd_datetime', alignment:'center', width:120},
  31. ],
  32. onCellPrepared: function(e) {
  33. if(e.rowType == 'data') {
  34. if(e.column.dataField == 'pop_state') {
  35. var color = ( e.value == '표시중' )? '#3498db': '#e32815';
  36. e.cellElement.css("color", color);
  37. }
  38. }
  39. },
  40. dataSource: new DevExpress.data.DataSource({
  41. key : 'pop_idx',
  42. load: function(loadOptions) {
  43. var d = $.Deferred();
  44. var params = grid.getSearchParam(loadOptions);
  45. $.ajax({
  46. url : base_url + '/admin/ajax/management/popups',
  47. type: 'GET',
  48. async: false,
  49. cache: false,
  50. data: params
  51. }).done(function(res) {
  52. d.resolve(res.lists, {
  53. totalCount : res.totalCount
  54. });
  55. });
  56. return d.promise();
  57. }
  58. }),
  59. onRowDblClick: function(e) {
  60. grid.form(e.data.pop_idx);
  61. },
  62. onContextMenuPreparing: function(e) {
  63. if (e.row.rowType === "data") {
  64. e.items = [
  65. {
  66. icon: 'edit',
  67. text: '수정',
  68. onItemClick: function () {
  69. grid.form(e.row.data.pop_idx);
  70. }
  71. },
  72. {
  73. icon : 'trash',
  74. text: "삭제",
  75. onItemClick: function () {
  76. grid.delete(e.row.data);
  77. }
  78. }
  79. ]
  80. }
  81. },
  82. });
  83. grid.form = function(pop_idx) {
  84. pop_idx = typeof pop_idx != 'undefined' && pop_idx ? pop_idx : '';
  85. APP.MODAL.callback = function() {
  86. grid.refresh();
  87. APP.MODAL.close();
  88. };
  89. APP.MODAL.open({
  90. iframe: {
  91. url: base_url + '/admin/management/popup_form/' + pop_idx,
  92. },
  93. width:800,
  94. height:600,
  95. header: {
  96. title:'팝업 정보 입력'
  97. }
  98. });
  99. };
  100. grid.delete = function(data) {
  101. if(! confirm('선택하신 팝업 정보 [' + data.pop_title + ']를 삭제하시겠습니까?')) return false;
  102. $.ajax({
  103. url: base_url + '/admin/ajax/management/popups',
  104. type: 'DELETE',
  105. data: {
  106. pop_idx : data.pop_idx
  107. },
  108. success:function() {
  109. toastr.success('팝업삭제가 완료되었습니다.');
  110. grid.refresh();
  111. }
  112. })
  113. };
  114. $(function() {
  115. grid.init();
  116. });
  117. </script>