<?php
$pgMod="payment";
$pgAct="view";
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);

	

if($pgAct=="delete" && isset($_GET['id']) && trim($_GET['id'])!='')
{

	$res = $db->delete("enquiry_list","where id='".$_GET['id']."'");
	if(!is_null($res)) { $_SESSION['msg']='Deleted Successfully'; }
	else { array_push($alert_err,$db->getErMsg()); }
	redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"website", "page_id"=>$pgMod)));
} 

if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
if($pgAct=="edit" && $_GET["id"]!="")
{   
	$aryForm=$db->getRow("SELECT * FROM slider WHERE school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_GET['id']."'");
}
if($pgAct=="add" || ($pgAct=="edit" && isset($_GET['id']) && trim($_GET['id']) !=''))
{
//	echo "<pre>";print_r($aryForm);echo "</pre>".$aryForm['root'];exit;
?>
<!-- Forms --> 
	<div class="row-fluid">
        <form method="post" action="" enctype="multipart/form-data">
			<!-- Forms: Box -->
			<div class="span12">

				<!-- Forms: Top Bar -->
				<div class="top-bar">
					<h3><i class="icon-cog"></i> Create a New Slider</h3>
				</div>
				<!-- / Forms: Top Bar -->

				<!-- Forms: Content -->
				<div class="well no-padding">

						<input type="hidden" name="temp" value="">
                        
                        <div class="control-group">
							<label class="control-label" for="heading">Image</label>
							<div class="controls">
								<input type="file" id="image" name="image" class="input-block-level" >
							</div>
						</div>
                        

						<div class="form-actions">
                        
							<button type="submit" class="btn btn-primary"> Save</button>
							<button type="button" class="btn"> Cancel</button>
						</div>
                        
				</div>
				<!-- / Forms: Content -->

			</div>
			<!-- / Forms: Box -->

        </form>
	</div>
<?php   
}else{
	?>
	<div class="row-fluid">
    <div class="span12">
    
        <div class="top-bar">
        <h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
        <!--<button style="float:right; margin-top:5px" onclick="window.location='./?src=website&page_id=<?php echo $pgMod; ?>&action=add'" class="btn" type="button">Add <?php echo $pgMod; ?></button>-->
        </div>
    
        <div class="well no-padding">
             <?php 

// $data = $db->getRow("select * from about_us where id='1' ");
  $aryPgAct=array("src"=>"website", "page_id"=>$pgMod,"action"=>"add");

            $url = "https://bps.savarnacloudtech.com/api/get_payment.php";

            $context  = stream_context_create($options);
            $result = file_get_contents($url, false, $context);

            $temp = json_decode($result,true);
            // $aryList = $temp['slider'];
?>
            <table class="table" id="example"> 
                <thead>
                    <tr>
                        <th scope="col">S.no</th>

      <th scope="col">Name</th>
      <th scope="col">Father Name</th>
      <th scope="col">Mother Name</th>
      <!--<th scope="col">Email</th>-->
       <th scope="col">Mobile</th>
      <th scope="col">Amount</th>
      <th scope="col">Txn Id</th>
      <th scope="col">Payment Date</th>
      
                    </tr>
                </thead>
                <tbody>
                <?php foreach($temp as $res){ $i++; 
                $aryPgAct["id"]=$res['id'];
                ?>
            <tr>
                     <th  style="font-weight: 600; color: green;padding: 0.75rem;" ><?php echo $i?></th>
      <th style="padding: 0.75rem;" ><?php echo $res['name'];?></th>
    <th style="padding: 0.75rem;" ><?php echo $res['fname'];?></th>
     <th style="padding: 0.75rem;" ><?php echo $res['mname'];?></th>
      <!--<th style="padding: 0.75rem;" ><?php echo $res['email'];?></th>-->
      <th style="padding: 0.75rem;" ><?php echo $res['phone'];?></th>
      <th style="padding: 0.75rem;" ><?php echo $res['amount'];?></th>
      <th style="padding: 0.75rem;" ><?php echo $res['txnid'];?></th>
     <?php $phpdate = strtotime( $res['payment_date'] );
$mysqldate = date( 'd-m-Y ', $phpdate );?>
       <th style="padding: 0.75rem;" ><?php echo $mysqldate;?></th>
                 </tr>
                <?php } ?>
                </tbody>
            </table>
            <?php
        }
       
        ?>
        </div>
  </div>
</div>

<!-- / Forms -->