21 lines
675 B
PHP
21 lines
675 B
PHP
<?php
|
|
// food/order/history.php — سجل طلبات الزبون
|
|
require_once __DIR__ . '/../connect_app.php';
|
|
|
|
$page = max(1, (int)(filterRequest('page', 'int') ?? 1));
|
|
$limit = 20;
|
|
$offset = ($page - 1) * $limit;
|
|
|
|
$st = $food_con->prepare(
|
|
"SELECT o.id, o.status, o.grand_total, o.created_at, o.delivered_at, o.rating,
|
|
m.name_ar AS merchant_name_ar, m.logo_url AS merchant_logo_url
|
|
FROM food_orders o
|
|
JOIN food_merchants m ON m.id = o.merchant_id
|
|
WHERE o.passenger_id = ?
|
|
ORDER BY o.created_at DESC
|
|
LIMIT $limit OFFSET $offset"
|
|
);
|
|
$st->execute([$food_passenger_id]);
|
|
|
|
jsonSuccess(['orders' => $st->fetchAll(), 'page' => $page]);
|