25 lines
886 B
PHP
25 lines
886 B
PHP
<?php
|
|
// transit/org/browse.php — الراكب يتصفح المؤسسات المتاحة للتفعيل
|
|
// POST: country?, type?, search?
|
|
|
|
require_once __DIR__ . '/../../transit/connect_app.php';
|
|
|
|
$country = filterRequest('country');
|
|
$type = filterRequest('type');
|
|
$search = filterRequest('search');
|
|
|
|
$where = "contract_status IN ('trial','active')";
|
|
$params = [];
|
|
|
|
if ($country) { $where .= ' AND country = ?'; $params[] = strtoupper(substr($country, 0, 2)); }
|
|
if ($type) { $where .= ' AND type = ?'; $params[] = $type; }
|
|
if ($search) { $where .= ' AND (name_ar LIKE ? OR name_en LIKE ?)'; $params[] = "%$search%"; $params[] = "%$search%"; }
|
|
|
|
$st = $transit_con->prepare(
|
|
"SELECT id, type, country, city, name_ar, name_en, logo_url
|
|
FROM transit_orgs WHERE $where ORDER BY name_ar ASC LIMIT 200"
|
|
);
|
|
$st->execute($params);
|
|
|
|
jsonSuccess(['orgs' => $st->fetchAll()]);
|