This commit is contained in:
Todd
2026-05-24 13:30:30 -04:00
parent 753bc04141
commit f29035ce81
26 changed files with 1092 additions and 385 deletions

View File

@ -4,7 +4,10 @@ import { calculateQuote } from '../utils/quoteCalculator';
export default function QuoteSummary({ pricing, selections, onBack, onNew }) {
const quoteRef = useRef(null);
const quote = calculateQuote(pricing, selections);
const operator = pricing.operators.find((o) => o.id === selections.operator);
const operator =
selections.operator && typeof selections.operator === 'object'
? selections.operator
: pricing.operators.find((o) => o.id === selections.operator);
const handleDownloadPDF = async () => {
const html2canvas = (await import('html2canvas')).default;
@ -40,7 +43,8 @@ export default function QuoteSummary({ pricing, selections, onBack, onNew }) {
heightLeft -= pageHeight - margin;
}
pdf.save(`Gate_Quote_${operator?.model || 'Quote'}.pdf`);
const modelName = operator?.tiltModel || operator?.model || 'Quote';
pdf.save('Gate_Quote_' + modelName + '.pdf');
};
return (
@ -89,12 +93,31 @@ export default function QuoteSummary({ pricing, selections, onBack, onNew }) {
</div>
{operator && (
<div className="bg-gray-50 rounded-lg p-4 mb-4">
<div className="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-1">
Selected Operator
<div className="bg-gray-50 rounded-lg p-4 mb-4 flex items-start gap-4">
{operator.imageFile && !operator.tiltModel && (
<img
src={'/images/operators/' + operator.imageFile}
alt={operator.name}
className="w-24 h-24 rounded-lg object-cover shrink-0 border border-gray-200"
onError={(e) => { e.target.style.display = 'none'; }}
/>
)}
<div>
<div className="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-1">
Selected Operator
</div>
<div className="font-semibold text-gray-900">
{operator.tiltName || operator.name}
</div>
<div className="text-sm text-gray-500">
Model: {operator.tiltModel || operator.model}
</div>
{operator.tiltDescription && (
<div className="text-sm text-gray-500">
{operator.tiltDescription}
</div>
)}
</div>
<div className="font-semibold text-gray-900">{operator.name}</div>
<div className="text-sm text-gray-500">Model: {operator.model}</div>
</div>
)}
@ -152,9 +175,9 @@ export default function QuoteSummary({ pricing, selections, onBack, onNew }) {
</div>
)}
<div className="border-t border-gray-300 pt-4 space-y-2">
<div className="flex justify-between text-sm text-gray-600">
<span>Subtotal</span>
<div className="border-t border-gray-300 pt-4">
<div className="flex justify-between text-lg font-bold text-gray-900">
<span>Total Cost</span>
<span>
{pricing.currency.symbol}
{quote.subtotal.toLocaleString(pricing.currency.locale, {
@ -163,26 +186,6 @@ export default function QuoteSummary({ pricing, selections, onBack, onNew }) {
})}
</span>
</div>
<div className="flex justify-between text-sm text-gray-600">
<span>HST ({((quote.taxRate ?? 0) * 100).toFixed(0)}%)</span>
<span>
{pricing.currency.symbol}
{quote.tax.toLocaleString(pricing.currency.locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</span>
</div>
<div className="flex justify-between text-lg font-bold text-gray-900 border-t border-gray-200 pt-2">
<span>Total Estimate</span>
<span>
{pricing.currency.symbol}
{quote.total.toLocaleString(pricing.currency.locale, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
</span>
</div>
</div>
<div className="mt-4 text-xs text-gray-400 text-center border-t border-gray-200 pt-4">