admin 22
This commit is contained in:
@@ -11,7 +11,7 @@ if (!empty($promo_code)) {
|
|||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindParam(':promo_code', $promo_code, PDO::PARAM_STR);
|
$stmt->bindParam(':promo_code', $promo_code, PDO::PARAM_STR);
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT `id`, `promo_code`, `amount`, `description`, `passengerID`, `validity_start_date`, `validity_end_date` FROM `promos` ORDER BY id DESC";
|
$sql = "SELECT `id`, `promo_code`, `amount`, `description`, `passengerID`, `validity_start_date`, `validity_end_date` FROM `promos` WHERE `passengerID` IN ('all', 'none', '') ORDER BY id DESC";
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,12 +152,13 @@ LEFT JOIN driver d ON
|
|||||||
LEFT JOIN ride ON ride.id = cm.ride_id
|
LEFT JOIN ride ON ride.id = cm.ride_id
|
||||||
left join payments on payments.rideId=cm.ride_id";
|
left join payments on payments.rideId=cm.ride_id";
|
||||||
|
|
||||||
$stmt = $con->prepare($sql);
|
try {
|
||||||
$stmt->execute();
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if ($row) {
|
if ($row) {
|
||||||
foreach ($row as &$item) {
|
foreach ($row as &$item) {
|
||||||
if (!empty($item['passengerName'])) {
|
if (!empty($item['passengerName'])) {
|
||||||
$dec = $encryptionHelper->decryptData($item['passengerName']);
|
$dec = $encryptionHelper->decryptData($item['passengerName']);
|
||||||
@@ -177,8 +178,10 @@ if ($row) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsonSuccess($row);
|
jsonSuccess($row);
|
||||||
} else {
|
} else {
|
||||||
// Return empty success for admin dashboard instead of error
|
|
||||||
jsonSuccess([], "No complaints found");
|
jsonSuccess([], "No complaints found");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
jsonError("Database error: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user