<?php

//get current session
 $session = get_current_session_4($id = 4);

 //get current semester
 $semester = get_current_semester($id = 1);

 $image = get_user_image($user_id);


 ?>
    <div style="height:20px; displat:block;"></div>

    <ul class="breadcrumb">

        <li><a href="dashboard.php?act=payments&qlk=<?php echo md5(2); ?>">Payments</a> <span class="divider"></span> </li>
        <li class="active" >School fee payments<span class="divider"></span> </li>
    </ul>

<div class="well">

    <!-- in the future version check if the current invoice has expired den show but if nt exired dont show -->
    <?php
	if(!has_paid_school_fee($user_id, $session, $semester ))
	{ ?>


    	<div class="alert alert-info in" >
                 <button class="close" data-dismiss="alert" type="button">
                    X

                 </button>
                    <i class="glyphicon glyphicon-info-sign"></i>&nbsp;&nbsp;Please click on the green-plus-sign below to generate invoice for your school fee payment.
        </div>
    	<a href="dashboard.php?act=generate_invoice&for=sf&invoice_to=<?php echo md5(get_user_id());?>&qlk=<?php echo md5(2); ?>"  class="pull-right"><img src="images/add_icon.png" data-toggle="tooltip" data-placement="top"  title="Click here to generate invoice to PAY" />   </a> <br/><br/>

    <?php
    }
	?>
	 <div style="height:20px; displat:block;"></div>




     <!--First accordion panel container tat accomodates all other payments -->

    <div class="panel panel-success">
        <div class="panel-heading">
            <p class="panel-title">
                <a id="Me" data-toggle="collapse" data-parent="#accordion" href="#collapseMe"> <span class="glyphicon glyphicon-plus"></span>&nbsp;&nbsp;PAYMENT HISTORY  <a class="btn btn-danger btn-sm" style="color:#FFFF" href="#" data-toggle="modal" data-target="#myModallTLOGRegFee"> Re-query Transaction Status - Reg</a></a>
                 <span class="label label-success" style="font-size:15px;float:right;"></span>
            </p>
        </div>
                <div id="collapseMe" class="panel-collapse collapse in ">
                    <div class="panel-body">
                        <ul class="list-group">





                                     <!-- accordion for history starts here ###############################################################-->

                                      <div id="accordion" class="panel-group">

                                        <?php $q = "SELECT * FROM sessions  WHERE status = '0' ORDER BY title DESC";
                                                    $r = mysqli_query($dbc, $q);

                                                    if(mysqli_num_rows($r)>0)
                                                    {
                                                        $a=0; //initialise counter
                                                        while($row = mysqli_fetch_array($r,MYSQLI_ASSOC))
                                                        {
                                        ?>
                                                            <div class="panel panel-success">
                                                                <div class="panel-heading">
                                                                    <p class="panel-title">
                                                                        <a id="<?php echo $a + 1; ?>" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php  echo $a + 1; ?>">
                                                                        <span class="glyphicon glyphicon-plus"></span>
                                                                            <?php echo $row['title']; ?>
                                                                        </a>

                                                                    <span class="label label-success" style="font-size:15px;float:right;">
                                                                    <?php //echo get_total_votes_per_post($row['id']); //parameter is post id?></span>


                                                                    </p>
                                                                </div>
                                                                        <div id="collapse<?php echo $a + 1; ?>" class="panel-collapse collapse<?php //echo $a + 1; ?>  <?php if($a + 1 =='1'){ echo 'in';} //hide the collapse ?>">
                                                                            <div class="panel-body">
                                                                                <ul class="list-group" >
                                                                                <div class="refresh_me">
                                                                                    <?php

																					    $session = $row['id'];
                                                                                        //collect the post id

																					    //echo '<h5 id="list" class="btn btn-success">First Semester</h5> <br>';


																						if($image != '')
																						{


																							echo show_school_fee_payment_by_session($user_id, $session);
                                                                                        	//echo  show_school_fee_payment($user_id, $session, $semester = 1);

																						}
																						else
																						{
																							echo '<a  href="#" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Please Upload Your Passport Before You Can Print Receipt"> P l e a s e  U p l o a d  Y o u r  P a s s p o r t</a>';
																						}



																						echo '<hr/>';
																						//echo '<h5 id="list" class="btn btn-success">Second Semester</h5> <br>';
                                                                                       // echo  show_school_fee_payment($user_id, $session, $semester = 2);



																					  ?>
                                                                                      </div>
                                                                                    </ul>
                                                                        </div>
                                                            </div>
                                                            <!--First accordion panel container Ends here -->
                                            <?php

                                                        $a++; //increment the loop for the control
                                                        }
                                                    }
                                            ?>

                                                            </div><!-- panel --info-->




                                                            <!-- accordion for history ends here #########################################-->




                    </ul><!-- end of list group --->
                </div><!-- end o panel body -->
    </div>
    <!--First accordion panel container Ends here -->


    </div>
    <!-- payment history -->




</div><!-- /well -->
