<?php
include_once "../../includes/config.php";
include_once "../../includes/database.php";
include_once "../../includes/validation.php";
include_once "../../includes/Helper.php";
include_once "../../includes/ajax/check_session_ajax.php";
require_once '../../includes/ajax/check_edit_page_ajax.php';
include_once "../../includes/auth.php";
$auth = array('customer_admin');
$authRes = checkAuth($auth, $user);
if(!$authRes)
{
    http_response_code(401);
	echo json_encode(array('error_text' => 'Authentication Error'));
	exit;
}

class DeletedAjax extends database{
	public function index($data, $id, $userID)
	{
		$where['cl_id'] = $id;
                $where['cl_user_id'] = $userID;
		return $this->update('tb_category', $data, $where);
	}

	
	
}


$data['deleted_at'] = date('Y-m-d H:i:s');



$obj = new DeletedAjax();

$res = $obj->index($data, $id, $user['cl_id']);
if(!$res)
{
	http_response_code(401);
	echo json_encode(array('error_text' => 'Something Went Wrong'));
	exit;
}

session_start();
$_SESSION['error_message'] = 'Deleted Successfully';
$_SESSION['error_type'] = 'success';

http_response_code(200);
echo json_encode(array('message' => 'Deleted Successfully'));
exit;