<?php session_start();

class DashboardController {

    private $con;

    function __construct(){
        include_once("../../includes/DB/Connection.php");
		$db = new Connection();
		$this->con = $db->connect();
    }

    public function getCounsLeadCount($request){

        return $request;
        
        $logged_user_id = $_SESSION['log_session']['user_id'];
        $logged_user_role_id = $_SESSION['log_session']['user_role_id'];
        $logged_user_camp_id = $_SESSION['log_session']['campus_id'];
        $logged_user_bran_id = $_SESSION['log_session']['branch_id'];

        $stmt_lead_count = $this->con->prepare("SELECT COUNT(*) AS counselor_lead_count FROM lead l WHERE l.user_id = '?' AND l.lead_status <= ?");

        if($stmt_lead_count){// Check if preparation was successful

            $stmt_lead_count->bind_param("ii",$logged_user_id, 6);

            $stmt_lead_count->execute();
            
            // Get the result
            $result = $stmt_lead_count->get_result();

            // Process the result
            if ($result->num_rows > 0) {

                $lead_count = 0;

                while ($row = $result->fetch_assoc()) {
                    $lead_count = $row;
                }

                return ['status' => 1, 'message' => $lead_count];
            }

        }



    }

}


if(isset($_GET['GET_COUNS_LEAD_COUNT'])){
    if(isset($_SESSION['log_session']['user_id'])){
        $dc = new DashboardController();
        echo json_encode($dc->getCounsLeadCount($_GET));
		exit();
    }
}




?>