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.

236 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. /***********************************************************************************
  2. * 관리자 페이지 초기화
  3. ***********************************************************************************/
  4. APP.init = function(){
  5. APP.initMenu();
  6. APP.initPlugins();
  7. APP.initFitHeight();
  8. APP.initSortableList();
  9. DevExpress.localization.locale('ko');
  10. };
  11. /***********************************************************************************
  12. * 메뉴관련 초기화
  13. ***********************************************************************************/
  14. APP.initMenu = function(){
  15. $('#nav .main-navigation li').each(function(){
  16. var $this = $(this);
  17. var menuCode = $this.data('active');
  18. if(menuCode == menuActive)
  19. {
  20. $(this).addClass('active');
  21. $(this).parents('li').addClass('active');
  22. }
  23. });
  24. };
  25. APP.initPlugins = function() {
  26. $.datepicker._updateDatepicker_original = $.datepicker._updateDatepicker;
  27. $.datepicker._updateDatepicker = function(inst) {
  28. $.datepicker._updateDatepicker_original(inst);
  29. var afterShow = this._get(inst, 'afterShow');
  30. if (afterShow)
  31. afterShow.apply((inst.input ? inst.input[0] : null));
  32. }
  33. $.datepicker.regional['ko'] = {
  34. closeText: '닫기',
  35. prevText: '이전달',
  36. nextText: '다음달',
  37. currentText: '오늘',
  38. monthNames: ['1월','2월','3월','4월','5월','6월', '7월','8월','9월','10월','11월','12월'],
  39. monthNamesShort: ['1월','2월','3월','4월','5월','6월', '7월','8월','9월','10월','11월','12월'],
  40. dayNames: ['일','월','화','수','목','금','토'],
  41. dayNamesShort: ['일','월','화','수','목','금','토'],
  42. dayNamesMin: ['일','월','화','수','목','금','토'],
  43. weekHeader: 'Wk',
  44. dateFormat: 'yy-mm-dd',
  45. firstDay: 0,
  46. isRTL: false,
  47. showMonthAfterYear: true,
  48. changeMonth: true,
  49. changeYear: true,
  50. yearSuffix: ''
  51. };
  52. $.datepicker.setDefaults($.datepicker.regional['ko']);
  53. $('[data-toggle="datepicker"]').each(function(){
  54. $(this).datepicker();
  55. if( typeof $(this).data('chained-datepicker') != 'undefined' && $(this).data('chained-datepicker') )
  56. {
  57. var el = $(this).data('chained-datepicker'),
  58. $el = $(el);
  59. if($el.length > 0 ) {
  60. $(this).change(function() {
  61. if($el.hasClass('hasDatepicker')) {
  62. $el.datepicker('option', 'minDate', $(this).val() );
  63. }
  64. })
  65. }
  66. }
  67. });
  68. $("body").on("click", '[data-toggle="datepicker"]', function(){
  69. if (!$(this).hasClass("hasDatepicker"))
  70. {
  71. $(this).datepicker();
  72. $(this).datepicker("show");
  73. }
  74. });
  75. };
  76. APP.initSortableList = function() {
  77. $('[data-toggle="sortable"]').each(function(){
  78. if( $(this).hasClass('has-sortable') ) return true;
  79. $(this).addClass('has-sortable');
  80. var $this = $(this);
  81. var key = $(this).data('key');
  82. var table = $(this).data('table');
  83. var sort = $(this).data('sort');
  84. $this.sortable({
  85. handle : '.move-grip',
  86. update : function() {
  87. var sortArray = [];
  88. $('input[name="'+key+'[]"]').each(function(){
  89. sortArray.push( $(this).val() );
  90. });
  91. $.ajax({
  92. url : base_url + '/admin/ajax/management/sort',
  93. type : 'POST',
  94. data : {
  95. key : key,
  96. table : table,
  97. sort : sort,
  98. sort_order : sortArray
  99. },
  100. success:function(res) {
  101. toastr.success('순서변경이 적용되었습니다.');
  102. }
  103. })
  104. }
  105. })
  106. });
  107. };
  108. APP.initFitHeight = function() {
  109. $(window).resize(function() {
  110. if($('[data-fit-content]').length> 0 )
  111. {
  112. var mH = $('#contents').height();
  113. $('[data-fit-aside]').each(function() {
  114. mH -= $(this).outerHeight(true);
  115. });
  116. $('[data-fit-content]').height(mH);
  117. }
  118. }).resize();
  119. };
  120. APP.memberMenuObject = function(e, point_name, obj) {
  121. var a = [
  122. {
  123. icon: 'card',
  124. text: '회원정보',
  125. beginGroup:true,
  126. onItemClick: function() {
  127. APP.MEMBER.POP_INFO_ADMIN(e.row.data.mem_idx);
  128. }
  129. },
  130. {
  131. icon: 'edit',
  132. text: '정보수정',
  133. onItemClick: function() {
  134. APP.MEMBER.POP_MODIFY_ADMIN(e.row.data.mem_idx);
  135. }
  136. },
  137. {
  138. icon: 'key',
  139. text: '비밀번호 변경',
  140. onItemClick: function() {
  141. APP.MEMBER.POP_PASSWORD_ADMIN(e.row.data.mem_idx);
  142. }
  143. },
  144. {
  145. beginGroup:true,
  146. icon:'repeat',
  147. text: '휴면처리',
  148. visible: e.row.data.mem_status == 'Y',
  149. onItemClick: function() {
  150. APP.MEMBER.STATUS_CHANGE(e.row.data.mem_idx,'Y','H');
  151. }
  152. },
  153. {
  154. icon:'clear',
  155. text: '로그인금지',
  156. visible: e.row.data.mem_status == 'Y',
  157. onItemClick: function() {
  158. APP.MEMBER.STATUS_CHANGE(e.row.data.mem_idx,'Y','D');
  159. }
  160. },
  161. {
  162. icon:'clearformat',
  163. text: '휴면해제',
  164. visible: e.row.data.mem_status == 'H',
  165. onItemClick: function() {
  166. APP.MEMBER.STATUS_CHANGE(e.row.data.mem_idx,'H','Y');
  167. }
  168. },
  169. {
  170. icon:'clearformat',
  171. text: '로그인금지 해제',
  172. visible: e.row.data.mem_status == 'D',
  173. onItemClick: function() {
  174. APP.MEMBER.STATUS_CHANGE(e.row.data.mem_idx,'D','Y');
  175. }
  176. },
  177. {
  178. icon:'trash',
  179. text: '회원 탈퇴',
  180. visible: e.row.data.mem_status != 'N',
  181. onItemClick: function() {
  182. APP.MEMBER.STATUS_CHANGE(e.row.data.mem_idx,e.row.data.mem_status,'Y');
  183. }
  184. },
  185. {
  186. icon:'event',
  187. beginGroup:true,
  188. text: '로그인 기록',
  189. onItemClick: function() {
  190. APP.POPUP({
  191. url: base_url + '/admin/members/log?mode=popup&sc=idx&st=' + e.row.data.mem_idx
  192. })
  193. }
  194. },
  195. {
  196. icon:'unpin',
  197. beginGroup:true,
  198. text: point_name + ' 관리',
  199. visible: point_name !== false,
  200. onItemClick: function() {
  201. APP.MEMBER.POP_POINT_ADMIN(e.row.data.mem_idx);
  202. }
  203. },
  204. {
  205. icon:'unpin',
  206. text: point_name + ' 추가',
  207. visible: point_name !== false,
  208. onItemClick: function() {
  209. APP.MEMBER.POP_POINT_FORM_ADMIN(e.row.data.mem_idx);
  210. }
  211. }
  212. ]
  213. return a;
  214. };
  215. $(function(){
  216. APP.init();
  217. });