diff --git a/app/reservations/page.js b/app/reservations/page.js index 859b31d..41bf3da 100644 --- a/app/reservations/page.js +++ b/app/reservations/page.js @@ -111,7 +111,8 @@ function ReservationCard({ r, onViewDetails, onPay, payingId }) { const beds = propBeds(p); const baths = propBaths(p); const isOwnerConfirmed = STATUS_MAP[r.status] === 'ownerConfirmed'; - const deadline = isOwnerConfirmed && r.ownerApprovalDate + const hasTimeWindow = r.ownerApprovalDate && r.allowedPaymentPeriod; + const deadline = hasTimeWindow ? new Date(r.ownerApprovalDate).getTime() + parseTimeSpan(r.allowedPaymentPeriod) : null; const isExpired = deadline ? Date.now() > deadline : false; @@ -143,12 +144,12 @@ function ReservationCard({ r, onViewDetails, onPay, payingId }) {
{new Date(r.endDate).toLocaleDateString('ar')}
- {isOwnerConfirmed &&
+ {hasTimeWindow &&
متبقي للدفع:
- {r.allowedPaymentPeriod &&
مدة الدفع: {formatWindowDuration(r.allowedPaymentPeriod)}
} +
مدة الدفع: {formatWindowDuration(r.allowedPaymentPeriod)}
}
- {isOwnerConfirmed &&
+ {hasTimeWindow &&
متبقي للدفع:
- {r.allowedPaymentPeriod &&
مدة الدفع: {formatWindowDuration(r.allowedPaymentPeriod)}
} +
مدة الدفع: {formatWindowDuration(r.allowedPaymentPeriod)}
{!isExpired &&