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.

182 lines
7.2 KiB

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