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.

123 lines
3.4 KiB

7 years ago
  1. var faq = {};
  2. faq.form = function(fac_idx, faq_idx)
  3. {
  4. var faq_idx = (typeof faq_idx == 'string' || typeof faq_idx == 'number' ) ? faq_idx : null;
  5. var fac_idx = (typeof fac_idx == 'string' || typeof fac_idx == 'number' ) ? fac_idx : null;
  6. if(! fac_idx) {
  7. alert('FAQ 분류 정보가 없습니다.');
  8. return false;
  9. }
  10. APP.MODAL.open({
  11. width: 800,
  12. height :650,
  13. header : {
  14. title : faq_idx ? 'FAQ 정보 수정' : 'FAQ 추가'
  15. },
  16. callback : function(){
  17. location.reload();
  18. },
  19. iframe : {
  20. method : 'get',
  21. url : '/admin/management/faq_form',
  22. param : {
  23. fac_idx : fac_idx,
  24. faq_idx : faq_idx
  25. }
  26. }
  27. });
  28. };
  29. faq.remove = function(faq_idx) {
  30. if(typeof faq_idx == 'undefined' || ! faq_idx || faq_idx.trim() == '') {
  31. alert('잘못된 접근입니다.');
  32. }
  33. if(! confirm('해당 FAQ를 삭제하시겠습니까?')) return false;
  34. $.ajax({
  35. url : '/ajax/faq/info',
  36. type : 'delete',
  37. async:false,
  38. cache:false,
  39. data:{faq_idx:faq_idx},
  40. success:function(res){
  41. alert('FAQ가 삭제되었습니다.');
  42. location.reload();
  43. }
  44. });
  45. };
  46. /**
  47. * FAQ 분류
  48. * @type {{}}
  49. */
  50. faq.category = {};
  51. faq.category.form = function(fac_idx)
  52. {
  53. var fac_idx = (typeof fac_idx == 'string' || typeof fac_idx == 'number' ) ? fac_idx : null;
  54. APP.MODAL.open({
  55. width: $(window).width() > 600 ? 600 : $(window).width(),
  56. height :250,
  57. header : {
  58. title : fac_idx ? 'FAQ 분류 정보 수정' : 'FAQ 분류 추가'
  59. },
  60. callback : function(){
  61. location.reload();
  62. },
  63. iframe : {
  64. method : 'get',
  65. url : '/admin/management/faq_category_form',
  66. param : {
  67. fac_idx : fac_idx
  68. }
  69. }
  70. });
  71. };
  72. faq.category.exist = function(fac_idx) {
  73. if(typeof fac_idx == 'undefined' || ! fac_idx || fac_idx.trim() == '') return false;
  74. var result = false;
  75. $.ajax({
  76. url : '/ajax/faq/category',
  77. type:'get',
  78. async:false,
  79. cache:false,
  80. data:{fac_idx:fac_idx},
  81. success:function (res) {
  82. result = !(res && typeof res.fac_idx != 'undefined' && res.fac_idx);
  83. }
  84. });
  85. return result;
  86. };
  87. faq.category.remove = function(fac_idx) {
  88. if(typeof fac_idx == 'undefined' || ! fac_idx || fac_idx.trim() == '') {
  89. alert('잘못된 접근입니다.');
  90. }
  91. var count = 0;
  92. $.ajax({
  93. url : '/ajax/faq/lists',
  94. type : 'get',
  95. async:false,
  96. cache: false,
  97. data : {fac_idx:fac_idx},
  98. success:function(res){
  99. count = res.total_count;
  100. }
  101. });
  102. var msg = ( count > 0 ) ? '해당 FAQ 분류에 ' + count + '개의 FAQ 목록이 등록되어 있습니다.\nFAQ 분류을 삭제할시 등록된 FAQ 목록도 같이 삭제됩니다.\n\n계속 하시겠습니까?' : 'FAQ 분류을 삭제하시겠습니까?';
  103. if(! confirm(msg)) return false;
  104. $.ajax({
  105. url : '/ajax/faq/category',
  106. type : 'delete',
  107. async:false,
  108. cache:false,
  109. data:{fac_idx:fac_idx},
  110. success:function(res){
  111. alert('FAQ 분류가 삭제되었습니다.');
  112. location.href= base_url + "/admin/management/faq";
  113. }
  114. });
  115. };