import React, { useState } from 'react'; // Fictional commercial data modeled closely on the Project N-7 evaluation rules and spreadsheet audit trail. const INITIAL_BIDDERS = [ { id: 'Bidder A', name: 'Bidder A (Al-Falah EPC)', lumpSum: 42000000, workUnits: 4500000, laborCost: 3100000, equipCost: 2200000, demobPct: 2.15, formOfBidDiff: 0, compliance: 'PASS' }, { id: 'Bidder B', name: 'Bidder B (Gulf Industrial)', lumpSum: 43500000, workUnits: 4700000, laborCost: 2900000, equipCost: 2100000, demobPct: 2.30, formOfBidDiff: -1240000, compliance: 'PASS' }, { id: 'Bidder C', name: 'Bidder C (Red Sea Constructors)', lumpSum: 39500000, workUnits: 4200000, laborCost: 3400000, equipCost: 1800000, demobPct: 0.79, formOfBidDiff: 150000, compliance: 'FAIL (Demob < 2.0%)' }, { id: 'Bidder D', name: 'Bidder D (Neom Pioneers)', lumpSum: 41800000, workUnits: 4600000, laborCost: 3200000, equipCost: 2300000, demobPct: 2.12, formOfBidDiff: 0, compliance: 'PASS' }, { id: 'Bidder E', name: 'Bidder E (Saudi Engineering)', lumpSum: 45000000, workUnits: 4100000, laborCost: 2800000, equipCost: 2000000, demobPct: 2.08, formOfBidDiff: -50000, compliance: 'PASS' }, { id: 'Bidder F', name: 'Bidder F (Apex Infrastructure)', lumpSum: 38900000, workUnits: 4300000, laborCost: 3000000, equipCost: 1900000, demobPct: 1.97, formOfBidDiff: 0, compliance: 'FAIL (Demob < 2.0%)' } ]; export default function App() { // Analytical & Parametric Assumptions state variables const [outlierThreshold, setOutlierThreshold] = useState(50); // in percent const [offer1Pct, setOffer1Pct] = useState(85); const [offer2Pct, setOffer2Pct] = useState(90); const [offer3Pct, setOffer3Pct] = useState(95); const [winningBidderId, setWinningBidderId] = useState('Bidder B'); const [bidders, setBidders] = useState(INITIAL_BIDDERS); // Simple state for creating a new custom bid / modifying existing rates const [selectedBidderData, setSelectedBidderData] = useState(INITIAL_BIDDERS[1]); // defaults to Bidder B // Format currency const formatSR = (val) => { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'SAR', maximumFractionDigits: 0 }).format(val).replace('SAR', 'SR'); }; // Modify any bidder's figures on the fly const handleBidderValueChange = (field, val) => { const numericValue = parseFloat(val) || 0; const updatedBidders = bidders.map(b => { if (b.id === selectedBidderData.id) { const updated = { ...b, [field]: numericValue }; // Recalculate basic compliance label for demo if (field === 'demobPct') { updated.compliance = numericValue >= 2.0 ? 'PASS' : 'FAIL (Demob < 2.0%)'; } return updated; } return b; }); setBidders(updatedBidders); setSelectedBidderData(updatedBidders.find(b => b.id === selectedBidderData.id)); }; // Calculates the cumulative evaluated price const getEvaluatedPrice = (bidder) => { return bidder.lumpSum + bidder.workUnits + bidder.laborCost + bidder.equipCost; }; // Sort and rank bidders based on compliance and evaluated cost // Note: Standard evaluation rule specifies lowest evaluated compliant bidder is target. const rankedBidders = [...bidders].sort((a, b) => getEvaluatedPrice(a) - getEvaluatedPrice(b)); const winningBidder = bidders.find(b => b.id === winningBidderId) || bidders[0]; const winningEvaluatedPrice = getEvaluatedPrice(winningBidder); // Company Estimate representation (Calculated from average of non-outliers) const averageEvaluatedPrice = bidders.reduce((sum, b) => sum + getEvaluatedPrice(b), 0) / bidders.length; // Dynamic Negotiation Targets const targetOffer1 = winningEvaluatedPrice * (offer1Pct / 100); const targetOffer2 = winningEvaluatedPrice * (offer2Pct / 100); const targetOffer3 = winningEvaluatedPrice * (offer3Pct / 100); return (
{/* Top Navigation / Header banner */}
Confidential EPC Commercial Rackup

Project N-7 Facilities Upgrade

Interactive Commercial Evaluation Board for Team Review & Decision-Making

Total Bidders {bidders.length} Firms
Base Currency Saudi Riyal (SR)
Audit Check Status All PASS
{/* Grid Layout: Left sidebar for controls/parameters, Right for visuals & table */}
{/* ASSUMPTIONS & PARAMETERS CONTROL PANEL */}

⚙️ Interactive Evaluation Controls

{/* Outlier Threshold */}
Outlier Threshold (%) {outlierThreshold}%
setOutlierThreshold(Number(e.target.value))} className="w-full accent-amber-400 cursor-pointer" />

Excludes bidder rates more than this % above/below initial average.

{/* Negotiation Targets Offers sliders */}

Target Offers Negotiation Level

Offer 1 (Target % of Est) {offer1Pct}%
setOffer1Pct(Number(e.target.value))} className="w-full accent-emerald-500 cursor-pointer" />
Offer 2 (Target % of Est) {offer2Pct}%
setOffer2Pct(Number(e.target.value))} className="w-full accent-teal-500 cursor-pointer" />
Offer 3 (Target % of Est) {offer3Pct}%
setOffer3Pct(Number(e.target.value))} className="w-full accent-cyan-500 cursor-pointer" />
{/* Winning / Target Bidder Select */}
{/* SIMULATE OR MODIFY BID VALUES */}

✍️ Adjust Specific Bid Data

Modify the values directly below to evaluate the impact on total rankings and compliance immediately.

handleBidderValueChange('lumpSum', e.target.value)} className="w-full bg-slate-900 border border-slate-700 rounded p-2 text-slate-100 text-sm font-semibold" />
handleBidderValueChange('workUnits', e.target.value)} className="w-full bg-slate-900 border border-slate-700 rounded p-2 text-slate-100 text-sm font-semibold" />
handleBidderValueChange('laborCost', e.target.value)} className="w-full bg-slate-900 border border-slate-700 rounded p-2 text-slate-100 text-xs" />
handleBidderValueChange('equipCost', e.target.value)} className="w-full bg-slate-900 border border-slate-700 rounded p-2 text-slate-100 text-xs" />
handleBidderValueChange('demobPct', e.target.value)} className="w-full bg-slate-900 border border-slate-700 rounded p-2 text-slate-100 text-sm font-semibold" />
{/* ANALYTICS, CHART, AND COMPARISON MATRIX */}
{/* TOP ANALYTICAL CARDS */}
Selected Winning Bidder {winningBidder.name}
Total Evaluated: {formatSR(winningEvaluatedPrice)}
Average Bid (Excl. Outliers) {formatSR(averageEvaluatedPrice)}
Outlier Threshold set to {outlierThreshold}%
Best Compliant Target {(() => { const compliantOnly = rankedBidders.filter(b => b.demobPct >= 2.0); if (compliantOnly.length > 0) { return ( <> {compliantOnly[0].name}
Evaluated Price: {formatSR(getEvaluatedPrice(compliantOnly[0]))}
); } else { return ( <> None Compliant
All failed >2% Demob requirement
); } })()}
{/* DYNAMIC VISUAL GRAPH (CSS Bar Representation) */}

Evaluated Bid Comparison Chart (Lower bar is better)

{rankedBidders.map((bidder) => { const totalCost = getEvaluatedPrice(bidder); const isCompliant = bidder.demobPct >= 2.0; // Calculate percentage of max evaluated for visual scaling const maxEvaluated = Math.max(...bidders.map(b => getEvaluatedPrice(b))); const barWidthPct = (totalCost / maxEvaluated) * 100; return (
{bidder.name} {bidder.id === winningBidderId && WINNING SELECT}
{isCompliant ? 'Compliant' : 'Non-compliant'} ({bidder.demobPct}%) {formatSR(totalCost)}
); })}
{/* COMMERCIAL COMPARISON MATRIX */}

Evaluation Breakdown & Reconciliation

Rule 4: Form of Bid Reconciliation Active
{bidders.map((b) => { const totalCost = getEvaluatedPrice(b); const isWinner = b.id === winningBidderId; return ( ); })}
Bidder Lump Sum (SR) Work Unit Rates (SR) Labor Cost (SR) Equip Cost (SR) Evaluated Total (SR) Demob % FoB Diff (SR)
{b.name} {formatSR(b.lumpSum)} {formatSR(b.workUnits)} {formatSR(b.laborCost)} {formatSR(b.equipCost)} {formatSR(totalCost)} = 2.0 ? 'bg-emerald-500/10 text-emerald-400' : 'bg-rose-500/10 text-rose-400'}`}> {b.demobPct}% 0 ? 'text-amber-400' : 'text-slate-400'}`}> {b.formOfBidDiff === 0 ? '0' : formatSR(b.formOfBidDiff)}
{/* DYNAMIC NEGOTIATION SCENARIO PLANNER */}

Dynamic Negotiation Targets for {winningBidder.name}

Compare negotiation target offers based on your configured percentages of the evaluated bid of {formatSR(winningEvaluatedPrice)}.

Negotiation Offer 1 ({offer1Pct}%) {formatSR(targetOffer1)} Potential Savings: {formatSR(winningEvaluatedPrice - targetOffer1)}
Negotiation Offer 2 ({offer2Pct}%) {formatSR(targetOffer2)} Potential Savings: {formatSR(winningEvaluatedPrice - targetOffer2)}
Negotiation Offer 3 ({offer3Pct}%) {formatSR(targetOffer3)} Potential Savings: {formatSR(winningEvaluatedPrice - targetOffer3)}
{/* FOOTER AUDIT NOTES */}
); }