<?php
	$getClaimId = $_GET['update'];
?>

<div class="right_col" role="main">

    <div class="">

        <div class="row">

            <div class="col-md-12 col-sm-12 col-xs-12">

                <div class="x_panel">

					<div class="x_title">

						<h2>Claim</h2>

						<div class="clearfix"></div>

					</div>

					<div class="x_content">

						<form class="form-horizontal form-label-left" method="post">
                        
                        	<div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="claimtitle">Title 
								</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="claimtitle" class="form-control col-md-3 col-xs-12" name="title" type="text" value="<?php echo getDetailFromTable('claims',$getClaimId)[1]; ?>">
								</div>
							</div>
                            
                            <div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="price">Amount 
								</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="price" class="form-control col-md-3 col-xs-12" name="amount" type="number" placeholder="1.00" step="0.01" value="<?php echo getDetailFromTable('claims',$getClaimId)[4]; ?>">
								</div>
							</div>
                            
                            <div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="">Date</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="cdate" class="form-control col-md-4 col-xs-12" name="date" type="date" value="<?php echo getDetailFromTable('claims',$getClaimId)[2]; ?>">
								</div>
							</div>
                            
                            <div class="item form-group">
								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="upload">Upload 
								</label>
								<div class="col-md-4 col-sm-3 col-xs-12">
									<input id="upload" class="form-control col-md-3 col-xs-12" name="upload" type="file" value="">
								</div>
							</div>

							<div class="ln_solid"></div>

							<div class="form-group">
								<div class="col-md-6 col-md-offset-3">
									<button id="send" type="submit" class="btn btn-success" name="submit">Submit</button>
									<button type="reset" class="btn btn-primary" onclick="javascript:window.location='index.php?pagecontent=dashboard'">Cancel</button>
								</div>
							</div>

						</form>
					
					</div>
                </div>
            </div>
        </div>
    </div>
</div>



<?php 

	if(isset($_POST['submit']))

	{
		$postTitle = $_POST['title'];
		$postDate = $_POST['date'];
		$postAmount = $_POST['amount'];
		$postFile = $_POST['file'];
		
		//admin id
		$adminId = $_SESSION['admin'][0];

		mysqli_query($conn, "UPDATE claims SET c_title='$postTitle', c_date='$postDate', c_amount='$postAmount', a_id=$adminId WHERE c_id=$getClaimId") or die (mysql_error());

		header("Location: ?pagecontent=claims");  
		
		
//TELEGRAM NOTIFICATION
/*$adminUsername = $_SESSION['admin'][1];
		
$messaggio = "NEW RESERVATION BY ".$adminUsername."

User : ".$userId."
Room : ".$roomId."
Check In : ".$checkInDate."
Platform : ".$platformId."
Price : RM ".$total."
Note : ".$note."

".$ipAddress;

sendMessage($chatID, $messaggio, $token);*/
		
	}

?>



