diff --git a/api/get_cities.php b/api/get_cities.php new file mode 100644 index 0000000..bc2a11b --- /dev/null +++ b/api/get_cities.php @@ -0,0 +1,20 @@ +prepare("SELECT id, name_en, name_ar FROM cities WHERE country_id = ? ORDER BY name_en ASC"); + $stmt->execute([$countryId]); + $cities = $stmt->fetchAll(PDO::FETCH_ASSOC); + echo json_encode($cities); +} catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); +} diff --git a/shipment_detail.php b/shipment_detail.php index bc04268..109ea2e 100644 --- a/shipment_detail.php +++ b/shipment_detail.php @@ -22,7 +22,8 @@ $isShipper = $userRole === 'shipper'; $isTruckOwner = $userRole === 'truck_owner'; // Platform Fee Configuration -const PLATFORM_FEE_PERCENTAGE = 0.05; // 5% +$settings = get_settings(); +$platformFeePercentage = (float)($settings['platform_charge_percentage'] ?? 0) / 100; // Handle POST actions if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -52,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($action === 'accept_offer' && $isShipper) { if ($shipment && $shipment['status'] === 'offered' && $shipment['offer_price'] > 0) { $offerPrice = (float)$shipment['offer_price']; - $platformFee = $offerPrice * PLATFORM_FEE_PERCENTAGE; + $platformFee = $offerPrice * $platformFeePercentage; $totalPrice = $offerPrice + $platformFee; $stmt = db()->prepare( @@ -186,7 +187,7 @@ render_header(t('shipment_detail')); 0): ?>