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.

205 lines
8.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <div class="page-header">
  2. <h1 class="page-title">FAQ 관리</h1>
  3. </div>
  4. <div class="row">
  5. <div class="col-sm-5">
  6. <div class="ax-button-group">
  7. <div class="left">
  8. <h4>FAQ 분류</h4>
  9. </div>
  10. <div class="right">
  11. <button type="button" class="btn btn-default" onclick="faq.category.form();"><i class="fal fa-plus-circle"></i> 분류 추가</button>
  12. </div>
  13. </div>
  14. <div class="grid">
  15. <table>
  16. <thead>
  17. <tr>
  18. <th class="W20"></th>
  19. <th>분류이름</th>
  20. <th class="W50">등록</th>
  21. <th class="W80">관리</th>
  22. </tr>
  23. </thead>
  24. <tbody data-toggle="sortable" data-key="fac_idx" data-sort="sort" data-table="faq_category">
  25. <?php foreach($faq_category['list'] as $row) :?>
  26. <tr class="<?=isset($fac_idx)&&$fac_idx==$row['fac_idx']?'active':''?>">
  27. <td class="text-center"><span class="move-grip"></span><input type="hidden" name="fac_idx[]" value="<?=$row['fac_idx']?>"></td>
  28. <td class=""><i class="fal <?=isset($fac_idx)&&$fac_idx==$row['fac_idx']?'fa-folder-open':'fa-folder'?>"></i>&nbsp;<a href="<?=base_url('admin/management/faq/'.$row['fac_idx'])?>"><?=$row['fac_title']?></a></td>
  29. <td class="text-right W50"><?=number_format($row['fac_count'])?></td>
  30. <td class="text-center">
  31. <button type="button" class="btn btn-default btn-sm MR5" onclick="faq.category.form('<?=$row['fac_idx']?>');"><i class="fal fa-pencil"></i></button>
  32. <button type="button" class="btn btn-danger btn-sm" onclick="faq.category.remove('<?=$row['fac_idx']?>');"><i class="fal fa-trash"></i></button>
  33. </td>
  34. </tr>
  35. <?php endforeach;?>
  36. <?php if(count($faq_category['list']) == 0) :?>
  37. <tr>
  38. <td colspan="4" class="empty">등록된 FAQ 분류가 없습니다.</td>
  39. </tr>
  40. <?php endif;?>
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. <div class="col-sm-7">
  46. <?php if($fac_idx) :?>
  47. <div class="ax-button-group">
  48. <div class="left">
  49. <h4>[<?=$faq_group['fac_title']?>] 내용 관리</h4>
  50. </div>
  51. <div class="right">
  52. <button type="button" class="btn btn-default" onclick="faq.form('<?=$fac_idx?>');"><i class="fal fa-plus-circle"></i> FAQ 추가</button>
  53. </div>
  54. </div>
  55. <div class="grid">
  56. <table>
  57. <thead>
  58. <tr>
  59. <th class="W20"></th>
  60. <th>FAQ 제목</th>
  61. <th class="W80">수정자</th>
  62. <th class="W130">수정일시</th>
  63. <th class="W80">관리</th>
  64. </tr>
  65. </thead>
  66. <tbody data-toggle="sortable" data-key="faq_idx" data-sort="sort" data-table="faq">
  67. <?php foreach($faq_list['list'] as $row) :?>
  68. <tr>
  69. <td class="text-center"><span class="move-grip"></span><input type="hidden" name="faq_idx[]" value="<?=$row['faq_idx']?>"></td>
  70. <td><?=$row['faq_title']?></td>
  71. <td class="text-center"><?=$row['upd_username']?></td>
  72. <td><?=$row['upd_datetime']?></td>
  73. <td class="text-center">
  74. <button type="button" class="btn btn-default btn-xs MR5" onclick="faq.form('<?=$row['fac_idx']?>','<?=$row['faq_idx']?>');"><i class="fal fa-pencil"></i></button>
  75. <button type="button" class="btn btn-danger btn-xs" onclick="faq.remove('<?=$row['faq_idx']?>');"><i class="fal fa-trash"></i></button>
  76. </td>
  77. </tr>
  78. <?php endforeach;?>
  79. <?php if(count($faq_list['list']) == 0) :?>
  80. <tr>
  81. <td colspan="5" class="empty">등록된 FAQ가 없습니다.</td>
  82. </tr>
  83. <?php endif;?>
  84. </tbody>
  85. </table>
  86. </div>
  87. <?php endif;?>
  88. </div>
  89. </div>
  90. <script>
  91. var faq = {};
  92. faq.form = function(fac_idx, faq_idx) {
  93. var faq_idx = (typeof faq_idx == 'string' || typeof faq_idx == 'number' ) ? faq_idx : null;
  94. var fac_idx = (typeof fac_idx == 'string' || typeof fac_idx == 'number' ) ? fac_idx : null;
  95. if(! fac_idx) {
  96. alert('FAQ 분류 정보가 없습니다.');
  97. return false;
  98. }
  99. APP.MODAL.open({
  100. width: 800,
  101. height :650,
  102. header : {
  103. title : faq_idx ? 'FAQ 정보 수정' : 'FAQ 추가'
  104. },
  105. callback : function(){
  106. location.reload();
  107. },
  108. iframe : {
  109. method : 'get',
  110. url : base_url + '/admin/management/faq_form',
  111. param : {
  112. fac_idx : fac_idx,
  113. faq_idx : faq_idx
  114. }
  115. }
  116. });
  117. };
  118. faq.remove = function(faq_idx) {
  119. if(typeof faq_idx == 'undefined' || ! faq_idx || faq_idx.trim() == '') {
  120. alert('잘못된 접근입니다.');
  121. }
  122. if(! confirm('해당 FAQ를 삭제하시겠습니까?')) return false;
  123. $.ajax({
  124. url : base_url + '/admin/ajax/management/faq',
  125. type : 'DELETE',
  126. async:false,
  127. cache:false,
  128. data:{faq_idx:faq_idx},
  129. success:function(res){
  130. alert('FAQ가 삭제되었습니다.');
  131. location.reload();
  132. }
  133. });
  134. };
  135. /**
  136. * FAQ 분류
  137. * @type {{}}
  138. */
  139. faq.category = {};
  140. faq.category.form = function(fac_idx)
  141. {
  142. var fac_idx = (typeof fac_idx == 'string' || typeof fac_idx == 'number' ) ? fac_idx : null;
  143. APP.MODAL.open({
  144. width: $(window).width() > 600 ? 600 : $(window).width(),
  145. height :250,
  146. header : {
  147. title : fac_idx ? 'FAQ 분류 정보 수정' : 'FAQ 분류 추가'
  148. },
  149. callback : function(){
  150. location.reload();
  151. },
  152. iframe : {
  153. method : 'get',
  154. url : base_url + '/admin/management/faq_category_form',
  155. param : {
  156. fac_idx : fac_idx
  157. }
  158. }
  159. });
  160. };
  161. faq.category.remove = function(fac_idx) {
  162. if(typeof fac_idx == 'undefined' || ! fac_idx || fac_idx.trim() == '') {
  163. alert('잘못된 접근입니다.');
  164. }
  165. var count = 0;
  166. $.ajax({
  167. url : base_url + '/admin/ajax/management/faq',
  168. type : 'get',
  169. async:false,
  170. cache: false,
  171. data : {fac_idx:fac_idx},
  172. success:function(res){
  173. count = res.total_count;
  174. }
  175. });
  176. var msg = ( count > 0 ) ? '해당 FAQ 분류에 ' + count + '개의 FAQ 목록이 등록되어 있습니다.\nFAQ 분류을 삭제할시 등록된 FAQ 목록도 같이 삭제됩니다.\n\n계속 하시겠습니까?' : 'FAQ 분류을 삭제하시겠습니까?';
  177. if(! confirm(msg)) return false;
  178. $.ajax({
  179. url : base_url+ '/admin/ajax/management/faq_category',
  180. type : 'delete',
  181. async:false,
  182. cache:false,
  183. data:{fac_idx:fac_idx},
  184. success:function(res){
  185. alert('FAQ 분류가 삭제되었습니다.');
  186. location.href= base_url + "/admin/management/faq";
  187. }
  188. });
  189. };
  190. </script>