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.3 KiB

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