[text] qwer

Viewer

  1. {% load i18n %}
  2. {% load widget_tweaks %}
  3. {% load static %}
  4. {% load admission_filter %}
  5. {% load admission_specific_filter %}
  6. <!DOCTYPE html>
  7. <html lang="en">
  8. <head>
  9.     <meta charset="UTF-8">
  10.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11.     <title>BITS WILP</title>
  12.     <link rel="icon" type="image/x-icon" href="{% static 'assets/images/bits_logo.png' %}">
  13.     <!-- Fonts -->
  14.     <link rel="preconnect" href="https://fonts.googleapis.com">
  15.     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  16.     <link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:opsz,[email protected],200;6..12,400;6..12,600;6..12,800&display=swap" rel="stylesheet">
  17.     <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
  18.  
  19.     <!-- Stylesheets -->
  20.     <link rel="stylesheet" type="text/css" href="{% static 'assets/css/style.css'%}">
  21.     <link rel="stylesheet" href="{% static 'assets/css/bootstrap.min.css'%}">
  22.     <link rel="stylesheet" href="{% static 'assets/css/ie10-viewport-bug-workaround.css'%}">
  23.     <link rel="stylesheet" href="{% static 'assets/css/signin.css'%}">
  24.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
  25.     <link rel="stylesheet" href="{% static 'registrations/css/theme.css'%}">
  26.  
  27.     <!-- JavaScript -->
  28.     <script src="{% static 'assets/js/ie-emulation-modes-warning.js'%}"></script>
  29.     <script src="{% static 'assets/js/jquerynew.min.js'%}"></script>
  30.  
  31.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropper/4.0.0/cropper.min.css" integrity="sha256-/KLAk4A9xEOKGyr4umt11boYQJtP40gBLT+WrfWImuY=" crossorigin="anonymous">
  32.     <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
  33.     <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
  34.   <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
  35. {% if wizard.steps.current == '7' %}
  36. <script type="text/javascript">
  37.     var file_error = [];
  38.                 var actual_size = 10485760;
  39.                 var forms = '{{formset.forms|length}}';
  40.  
  41.     $(document).ready(function() {
  42.  
  43.         if ('{{document_submission_flag}}' == 'False') {
  44.             $('#upload_doc_sub').prop('disabled', true);
  45.         }
  46.  
  47.         {% for form in formset.forms %}
  48.             file_error["{{form.file.auto_id}}"] = false;
  49.  
  50.             $("#{{form.file.auto_id}}").change(function() {
  51.                 if($(this).prop('files')[0].size>actual_size) {
  52.                     $('#{{form.id.auto_id}}' + "_errors").html(
  53.                         '* Please keep file size under ' + 
  54.                         Math.round((actual_size/1024)/1024, 2) +
  55.                         ' MB. Current file size is' +
  56.                         Math.round(($(this).prop('files')[0].size/1024)/1024, 2) +
  57.                         ' MB.'
  58.                     );
  59.                     $(this).val('');
  60.                     file_error[$(this).attr('id')] = true;
  61.                 }
  62.                 else if($(this).prop('files')[0].name.split('.')[0].length>25){
  63.                     $('#{{form.id.auto_id}}' + "_errors").html("* File Name length should be less then 25.");
  64.                     $(this).val('');
  65.                     file_error[$(this).attr('id')] = true;
  66.                 }
  67.                 else if (
  68.                     $.inArray(
  69.                         $(this).val().substr(
  70.                             $(this).val().lastIndexOf('.')+1
  71.                         ).toLowerCase(), 
  72.                         ['pdf', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'zip', 'doc', 'docx']
  73.                     ) == -1
  74.                 ) {
  75.                     $('#{{form.id.auto_id}}' + "_errors").html("* Incorrect file formats selected for upload, please ensure that only PDF, JPEG, PNG, TIFF, ZIP and DOC are chosen for upload.");
  76.                     $(this).val('');
  77.                     file_error[$(this).attr('id')] = true;
  78.                 }
  79.                 else{
  80.                     $('#{{form.id.auto_id}}' + "_errors").html('');
  81.                     file_error[$(this).attr('id')] = false;
  82.                 }
  83.                 if ($(this).hasClass('important') && $(this).prop('files').length === 0) {
  84.                     file_error[$(this).attr('id')] = true;
  85.                 } else {
  86.                     file_error[$(this).attr('id')] = false;
  87.                 }              
  88.             });
  89.         {% endfor %}
  90.         
  91.         $('#upload_doc_sub').click(function() {
  92.             if ($('.mentor').data('error-msg')){
  93.                 $('.mentor').after('<span class="text-danger">' + $('.mentor').data('error-msg') + '</span>');
  94.             }
  95.             if ($('.employer').data('error-msg')){
  96.                 $('.employer').after('<span class="text-danger">' + $('.employer').data('error-msg') + '</span>');
  97.             }
  98.             $('.req').each(function() {
  99.                 var $fileInput = $(this);
  100.                 var $errorSpan = $fileInput.siblings('.text-danger');
  101.                 var $documentLink = $fileInput.closest('td').find('a');
  102.  
  103.                 if (!$fileInput.val() && !$documentLink.length) {
  104.                     
  105.                     $errorSpan.text($fileInput.data('error-msg'));
  106.                     event.preventDefault();
  107.                     
  108.                 } else {
  109.                     $errorSpan.text('');
  110.                 }
  111.             });
  112.             $('.rej').each(function() {
  113.                 var $fileInput = $(this);
  114.                 var $errorSpan = $fileInput.siblings('.text-danger');
  115.  
  116.                 if (!$fileInput.val()) {
  117.                     $errorSpan.text($fileInput.data('error-msg'));
  118.                     event.preventDefault();
  119.                     
  120.                 } else {
  121.                     $errorSpan.text('');
  122.                 }
  123.             });
  124.             $('.std').each(function() {
  125.                 var $fileInput = $(this);
  126.                 var $errorSpan = $fileInput.siblings('.text-danger');
  127.  
  128.                 if (!$fileInput.val()) {
  129.                     $errorSpan.text($fileInput.data('error-msg'));
  130.                     event.preventDefault();
  131.                     
  132.                 } else {
  133.                     $errorSpan.text('');
  134.                 }
  135.             });
  136.  
  137.             $('.mentor').data('error-msg', '');
  138.             $('.employer').data('error-msg', '');
  139.         });
  140.     });
  141. </script>
  142. {% endif %}
  143. {% if wizard.steps.current == '6' %}
  144. <script>
  145.     $(document).ready(function() {
  146.         $('#id_6-photo_file, #id_6-signature_file').change(function() {
  147.             var fileId = $(this).attr('id');
  148.             var errorTag = $('#' + fileId + '_error');
  149.     
  150.             var maxSizeKB = 100;
  151.             var minSizeKB = 20;
  152.  
  153.             var file = $(this).prop('files')[0]
  154.             var fileSizeKB = file.size / 1024;
  155.  
  156.             if (fileId === 'id_6-photo_file') {
  157.                 errorTag = $('#error_rev_photo');
  158.             } else if (fileId === 'id_6-signature_file') {
  159.                 var minSizeKB = 5;
  160.                 errorTag = $('#error_rev_sign');
  161.             }
  162.             
  163.             errorTag.text('');
  164.  
  165.             if (fileSizeKB > maxSizeKB || fileSizeKB < minSizeKB) {
  166.                 errorTag.text(
  167.                     'The size of the file should be between ' + minSizeKB + ' KB and ' + maxSizeKB + ' KB.');
  168.                 $(this).val("");
  169.             } else if ($(this).prop('files')[0].name.split('.')[0].length > 25) {
  170.                 errorTag.text(
  171.                     'File Name length should be less than 25.');
  172.                 $(this).val("");
  173.             } else if ($.inArray(
  174.                 $(this).val().substr($(this).val().lastIndexOf('.') + 1).toLowerCase(),
  175.                 [ 'jpeg', 'jpg', 'png', 'jfif']
  176.                 ) == -1) {
  177.                     errorTag.text(
  178.                     'Incorrect file formats selected for upload, please ensure that only PDF, JPEG, PNG and JFIF are chosen for upload.');
  179.                 $(this).val("");
  180.             }
  181.         });
  182.         $('.btn-next').click(function(event) {
  183.         
  184.             var photoFile = $('#id_6-photo_file').prop('files')[0];
  185.             $('#error_rev_photo').text('');
  186.             {% if not photo %}
  187.             if (!photoFile) {
  188.                 event.preventDefault();
  189.                 $('#error_rev_photo').text('Please upload a photograph.');
  190.                 return;
  191.             }
  192.             {% endif %}
  193.  
  194.             var signatureFile = $('#id_6-signature_file').prop('files')[0];
  195.  
  196.             {% if not sign %}
  197.             $('#error_rev_sign').text('');
  198.             if (!signatureFile) {
  199.                 event.preventDefault();
  200.                 $('#error_rev_sign').text('Please upload a signature.');
  201.                 return;
  202.             }
  203.             {% endif %}
  204.         });
  205.     });
  206. </script>    
  207.     
  208. {% endif %}
  209. <script>
  210.     $(document).ready(function () {
  211.         {% if employer %}
  212.             document.getElementById("id_5-hr_name").readOnly = true;
  213.             document.getElementById("id_5-hr_email").readOnly = true;
  214.             document.getElementById("id_5-hr_phone").readOnly = true;
  215.         {% endif %}
  216.         {% if mentor %}
  217.             document.getElementById("id_5-mentor_name").readOnly = true;
  218.             document.getElementById("id_5-mentor_email").readOnly = true;
  219.             document.getElementById("id_5-mentor_phone").readOnly = true;
  220.         {% endif %}
  221.     
  222.     // full name validation
  223.     $("#id_0-full_name").on("change", function(){
  224.         let fullName = $("#id_0-full_name").val();
  225.         let errorSpanId = 'fullnameError';
  226.         let pattern = /^[a-zA-Z\s,.`'-]+$/;
  227.         let maxLength = 100;
  228.  
  229.         if (fullName.trim() !== '' && !pattern.test(fullName)) {
  230.             updateFullNameErrorMessage('Please match the requested format.', errorSpanId);
  231.             $("#id_0-full_name").val('');
  232.         }
  233.         else if(fullName.length > maxLength) {
  234.             updateFullNameErrorMessage('Please enter a name with a maximum length of ' + maxLength + ' characters.', errorSpanId);
  235.             $("#id_0-full_name").val('');
  236.         }
  237.         else{
  238.             updateFullNameErrorMessage('', errorSpanId);
  239.         } 
  240.     
  241.         function updateFullNameErrorMessage(message, errorSpanId) {
  242.             $('#' + errorSpanId).text(message);
  243.         }
  244.     });
  245.  
  246.     // fathers name valdation
  247.     $("#id_0-fathers_name").on("change", function(){
  248.         let fathersName = $("#id_0-fathers_name").val();
  249.         let errorSpanId = 'fathersNameError';
  250.         let pattern = /^[A-Za-z]+( [A-Za-z]+)*$/;
  251.     
  252.         if (!pattern.test(fathersName)) {
  253.             updateFathersNameErrorMessage('Please match the requested format.', errorSpanId);
  254.             $("#id_0-fathers_name").val('');
  255.         }
  256.         else{
  257.             updateFathersNameErrorMessage('', errorSpanId);
  258.         } 
  259.     
  260.         function updateFathersNameErrorMessage(message, errorSpanId) {
  261.             $('#' + errorSpanId).text(message);
  262.         }
  263.     });
  264.     
  265.     // mothers name validation
  266.     $("#id_0-mothers_name").on("change", function(){
  267.         let mothersName = $("#id_0-mothers_name").val();
  268.         let errorSpanId = 'mothersNameError';
  269.         let pattern = /^[A-Za-z]+( [A-Za-z]+)*$/;
  270.     
  271.         if (!pattern.test(mothersName)) {
  272.             updateMothersNameErrorMessage('Please match the requested format.', errorSpanId);
  273.             $("#id_0-mothers_name").val('');
  274.         }
  275.         else{
  276.             updateMothersNameErrorMessage('', errorSpanId);
  277.         } 
  278.     
  279.         function updateMothersNameErrorMessage(message, errorSpanId) {
  280.             $('#' + errorSpanId).text(message);
  281.         }
  282.     });
  283.  
  284.     function validatePinCode() {
  285.         let country = $("#id_0-country").val();
  286.         let pin_code = $("#id_0-pin_code").val()
  287.         let errorSpanId = 'pincodeError';
  288.  
  289.         if (pin_code.length !== 0)  {
  290.             if ( country === 'IN' && pin_code.length === 6 && pin_code[0] === '0'){
  291.                 updatePincodeErrorMessage('First digit of pincode must be from 1-9.', errorSpanId);
  292.                 $("#id_0-pin_code").val('').focus();
  293.             }
  294.         else if (country === 'IN' && pin_code.length !== 6 ) {
  295.                 //showToast('Please enter a 6-digit PIN Code for India.', 'toastContainer');
  296.                 updatePincodeErrorMessage('Please enter a 6-digit PIN Code for India.', errorSpanId);
  297.                 $("#id_0-pin_code").val('').focus();
  298.             }
  299.         else{
  300.             updatePincodeErrorMessage('', errorSpanId);
  301.             }
  302.         }
  303.         
  304.     }
  305.  
  306.     function updatePincodeErrorMessage(message, errorSpanId) {
  307.         $('#' + errorSpanId).text(message);
  308.     }
  309.  
  310.     $("#id_0-country, #id_0-state, #id_0-pin_code").on("change", validatePinCode);
  311.     
  312.     $("#id_0-country").on("change", function(){
  313.         let country = $("#id_0-country").val();
  314.         let errorSpanId = 'stateError';
  315.         let phoneCode = $('#id_0-phone_0')
  316.         let mobileCode = $('#id_0-mobile_0')
  317.         $("#id_0-state").val('');
  318.  
  319.         if (country !== 'IN' && $("#id_0-state").val() !== '30') {
  320.             //showToast('Please select out of India in State field as Country is not India.', 'toastContainer');
  321.             updateStateErrorMessage('Please select Outside India in State field as Country is not India.', errorSpanId);
  322.             $("#id_0-state").val('');
  323.         }
  324.         else{
  325.             if ($("#id_0-state").val() === '30') {
  326.                 updateStateErrorMessage('', errorSpanId);
  327.             }
  328.         } 
  329.  
  330.         if (country ==='IN'){
  331.             phoneCode.val('+91'); 
  332.             mobileCode.val('+91'); 
  333.             $('#id_0-phone_1').val('');
  334.             $('#id_0-mobile_1').val('');
  335.         }
  336.  
  337.         function updateStateErrorMessage(message, errorSpanId) {
  338.             $('#' + errorSpanId).text(message);
  339.         }
  340.     });
  341.  
  342.     $("#id_0-state").on("change", function(){
  343.         let stateValue = $("#id_0-state").val();
  344.         let errorSpanId = 'stateError';
  345.         let country = $("#id_0-country").val();
  346.         
  347.         if (country === 'IN' && stateValue === '30') {
  348.             updateState1ErrorMessage('Please select some other state in State field as Country is India.', errorSpanId);
  349.             $("#id_0-state").val('');
  350.         }
  351.         else if (country !== 'IN' && stateValue === '30') {
  352.             updateState1ErrorMessage('', errorSpanId);
  353.         }
  354.         else if (country !== 'IN' && stateValue !== '30') {
  355.             updateState1ErrorMessage('Please select Outside India in State field as Country is not India.', errorSpanId);
  356.         }
  357.         else{
  358.             updateState1ErrorMessage('', errorSpanId);
  359.         }
  360.  
  361.         function updateState1ErrorMessage(message, errorSpanId) {
  362.             $('#' + errorSpanId).text(message);
  363.         }
  364.     });
  365.  
  366.     /*$("#id_0-state").on("change", function(){
  367.     let country = $("#id_0-country").val();
  368.     if (country !== 'IN' && $("#id_0-state").val() !== '30') {
  369.         //showToast('Please select out of India in State field as Country is not India.', 'toastContainer');
  370.         $("#id_0-state").val('');
  371.     } 
  372. });*/
  373.     // email id validation
  374.     $("#id_0-email_id").on("change", function(){
  375.         let email = $("#id_0-email_id").val();
  376.         let errorSpanId = 'emailError';
  377.         let pattern = /^[^@]+@[^@]+\.[a-zA-Z]{2,}$/;
  378.  
  379.         if (!pattern.test(email)) {
  380.             updateEmailErrorMessage('Please enter proper email address.', errorSpanId);
  381.             $("#id_0-email_id").val('');
  382.         }
  383.         else {
  384.             updateEmailErrorMessage('', errorSpanId);
  385.         } 
  386.  
  387.         function updateEmailErrorMessage(message, errorSpanId) {
  388.             $('#' + errorSpanId).text(message);
  389.         }
  390.     });
  391.  
  392.     // alternate email id validation
  393.     $("#id_0-alternate_email_id").on("change", function(){
  394.         let email = $("#id_0-alternate_email_id").val();
  395.         let mainEmail = $("#id_0-email_id").val();
  396.         let errorSpanId = 'alternateemailError';
  397.         let pattern = /^[^@]+@[^@]+\.[a-zA-Z]{2,}$/;
  398.  
  399.         if (!pattern.test(email)) {
  400.             updateEmailErrorMessage('Please enter proper alternate email address.', errorSpanId);
  401.             $("#id_0-alternate_email_id").val('');
  402.         }
  403.         else if (email === mainEmail) {
  404.             updateEmailErrorMessage('Alternate Email ID should not be the same as Email ID.', errorSpanId);
  405.             $("#id_0-alternate_email_id").val('');
  406.         }
  407.         else {
  408.             updateEmailErrorMessage('', errorSpanId);
  409.         } 
  410.  
  411.         function updateEmailErrorMessage(message, errorSpanId) {
  412.             $('#' + errorSpanId).text(message);
  413.         }
  414.     });
  415.  
  416.     // Hide the text field and button initially
  417.     if ($("#id_1-prior_student_flag").val() ==1){
  418.         $("#bits_student_lable_prior").show();
  419.         $('#id_1-bits_student_id').prop('required',true);
  420.         }
  421.         else {
  422.         $('#id_1-bits_student_id').prop('required',false);
  423.         $("#bits_student_lable_prior").hide();
  424.         }
  425.  
  426.     // Show the text field and button when the user selects "Yes" in the dropdown
  427.     $('#id_1-prior_student_flag').change(function() {
  428.         if ($(this).val() == '1') {
  429.             $('#bits_student_lable_prior').show();
  430.             $('#id_1-bits_student_id').prop('required',true);
  431.         } else {
  432.             $('#bits_student_lable_prior').hide();
  433.             InvalidBsi(document.getElementById('id_1-bits_student_id'))
  434.             $('#id_1-bits_student_id').val('');
  435.             $('#id_1-bits_student_id').prop('required',false);
  436.         }
  437.     });
  438.  
  439.     $('#id_1-programming_flag').change(function() {
  440.         if ($(this).val() == 'True') {
  441.             $('#programming_language_knows').show();
  442.             $('#id_1-programming_language_knows').prop('required',true);
  443.         } else {
  444.             $('#programming_language_knows').hide();
  445.             InvalidPlk(document.getElementById('id_1-programming_language_knows'))
  446.             $('#id_1-programming_language_knows').val('');
  447.             $('#id_1-programming_language_knows').prop('required',false);
  448.         }
  449.     });
  450.  
  451.     if ( $('#id_1-programming_flag').val() == 'True') {
  452.             $('#programming_language_knows').show();
  453.             $('#id_1-programming_language_knows').prop('required',true);
  454.         } else {
  455.             $('#programming_language_knows').hide();
  456.             $('#id_1-programming_language_knows').val('');
  457.             $('#id_1-programming_language_knows').prop('required',false);
  458.         }
  459.  
  460.     // Hide the text field and button initially
  461.     if ($('#id_1-other_bits_prog_flag').val() ==1){
  462.         $('#bits_student_lable_present').show();
  463.         $('#id_1-present_bits_student_id').prop('required',true);
  464.         }
  465.     else {
  466.         $('#id_1-present_bits_student_id').prop('required',false);
  467.         $("#bits_student_lable_present").hide();
  468.         }
  469.  
  470.     // Show the text field and button when the user selects "Yes" in the dropdown
  471.     $("#id_1-other_bits_prog_flag").change(function() {
  472.     if ($(this).val() == "1") {
  473.         $("#bits_student_lable_present").show();
  474.         $('#id_1-present_bits_student_id').prop('required',true);
  475.     } else {
  476.         $("#bits_student_lable_present").hide();
  477.         InvalidPbsi(document.getElementById('id_1-present_bits_student_id'))
  478.         $('#id_1-present_bits_student_id').val('');
  479.         $('#id_1-present_bits_student_id').prop('required',false);
  480.     }
  481.     });
  482.  
  483.     // For Parallel studies
  484.     if ($("#id_1-parallel_studies_flag").val() ==1){
  485.         $("#parallel_studies_uni").show();
  486.         $("#parallel_studies_uni1").show();
  487.         $('#id_1-other_uni_name').prop('required',true);
  488.         $('#id_1-other_uni_prog').prop('required',true);
  489.         $('#id_1-pass_year_month').prop('required',true);
  490.         }
  491.         else {
  492.             $("#parallel_studies_uni").hide();
  493.             $("#parallel_studies_uni1").hide();
  494.             $('#id_1-other_uni_name').prop('required',false);
  495.             $('#id_1-other_uni_prog').prop('required',false);
  496.             $('#id_1-pass_year_month').prop('required',false);
  497.         }
  498.  
  499.   // Show the text field and button when the user selects "Yes" in the dropdown
  500.   $("#id_1-parallel_studies_flag").change(function() {
  501.     if ($(this).val() == "1") {
  502.     $("#parallel_studies_uni").show();
  503.     $("#parallel_studies_uni1").show();
  504.     $('#id_1-other_uni_name').prop('required',true);
  505.     $('#id_1-other_uni_prog').prop('required',true);
  506.     $('#id_1-pass_year_month').prop('required',true);
  507.     } else {
  508.       $("#parallel_studies_uni").hide();
  509.       $("#parallel_studies_uni1").hide();
  510.       InvalidPym(document.getElementById('id_1-pass_year_month'))
  511.       InvalidOun(document.getElementById('id_1-other_uni_name'))
  512.       InvalidOup(document.getElementById('id_1-other_uni_prog'))
  513.       $('#id_1-other_uni_name').val('');
  514.       $('#id_1-other_uni_prog').val('');
  515.       $('#id_1-pass_year_month').val('');
  516.       $('#id_1-other_uni_prog').prop('required',false);
  517.       $('#id_1-pass_year_month').prop('required',false);
  518.       $('#id_1-other_uni_name').prop('required',false);
  519.     }
  520.   });
  521.   // check cgpa
  522.   if ($('#cgpa').is(":checked")){
  523.     $("#cpgaContainer").show();
  524.     $('#id_1-cpga_outoff').prop('required',true);
  525.     $('#id_1-percentage_marks_cgpa').attr('placeholder', 'CGPA');
  526.     }
  527.     else {
  528.     $("#cpgaContainer").hide();
  529.     $('#id_1-cpga_outoff').prop('required',false);
  530.     $('#id_1-percentage_marks_cgpa').attr('placeholder', 'Percentage');
  531.     }
  532.  
  533.     $('input[name="marksOrCgpa"]').change(function () {
  534.     if ($(this).val() === 'cgpa') {
  535.         $('#cpgaContainer').show();
  536.         $('#id_1-cpga_outoff').prop('required', true);
  537.         $('#id_1-percentage_marks_cgpa').val('');
  538.         $('#id_1-percentage_marks_cgpa').attr('placeholder', 'CGPA');
  539.     } else {
  540.         $('#cpgaContainer').hide();
  541.         $('#id_1-percentage_marks_cgpa').val('');
  542.         $('#id_1-cpga_outoff').val('');
  543.         $('#id_1-cpga_outoff').prop('required', false);
  544.         $('#id_1-percentage_marks_cgpa').attr('placeholder', 'Percentage');
  545.     }
  546.     });
  547.  
  548.     //document.getElementById("id_4-program").readOnly = true;
  549.     });
  550.  
  551.     // Date of Birth validation
  552.     $(document).ready(function() {
  553.         let currentDate = new Date().toISOString().split('T')[0];
  554.     
  555.         $('#id_0-date_of_birth').attr('max', currentDate);
  556.  
  557.         $('#id_0-date_of_birth').on('blur', function() {
  558.         let dateOfBirth = $(this).val();
  559.         let errorSpanId = 'dobError';
  560.  
  561.         if (dateOfBirth) {
  562.             let today = new Date();
  563.             let selectedDate = new Date(dateOfBirth);
  564.             let age = today.getFullYear() - selectedDate.getFullYear() - ((today.getMonth() < selectedDate.getMonth() || (today.getMonth() === selectedDate.getMonth() && today.getDate() < selectedDate.getDate())) ? 1 : 0);
  565.             if (age < 17) {
  566.                 updateDobErrorMessage('Minimum age should be 17 years.', errorSpanId);
  567.                 $(this).val('');
  568.             }
  569.             else{
  570.                 updateDobErrorMessage('', errorSpanId);
  571.             }
  572.         }
  573.         });
  574.         function updateDobErrorMessage(message, errorSpanId) {
  575.             $('#' + errorSpanId).text(message);
  576.         }
  577.     });
  578.     
  579. </script>
  580. <style>
  581.     body {
  582.         background: #EEEEEE;
  583.     }
  584.     .logo-row {
  585.         margin: 0 auto;
  586.         padding: 20px;
  587.         text-align: center;
  588.         max-width: 500px;
  589.     }
  590.  
  591.     .logo {
  592.         max-width: 100%;
  593.         text-align: center;
  594.         margin-left: -5px;
  595.     }
  596.  
  597.     .menu-top {
  598.         background: #74c3e8c9 ;
  599.         /* height: 48px; */
  600.         line-height: 48px;
  601.         color: #211D70;
  602.         border-top: 2px solid #FFF;
  603.         border-bottom: 2px solid #FFF;
  604.     }
  605.  
  606.     .menu-top .title {
  607.         padding-left: 20px;
  608.         font-size: 18px;
  609.         font-weight: bold;
  610.         line-height: 48px;
  611.         height: 48px;
  612.     }
  613.  
  614.     .menu-top .title  span {
  615.         display: inline-block;
  616.         vertical-align: middle;
  617.         line-height: normal;
  618.     }
  619.  
  620.     .menu-top .links {
  621.         display: inline-block;
  622.         text-align: right;
  623.         vertical-align: middle;
  624.         
  625.     }
  626.  
  627.     .menu-top .links a {
  628.         color: #211D70;
  629.         text-align: center;
  630.         text-decoration: none;
  631.         font-size: 12px;
  632.         padding: 4px;
  633.         
  634.     }
  635.  
  636.     .row.menu-top-container a:after {
  637.         content: "";
  638.         background: #211D70;
  639.         position: absolute;
  640.         bottom: 4px;
  641.         height: 40%;
  642.         width: 1px;
  643.         margin: 10px 4px;
  644.     }
  645.     
  646.     .menu-top .links a:last-child:after {
  647.             background: none;
  648.         }
  649.  
  650.     .title-h2 {
  651.         color: #211D70;
  652.         font-size: 18px;
  653.         font-weight: 800;
  654.         padding: 10px 0px 20px 0px;
  655.     }
  656.     .title-h1 {
  657.         color: #211D70;
  658.         font-size: 16px;
  659.         font-weight: 600;
  660.         padding: 10px 0px 20px 0px;
  661.     }
  662.  
  663.     .outer-cf {
  664.         padding: 4px 10px ; 
  665.     }
  666.     .inner-cf {
  667.         border-radius: 18px;
  668.     }
  669.  
  670.     .vertical-navbar {
  671.         border-right: 2px dashed #EEE;
  672.         color: #211D70;
  673.         font-size: 14px;
  674.         padding: 10px;
  675.     }
  676.  
  677.     form {
  678.         padding: 10px;
  679.     }
  680.  
  681.     #list-unstyled {
  682.         overflow: hidden;
  683.         
  684.         counter-reset: step;
  685.     }
  686.  
  687.     #list-unstyled li {
  688.      list-style-type: none;
  689.  
  690.     position: relative;
  691.     width: 100%;
  692.     
  693.       padding: 8px 0px 40px 30px;
  694.     
  695.     }
  696.  
  697.     #list-unstyled li:before {
  698.         /*
  699.         content: counter(step);
  700.         counter-increment: step;
  701.         width: 24px;
  702.         height: 24px;
  703.         line-height: 24px;
  704.         display: block;
  705.         font-size: 12px;
  706.         color: white;
  707.         background: #211D70;
  708.         border-radius: 25px;   
  709.         */
  710.         content: counter(step);
  711.         counter-increment: step;
  712.         height: 24px;
  713.         width: 24px;
  714.         line-height: 20px;
  715.         border: 1px solid blue;
  716.         border-radius: 50%;
  717.         color: white;
  718.         text-align: center;
  719.         position: absolute;      
  720.         background: #211D70;
  721.         left: 0;
  722.         top: 4px;
  723.         
  724.     }
  725.  
  726.     #list-unstyled li:after {
  727.         content: '';
  728.         width: 100%;
  729.         height: 2px;
  730.         background: white;
  731.         position: absolute;
  732.         left: -50%;
  733.         top: 9px;
  734.         z-index: -1; /*put it behind the numbers*/
  735.     }
  736. /*
  737.  
  738. #list-unstyled {
  739.     counter-reset: step;
  740.     list-style-type: none;
  741.     font-size: 14px;
  742.     line-height: 48px;
  743.     padding-left: 10px;
  744.     overflow: hidden;
  745. }
  746.     ul#list-unstyled li {
  747.       position: relative;   
  748.       padding: 5px 0 5px 30px;
  749.       line-height: 20px;
  750.  
  751.     }
  752.       ul#list-unstyled li:before {
  753.         content: counter(step);
  754.         counter-increment: step;
  755.         height: 20px;
  756.         width: 20px;
  757.         border: 1px solid blue;
  758.         border-radius: 50%;
  759.         color: red;
  760.         text-align: center;
  761.         position: absolute;      
  762.         left: 0;
  763.         top: 4px;
  764.       }
  765.       */
  766.  
  767.       .footer {
  768.         padding: 20px;
  769.       }
  770.  
  771.     .btn-close {
  772.         cursor: pointer;
  773.     }
  774.  
  775.     .ui-datepicker-calendar {
  776.         display: none;
  777.     }
  778.     /* .table tbody tr:last-child td:first-child {
  779.         border-bottom-left-radius: 10px;
  780.     }
  781.  
  782.     .table tbody tr:last-child td:last-child {
  783.         border-bottom-right-radius: 10px;
  784.     } */
  785.  
  786.     .table tbody tr {
  787.         border-bottom: white ;
  788.     }
  789.  
  790.     .table {
  791.         box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
  792.     }
  793.  
  794.     .errorSpan{
  795.         font-size: 12px;
  796.     }
  797.     {% if wizard.steps.current == '7' %}
  798.     .accordion-button:not(.collapsed)::after {
  799.     display: none !important;
  800.     }
  801.     {% endif %}
  802. </style>
  803. </head>
  804. <body>
  805.     <div class="header row">
  806.         <div class="logo-row">
  807.             <img src="{% static 'assets/images/BIts_Logo-01.png' %}" alt="logo" class="logo">
  808.         </div>
  809.     </div>
  810.     <div class="menu-top row">
  811.         <div class="row menu-top-container">
  812.             <div class="col-sm-12 col-md-6 col-lg-3 title">
  813.                 <span> Application Center</span>
  814.             </div>
  815.             <div class="col-sm-12 col-md-6 col-lg-9 links">
  816.                 <a href="#"> How To Apply </a> <a href="{% url 'auth_logout'%}"> Log Out </a> 
  817.             </div>
  818.         </div>
  819.     </div>
  820.     {% if not escalated_to_superreviewer %}
  821.     <div class="content-container container-fluid outer-cf">
  822.         <div id="toastContainer" class="toast-container"></div>
  823.         <h2 class="text-center title-h2"> 
  824.             <label class="title-h1">PROGRAM :</label> {{ pg_name }}
  825.             {% if pg_not_active %}
  826.             <p class="text-center fs-4 fw-normal text-danger">Warning: New application submissions for this program will not be allowed.</p>
  827.         {% endif %}
  828.         </h2>
  829.         <div class="container-fluid inner-cf wizard">
  830.         <div class="row">
  831.             <div class="col-sm-6 col-md-4 col-lg-3 vertical-navbar">
  832.                 <form method='post' enctype="multipart/form-data">
  833.                     {% csrf_token %} 
  834.                     <ul class="list-unstyled1 ">
  835.                         <li class=" {% if resubmit_check == 'NotAllowed'%} custom-list-item-not {% else%} custom-list-item {% endif %} {% if wizard.steps.current == '0' %}  focus {% else %} {% if 0 <= completed_steps %} complete {% endif %} {% endif %} " {% if 0 <= completed_steps and resubmit_check == 'Allow' %} onclick="gotoStep('0')" {% endif %}> Personal Details </li>
  836.                         <div class="li-vline"></div>
  837.                         <li class="{% if resubmit_check == 'NotAllowed'%} custom-list-item-not {% else %}custom-list-item {% endif %} {% if wizard.steps.current == '1' %} focus {% else %} {% if 1 <= completed_steps %} complete {% endif %} {% endif %}" {% if 0 <= completed_steps and resubmit_check == 'Allow' %} onclick="gotoStep('1')" {% endif %}> Education Details </li>
  838.                         <div class="li-vline"></div>
  839.                         {% if WithoutExperience %}
  840.                         <li class=" {% if resubmit_check == 'NotAllowed'%} custom-list-item-not {% else %}custom-list-item {% endif %} {% if wizard.steps.current == '2' %} focus {% else %} {% if 2 <= completed_steps %} complete {% endif %} {% endif %}" {% if 1 <= completed_steps and resubmit_check == 'Allow' %} onclick="gotoStep('2')" {% endif %}> Employment Details </li>
  841.                         <div class="li-vline"></div>
  842.                         {% endif %}
  843.                         {% if UndertakingFormNav %}
  844.                         <li class="{% if resubmit_check == 'NotAllowed'%} custom-list-item-not {% else %}custom-list-item {% endif %} {% if wizard.steps.current == '3' %} focus {% else %} {% if 3 <= completed_steps %} complete {% endif %} {% endif %}" {% if 2 <= completed_steps and resubmit_check == 'Allow' %} onclick="gotoStep('3')" {% endif %}> Technical Competency </li>
  845.                         <div class="li-vline"></div>
  846.                         {% endif %}
  847.                         <li class="{% if resubmit_check == 'NotAllowed'%} custom-list-item-not {% else %}custom-list-item {% endif %} {% if wizard.steps.current == '4' %} focus {% else %} {% if 4 <= completed_steps %} complete {% endif %} {% endif %}" {% if 3 <= completed_steps and resubmit_check == 'Allow' %} onclick="gotoStep('4')" {% endif %}> Application Fee </li>
  848.                         <div class="li-vline"></div>
  849.                         {% if MentorEmpolyerFormNav %}
  850.                         <li class="{% if resubmit_consent_check %} custom-list-item {% else %} custom-list-item-not {% endif %} {% if wizard.steps.current == '5' %} focus {% else %} {% if 5 <= completed_steps %} complete {% endif %} {% endif %}" {% if 4 <= completed_steps and resubmit_consent_check %} onclick="gotoStep('5')" {% endif %}> Mentor and Employer Consent</li>
  851.                         <div class="li-vline"></div>
  852.                         {% endif %}
  853.                         <li class="custom-list-item {% if wizard.steps.current == '6' %} focus {% else %} {% if 6 <= completed_steps %} complete {% endif %} {% endif %}" {% if 5 <= completed_steps %} onclick="gotoStep('6')" {% endif %}> Review Application</li>
  854.                         <div class="li-vline"></div>
  855.                         <li class="custom-list-item {% if wizard.steps.current == '7' %} focus {% else %} {% if 7 <= completed_steps %} complete {% endif %} {% endif %}" {% if 6 <= completed_steps %} onclick="gotoStep('7')" {% endif %}> Upload Documents </li>
  856.                     </ul>
  857.                     <input type="hidden" name="gotoStepNav" id="gotoStepNav" value="">
  858.                 </form>
  859.             </div>
  860.             <div class="col-sm-6 col-md-8 col-lg-9">
  861.                 <div class="content">
  862.                     <form action="" method="post" enctype="multipart/form-data">
  863.                         {% csrf_token %}
  864.                     
  865.                         {{ wizard.management_form }}
  866.                     
  867.                         {% if wizard.steps.current == '0' %}
  868.                         {% include 'wizardSteps/step_0_personal_form.html' %}
  869.                         {% endif %}
  870.                     
  871.                         {% if wizard.steps.current == '1' %}
  872.                         {% include 'wizardSteps/step_1_education_form.html' %}
  873.                         {% endif %}
  874.                     
  875.                         {% if wizard.steps.current == '2' %}
  876.                         {% include 'wizardSteps/step_2_employment_form.html' %}
  877.                         {% endif %}
  878.                     
  879.                         {% if wizard.steps.current == '3' %}
  880.                         {% include 'wizardSteps/step_3_technical_form.html' %}
  881.                         {% endif %}
  882.                     
  883.                         {% if wizard.steps.current == '4' %}
  884.                         {% include 'wizardSteps/step_4_app_fee_form.html' %}
  885.                         {% endif %}
  886.                     
  887.                         {% if wizard.steps.current == '5' %}
  888.                         {% include 'wizardSteps/step_5_consent_form.html' %}
  889.                         {% endif %}
  890.                     
  891.                         {% if wizard.steps.current == '6' %}
  892.                         {% include 'wizardSteps/step_6_review_form.html' %}
  893.                         {% endif %}
  894.                     
  895.                         {% if wizard.steps.current == '7' %}
  896.                         {% include 'wizardSteps/step_7_upload_form.html' %}
  897.                         {% endif %}
  898.                         
  899.                         {% if wizard.steps.current == '4' %}
  900.                         <div class="button-container d-flex justify-content-end align-items-end">
  901.                             <div>
  902.                                 <input class="btn btn-rounded btn-primary btn-next" type="submit" value="Next" />
  903.                             </div>
  904.                         </div>
  905.                         {% elif wizard.steps.current != '7' %}
  906.                         <div class="button-container d-flex justify-content-end align-items-end">
  907.                             <div>
  908.                                 <input class="btn btn-rounded btn-primary btn-next" type="submit" value="Save & Next" />
  909.                             </div>
  910.                         </div>
  911.                         {% endif %}
  912.                     </form>
  913.                 </div>
  914.             </div>
  915.             </div>
  916.         </div>
  917.     </div>
  918.     <input type="hidden" id="resubmit_check" value="{{resubmit_check}}">
  919.     <div class="footer">
  920.         © 2023 BITS Pilani | Contact us : [email protected]
  921.     </div>
  922.     {% else %}
  923.         <br>
  924.         <p class="text-center fs-3 fw-normal text-danger">Application under review by higher authorities.</p>
  925.     {% endif %}
  926.  
  927.     <!-- popup for education and employment -->
  928.     {% include 'wizardSteps/edu_emp_popup_form.html' %}
  929.  
  930.     <div id="dialog" class="ui-widget" style="display: none;">
  931.     </div>
  932.  
  933.     <!-- popup for resubmit check -->
  934.     <div class="modal fade" id="resubmitmodal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  935.         <div class="modal-dialog modal-dialog-centered">
  936.             <div class="modal-content">
  937.                 <div class="modal-header">
  938.                     <h5 class="modal-title text-center fw-bold fs-4" id="exampleModalLabel">Resubmit Documents</h5>
  939.                 </div>
  940.                 <div class="modal-body text-center fw-4">
  941.                     You are not allowed to edit this page.
  942.                 </div>
  943.                 <div class="modal-footer">
  944.                     <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
  945.                 </div>
  946.             </div>
  947.         </div>
  948.     </div>
  949.  
  950.     <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
  951.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
  952.     <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
  953.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" integrity="sha384-3B6NwesSXE7YJlcLI9RpRqGf2p/EgVH8BgoKTaUrmKNDkHPStTQ3EyoYjCGXaOTS" crossorigin="anonymous">
  954.     <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  955.     <script>
  956.         $(document).ready(function() {
  957.             function initializeCropper(fileInputId) {
  958.                 var $image = $("#image");
  959.                 var cropBoxData;
  960.                 var canvasData;
  961.  
  962.                 $("#modalCrop").on("shown.bs.modal", function () {
  963.                         $image.cropper({
  964.                             viewMode: 1,
  965.                             aspectRatio: null,
  966.                             cropBoxResizable: true,
  967.                             zoomable: true,
  968.                             zoomOnWheel: true,
  969.                         });
  970.                 }).on("hidden.bs.modal", function () {
  971.                     cropBoxData = $image.cropper("getCropBoxData");
  972.                     canvasData = $image.cropper("getCanvasData");
  973.                     $image.cropper("destroy");
  974.                 }).on("hide.bs.modal", function () {
  975.                     if (!$('#' + fileInputId).val()) {
  976.                         $('#' + fileInputId).val("");
  977.                     }
  978.                 });
  979.  
  980.                 $(".js-zoom-in").click(function () {
  981.                     $image.cropper("zoom", 0.1);
  982.                 });
  983.  
  984.                 $(".js-zoom-out").click(function () {
  985.                     $image.cropper("zoom", -0.1);
  986.                 });
  987.  
  988.                 $(".js-rotate-c").click(function () {
  989.                     $image.cropper("rotate", 90);
  990.                 });
  991.  
  992.                 $(".js-rotate-ac").click(function () {
  993.                     $image.cropper("rotate", -90);
  994.                 });
  995.  
  996.                 $(".js-crop-and-upload").click(function () {
  997.                     var cropData = $image.cropper("getData");
  998.                     if (fileInputId === "id_6-photo_file") {
  999.                         $('#id_6-x').val(cropData["x"]);
  1000.                         $('#id_6-y').val(cropData["y"]);
  1001.                         $('#id_6-height').val(cropData["height"]);
  1002.                         $('#id_6-width').val(cropData["width"]);
  1003.                         $('#id_6-rotate').val(cropData["rotate"]);
  1004.                     } else if (fileInputId === "id_6-signature_file") {
  1005.                         $('#id_6-x2').val(cropData["x"]);
  1006.                         $('#id_6-y2').val(cropData["y"]);
  1007.                         $('#id_6-height2').val(cropData["height"]);
  1008.                         $('#id_6-width2').val(cropData["width"]);
  1009.                         $('#id_6-rotate2').val(cropData["rotate"]);
  1010.                     }
  1011.                     $("#modalCrop").modal("hide");
  1012.                 });
  1013.  
  1014.                 $(".crop_close").click(function () {
  1015.                     if (fileInputId === "id_6-photo_file") {
  1016.                         $('#id_6-x').val('');
  1017.                         $('#id_6-y').val('');
  1018.                         $('#id_6-height').val('');
  1019.                         $('#id_6-width').val('');
  1020.                         $('#id_6-rotate').val('');
  1021.                     } else if (fileInputId === "id_6-signature_file") {
  1022.                         $('#id_6-x2').val('');
  1023.                         $('#id_6-y2').val('');
  1024.                         $('#id_6-height2').val('');
  1025.                         $('#id_6-width2').val('');
  1026.                         $('#id_6-rotate2').val('');
  1027.                     }
  1028.                 });
  1029.             }
  1030.  
  1031.             $('#id_6-photo_file').change(function () {
  1032.                 if (this.files && this.files[0]) {
  1033.                     var reader = new FileReader();
  1034.                     reader.onload = function (e) {
  1035.                         $("#image").attr("src", e.target.result);
  1036.                         $("#modalCrop").modal("show");
  1037.                     }
  1038.                     reader.readAsDataURL(this.files[0]);
  1039.                     initializeCropper("id_6-photo_file");
  1040.                 }
  1041.             });
  1042.  
  1043.             $('#id_6-signature_file').change(function () {
  1044.                 if (this.files && this.files[0]) {
  1045.                     var reader = new FileReader();
  1046.                     reader.onload = function (e) {
  1047.                         $("#image").attr("src", e.target.result);
  1048.                         $("#modalCrop").modal("show");
  1049.                     }
  1050.                     reader.readAsDataURL(this.files[0]);
  1051.                     initializeCropper("id_6-signature_file");
  1052.                 }
  1053.             });
  1054.             $("#id_1-pass_year_month").datepicker({
  1055.                 dateFormat: "M yy",
  1056.                 changeMonth: true,
  1057.                 changeYear: true,
  1058.                 showButtonPanel: true,
  1059.                 defaultDate: new Date(),
  1060.                 minDate: 0,
  1061.                 onClose: function(dateText, inst) {
  1062.                     var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
  1063.                     var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
  1064.                     $(this).datepicker('setDate', new Date(year, month, 1));
  1065.                 }
  1066.             });
  1067.  
  1068.             $('#id_5-mentor_phone').on('focusout', function () {
  1069.                 validatePhoneNumber($(this).val(), 'mentor');
  1070.             });
  1071.  
  1072.             $('#id_5-hr_phone').on('focusout', function () {
  1073.                 validatePhoneNumber($(this).val(),'hr');
  1074.             });
  1075.  
  1076.             $('#id_5-mentor_email').on('focusout', function () {
  1077.                 validateEmail($(this).val(), 'mentor');
  1078.             });
  1079.  
  1080.             $('#id_5-hr_email').on('focusout', function () {
  1081.                 validateEmail($(this).val(),'hr');
  1082.             });
  1083.  
  1084.             let date = new Date();
  1085.             let month = (date.getMonth() + 1).toString().padStart(2, '0');
  1086.             let day = date.getDate().toString().padStart(2, '0');
  1087.             let currentDate = `${date.getFullYear()}-${month}-${day}`;
  1088.  
  1089.             $('#id_2-current_org_employment_date').attr('max', currentDate);
  1090.  
  1091.             // certification popup 
  1092.             {% if  show_greeting_msg %}
  1093.             {% include 'certificate/greeting_style.html' %}
  1094.             {% endif %}
  1095.             
  1096.         });
  1097.     </script>
  1098.     <script>
  1099.         
  1100.         function showToast(message, type) {
  1101.             const toastElement = document.createElement('div');
  1102.             toastElement.className = `toast toast-error container`;
  1103.             toastElement.innerHTML = `
  1104.                 <div class="row">
  1105.                     <div class="col-auto" style="margin-left: auto; display: flex; justify-content: center;">
  1106.                         <div class="close-btn" onclick="closeToast(this)">
  1107.                             <i class="fas fa-times"></i>
  1108.                         </div>
  1109.                     </div>
  1110.                 </div>
  1111.                 <div class="row">
  1112.                 <div class="col">${message}</div>
  1113.                 </div>
  1114.                 <br>
  1115.                 <div class="loading-line"></div>
  1116.             `;
  1117.  
  1118.             document.getElementById(type).appendChild(toastElement);
  1119.  
  1120.             setTimeout(() => {
  1121.                 toastElement.classList.add('show');
  1122.             }, 10);
  1123.  
  1124.             setTimeout(() => {
  1125.                 toastElement.classList.remove('show');
  1126.                 setTimeout(() => {
  1127.                 toastElement.remove();
  1128.                 }, 500);
  1129.             }, 5000);
  1130.         }
  1131.  
  1132.         function closeToast(button) {
  1133.             const toast = button.closest('.toast');
  1134.             toast.classList.remove('show');
  1135.             setTimeout(() => {
  1136.                 toast.remove();
  1137.             }, 500);
  1138.         }
  1139.             
  1140.         function gotoStep(step) {
  1141.             if ($('#resubmit_check').val() === 'NotAllowed' && ['0', '1', '2', '3', '4'].includes(step)) {
  1142.                 $("#resubmitmodal").modal("show");
  1143.                 return false;
  1144.             }
  1145.             let gotoStepNav = document.getElementById('gotoStepNav');
  1146.             let confirmed = window.confirm('You have unsaved changes. Are you sure you want to go to the next form?');
  1147.             if(confirmed) {
  1148.                 gotoStepNav.value = step;
  1149.                 gotoStepNav.form.submit();
  1150.             }
  1151.         }
  1152.  
  1153.         // Custom Validation For Educational Page
  1154.         function InvalidPlk(textbox) {
  1155.             
  1156.             flag = $('#id_1-programming_flag').val();
  1157.             
  1158.             if( textbox.value === "" && flag === 'True' ){
  1159.                     textbox.setCustomValidity('Please Enter Programming Language');
  1160.             } else {
  1161.                     textbox.setCustomValidity('');
  1162.                     }
  1163.             return true;
  1164.         }
  1165.  
  1166.         function InvalidBsi(textbox) {
  1167.             
  1168.             flag = $('#id_1-prior_student_flag').val();
  1169.             
  1170.             if( textbox.value === "" && flag === '1' ){
  1171.                     textbox.setCustomValidity('Please Enter BITS ID Number (if past student) ');
  1172.             } else {
  1173.                     textbox.setCustomValidity('');
  1174.                     }
  1175.             return true;
  1176.         }
  1177.  
  1178.         function InvalidPbsi(textbox) {
  1179.             
  1180.             flag = $('#id_1-other_bits_prog_flag').val();
  1181.             
  1182.             if( textbox.value === "" && flag === '1' ){
  1183.                     textbox.setCustomValidity('Please Enter BITS ID Number (if present student)');
  1184.             } else {
  1185.                     textbox.setCustomValidity('');
  1186.                     }
  1187.             return true;
  1188.         }
  1189.  
  1190.         function InvalidPym(textbox) {
  1191.             
  1192.             flag = $('#id_1-parallel_studies_flag').val();
  1193.             
  1194.             if( textbox.value === "" && flag === '1' ){
  1195.                     textbox.setCustomValidity('Please Enter Passing year and month');
  1196.             } else {
  1197.                     textbox.setCustomValidity('');
  1198.                     }
  1199.             return true;
  1200.         }
  1201.  
  1202.         function InvalidOun(textbox) {
  1203.             
  1204.             flag = $('#id_1-parallel_studies_flag').val();
  1205.             
  1206.             if( textbox.value === "" && flag === '1' ){
  1207.                     textbox.setCustomValidity('Please Enter Name of the University (if currently enrolled in any other university or college)');
  1208.             } else {
  1209.                     textbox.setCustomValidity('');
  1210.                     }
  1211.             return true;
  1212.         }        
  1213.         
  1214.         function InvalidOup(textbox) {
  1215.             
  1216.             flag = $('#id_1-parallel_studies_flag').val();
  1217.             
  1218.             if( textbox.value === "" && flag === '1' ){
  1219.                     textbox.setCustomValidity('Please Enter Programme Name (if currently enrolled in any other university or college)');
  1220.             } else {
  1221.                     textbox.setCustomValidity('');
  1222.                     }
  1223.             return true;
  1224.         }
  1225.         
  1226.         // contact number validations
  1227.  
  1228.         function validatePersonalPhoneNumber(phone1Value, phone0Selector, errorSpanId) {
  1229.             var phoneRegex = /^\+?[\d\s\-()+]{10}$/;
  1230.         
  1231.             var phone0Value = $(phone0Selector).val();
  1232.             if (phone0Value === '+91' && !phoneRegex.test(phone1Value.val())) {
  1233.  
  1234.                 updateErrorMessageContact('Please enter 10 digit number.', errorSpanId);
  1235.                 phone1Value.val('');
  1236.                 return false;
  1237.             }else {
  1238.                 updateErrorMessageContact('', errorSpanId);
  1239.             }
  1240.         
  1241.             var phoneValue = $('#id_0-phone_1').val().trim();
  1242.             var mobileValue = $('#id_0-mobile_1').val().trim();
  1243.         
  1244.             if (phoneValue.trim() !== '' && mobileValue.trim() !== '' && phoneValue === mobileValue) {
  1245.                 updateErrorMessageContact('Primary and Alternate number cannot be the same.', errorSpanId);
  1246.                 phone1Value.val('');
  1247.                 return false;
  1248.             } else {
  1249.                 updateErrorMessageContact('', errorSpanId);
  1250.             }
  1251.         }
  1252.         
  1253.         $('#id_0-phone_1').on('focusout', function () {
  1254.             validatePersonalPhoneNumber($(this), '#id_0-phone_0', 'primaryError');
  1255.         });
  1256.         
  1257.         $('#id_0-mobile_1').on('focusout', function () {
  1258.             validatePersonalPhoneNumber($(this), '#id_0-mobile_0', 'alternateError');
  1259.         });
  1260.         
  1261.         function updateErrorMessageContact(message, spanId) {
  1262.             $('#' + spanId).text(message);
  1263.         }
  1264.  
  1265.         function validatePhoneNumber(phoneNumber,field) {
  1266.             var phoneRegex = /^\+?[\d\s\-()+]{10,15}$/;
  1267.  
  1268.             if (!phoneRegex.test(phoneNumber)) {
  1269.                 showToast('Please enter a valid phone number.', 'toastContainer');
  1270.                 if (field === 'mentor') {
  1271.                     $('#id_5-mentor_phone').val('');
  1272.                     $('#id_5-mentor_phone').focus();
  1273.                 } else {
  1274.                     $('#id_5-hr_phone').val('');
  1275.                     $('#id_5-hr_phone').focus();
  1276.                 }
  1277.             }
  1278.         }
  1279.  
  1280.         function validateEmail(email,field) {
  1281.             let isValidEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
  1282.             
  1283.             if (!isValidEmail) {
  1284.                 showToast('Please enter a valid email address.', 'toastContainer');
  1285.                 if (field === 'mentor') {
  1286.                     $('#id_5-mentor_email').val('');
  1287.                     $('#id_5-mentor_email').focus();
  1288.                 } else {
  1289.                     $('#id_5-hr_email').val('');
  1290.                     $('#id_5-hr_email').focus();
  1291.                 }
  1292.             }
  1293.         }
  1294.  
  1295.         $('#id_1-qual_cat option[value=""]').text('Choose Qualification Level');
  1296.  
  1297.         // validations for education and employment popups 
  1298.         $('#id_2-start_date').attr('max', $('#id_2-current_org_employment_date').val())
  1299.         $('#id_2-end_date').attr('max', $('#id_2-current_org_employment_date').val())
  1300.         
  1301.         function updateMinDate() {
  1302.             let joinDate = $('#id_2-current_org_employment_date');
  1303.             let dojErr = document.getElementById('dojErr');
  1304.             $.ajax({
  1305.                 type: "GET",
  1306.                 url: "{% url 'registrationForm:join-date-ajax'%}",
  1307.                 data: { 'joining_date': joinDate.val() },
  1308.                 cache: false,
  1309.                 success: function (data) {
  1310.                     if(data.value){
  1311.                         dojErr.textContent = "Employment starts 10 years post-birth";
  1312.                         dojErr.style.display = 'block';
  1313.                         joinDate.val('');
  1314.                     } else {
  1315.                         dojErr.style.display = 'none';
  1316.                         $('#id_2-start_date').attr('max', $('#id_2-current_org_employment_date').val())
  1317.                         $('#id_2-end_date').attr('max', $('#id_2-current_org_employment_date').val())
  1318.                     }
  1319.                 }
  1320.             });
  1321.         }
  1322.  
  1323.         function dates() {
  1324.             let currentDate = new Date($('#id_2-current_org_employment_date').val());
  1325.             let startDate = new Date($('#id_2-start_date').val());
  1326.             let endDate = new Date($('#id_2-end_date').val());
  1327.             return [currentDate, startDate, endDate];
  1328.         }
  1329.  
  1330.         function calculateDaysDifference(startDate, endDate) {
  1331.             let timeDifference = endDate - startDate;
  1332.             return Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  1333.         }
  1334.  
  1335.         function updateStartDate() {
  1336.             $('#id_2-end_date').attr('min', $('#id_2-start_date').val());
  1337.         }
  1338.  
  1339.         function cgpaValidate(element) {
  1340.             let val = parseInt(element.value, 10);
  1341.             let eduErrRow = document.getElementById('eduErrRow');
  1342.             let eduErr = document.getElementById('eduErr');
  1343.  
  1344.  
  1345.             if (isNaN(val) || val < 0 || val > 10 || val % 1 !== 0) {
  1346.                 eduErr.textContent = "Please enter a valid CGPA between 0 and 10";
  1347.                 eduErrRow.style.display = 'block';
  1348.                 element.value = '';
  1349.                 element.focus();
  1350.             } else {
  1351.                 eduErrRow.style.display = 'none';
  1352.             }
  1353.         }
  1354.  
  1355.         $("#id_1-other_degree").hide();
  1356.         $("#id_1-other_discipline").hide();
  1357.  
  1358.         function expFieldsRefresh() {
  1359.             $("#id_2-organization").val('');
  1360.             $("#id_2-designations").val('');
  1361.             $("#id_2-start_date").val('');
  1362.             $("#id_2-end_date").val('');
  1363.             $("#edit_rows_exp").val('')
  1364.             $("#save_rec_exp").attr('name', 'Save');
  1365.         }
  1366.  
  1367.         function eduFieldsRefresh() {
  1368.             $("#id_1-qual_cat").val('');
  1369.             $("#id_1-degree").val('');
  1370.             $("#id_1-school_college").val('');
  1371.             $("#id_1-discipline").val('');
  1372.             $("#id_1-start_year").val('');
  1373.             $("#id_1-completion_year").val('');
  1374.             $("#percentMarks").prop('checked', true);
  1375.             $("#id_1-other_discipline").attr("type","hidden");
  1376.             $("#id_1-other_discipline").attr("required","false");
  1377.             $("#id_1-other_discipline").val('');
  1378.             $("#id_1-other_degree").attr("type","hidden");
  1379.             $("#id_1-other_degree").attr("required","false");
  1380.             $("#id_1-other_degree").val('');
  1381.             $('#id_1-cpga_outoff').prop('required',false);
  1382.             $('#cpgaContainer').hide();
  1383.             $('#id_1-percentage_marks_cgpa').val('');
  1384.             $('#id_1-cpga_outoff').val('');
  1385.             $('#id_1-percentage_marks_cgpa').attr('placeholder', 'Percentage');
  1386.             $("#edit_rows").val('')
  1387.             $("#save_rec").attr('name', 'Save');
  1388.             
  1389.         }
  1390.  
  1391.         function updatePopupHeader() {
  1392.             $("#exampleModalLabel").text("Add Qualification");
  1393.             $("#exampleModalLabel1").text("Add Employment Details");
  1394.         }
  1395.  
  1396.         function QualCategory() {
  1397.             let select_id = $("#id_1-qual_cat").val();
  1398.             let qualName = $('#id_1-degree')
  1399.             let disc = $('#id_1-discipline')
  1400.  
  1401.             // Clear values related to the selection
  1402.             $("#id_1-degree").val('');
  1403.             let select_input = $("#id_1-other_degree");
  1404.             select_input.attr("type", "hidden");
  1405.             select_input.removeAttr("required");
  1406.             select_input.val('');
  1407.             qualName.prop('disabled', false);
  1408.             qualName.val('');
  1409.             disc.prop('disabled', false);
  1410.             disc.val('');
  1411.             
  1412.             if (select_id == '1') {
  1413.                 qualName.val('10th Grade (Matriculation)')
  1414.                 qualName.prop('disabled', true);
  1415.                 disc.val('10th MATRICULATION')
  1416.                 disc.prop('disabled', true);
  1417.             }
  1418.             $.ajax({
  1419.                 type: "GET",
  1420.                 url: "{% url 'registrationForm:qual-category-ajax'%}",
  1421.                 data: { 'select_id': select_id },
  1422.                 cache: false,
  1423.                 success: function (data) {
  1424.                     autocompleteDataInds = data['degree']
  1425.                 },
  1426.             });
  1427.         }
  1428.  
  1429.         function ListOfDiscipline() {
  1430.             let qualName = $('#id_1-degree').val();
  1431.  
  1432.             if (qualName) {
  1433.                 $.ajax({
  1434.                     type: "GET",
  1435.                     url: "{% url 'registrationForm:qual-discipline-ajax'%}",
  1436.                     data: { 'qualName': qualName },
  1437.                     cache: false,
  1438.                     success: function (data) {
  1439.                         autocompleteData = data['disciplines']
  1440.                     },
  1441.                 });
  1442.             }
  1443.         }
  1444.  
  1445.         function OtherBox(selectBox){
  1446.             let select_id = $("#"+selectBox.id ).val();
  1447.             let select_input= selectBox.id === 'id_1-discipline' ? $("#id_1-other_discipline") : $("#id_1-other_degree");
  1448.             if (select_id == "Others"){
  1449.                 select_input.attr("type", "text");
  1450.                 select_input.show();
  1451.                 select_input.attr("required","true");
  1452.             }
  1453.             else{
  1454.                 select_input.attr("type","hidden");
  1455.                 select_input.removeAttr("required");
  1456.                 select_input.val('');
  1457.             }
  1458.         
  1459.         }
  1460.  
  1461.         function saveRec(event) {
  1462.  
  1463.             event.preventDefault();
  1464.             let quaLevel = $("#id_1-qual_cat").val();
  1465.             let quaName = $("#id_1-degree").val();
  1466.             let board = $("#id_1-school_college").val();
  1467.             let quaDisc = $("#id_1-discipline").val();
  1468.             let startYear = $("#id_1-start_year").val();
  1469.             let endYear = $("#id_1-completion_year").val();
  1470.             let percentage = $("#id_1-percentage_marks_cgpa").val();
  1471.             let outoff = $("#id_1-cpga_outoff").val();
  1472.             let percentMarks = $("#percentMarks").is(":checked")
  1473.             let cgpa = $('#cgpa').is(":checked")
  1474.             let other_degree = $("#id_1-other_degree").val();
  1475.             let other_discipline = $("#id_1-other_discipline").val();
  1476.             let csrfToken = "{{ csrf_token }}";
  1477.             if (quaLevel == '1') {
  1478.                 qualName = '10th Grade (Matriculation)'
  1479.                 quaDisc = '10th MATRICULATION';
  1480.             }
  1481.  
  1482.             let eduErrRow = document.getElementById('eduErrRow');
  1483.             let eduErr = document.getElementById('eduErr');
  1484.  
  1485.             if (!quaLevel || !quaName || !board || !quaDisc || !startYear || !endYear || !percentage) {
  1486.  
  1487.                 eduErr.textContent = "Please fill in all required fields";
  1488.                 eduErrRow.style.display = 'block';
  1489.  
  1490.             }else {
  1491.  
  1492.                 let val = false;
  1493.  
  1494.                 if (cgpa) {
  1495.                     if (outoff) {
  1496.                         if (parseInt(outoff) < parseFloat(percentage)) {
  1497.                             eduErr.textContent = "CGPA is Greater than Out of";
  1498.                             eduErrRow.style.display = 'block';
  1499.                             return false;
  1500.                         }
  1501.                     }
  1502.                 }
  1503.                 
  1504.                 if (percentMarks) {
  1505.                     if (100 < parseFloat(percentage)) {
  1506.                         eduErr.textContent = "Percentage should less than or equal to 100";
  1507.                         eduErrRow.style.display = 'block';
  1508.                         return false;
  1509.                     }
  1510.                 }
  1511.                 
  1512.                 if ($("#id_1-degree" ).val() === "Others") {
  1513.                     if (!other_degree) {
  1514.                         val = true;
  1515.                     }
  1516.                 }
  1517.                 if ($("#id_1-discipline" ).val() === "Others") {
  1518.                     if (!other_discipline) {
  1519.                         val = true;
  1520.                     }
  1521.                 }                
  1522.                 if (cgpa) {
  1523.                     if (!outoff) {
  1524.                         val = true;
  1525.                     }
  1526.                 }
  1527.                 if (val) {
  1528.                     eduErr.textContent = "Please fill in all required fields";
  1529.                     eduErrRow.style.display = 'block';
  1530.                 }else {
  1531.  
  1532.                     let param = {
  1533.                         "quaLevel": quaLevel,
  1534.                         "quaName": quaName,
  1535.                         "board": board,
  1536.                         "quaDisc": quaDisc,
  1537.                         "startYear": startYear,
  1538.                         "endYear": endYear,
  1539.                         "percentage": percentage,
  1540.                         "outoff": outoff,
  1541.                         "percentMarks": percentMarks,
  1542.                         "cgpa": cgpa,
  1543.                         "other_degree":other_degree,
  1544.                         "other_discipline":other_discipline,
  1545.                         "name":$(event.currentTarget).attr('name'),
  1546.                         "id": $("#edit_rows").val(),
  1547.                     };
  1548.                     
  1549.                     $.ajax({
  1550.                         url: "{% url 'registrationForm:add_or_edit_qualification' %}",
  1551.                         contentType: "application/json",
  1552.                         headers: {
  1553.                             'X-CSRFToken': csrfToken
  1554.                         },
  1555.                         type: 'POST',
  1556.                         data: JSON.stringify(param),
  1557.                         success: function (data) {
  1558.                             if (data.id) {
  1559.                                 tbody = $("#edu_tbody");
  1560.                                 newRow = $("<tr id='edu"+data.id+"'>");
  1561.                                 cell1 = $("<td>").text(data.quaLevel);
  1562.                                 cell2 = data.quaName === 'Others' ? $("<td>").text(data.other_degree) : $("<td>").text(data.quaName); 
  1563.                                 cell3 = $("<td>").text(data.board);
  1564.                                 cell4 = data.quaDisc === 'Others' ? $("<td>").text(data.other_discipline) : $("<td>").text(data.quaDisc);
  1565.                                 cell5 = $("<td>").text(data.startYear);
  1566.                                 cell6 = $("<td>").text(data.endYear);
  1567.                                 cell7 = data.outoff ? $("<td>").text(data.percentage +'/'+ data.outoff) : $("<td>").text(data.percentage);
  1568.                                 cell8 = $("<td>").html('<i class="fas fa-edit fa-lg" data-id="'+ data.id +'" onclick="scqEdit(event)"></i>');
  1569.                                 cell9 = $("<td>").html('<i class="fa-regular fa-trash-can fa-lg" aria-hidden="true" data-id="'+ data.id +'" onclick="scqDel(event)"></i>');
  1570.                                 newRow.append(cell1, cell2, cell3, cell4, cell5, cell6, cell7, cell8, cell9);
  1571.                                 tbody.append(newRow);
  1572.                             } else {
  1573.                                 let rowToUpdate = $('#edu' + $("#edit_rows").val());
  1574.                                 rowToUpdate.find('td:eq(0)').text(data.quaLevel);
  1575.                                 rowToUpdate.find('td:eq(1)').text(data.quaName === 'Others' ? data.other_degree : data.quaName);
  1576.                                 rowToUpdate.find('td:eq(2)').text(data.board);
  1577.                                 rowToUpdate.find('td:eq(3)').text(data.quaDisc === 'Others' ? data.other_discipline: data.quaDisc);
  1578.                                 rowToUpdate.find('td:eq(4)').text(data.startYear);
  1579.                                 rowToUpdate.find('td:eq(5)').text(data.endYear);
  1580.                                 rowToUpdate.find('td:eq(6)').text(data.outoff ? data.percentage +'/'+ data.outoff : data.percentage);
  1581.                             }
  1582.                             eduFieldsRefresh()
  1583.                             $("#staticBackdrop").modal("hide");
  1584.                         },
  1585.                         error: function (xhr, status, error) {
  1586.                             console.error("AJAX request failed. Status:", status, "Error:", error);
  1587.                         }
  1588.                     });
  1589.                 }
  1590.             }
  1591.             
  1592.         }
  1593.  
  1594.         function saveExpRec(event) {
  1595.             
  1596.             event.preventDefault();
  1597.  
  1598.             let org = $("#id_2-organization").val();
  1599.             let desc = $("#id_2-designations").val();
  1600.             let startDate = $("#id_2-start_date").val();
  1601.             let endDate = $("#id_2-end_date").val();
  1602.             let csrfToken = "{{ csrf_token }}";
  1603.             let empErr = document.getElementById('empErr');
  1604.             let empErrRow = document.getElementById('empErrRow');
  1605.  
  1606.             if (!org || !desc || !startDate || !endDate) {
  1607.  
  1608.                 empErr.textContent = "Please fill in all required fields";
  1609.                 empErrRow.style.display = 'block';
  1610.  
  1611.             } else {
  1612.  
  1613.                 const [currentDate, start_date, end_date] = dates();
  1614.                 let daysCount = calculateDaysDifference(start_date, end_date);
  1615.  
  1616.                 if (start_date > currentDate) {
  1617.                     empErr.textContent = "Invalid date sequence: Start date > Date of Joining Current Organization";
  1618.                     empErrRow.style.display = 'block';
  1619.                     return false;
  1620.                 } else if (end_date > currentDate) {
  1621.                     empErr.textContent = "Invalid date sequence: End date > Date of Joining Current Organization";
  1622.                     empErrRow.style.display = 'block';
  1623.                     return false;
  1624.                 } else if (start_date > end_date) {
  1625.                     empErr.textContent = "Invalid date sequence: Start date > End Date";
  1626.                     empErrRow.style.display = 'block';
  1627.                     return false;
  1628.                 } else if (daysCount < 15) {
  1629.                     empErr.textContent = "Work Experience should not less than 15 days.";
  1630.                     empErrRow.style.display = 'block';
  1631.                     return false;
  1632.                 } else {
  1633.                     empErrRow.style.display = 'none';
  1634.                 }
  1635.  
  1636.                 let param = {
  1637.                     "organization": org,
  1638.                     "designations": desc,
  1639.                     "start_date": startDate,
  1640.                     "end_date": endDate,
  1641.                     "name": $(event.currentTarget).attr('name'),
  1642.                     "id": $("#edit_rows_exp").val(),
  1643.                 };
  1644.  
  1645.                 $.ajax({
  1646.                     url: "{% url 'registrationForm:add_or_edit_exp' %}",
  1647.                     contentType: "application/json",
  1648.                     headers: {
  1649.                         'X-CSRFToken': csrfToken
  1650.                     },
  1651.                     type: 'POST',
  1652.                     data: JSON.stringify(param),
  1653.                     success: function (data) {
  1654.                         if (data.error) {
  1655.                             empErr.textContent = data.message;
  1656.                             empErrRow.style.display = 'block';
  1657.                             return false;
  1658.                         } else {
  1659.                             empErrRow.style.display = 'none';
  1660.                         }
  1661.                         if (data.id) {
  1662.                             tbody = $("#exp_tbody");
  1663.                             newRow = $("<tr id='exp"+data.id+"'>");
  1664.                             cell1 = $("<td>").text(data.organization);
  1665.                             cell2 = $("<td>").text(data.designations);
  1666.                             cell3 = $("<td>").text(data.start_date);
  1667.                             cell4 = $("<td>").text(data.end_date);
  1668.                             cell5 = $("<td>").html('<i class="fas fa-edit fa-lg" data-id="'+ data.id +'" onclick="scweEdit(event)"></i>');
  1669.                             cell6 = $("<td>").html('<i class="fa-regular fa-trash-can fa-lg" aria-hidden="true" data-id="'+ data.id +'" onclick="scweDel(event)"></i>');
  1670.                             newRow.append(cell1, cell2, cell3, cell4, cell5, cell6);
  1671.                             tbody.append(newRow);
  1672.                         } else {
  1673.                             let rowToUpdate = $('#exp' + $("#edit_rows_exp").val());
  1674.                             rowToUpdate.find('td:eq(0)').text(data.organization);
  1675.                             rowToUpdate.find('td:eq(1)').text(data.designations);
  1676.                             rowToUpdate.find('td:eq(2)').text(data.start_date);
  1677.                             rowToUpdate.find('td:eq(3)').text(data.end_date);
  1678.                         }
  1679.                         expFieldsRefresh()
  1680.                         $("#staticBackdrop").modal("hide");
  1681.                     },
  1682.                     error: function (xhr, status, error) {
  1683.                         console.error('AJAX Error:', error);
  1684.                     }
  1685.                 });
  1686.             }
  1687.         }
  1688.  
  1689.         function StartEndYear(element) {
  1690.             let val = element.id === "id_1-start_year" ? parseInt($("#id_1-completion_year").val()) : parseInt($("#id_1-start_year").val());
  1691.             let yearErr = element.id === "id_1-start_year" ? document.getElementById("startYearErr") : document.getElementById("endYearErr")
  1692.             let valid = false;
  1693.             let msg = "";
  1694.             let inputValue = $(element).val();
  1695.             let currentDate = new Date();
  1696.             let currentYear =currentDate.getFullYear();
  1697.  
  1698.             if (inputValue.length !== 4) {
  1699.                 yearErr.textContent = "Please enter a valid Year";
  1700.                 yearErr.style.display = 'block';
  1701.                 $(element).val('');
  1702.                 $(element).focus();
  1703.                 return false;
  1704.             } else if ( parseInt(inputValue) > currentYear) {
  1705.                 yearErr.textContent = "Please enter a proper Year";
  1706.                 yearErr.style.display = 'block';
  1707.                 $(element).val('');
  1708.                 $(element).focus();
  1709.                 return false;
  1710.             } else if (element.id === "id_1-start_year") {
  1711.                 if (val) {
  1712.                     valid = parseInt(inputValue) > val;
  1713.                     msg = valid ? "Start Year must be less than End Year" : "";
  1714.                 }
  1715.             } else {
  1716.                 yearErr.style.display = 'none';
  1717.                 if (val) {
  1718.                     valid = parseInt(inputValue) < val;
  1719.                     msg = valid ? "End Year must be greater than Start Year" : "";
  1720.                 }
  1721.             }
  1722.  
  1723.             if (valid) {
  1724.                 yearErr.textContent = msg;
  1725.                 yearErr.style.display = 'block';
  1726.                 $(element).val('');
  1727.                 $(element).focus();
  1728.                 return false;
  1729.             }
  1730.             yearErr.style.display = 'none';
  1731.         }
  1732.  
  1733.         function scqDel(event) {
  1734.             let confirmed = window.confirm('Are you sure you want to delete this item?');
  1735.             let csrfToken = "{{ csrf_token }}";
  1736.             let itemId = event.currentTarget.dataset.id;
  1737.  
  1738.             if (confirmed) {
  1739.                 $.ajax({
  1740.                     url: "{% url 'registrationForm:del_qualification' %}",
  1741.                     contentType: "application/json",
  1742.                     headers: {
  1743.                         'X-CSRFToken': csrfToken
  1744.                     },
  1745.                     type: 'POST',
  1746.                     data: JSON.stringify({ 'id': itemId }),
  1747.                     success: function (data) {
  1748.                         $('#edu' + itemId).remove();
  1749.                     }
  1750.                 });
  1751.             }
  1752.         }
  1753.  
  1754.         function scweDel(event) {
  1755.             let confirmed = window.confirm('Are you sure you want to delete this item?');
  1756.             let csrfToken = "{{ csrf_token }}";
  1757.             let itemId = event.currentTarget.dataset.id;
  1758.  
  1759.             if (confirmed) {
  1760.                 $.ajax({
  1761.                     url: "{% url 'registrationForm:del_exp' %}",
  1762.                     contentType: "application/json",
  1763.                     headers: {
  1764.                         'X-CSRFToken': csrfToken
  1765.                     },
  1766.                     type: 'POST',
  1767.                     data: JSON.stringify({ 'id': itemId }),
  1768.                     success: function (data) {
  1769.                         $('#exp' + itemId).remove();
  1770.                     }
  1771.                 });
  1772.             }
  1773.         }
  1774.  
  1775.         function educationPopupCleanup() {
  1776.             let eduErrRow = document.getElementById('eduErrRow');
  1777.             let degErr = document.getElementById('degErr');
  1778.             let dicErr = document.getElementById('dicErr');
  1779.             let startYearErr = document.getElementById('startYearErr');
  1780.             let endYearErr = document.getElementById('endYearErr');
  1781.  
  1782.             eduErrRow.style.display = 'none';
  1783.             degErr.style.display = 'none';
  1784.             dicErr.style.display = 'none';
  1785.             startYearErr.style.display = 'none';
  1786.             endYearErr.style.display = 'none';
  1787.         }
  1788.  
  1789.         function employmentPopupCleanup() {
  1790.             let empErrRow = document.getElementById('empErrRow');
  1791.             empErrRow.style.display = 'none';
  1792.         }
  1793.  
  1794.         function openPopUp(element) {
  1795.             if (element === 'edu'){
  1796.                 educationPopupCleanup();
  1797.             }
  1798.             if (element === 'emp') {
  1799.                 employmentPopupCleanup()
  1800.             }
  1801.             updatePopupHeader();
  1802.             $("#staticBackdrop").modal("show");
  1803.         }
  1804.  
  1805.         $('#id_2-current_employment_status').on('change', function() {
  1806.             if ($("#id_2-current_employment_status").val() == "2") {
  1807.                 $("#unemployed").modal("show");
  1808.             }
  1809.         });
  1810.  
  1811.         function employmentCheck(){
  1812.         }
  1813.  
  1814.         function closePopUp(element) {
  1815.             if (element=='emp'){
  1816.                 expFieldsRefresh()
  1817.             } else {
  1818.                 eduFieldsRefresh()
  1819.             }
  1820.             $("#staticBackdrop").modal("hide");
  1821.         }
  1822.  
  1823.         function scweEdit(element) {
  1824.             employmentPopupCleanup();
  1825.             $("#staticBackdrop").modal("show");
  1826.             $("#exampleModalLabel1").text("Edit Employment Details");
  1827.             $("#edit_rows_exp").val(event.currentTarget.dataset.id);
  1828.             $("#save_rec_exp").attr('name', 'EditAndSave');
  1829.  
  1830.             let organization = $("#id_2-organization")
  1831.             let designations = $("#id_2-designations")
  1832.             let startDate = $("#id_2-start_date")
  1833.             let endDate = $("#id_2-end_date")
  1834.             let csrfToken = "{{ csrf_token }}";
  1835.  
  1836.             $.ajax({
  1837.                     url: "{% url 'registrationForm:get_exp' %}",
  1838.                     contentType: "application/json",
  1839.                     headers: {
  1840.                         'X-CSRFToken': csrfToken
  1841.                     },
  1842.                     type: 'GET',
  1843.                     data: { 'id': event.currentTarget.dataset.id, },
  1844.                     success: function (data) {
  1845.                         organization.val(data.organization);
  1846.                         designations.val(data.designations);
  1847.                         startDate.val(data.start_date);
  1848.                         endDate.val(data.end_date);
  1849.                     }
  1850.                 });
  1851.         }
  1852.  
  1853.         function scqEdit(element) {
  1854.             educationPopupCleanup();
  1855.             $("#staticBackdrop").modal("show");
  1856.             $("#exampleModalLabel").text("Edit Qualification");
  1857.             $("#edit_rows").val(event.currentTarget.dataset.id);
  1858.             $("#save_rec").attr('name', 'EditAndSave');
  1859.  
  1860.             let quaLevel = $("#id_1-qual_cat");
  1861.             let quaName = $("#id_1-degree");
  1862.             let board = $("#id_1-school_college");
  1863.             let quaDisc = $("#id_1-discipline");
  1864.             let startYear = $("#id_1-start_year");
  1865.             let endYear = $("#id_1-completion_year");
  1866.             let percentage = $("#id_1-percentage_marks_cgpa");
  1867.             let outoff = $("#id_1-cpga_outoff")
  1868.             let cgpa = $('#cgpa')
  1869.             let other_degree = $("#id_1-other_degree");
  1870.             let other_discipline = $("#id_1-other_discipline");
  1871.             let csrfToken = "{{ csrf_token }}";
  1872.  
  1873.             $.ajax({
  1874.                     url: "{% url 'registrationForm:get_qualification' %}",
  1875.                     contentType: "application/json",
  1876.                     headers: {
  1877.                         'X-CSRFToken': csrfToken
  1878.                     },
  1879.                     type: 'GET',
  1880.                     data: { 'id': event.currentTarget.dataset.id },
  1881.                     success: function (data) {
  1882.                         startYear.val(data.startYear);
  1883.                         endYear.val(data.endYear);
  1884.                         board.val(data.board);
  1885.                         quaLevel.val(data.quaLevel);
  1886.                         QualCategory();
  1887.                         quaName.val(data.quaName);
  1888.                         quaDisc.val(data.quaDisc);
  1889.                         ListOfDiscipline();
  1890.                         percentage.val(data.percentage);
  1891.                         if (data.outoff) {
  1892.                             $("#cpgaContainer").attr("type", "text");
  1893.                             $("#cpgaContainer").show();
  1894.                             $('#id_1-cpga_outoff').prop('required',true);
  1895.                             $('#id_1-percentage_marks_cgpa').attr('placeholder', 'CGPA');
  1896.                             cgpa.prop('checked', true);
  1897.                             outoff.val(data.outoff);
  1898.                         }
  1899.                         if (data.other_degree) {
  1900.                             other_degree.attr("type", "text");
  1901.                             other_degree.show();
  1902.                             other_degree.attr("required","true");
  1903.                             other_degree.val(data.other_degree);
  1904.                         }
  1905.                         if (data.other_discipline) {
  1906.                             other_discipline.attr("type", "text");
  1907.                             other_discipline.show();
  1908.                             other_discipline.attr("required","true");
  1909.                             other_discipline.val(data.other_discipline);
  1910.                         }
  1911.                     }
  1912.                 });
  1913.         }
  1914.  
  1915.     function goBack() {
  1916.         let gotoStepInput = document.getElementById('wizard_goto_step');
  1917.  
  1918.         if ($('#resubmit_check').val() === 'NotAllowed' && ['0', '1', '2', '3', '4'].includes(gotoStepInput.value)) {
  1919.             $("#resubmitmodal").modal("show");
  1920.             return false;
  1921.         }
  1922.  
  1923.         if (gotoStepInput) {
  1924.             gotoStepInput.name = 'goto_step';
  1925.             gotoStepInput.form.submit();
  1926.         }
  1927.     }
  1928.  
  1929.     function inviteEmployerEmail() {
  1930.         let name = $('#id_5-hr_name').val();
  1931.         let email = $('#id_5-hr_email').val();
  1932.         let phone = $('#id_5-hr_phone').val();
  1933.         let csrfToken = "{{ csrf_token }}";
  1934.  
  1935.         if(!name || !phone || !email) {
  1936.             let errorMessage = 'Please fill in the following fields:<br>';
  1937.                 
  1938.             if (!name) errorMessage += '- Employer Name<br>';
  1939.             if (!email) errorMessage += '- Employer Email<br>';
  1940.             if (!phone) errorMessage += '- Employer Phone<br>';
  1941.  
  1942.             showToast(errorMessage, 'toastContainer');
  1943.  
  1944.         }
  1945.         else {
  1946.             let param = {"hr_name":name,"hr_email":email,"hr_phone":phone};
  1947.  
  1948.             $.ajax({
  1949.                 url: "{% url 'registrationForm:inviteemployeremail' %}",
  1950.                 contentType : "application/json",
  1951.                 headers: {
  1952.                         'X-CSRFToken': csrfToken  
  1953.                     },
  1954.                 type: 'POST',
  1955.                 data: JSON.stringify(param),
  1956.                 success: function (data) {
  1957.                     $('#hr_table').show();
  1958.                     $('#hr_name').text(data.hr_name);
  1959.                     $('#hr_created_at').text(data.created);
  1960.                     $('#hr_status').text(data.status);
  1961.                     $('#hr_signed_time').text(data.sign_at);
  1962.                     document.getElementById('inviteempemail').style.display = 'none';
  1963.                     $('#id_5-hr_name').attr('readonly',true);
  1964.                     $('#id_5-hr_email').attr('readonly',true);
  1965.                     $('#id_5-hr_phone').attr('readonly',true);
  1966.                     $('#employer_error').html('');
  1967.                 }
  1968.             });
  1969.         }
  1970.     }
  1971.  
  1972.     function inviteMentorEmail() {
  1973.         let name = $('#id_5-mentor_name').val();
  1974.         let email = $('#id_5-mentor_email').val();
  1975.         let phone = $('#id_5-mentor_phone').val();
  1976.         let csrfToken = "{{ csrf_token }}";
  1977.  
  1978.         if(!name || !phone || !email) {
  1979.             let errorMessage = 'Please fill in the following fields:<br>';
  1980.                 
  1981.             if (!name) errorMessage += '- Mentor Name<br>';
  1982.             if (!email) errorMessage += '- Mentor Email<br>';
  1983.             if (!phone) errorMessage += '- Mentor Phone<br>';
  1984.             
  1985.             showToast(errorMessage, 'toastContainer');
  1986.         }
  1987.         else {
  1988.             let param = {"mentor_name":name,"mentor_email":email,"mentor_phone":phone};
  1989.  
  1990.             $.ajax({
  1991.                 url: "{% url 'registrationForm:invitementoremail' %}",
  1992.                 contentType : "application/json",
  1993.                 headers: {
  1994.                         'X-CSRFToken': csrfToken  
  1995.                     },
  1996.                 type: 'POST',
  1997.                 data: JSON.stringify(param),
  1998.                 success: function (data) {
  1999.                     $('#mentor_table').show();
  2000.                     $('#mentor_name').text(data.mentor_name);
  2001.                     $('#mentor_created_at').text(data.created);
  2002.                     $('#mentor_status').text(data.status);
  2003.                     $('#mentor_signed_time').text(data.sign_at);
  2004.                     document.getElementById('invitemenemail').style.display = 'none';
  2005.                     $('#id_5-mentor_name').attr('readonly',true);
  2006.                     $('#id_5-mentor_email').attr('readonly',true);
  2007.                     $('#id_5-mentor_phone').attr('readonly',true);
  2008.                     $('#mentor_error').html('');
  2009.                 }
  2010.             });
  2011.         }
  2012.     }
  2013.  
  2014.     function reSendMail(table){
  2015.         let csrfToken = "{{ csrf_token }}";
  2016.         let param = {"table_name":table};
  2017.  
  2018.  
  2019.         $.ajax({
  2020.                 url: "{% url 'registrationForm:resendmail' %}",
  2021.                 contentType : "application/json",
  2022.                 headers: {
  2023.                         'X-CSRFToken': csrfToken  
  2024.                     },
  2025.                 type: 'POST',
  2026.                 data: JSON.stringify(param),
  2027.                 success: function (data) {
  2028.                     alert('Mail sent successfully')
  2029.                 }
  2030.             });
  2031.     }
  2032.  
  2033.  
  2034.     function disableLink(table){
  2035.         let csrfToken = "{{ csrf_token }}";
  2036.         let param = {"table_name":table};
  2037.  
  2038.  
  2039.         $.ajax({
  2040.                 url: "{% url 'registrationForm:disablelink' %}",
  2041.                 contentType : "application/json",
  2042.                 headers: {
  2043.                         'X-CSRFToken': csrfToken  
  2044.                     },
  2045.                 type: 'POST',
  2046.                 data: JSON.stringify(param),
  2047.                 success: function (data) {
  2048.                     if (table === 'mentor'){
  2049.                     document.getElementById('mentor_table').style.display = 'none';
  2050.                     document.getElementById('invitemenemail').style.display = 'block';
  2051.                     $('#id_5-mentor_name').attr('readonly',false);
  2052.                     $('#id_5-mentor_email').attr('readonly',false);
  2053.                     $('#id_5-mentor_phone').attr('readonly',false);
  2054.                 }
  2055.                 if (table === 'employer'){
  2056.                     document.getElementById('hr_table').style.display = 'none';
  2057.                     document.getElementById('inviteempemail').style.display = 'block';
  2058.                     $('#id_5-hr_name').attr('readonly',false);
  2059.                     $('#id_5-hr_email').attr('readonly',false);
  2060.                     $('#id_5-hr_phone').attr('readonly',false);
  2061.                 }
  2062.                 }
  2063.             });
  2064.     }
  2065.     </script>
  2066.     <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
  2067.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
  2068.     <script src="https://cdnjs.cloudflare.com/ajax/libs/cropper/4.0.0/cropper.min.js" integrity="sha256-QT8oUxSZbywEwAPBgej6iNFH1ephgQV3q2pzjIso5pk=" crossorigin="anonymous"></script>
  2069. </body>
  2070. </html>

Editor

You can edit this paste and save as new: