mirror of
https://github.com/myronblair/parkerslingshotrentals
synced 2026-06-30 17:50:31 -05:00
Change deposit to $45, add balance-due-at-pickup calculations
- DEPOSIT_AMOUNT changed from $100 to $45 - Balance (package price minus $45) shown dynamically in booking form when package selected - Customer confirmation email shows breakdown: deposit hold + balance at pickup - Admin email table includes deposit hold and balance columns - Admin booking flow step 5 shows deposit held + balance at pickup - Reminder email deposit detail updated to reflect held deposit and balance - Live status field shows $45 during card authorization flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-6
@@ -117,8 +117,8 @@ if ($isAjax) {
|
||||
'cta' => '',
|
||||
],
|
||||
'deposit' => [
|
||||
'label' => 'Security Deposit',
|
||||
'detail' => 'A refundable security deposit is required at the time of pickup. Please have it ready — cash or card accepted. It will be returned in full upon safe return of the vehicle.',
|
||||
'label' => 'Balance Due at Pickup',
|
||||
'detail' => 'Your $' . number_format(DEPOSIT_AMOUNT, 2) . ' deposit hold has been placed on your card. The remaining balance is due at pickup — cash or card accepted. Your deposit hold will be released upon safe return of the vehicle.',
|
||||
'cta' => '',
|
||||
],
|
||||
'license' => [
|
||||
@@ -655,7 +655,7 @@ textarea.notes-ta:focus{border-color:#f97316}
|
||||
<?= $depositLabel ?>
|
||||
</div>
|
||||
<div class="flow-body">
|
||||
<span class="flow-label">Security Deposit — $<?= number_format(DEPOSIT_AMOUNT,0) ?></span>
|
||||
<span class="flow-label">Deposit & Balance — $<?= number_format(DEPOSIT_AMOUNT,2) ?> held · $<?= number_format($b['amount']-DEPOSIT_AMOUNT,2) ?> at pickup</span>
|
||||
<span class="flow-meta" id="meta-<?= $bid ?>-deposit_received">
|
||||
<?php if ($cancelled): ?>N/A
|
||||
<?php elseif ($sqStatus === 'COMPLETED'): ?>Captured — $<?= number_format((float)($b['deposit_paid']??DEPOSIT_AMOUNT),2) ?> charged
|
||||
@@ -922,9 +922,9 @@ function squareAction(id, action, btn) {
|
||||
};
|
||||
const [orig, working, done] = labels[action];
|
||||
const confirmMsg = {
|
||||
square_capture: 'Charge the deposit hold to this card?',
|
||||
square_void: 'Void the deposit hold? The customer will NOT be charged.',
|
||||
square_refund: 'Refund the full deposit to this card?',
|
||||
square_capture: 'Charge the $<?= number_format(DEPOSIT_AMOUNT,2) ?> deposit hold to this card?',
|
||||
square_void: 'Void the $<?= number_format(DEPOSIT_AMOUNT,2) ?> deposit hold? The customer will NOT be charged.',
|
||||
square_refund: 'Refund the deposit to this card?',
|
||||
}[action];
|
||||
if (!confirm(confirmMsg)) return;
|
||||
btn.disabled = true;
|
||||
|
||||
+15
-10
@@ -66,6 +66,9 @@ $stmt->execute([$ref, $name, $email, $phone, $package, $rentalDate, $endDate, $p
|
||||
$dateLabel = date('F j, Y', strtotime($rentalDate));
|
||||
$pkgLabel = $pkg['label'];
|
||||
$amountLabel = '$' . number_format($pkg['amount'], 2);
|
||||
$depositLabel = '$' . number_format(DEPOSIT_AMOUNT, 2);
|
||||
$balance = $pkg['amount'] - DEPOSIT_AMOUNT;
|
||||
$balanceLabel = '$' . number_format($balance, 2);
|
||||
|
||||
// Admin email
|
||||
$adminHtml = "<div style='max-width:600px;margin:0 auto;font-family:Arial,sans-serif'>
|
||||
@@ -80,6 +83,8 @@ $adminHtml = "<div style='max-width:600px;margin:0 auto;font-family:Arial,sans-s
|
||||
<tr><td style='color:#6b7280;padding:8px 0'>Phone</td><td style='padding:8px 0'>" . htmlspecialchars($phone ?: '—') . "</td></tr>
|
||||
<tr><td style='color:#6b7280;padding:8px 0'>Package</td><td style='padding:8px 0;font-weight:700;color:#f97316'>{$pkgLabel} — {$amountLabel}</td></tr>
|
||||
<tr><td style='color:#6b7280;padding:8px 0'>Date</td><td style='padding:8px 0;font-weight:700'>{$dateLabel}</td></tr>
|
||||
<tr><td style='color:#6b7280;padding:8px 0'>Deposit Hold</td><td style='padding:8px 0'>{$depositLabel} (card held — not charged yet)</td></tr>
|
||||
<tr><td style='color:#6b7280;padding:8px 0'>Balance Due</td><td style='padding:8px 0;font-weight:700;color:#16a34a'>{$balanceLabel} at pickup</td></tr>
|
||||
</table>
|
||||
" . ($message ? "<div style='margin-top:12px;padding:12px;background:#fff7ed;border-left:4px solid #f97316'>" . nl2br(htmlspecialchars($message)) . "</div>" : "") . "
|
||||
<p style='margin-top:16px;font-size:13px;color:#9ca3af'>Submitted " . date('F j, Y g:i A') . " CT</p>
|
||||
@@ -100,6 +105,8 @@ $confirmHtml = "<div style='max-width:600px;margin:0 auto;font-family:Arial,sans
|
||||
<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Package:</strong> {$pkgLabel}</p>
|
||||
<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Requested Date:</strong> {$dateLabel}</p>
|
||||
<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Total:</strong> {$amountLabel}</p>
|
||||
<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Deposit (card hold today):</strong> {$depositLabel} <span style='font-size:12px;color:#9ca3af'>— not charged until confirmed</span></p>
|
||||
<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Balance due at pickup:</strong> <span style='font-weight:700;color:#16a34a'>{$balanceLabel}</span></p>
|
||||
</div>
|
||||
<div style='margin:20px 0;padding:16px;background:#fff7ed;border:1px solid #fed7aa;border-radius:10px;text-align:center'>
|
||||
<p style='margin:0 0 10px;font-size:14px;font-weight:700;color:#111'>Next Step: Sign Your Rental Agreement</p>
|
||||
@@ -136,16 +143,14 @@ if ($squareToken) {
|
||||
}
|
||||
}
|
||||
|
||||
$depositLine = $depositStatus
|
||||
? "<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Deposit Hold:</strong> \$" . number_format(DEPOSIT_AMOUNT, 2) . " authorized (not charged — released if booking is declined)</p>"
|
||||
: '';
|
||||
|
||||
// Inject deposit line into confirmation email
|
||||
$confirmHtml = str_replace(
|
||||
"<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Total:</strong> {$amountLabel}</p>",
|
||||
"<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Total:</strong> {$amountLabel}</p>{$depositLine}",
|
||||
$confirmHtml
|
||||
);
|
||||
// Add Square authorization badge to customer email if hold was placed
|
||||
if ($depositStatus) {
|
||||
$confirmHtml = str_replace(
|
||||
"<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Deposit (card hold today):</strong> {$depositLabel}",
|
||||
"<p style='margin:4px 0;font-size:14px;color:#374151'><strong>Deposit (card hold today):</strong> {$depositLabel} <span style='font-size:12px;color:#16a34a;font-weight:700'>✓ Authorized</span>",
|
||||
$confirmHtml
|
||||
);
|
||||
}
|
||||
|
||||
// Add deposit note to admin email if applicable
|
||||
if ($depositStatus) {
|
||||
|
||||
@@ -17,7 +17,7 @@ define('SQUARE_ACCESS_TOKEN', 'EAAAl3FsAu_2ri8kZE_ENEyi2T_C8HXXm5XQFY6Lbnd8SX6Fq
|
||||
define('SQUARE_APP_ID', 'sq0idp-YSM7BU9IVyOWSzpeP-0nzQ');
|
||||
define('SQUARE_LOCATION_ID', 'L8GZYHYKE95CE');
|
||||
define('SQUARE_VERSION', '2024-01-18');
|
||||
define('DEPOSIT_AMOUNT', 100.00); // $100 refundable security deposit hold
|
||||
define('DEPOSIT_AMOUNT', 45.00); // $45 deposit hold — balance due at pickup
|
||||
|
||||
define('PACKAGES', [
|
||||
'half-day' => ['label' => 'Half Day (4 hrs)', 'amount' => 99.00, 'days' => 0],
|
||||
|
||||
+25
-4
@@ -814,8 +814,11 @@
|
||||
|
||||
<!-- Square deposit card -->
|
||||
<div style="background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.1);border-radius:8px;padding:1rem;margin-top:0.25rem">
|
||||
<p style="font-size:0.78rem;font-weight:700;text-transform:uppercase;letter-spacing:1px;color:rgba(249,115,22,0.8);margin-bottom:0.5rem">Refundable Deposit — $100</p>
|
||||
<p style="font-size:0.8rem;color:rgba(255,255,255,0.5);margin-bottom:0.85rem;line-height:1.5">A $100 hold will be placed on your card — <strong style="color:rgba(255,255,255,0.75)">not charged</strong> until your booking is confirmed. Released in full if declined or at return.</p>
|
||||
<div style="display:flex;justify-content:space-between;align-items:baseline;margin-bottom:0.5rem">
|
||||
<p style="font-size:0.78rem;font-weight:700;text-transform:uppercase;letter-spacing:1px;color:rgba(249,115,22,0.8);margin:0">Deposit — $45 today</p>
|
||||
<p id="balance-due-label" style="font-size:0.78rem;color:rgba(255,255,255,0.45);margin:0;display:none">Balance at pickup: <strong id="balance-due-amount" style="color:rgba(255,255,255,0.75)"></strong></p>
|
||||
</div>
|
||||
<p style="font-size:0.8rem;color:rgba(255,255,255,0.5);margin-bottom:0.85rem;line-height:1.5">A $45 hold is placed on your card to secure your date — <strong style="color:rgba(255,255,255,0.75)">not charged</strong> until confirmed. Remaining balance is due at pickup.</p>
|
||||
<div id="card-container" style="min-height:44px"></div>
|
||||
<p id="card-errors" style="color:#f87171;font-size:0.78rem;margin-top:0.4rem;display:none"></p>
|
||||
<div id="deposit-status" style="display:none;margin-top:0.6rem;font-size:0.82rem;border-radius:6px;padding:0.5rem 0.75rem;line-height:1.5"></div>
|
||||
@@ -984,6 +987,24 @@
|
||||
});
|
||||
}
|
||||
|
||||
// ── Balance-due display ───────────────────────────────────────────────────────
|
||||
const PACKAGE_PRICES = { 'half-day': 99, 'full-day': 169, 'weekend': 299 };
|
||||
const DEPOSIT = 45;
|
||||
const pkgSelect = document.querySelector('select[name="package"]');
|
||||
const balLabel = document.getElementById('balance-due-label');
|
||||
const balAmt = document.getElementById('balance-due-amount');
|
||||
if (pkgSelect) {
|
||||
pkgSelect.addEventListener('change', function() {
|
||||
const price = PACKAGE_PRICES[this.value];
|
||||
if (price && balLabel && balAmt) {
|
||||
balAmt.textContent = '$' + (price - DEPOSIT).toFixed(2).replace(/\.00$/, '');
|
||||
balLabel.style.display = '';
|
||||
} else if (balLabel) {
|
||||
balLabel.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ── Square Web Payments ───────────────────────────────────────────────────────
|
||||
let squareCard = null;
|
||||
async function initSquare() {
|
||||
@@ -1050,7 +1071,7 @@
|
||||
return;
|
||||
}
|
||||
squareToken = result.token;
|
||||
setDepStatus('Card verified — authorizing $100 deposit hold…', 'processing');
|
||||
setDepStatus('Card verified — authorizing $45 deposit hold…', 'processing');
|
||||
}
|
||||
|
||||
const data = {
|
||||
@@ -1069,7 +1090,7 @@
|
||||
if (json.success) {
|
||||
if (json.deposit_held) {
|
||||
const holdSuffix = json.square_payment_id ? ' · Confirmation: …' + json.square_payment_id.slice(-10).toUpperCase() : '';
|
||||
setDepStatus('✓ $100 deposit hold authorized' + holdSuffix, 'success');
|
||||
setDepStatus('✓ $45 deposit hold authorized' + holdSuffix, 'success');
|
||||
const cardEl = document.getElementById('card-container');
|
||||
if (cardEl) cardEl.style.display = 'none';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user