diff --git a/contact.php b/contact.php index 4160c95..e2c3b07 100644 --- a/contact.php +++ b/contact.php @@ -35,9 +35,13 @@ if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $date) || strtotime($date) < strtotime( echo json_encode(['success'=>false,'error'=>'Invalid or past date.']); exit; } -$pkg = PACKAGES[$package]; +$pkg = PACKAGES[$package]; +$rentalDays = ($package === 'full-day') ? max(1, min(3, (int)($input['rental_days'] ?? 1))) : 1; $rentalDate = $date; -$endDate = date('Y-m-d', strtotime($date . ' +' . $pkg['days'] . ' days')); +$endDate = ($package === 'full-day') + ? date('Y-m-d', strtotime($date . ' +' . ($rentalDays - 1) . ' days')) + : date('Y-m-d', strtotime($date . ' +' . $pkg['days'] . ' days')); +$totalAmount = ($package === 'full-day') ? $pkg['amount'] * $rentalDays : $pkg['amount']; // Check availability $conflict = db()->prepare( @@ -57,10 +61,12 @@ if ($blockedCheck->fetch()) { $ref = generateRef(); $dateLabel = date('F j, Y', strtotime($rentalDate)); -$pkgLabel = $pkg['label']; -$amountLabel = '$' . number_format($pkg['amount'], 2); +$pkgLabel = ($package === 'full-day' && $rentalDays > 1) + ? $pkg['label'] . ' × ' . $rentalDays . ' days' + : $pkg['label']; +$amountLabel = '$' . number_format($totalAmount, 2); $depositLabel = '$' . number_format(DEPOSIT_AMOUNT, 2); -$balance = $pkg['amount'] - DEPOSIT_AMOUNT; +$balance = $totalAmount - DEPOSIT_AMOUNT; $balanceLabel = '$' . number_format($balance, 2); // ── Square: create customer + card on file + deposit hold ───────────────────── @@ -143,7 +149,7 @@ $stmt = db()->prepare( VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" ); $stmt->execute([ - $ref, $name, $email, $phone, $package, $rentalDate, $endDate, $pkg['amount'], $message, + $ref, $name, $email, $phone, $package, $rentalDate, $endDate, $totalAmount, $message, $sqCustomerId, $sqCardId, $sqCardLast4, $sqCardBrand, $sqPaymentId, $sqPaymentStatus, ]); diff --git a/index.html b/index.html index df96b76..bbbac68 100644 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@ "name": "Parker County Slingshot Rentals", "description": "Polaris Slingshot rentals in Parker County, Texas. Daily and weekend rentals available for thrill-seekers near Weatherford and the DFW metroplex.", "url": "https://parkerslingshotrentals.com", - "telephone": "+1-817-555-0199", + "telephone": "+1-817-266-2022", "email": "info@parkerslingshotrentals.com", "priceRange": "$$", "currenciesAccepted": "USD", @@ -768,7 +768,7 @@