Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.03 KB | None | 0 0
  1. $(".select-search").select2({
  2. width: 450
  3. });
  4. function all_alert(text,icon,button,timer) {
  5. swal
  6. ({
  7. text: text,
  8. icon: icon,
  9. button: button,
  10. timer: timer
  11. });
  12.  
  13. }
  14. //start_send_data
  15. $('button.add_new_user').on('click', function (){
  16. var username = $('.username').empty().val();
  17. var password = $('.password').empty().val();
  18. var phone_number = $('.phone_number').empty().val();
  19. var email = $('.email').empty().val();
  20. all_alert("Please wait", "info", null, null)
  21. $.post("/add_new_user",{username:username,password:password,phone_number:phone_number,email:email})
  22. .done(function (response){
  23. if (response == "0"){
  24. all_alert("Add user", "success", null, 3000)
  25. }
  26. else{
  27. all_alert("Error", "warning", null, 3000)
  28. }
  29. return false;
  30. })
  31. });
  32. $('button.login').on('click', function (){
  33. var username = $('.username').empty().val();
  34. var password = $('.password').empty().val();
  35. all_alert("Please wait", "info", null, null)
  36. $.post("/",{username:username,password:password})
  37. .done(function (response){
  38. if (response == "0"){
  39. all_alert("login success", "success", null, 3000)
  40.  
  41. }
  42. else if (response == "1"){
  43. all_alert("check username or password", "success", null, 3000)
  44.  
  45. }
  46. else{
  47. all_alert("Error", "warning", null, 3000)
  48. }
  49. return false;
  50. })
  51. });
  52. $('button.add_new_volunteer').on('click', function (){
  53. var event_name = $('p.event_name').val();
  54. var first_name = $('.first_name').empty().val();
  55. var last_name = $('.last_name').empty().val();
  56. var national_id = $('.national_id').empty().val();
  57. var Date_of_birth = $('.Date_of_birth').empty().val();
  58. var profession = $('.profession').empty().val();
  59. var social_experience = $('select.social_experience').val();
  60. var special_skills = $('select.special_skills').val();
  61. var volunteer_payment = $('select.volunteer_payment').val();
  62. var full_commitment = $('select.full_commitment').val();
  63. var first_training = $('select.first_training').val();
  64. all_alert("Please wait", "info", null, null)
  65. $.post("/add_new_volunteer/",{event_name:event_name,first_name:first_name,last_name:last_name,national_id:national_id,Date_of_birth:Date_of_birth,
  66. profession:profession,social_experience:social_experience[0],special_skills:special_skills[0],volunteer_payment:volunteer_payment[0],
  67. full_commitment:full_commitment[0],first_training:first_training[0]})
  68. .done(function (response){
  69. if (response == "0"){
  70. all_alert("Add Volunteer", "success", null, 3000)
  71. }
  72. else{
  73. all_alert("Error", "warning", null, 3000)
  74. }
  75. return false;
  76. })
  77. });
  78. $('button.add_new_organizer').on('click', function (){
  79. var name_representative = $('.name_representative').empty().val();
  80. var name_institution = $('.name_institution').empty().val();
  81. var business_registration = $('.business_registration').empty().val();
  82. var company_representative_id_number = $('.company_representative_id_number').empty().val();
  83. var company_representative_email = $('.company_representative_email').empty().val();
  84. var company_representative_phone = $('.company_representative_phone').empty().val();
  85. all_alert("Please wait", "info", null, null)
  86. $.post("/add_new_organizer",{name_representative:name_representative,name_institution:name_institution,
  87. business_registration:business_registration,company_representative_id_number:company_representative_id_number,
  88. company_representative_email:company_representative_email,company_representative_phone:company_representative_phone})
  89. .done(function (response){
  90. if (response == "0"){
  91. all_alert("Add organizer", "success", null, 3000)
  92. }
  93. else{
  94. all_alert("Error", "warning", null, 3000)
  95. }
  96. return false;
  97. })
  98. });
  99. $(".file").change(function (){
  100. var data = new FormData();
  101. data.append("file", $(this)[0].files[0]);
  102. $('button.add_new_event').on('click', function (){
  103. var event_name = $('.event_name').empty().val();
  104. var activity = $('.activity').empty().val();
  105. var start_time = $('.start_time').empty().val();
  106. var start_date = $('.start_date').empty().val();
  107. var end_time = $('.end_time').empty().val();
  108. var end_date = $('.end_date').empty().val();
  109. var working_hour = $('.working_hour').empty().val();
  110. var volunteer_wage = $('.volunteer_wage').empty().val();
  111. var description = $('.description').empty().val();
  112. data.append("event_name", event_name);
  113. data.append("activity", activity);
  114. data.append("start_date", start_date);
  115. data.append("start_time", start_time);
  116. data.append("end_time", end_time);
  117. data.append("end_date", end_date);
  118. data.append("working_hour", working_hour);
  119. data.append("volunteer_wage", volunteer_wage);
  120. data.append("description", description);
  121. all_alert("Please wait", "info", null, null)
  122. $.ajax({type: 'POST',url: '/add_new_event',data: data,processData: false, contentType: false,
  123. success: function (response){
  124. if (response == "0"){
  125. all_alert("Add event", "success", null, 3000)
  126. }
  127. else{
  128. all_alert("Error", "warning", null, 3000)
  129. }
  130. return false;
  131. }
  132. });
  133.  
  134. });
  135. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement