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.

178 lines
6.7 KiB

  1. <div class="page-header" data-fit-aside>
  2. <h1 class="page-title">Q&amp;A 관리</h1>
  3. </div>
  4. <form data-grid-search onsubmit="grid.refresh(1);return false;" data-fit-aside autocomplete="off">
  5. <div data-ax-tbl>
  6. <div data-ax-tr>
  7. <div data-ax-td>
  8. <div data-ax-td-label>작성 기간 검색</div>
  9. <div data-ax-td-wrap>
  10. <input class="form-control" data-chained-datepicker="[name='enddate']" name="startdate" data-toggle="datepicker" value="">
  11. </div>
  12. <div data-ax-td-wrap>
  13. <input class="form-control" name="enddate" data-toggle="datepicker" value="">
  14. </div>
  15. </div>
  16. <div data-ax-td>
  17. <div data-ax-td-label>답변여부</div>
  18. <div data-ax-td-wrap>
  19. <select class="form-control" name="qna_ans_status">
  20. <option value="">전체보기</option>
  21. <option value="N">미답변</option>
  22. <option value="Y">답변완료</option>
  23. </select>
  24. </div>
  25. </div>
  26. <div data-ax-td>
  27. <div data-ax-td-label>검색어 입력</div>
  28. <div data-ax-td-wrap>
  29. <select class="form-control form-control-inline" name="sc">
  30. <option value="qna_title">질문 제목</option>
  31. <option value="qna_name">작성자</option>
  32. <option value="qna_phone">연락처</option>
  33. <option value="qna_email">이메일</option>
  34. </select>
  35. </div>
  36. </div>
  37. <div data-ax-td>
  38. <div data-ax-td-wrap>
  39. <input class="form-control" name="st" value="">
  40. </div>
  41. <div data-ax-td-wrap>
  42. <button class="btn btn-default btn-sm"><i class="fal fa-search"></i> 필터적용</button>
  43. </div>
  44. </div>
  45. <div data-ax-td class="right">
  46. <div data-ax-td-wrap>
  47. <button type="button" class="btn btn-default btn-sm" data-button="qna-category"><i class="fal fa-sitemap"></i> Q&amp;A 유형 관리</button>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </form>
  53. <div class="H10" data-fit-aside></div>
  54. <div class="grid-wrapper" data-fit-content>
  55. <div class="grid-container" id="grid-container"></div>
  56. </div>
  57. <script>
  58. var grid = new GRID('#grid-container', {
  59. paging: {
  60. pageSize: 20
  61. },
  62. columns: [
  63. {caption:'번호', dataField:'nums', alignment:'right', width:60, dataType:'number', format:'fixedPoint'},
  64. {caption:'질문일시', dataField:'reg_datetime', alignment:'center', width:120},
  65. {caption:'Q&A유형', dataField:'qnc_title', alignment:'center', width:120},
  66. {caption:'질문제목', dataField:'qna_title', alignment:'left'},
  67. {caption:'질문자', dataField:'qna_name', alignment:'center', width:80},
  68. {caption:'구분', dataField:'reg_user', alignment:'center', width:80, customizeText:function(cell) {return cell.value > 0 ?'회원':'비회원'}},
  69. {caption:'연락처', dataField:'qna_phone', alignment:'center', width:120},
  70. {caption:'E-mail', dataField:'qna_email', alignment:'left', width:180},
  71. {caption:'답변여부', dataField:'qna_ans_status', alignment:'center', width:60, customizeText:function(cell) {return cell.value == 'Y' ?'답변완료':''}},
  72. {caption:'답변자', dataField:'qna_ans_upd_username', alignment:'center', width:80},
  73. {caption:'답변일시', dataField:'qna_ans_upd_datetime', alignment:'center', width:120, customizeText:function(cell) {return cell.value != '0000-00-00 00:00:00' ?cell.value:''}}
  74. ],
  75. dataSource: new DevExpress.data.DataSource({
  76. key : 'qna_idx',
  77. load: function(loadOptions) {
  78. var d = $.Deferred();
  79. var params = grid.getSearchParam(loadOptions);
  80. $.ajax({
  81. url : base_url + '/admin/ajax/management/qna',
  82. type: 'GET',
  83. async: false,
  84. cache: false,
  85. data: params
  86. }).done(function(res) {
  87. d.resolve(res.lists, {
  88. totalCount : res.totalCount
  89. });
  90. });
  91. return d.promise();
  92. }
  93. }),
  94. onContextMenuPreparing: function(e) {
  95. if (e.row.rowType === "data") {
  96. e.items = [
  97. {
  98. icon : 'search',
  99. text: '내용보기',
  100. onItemClick: function () {
  101. grid.form(e.row.data.qna_idx);
  102. }
  103. },
  104. {
  105. icon : 'trash',
  106. text: "삭제",
  107. onItemClick: function () {
  108. grid.delete(e.row.data);
  109. }
  110. }
  111. ]
  112. }
  113. },
  114. onRowDblClick: function(e) {
  115. grid.form(e.data.qna_idx);
  116. },
  117. });
  118. grid.form = function(qna_idx) {
  119. APP.MODAL.callback = function() {
  120. grid.refresh();
  121. APP.MODAL.close();
  122. }
  123. APP.MODAL.open({
  124. iframe: {
  125. url: base_url + '/admin/management/qna_view/' + qna_idx
  126. },
  127. width:800,
  128. height:600,
  129. header: {
  130. title: 'Q&A 내용보기'
  131. }
  132. })
  133. };
  134. grid.delete = function(data) {
  135. if(! confirm('선택하신 데이타를 삭제하시겠습니까?\n제목: '+data.qna_title + '\n작성자: ' + data.qna_name)) return false;
  136. $.ajax({
  137. url: base_url + '/admin/ajax/management/qna',
  138. type: 'DELETE',
  139. data: {
  140. qna_idx: data.qna_idx
  141. },
  142. success:function() {
  143. toastr.success('삭제되었습니다.');
  144. grid.refresh();
  145. }
  146. })
  147. }
  148. $(function() {
  149. grid.init();
  150. $('[data-button="qna-category"]').click(function() {
  151. APP.MODAL.open({
  152. iframe: {
  153. url: base_url + '/admin/management/qna_category'
  154. },
  155. width: 800,
  156. height: 600,
  157. header: {
  158. title: 'Q&A 유형 관리'
  159. }
  160. })
  161. });
  162. })
  163. </script>