Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".select-search").select2({
- width: 450
- });
- function all_alert(text,icon,button,timer) {
- swal
- ({
- text: text,
- icon: icon,
- button: button,
- timer: timer
- });
- }
- //start_send_data
- $('button.add_new_user').on('click', function (){
- var username = $('.username').empty().val();
- var password = $('.password').empty().val();
- var phone_number = $('.phone_number').empty().val();
- var email = $('.email').empty().val();
- all_alert("Please wait", "info", null, null)
- $.post("/add_new_user",{username:username,password:password,phone_number:phone_number,email:email})
- .done(function (response){
- if (response == "0"){
- all_alert("Add user", "success", null, 3000)
- }
- else{
- all_alert("Error", "warning", null, 3000)
- }
- return false;
- })
- });
- $('button.login').on('click', function (){
- var username = $('.username').empty().val();
- var password = $('.password').empty().val();
- all_alert("Please wait", "info", null, null)
- $.post("/",{username:username,password:password})
- .done(function (response){
- if (response == "0"){
- all_alert("login success", "success", null, 3000)
- }
- else if (response == "1"){
- all_alert("check username or password", "success", null, 3000)
- }
- else{
- all_alert("Error", "warning", null, 3000)
- }
- return false;
- })
- });
- $('button.add_new_volunteer').on('click', function (){
- var event_name = $('p.event_name').val();
- var first_name = $('.first_name').empty().val();
- var last_name = $('.last_name').empty().val();
- var national_id = $('.national_id').empty().val();
- var Date_of_birth = $('.Date_of_birth').empty().val();
- var profession = $('.profession').empty().val();
- var social_experience = $('select.social_experience').val();
- var special_skills = $('select.special_skills').val();
- var volunteer_payment = $('select.volunteer_payment').val();
- var full_commitment = $('select.full_commitment').val();
- var first_training = $('select.first_training').val();
- all_alert("Please wait", "info", null, null)
- $.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,
- profession:profession,social_experience:social_experience[0],special_skills:special_skills[0],volunteer_payment:volunteer_payment[0],
- full_commitment:full_commitment[0],first_training:first_training[0]})
- .done(function (response){
- if (response == "0"){
- all_alert("Add Volunteer", "success", null, 3000)
- }
- else{
- all_alert("Error", "warning", null, 3000)
- }
- return false;
- })
- });
- $('button.add_new_organizer').on('click', function (){
- var name_representative = $('.name_representative').empty().val();
- var name_institution = $('.name_institution').empty().val();
- var business_registration = $('.business_registration').empty().val();
- var company_representative_id_number = $('.company_representative_id_number').empty().val();
- var company_representative_email = $('.company_representative_email').empty().val();
- var company_representative_phone = $('.company_representative_phone').empty().val();
- all_alert("Please wait", "info", null, null)
- $.post("/add_new_organizer",{name_representative:name_representative,name_institution:name_institution,
- business_registration:business_registration,company_representative_id_number:company_representative_id_number,
- company_representative_email:company_representative_email,company_representative_phone:company_representative_phone})
- .done(function (response){
- if (response == "0"){
- all_alert("Add organizer", "success", null, 3000)
- }
- else{
- all_alert("Error", "warning", null, 3000)
- }
- return false;
- })
- });
- $(".file").change(function (){
- var data = new FormData();
- data.append("file", $(this)[0].files[0]);
- $('button.add_new_event').on('click', function (){
- var event_name = $('.event_name').empty().val();
- var activity = $('.activity').empty().val();
- var start_time = $('.start_time').empty().val();
- var start_date = $('.start_date').empty().val();
- var end_time = $('.end_time').empty().val();
- var end_date = $('.end_date').empty().val();
- var working_hour = $('.working_hour').empty().val();
- var volunteer_wage = $('.volunteer_wage').empty().val();
- var description = $('.description').empty().val();
- data.append("event_name", event_name);
- data.append("activity", activity);
- data.append("start_date", start_date);
- data.append("start_time", start_time);
- data.append("end_time", end_time);
- data.append("end_date", end_date);
- data.append("working_hour", working_hour);
- data.append("volunteer_wage", volunteer_wage);
- data.append("description", description);
- all_alert("Please wait", "info", null, null)
- $.ajax({type: 'POST',url: '/add_new_event',data: data,processData: false, contentType: false,
- success: function (response){
- if (response == "0"){
- all_alert("Add event", "success", null, 3000)
- }
- else{
- all_alert("Error", "warning", null, 3000)
- }
- return false;
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement