<?php
include('../include/auth.php');
include('../include/lskfjwfe.php');
header('Content-Type: application/json');

$partner_id = isset($_POST['partner_id']) ? (int)$_POST['partner_id'] : 0;
if (!$partner_id) {
    echo json_encode([]);
    exit;
}

$sql = "
  SELECT DISTINCT api_fleet_acriss 
  FROM api_fleet 
  WHERE api_fleet_partner = $partner_id 
    AND api_fleet_acriss != ''
  ORDER BY api_fleet_acriss ASC
";

$res = $db2->query($sql);
$acriss = [];

while ($row = mysqli_fetch_assoc($res)) {
    $acriss[] = $row['api_fleet_acriss'];
}

echo json_encode($acriss);
