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.

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