<?php

$response = array();

// include db connect class
require_once __DIR__ . '/db_config.php';

    
if (isset($_POST['assignId']) ) {
    
    $assign_id= $_POST['assignId'];
    $employee_id= $_POST['employeeId'];
    $reason= $_POST['reason'];
    $request_for= "date";
    $increasedays= $_POST['increasedays'];
    $datetime= $_POST['datetime'];
    $task_id= $_POST['taskId'];
    $latitude=$_POST['latitude'];
    $longitude=$_POST['longitude'];
  
 $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE) or die(mysql_error());
  
  $query="INSERT INTO task_request (assign_id,employee_id,task_id,reason,request_for,increasedays,r_datetime,request_latitude,request_longitude) VALUES ('$assign_id','$employee_id','$task_id','$reason','$request_for','$increasedays','$datetime','$latitude','$longitude')";
  

    if (mysqli_query($con,$query)) {
        $response["s"] = 1;
        $response["m"] = "Task Succesfully Rejected";
    } else {
        $response["s"] = 0;
        $response["m"] = "Oops! An error occurred.";
    }
    mysqli_close($con);
} 
    echo json_encode($response);

?>