Guest User

Untitled

a guest
Dec 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('[data-toggle="modal"]').click(function(e) {
  3. var mode = $(this).attr('mode')
  4. if(mode == 'edit_contact') {
  5. var url = '/dashboard/contact/detail/';
  6. var id = $(this).attr('id_contact');
  7. $.get(url+id+'/',function(data){
  8. $('#edit_contact').html(data);
  9. })
  10. }else if(mode == 'send_message') {
  11. var url = '/dashboard/contact/confirm/get_list_template/';
  12. var id_contact = $(this).attr('id_contact');
  13. $.get(url+id_contact+'/',function(data){
  14. $('#send_notification').html(data);
  15. });
  16. }
  17. });
  18. });
  19. function send_message(element) {
  20. var url = '/dashboard/contact/send_message/';
  21. $('#progress_send_email').show();
  22. $(element).addClass('disabled');
  23. $.post(url,$('#send_confirmation_form').serialize(),function(data){
  24. var cp_hash = $('#send_confirmation_form').find('input[name=contact_person_hash]').attr('value');
  25. $('#ajax_response_message').html(data.message);
  26. $('#ajax_response').show();
  27. $('#progress_send_email').fadeOut(2000);
  28. $('b[contact_person_hash='+cp_hash+']').hide().html('Just Now').css('color','green').fadeIn(300);
  29. $('#send_notification').modal('hide');
  30. },'json');
  31. }
  32. /*
  33. * contoh lain
  34. */
  35. $(document).ready(function(){
  36. $('#submit_modal_email').click(function(){
  37. tinyMCE.triggerSave();
  38. $.post('/dashboard/email_template/modify/',$('#modify_template_form').serialize(),
  39. function(data) {
  40. $('#notification_area').html('<button class="close" data-dismiss="alert">&times;</button>'+data.message);
  41. $('#notification_area').removeClass('hide');
  42. $('#myModal').modal('hide');
  43. $('#notification_area').delay(5000).fadeOut(1000);
  44. },'json'
  45. );
  46. });
  47. });
  48. $('[data-toggle="modal"]').click(function(e) {
  49. e.preventDefault();
  50. $('#loader_modal').show();
  51. var mode = $(this).attr('mode');
  52. var template_id = $(this).attr('template_id');
  53. var target = '/dashboard/email_template/detail'
  54. if(mode == 'edit') {
  55. $('#submit_modal_email').show();
  56. $('#modal_title_email').text('Edit Mode');
  57. $.get(target+'/'+mode+'/'+template_id+'/',function(data){
  58. $('#modal_body_email').html(data);
  59. $('#loader_modal').hide();
  60. tinyMCE.init({
  61. mode : "exact",
  62. elements : "textarea_eh,textarea_eb,textarea_ef",
  63. theme : "simple"
  64. });
  65. });
  66. }else if(mode == 'view') {
  67. $('#submit_modal_email').hide();
  68. $('#modal_title_email').text('View Mode');
  69. $.get(target+'/'+mode+'/'+template_id+'/',function(data){
  70. $('#modal_body_email').html(data);
  71. $('#loader_modal').hide();
  72. });
  73. }
  74. });
Add Comment
Please, Sign In to add comment