<script>



$(document).ready(function() {

   
    $('#prosloadadmissioncontent').html('<div align="center"> <i class="fa fa-spinner fa-spin fs-1" style="color:#007ffb;"></i></div>');

       var UserID = '<?php echo $ApplicantID; ?>';
       var CampusID = '<?php echo  $CampusID; ?>';
       var session = '<?php echo  $ApplicantsessionName; ?>';


       $.ajax({

            type: "POST",
            url: "../../controller/scripts/applicant/loadapplicantexam.php",
            data: {
                CampusID:CampusID,
                UserID:UserID,
                session:session
            },
            success: function(feedback) {
                $('#prosloadadmissioncontent').html(feedback);


                    $(function() {
                        $('[data-plugin="knob"]').knob();
                    });
            }
        });


});













// Define the options for PDF generation
const options = {
  margin: 0.5,
  filename: 'filename',
  image: { 
    type: 'jpeg', 
    quality: 500
  },
  html2canvas: { 
    scale: 1 
  },
  jsPDF: { 
    unit: 'in', 
    format: 'letter', // Default value is 'letter'
    orientation: 'portrait' 
  }
};

// Change the format to 'a4'
options.jsPDF.format = 'a4';

// Attach the click event to the button
$('#download-pdf').click(function(e) {
  e.preventDefault();

  // Show the hidden div temporarily
  const element = document.getElementById('printdownload-admission');
  $('#printdownload-admission').show();  



// Generate the PDF
  html2pdf().from(element).set(options).save();

  // Hide the div again after generating the PDF
//   element.style.display = 'none';

  setTimeout(function () {
		$('#printdownload-admission').hide();    
	}, 1);
});




$('body').on('click','.acceptadmissionbtn', function(e) {
    
     $('#acceptadmissionbtn').html('<div align="center"> <i class="fa fa-spinner fa-spin fs-1" style="color:#007ffb;"></i></div>');

       var UserID = '<?php echo $ApplicantID; ?>';
       var CampusID = '<?php echo  $CampusID; ?>';
       var session = '<?php echo  $ApplicantsessionName; ?>';
       
       
       
           $.ajax({
    
                type: "POST",
                url: "../../controller/scripts/applicant/prosaceptadmissionhere.php",
                data: {
                    CampusID:CampusID,
                    UserID:UserID,
                    session:session
                },
                success: function(feedback) {
                   
    
    
                            if(feedback.trim() == 'sucess')
                            {
                                
                                
                                 $.wnoty({
                                    type: 'success',
                                    message: 'Admission Accepted successfully.',
                                    autohideDelay: 5000, // 5 seconds
                                    position:'top-right',
                                    autohide:true
                                    });

                                
                                
                            }else
                            {
                                
                                $.wnoty({
                                    type: 'warning',
                                    message: 'failed!! please try again..',
                                    autohideDelay: 5000, // 5 seconds
                                    position:'top-right',
                                    autohide:true
                                    });
                                
                                
                            }
    
                       
                }
            });
            
            
    
});

       




   

</script>