<?php if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
?>
<?php require_once("includes/initialize.php");
//$tag="";
//if ((isset($_GET['type'])))
//$tag=$_GET['type'];

$id = $session->user_id;
$user_data = Userdata::find_by_id($session->user_id);
$transact_feedbackchk = Transaction::findacceptance($user_data->formno, $user_data->email);
if ($transact_feedbackchk){
    
    redirect_to ("http://eportal.oscotechesaoke.edu.ng/student_portal/dashboard.php");
 }

      
        if ((substr($user_data->formno,2,2)!=18) and ((substr($user_data->formno,2,2)!=19))){
      
      //echo "All new table: ".substr($user_data->formno,2,2);
      
      Switch(substr($user_data->formno,2,2))
      {
          case '20':$table='form_data';
          break;
          
          case '21': $table='form_data21';
          break;
          
          case '22': $table='form_data22';
      }
  
      
       $biodata = Biodata2::find_by_id($table, $user_data->formno, $user_data->email);
       
      // echo "kll: ". $biodata->passport;
        $new_dp = DEPARTMENTCLASS::new_admin_dept($biodata->formno);
        
          if (!isset($new_dp->department)){
           $biodata->courses ='Nil';   
          }else{
        $biodata->courses = $new_dp->department;
          }
       $biodata->programme = $biodata->level;
  
        // $pixf = substr($biodata->passport, 10);
       $dp = DEPARTMENTCLASS::department_authenticate($biodata->department);
       $pix = "../../admission/passport/".$biodata->passport;
    
    
    
       
  }else{
 


$biodata = Biodata::find_by_id($user_data->formno, $user_data->email);

}
//echo  $user_data->std_process_id." level";


// if (($user_data->std_process_id==1) && (($user_data->start_session=='2019/2020') OR ($user_data->start_session=='2018/2019'))){
//     redirect_to("dashboard.php");
// }

// if (substr($user_data->formno,2,2)=='19'){

//  $new_dp = DEPARTMENTCLASS::new_admin_dept($user_data->formno);
//   $biodata->courses = $new_dp->department;
  
//  $biodata->programme = $biodata->level;
   
// }

$dp = DEPARTMENTCLASS::department_authenticate($biodata->courses);
$display_course = COURSECLASS::fetch_all_course($biodata->courses, $biodata->programme, $session_class->semester);







$dp = DEPARTMENTCLASS::department_authenticate($biodata->courses);

$alldp = DEPARTMENTCLASS::find_all($dp->faculty);
foreach ($alldp as $aldp) {
    $faculty = $aldp->faculty;
}
$pay_cat = '';
if ($faculty == 'Engineering' or $faculty == 'Applied Sciences' or $faculty == 'Enviromental Studies') {
    $pay_cat = 'science';
} elseif ($faculty == 'Management Sciences') {
    $pay_cat = 'nonscience';
}

if( $biodata->programme=='Adv. Cert.'){
  $level = $biodata->programme;  
}else {
$level = $biodata->programme;
$level = $level . " " . "I";

}
$pay_settings = Pay_settings::authenticate(1, $level);

//$biodata = Biodata::find_by_id($session->user_id);

//echo "<br>Form: ".$user_data->formno.' '. $user_data->email;
//$transact = Transaction::t_processing($id);
$transaction = Transaction::authenticateattempt($user_data->formno, $user_data->email);

?>

<div class="art-content-layout">
    <div class="art-content-layout-row">

        <div class="art-layout-cell layout-item-0" style="width: 100%">

            <!--<marquee behavior="alternate" scrolldelay="200" onmouseover="this.setAttribute('scrollamount',0,0);"-->
            <!--         onmouseout="this.setAttribute('scrollamount',6,0);">-->
            <!--    <div style="color:#F00; font-style:italic; font-weight:bolder;">NOTE: <span-->
            <!--                style="color:#F00; font-style:italic;">Upon successful payment of the acceptance fees, click Admission Module to print your admission letter</span>-->
            <!--    </div>-->
            <!--</marquee>-->
 <?php
  if ((substr($biodata->formno,0,2))=="PU"){?>

 <marquee behavior="alternate" scrolldelay="200" onmouseover="this.setAttribute('scrollamount',0,0);" onmouseout="this.setAttribute('scrollamount',6,0);" ><div style="color:#F00; font-style:italic; font-weight:bolder;">NOTE: <span style="color:#F00; font-style:italic;">Upon successful payment of the acceptance fees, make sure you do not block any pop up message on your machine. Click Payment Module to pay School fees</span> </div></marquee>
<?php } else {?>
 
 <marquee behavior="alternate" scrolldelay="200" onmouseover="this.setAttribute('scrollamount',0,0);" onmouseout="this.setAttribute('scrollamount',6,0);" ><div style="color:#F00; font-style:italic; font-weight:bolder;">NOTE: <span style="color:#F00; font-style:italic;">Upon successful payment of the acceptance fees, make sure you do not block any pop up message on your machine. Click Admission Module to print your admission letter</span> </div></marquee>
<?php  }?>

        </div>
    </div>
</div>
<div class="art-content-layout">
    <div class="art-content-layout-row">

        <div class="art-layout-cell layout-item-0" style="width: 100%">


            <div style="text-transform:uppercase; color:#099; font-weight:bolder; border-bottom:inset #000 thin;">
                Acceptance fees payment
            </div>
            <?php if ($message != 'Approved Successful') {
                echo output_message($message);
            } elseif ($message == 'Approved Successful') {
    //             echo "<script>window.open('acceptance_receipt.php')
	  
	   //</script>";
                echo "<span style=\"color:#060; font-weight:bolder \">{$message}</span>";
                $_SESSION['success'] = $message;
            } else {
                echo output_message($message);
            }

            ?>
        </div>
    </div>
</div>


<div class="art-content-layout">
    <div class="art-content-layout-row">
      
    

        


        <div class="art-layout-cell layout-item-0" style="width: 100%">
            
              <h2 style='color:red'>Duplicate Attempt Found.</h2> 
      <p style='font-size:15px'>Select continue with existing transaction to requery your transaction or start a new transaction.</p>

           <div>
               <select class='form-control' id='checkDuplicate' style='padding:10px 16px; font-size:16px; width:70%; margin-bottom:20px'>
                <option value='0'>Please select...</option>
                   <option value='<?php echo $transaction->id; ?>'>Continue with existing transaction</option>
                   <option value='1'>Start a new transaction</option>
               </select>
           </div> 
           <div>
               <button id='dupProceed' style='padding:10px 16px; background-color:green; color:white; border-radius:5px; border:none; font-size:15px'>Proceed</button>
           </div>
        </div>
    </div>
</div>
</div>


</article></div>
<style>
    #accept:hover {
        text-decoration: none;
        font-style: italic;
    }
    
    #dupProceed:hover {
        cursor:pointer;
    }
</style>


<script type="text/javascript">

   
        $(document).ready(function () {
            
         //   alert('fouhhhhh');
            
            $('#dupProceed').click(function(){
              
              var page =($('#checkDuplicate').val()); 
              
              if (page==0){
                  alert('Select an option from the menu.');
                  $('#checkDuplicate').focus();
                  
              }else if (page==1){
                  window.location='http://odfel.oscotechesaoke.edu.ng/student_portal/dashboard.php?type=acceptance';
              }else{
                  window.location='http://odfel.oscotechesaoke.edu.ng/student_portal/pages/sessionSetter.php?paymentID='+page;
              }
            })
         
            
            // alert(mes);
            // if (mes == "Approved Successful") {
            //     $('#accept').attr('disabled', 'disabled');
            // }
        })
</script>