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.

186 lines
7.6 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
  1. <div class="row">
  2. <div class="col-sm-4">
  3. <div class="ax-button-group">
  4. <div class="left">
  5. <h4>배너 분류</h4>
  6. </div>
  7. <div class="right">
  8. <button type="button" class="btn btn-default" data-button="btn-banner-group-form" data-idx=""><i class="fal fa-plus-circle"></i> 배너그룹 추가</button>
  9. </div>
  10. </div>
  11. <div class="grid">
  12. <table>
  13. <thead>
  14. <tr>
  15. <th class="W20"></th>
  16. <th>분류이름</th>
  17. <th class="W140">관리</th>
  18. </tr>
  19. </thead>
  20. <tbody data-toggle="sortable" data-key="bng_idx" data-sort="bng_sort" data-table="banner_group">
  21. <?php foreach($banner_group_list['list'] as $row) :?>
  22. <tr class="<?=isset($bng_key)&&$bng_key==$row['bng_key']?'active':''?>">
  23. <td class="text-center">
  24. <span class="move-grip"></span>
  25. <input type="hidden" name="bng_idx[]" value="<?=$row['bng_idx']?>">
  26. </td>
  27. <td><i class="far <?=isset($bng_key)&&$bng_key==$row['bng_key']?'fa-folder-open':'fa-folder'?>"></i>&nbsp;<a href="<?=base_url('admin/management/banner/'.$row['bng_key'])?>"><?=$row['bng_name']?></a></td>
  28. <td class="text-center">
  29. <button type="button" class="btn btn-default btn-xs MR5" data-button="btn-banner-group-form" data-idx="<?=$row['bng_idx']?>"><i class="far fa-pencil"></i> 수정</button>
  30. <button type="button" class="btn btn-danger btn-xs" data-button="btn-banner-group-delete" data-idx="<?=$row['bng_idx']?>"><i class="far fa-trash"></i> 삭제</button>
  31. </td>
  32. </tr>
  33. <?php endforeach;?>
  34. <?php if(count($banner_group_list['list']) == 0) :?>
  35. <tr>
  36. <td colspan="4" class="empty">등록된 배너 그룹이 없습니다.</td>
  37. </tr>
  38. <?php endif;?>
  39. </tbody>
  40. </table>
  41. </div>
  42. </div>
  43. <div class="col-sm-8">
  44. <?php if($bng_key) :?>
  45. <div class="ax-button-group">
  46. <div class="left">
  47. <h4>[<?=$banner_group['bng_name']?>] 배너 관리</h4>
  48. </div>
  49. <div class="right">
  50. <button type="button" class="btn btn-default" data-button="btn-banner-form" data-bng-key="<?=$bng_key?>" data-idx=""><i class="far fa-plus-circle"></i> 배너 추가</button>
  51. </div>
  52. </div>
  53. <p class="alert alert-info">한장만 표시되는 배너의 경우 가장 첫번째 순서의 배너를 가져옵니다.</p>
  54. <div class="grid">
  55. <table>
  56. <thead>
  57. <tr>
  58. <th class="W20"></th>
  59. <th class="W250">썸네일</th>
  60. <th>이름</th>
  61. <th class="W150">관리</th>
  62. </tr>
  63. </thead>
  64. <tbody data-toggle="sortable" data-key="ban_idx" data-sort="ban_sort" data-table="banner">
  65. <?php foreach($banner_list['list'] as $row) :?>
  66. <tr>
  67. <td class="text-center">
  68. <span class="move-grip"></span>
  69. <input type="hidden" name="ban_idx[]" value="<?=$row['ban_idx']?>">
  70. </td>
  71. <td><?=thumb_img($row['ban_filepath'],'img-thumbnail','style="max-width:250px"')?></td>
  72. <td><?=$row['ban_name']?></td>
  73. <td class="text-center W150">
  74. <button type="button" class="btn btn-default btn-sm MR5" data-button="btn-banner-form" data-bng-key="<?=$bng_key?>" data-idx="<?=$row['ban_idx']?>"><i class="far fa-pencil"></i> 수정</button>
  75. <button type="button" class="btn btn-danger btn-sm" data-button="btn-banner-delete" data-idx="<?=$row['ban_idx']?>"><i class="far fa-trash"></i> 삭제</button>
  76. </td>
  77. </tr>
  78. <?php endforeach;?>
  79. <?php if(count($banner_list['list']) == 0) :?>
  80. <tr>
  81. <td colspan="4" class="empty">등록된 배너가 없습니다.</td>
  82. </tr>
  83. <?php endif;?>
  84. </tbody>
  85. </table>
  86. </div>
  87. <script>
  88. $(function(){
  89. $("#banner-list").sortable({
  90. handle : 'i.far.fa-bars',
  91. update: function(){
  92. var sort_array = [];
  93. $("#banner-list input[name='ban_idx[]']").each(function(){
  94. sort_array.push( $(this).val() );
  95. });
  96. $.post('/admin/management/banner_sort',{sort_idx:sort_array});
  97. }
  98. });
  99. });
  100. </script>
  101. <?php endif;?>
  102. </div>
  103. </div>
  104. <script>
  105. $(function(){
  106. $('[data-button="btn-banner-group-form"]').click(function(){
  107. var bng_idx = $(this).data('idx');
  108. APP.MODAL.open({
  109. iframe : {
  110. url : '/admin/management/banner_group_form',
  111. param : {
  112. bng_idx : bng_idx
  113. }
  114. },
  115. width: 500,
  116. height: 400,
  117. header : {
  118. title : '배너 그룹 정보'
  119. }
  120. });
  121. });
  122. $('[data-button="btn-banner-group-delete"]').click(function(){
  123. var idx= $(this).data('idx');
  124. if( typeof idx == 'undefined' || ! idx) {
  125. alert('잘못된 접근입니다.');
  126. return;
  127. }
  128. if(! confirm('선택하신 배너 그룹을 삭제하시겠습니까?')) {
  129. return;
  130. }
  131. location.href="/admin/management/banner_group_delete/" + idx;
  132. });
  133. $('[data-button="btn-banner-form"]').click(function(){
  134. var ban_idx = $(this).data('idx');
  135. var bng_key = $(this).data('bng-key');
  136. if(typeof bng_key =='undefined' || ! bng_key) {
  137. alert('잘못된 접근입니다.');
  138. return;
  139. }
  140. APP.MODAL.open({
  141. iframe : {
  142. url : '/admin/management/banner_form',
  143. param : {
  144. bng_key : bng_key,
  145. ban_idx : ban_idx
  146. }
  147. },
  148. width: 500,
  149. height: 650,
  150. header : {
  151. title : '배너정보'
  152. }
  153. });
  154. });
  155. $('[data-button="btn-banner-delete"]').click(function(){
  156. var idx= $(this).data('idx');
  157. if( typeof idx == 'undefined' || ! idx) {
  158. alert('잘못된 접근입니다.');
  159. return;
  160. }
  161. if(! confirm('선택하신 배너를 삭제하시겠습니까?')) {
  162. return;
  163. }
  164. location.href="/admin/management/banner_delete/" + idx;
  165. });
  166. });
  167. </script>